I'm trying to limit resources consumed by MT4 and go to options to set max bars in chart to something smaller like 500. My custom indicator calculates values from a 10 and 20 EMA.
Now the indicator does not even want to attach to the chart!
Even if I increase the number I cannot get my CI to attach to the chart again.
Please can you let me know what the minimum number should be for max bars in chart and why a simple CI as set out above will not attach to the chart?
Lastly, could you please help me also by stating what the default value for max bars in chart normally is? I thought it is 999999 but cannot remember.
Thanks so much for your effort.
In order to use your resources efficiently, ask your indicator to compute only last bars, prev_calculated should be used and go only since that value to the end of the chart(to the current bar). You can also make your indicator sleeping if number of bars is same, and let it run only when new bar appears (rates_total>prev_calculated) if that can be accepted for your task
Related
I'm creating a chart showing the minimum and maximum salary by level within a company. I have both of these measures displaying as circles. Is it possible to create a bar/line connecting them so that users can clearly see how large the ranges are for each level? I've seen some barbell chart tutorials, but I think I'd need significant data wrangling to get data in a structure that would work for that.
Sidenote: My goal is really just to show the span, so I also thought a stacked bar/column chart could work, with min(salary) as the bottom bar, which I'd make white/transparent, and max(salary)-min(salary) as the top bar, but I could only get them to stack on top of each other when using dual axis.
I'm relatively new to Pine and was having trouble with a couple of things.
So I've got a indicator that I want to look back for the last 5 full days of activity, however not each stock trades in the premarket/afterhours so I want to be able to look back say 5 days and then calculate the number of bars on the time frame (i.e. for a 5 min or hourly resolution). That way I can calculate the number of bars present on the current ticker for that time frame and adjust my indicator length (instead of just having a constant figure of 80 bars or whatever).
The second thing I want to do is only have the indicator update on the completion of a full bar (for example the hourly resolution). So I want it to only calculate up to x-1 bars. Right now I'm finding that it's updating on each new tick. ( I was able to figure this one out, just changed it from i= 0 to length -1 to i=1 to length).
Any help is greatly appreciated.
Thanks,
A
The problem is that, if I try to change the lowest point to somewhere higher, the entire chart will be lowered severely.
How do I adjust each point with no above mentioned issue?
P.S. I use Highchart's Highstock.
It would be helpful if you could show a JsFiddle with the actual working code. Without knowing what exactly is going on with your chart it's difficult to figure out what the issue is and how to fix it.
Have a look at the yAxis - Highstock API Reference, you could potentially make use of min or max to counteract the scaling. Again though, without seeing your code it's tough to know.
If I understand your problem, you are trying to set the 7th point from currently at ~150 to something really high, say 5000? I did not notice any real change in the position of other points if the new value was under 1500 (or something around twice the first point)
Appears that your chart is set to comparison mode, hence, I believe, the default max and min are (100% & -100%) by default, this is w.r.t. to first point of the series. Highcharts would auto adjust these extremes if any of the points were to lie outside this range, you could force an override using yAxis.min & max.
For instance, you can set yAxis.min to -100 and yAxis.max to 100 like this
yAxis: {
min:-100,
max:100
}
Play around with the min and max to get to the values that suits your data the most, do remember these are % comparison to the first point. Any points outside these ranges would not show in the chart.
#jsFiddle
I want to shift a chart in another way than addPoint does. You can see what I mean in my JSFIDDLE: http://jsfiddle.net/Charissima/TEEdw/3/
When the chart has filled the container and the next point is added, it shifts to the left without losing the first point.
It works fine, but sometimes I can see the chart swapping a little bit. And even worth: when running over a longer time the chart gets lost. It still works, you can see it shifting and updating y in the upper right corner, but the chart is not visible any more. Even the navigator is empty.
So my question is: Is there a better and smarter way to shift the chart this way?
data.push([ xTime, prevY ]);
data.push([ xTime, y ]);
series.setData(data, true);
var faktor = ( (chart.xAxis[0].max - chart.xAxis[0].min) / 60 / 1000 ) * 200;
chart.xAxis[0].setExtremes( chart.xAxis[0].min + faktor, chart.xAxis[0].max + faktor);
I've been working on a chart with very similar attributes and have run into similar problems. One of the undesired effects of the addPoint() shift flag is that it tries to keep the data set the same size it was initialized with. I'm guessing that is your reason for not using it. It doesn't allow you to grow your data set to a certain size and then start shifting. I had this issue with the shift so I resorted to doing exactly what you are doing. I think this is the generally accepted alternative to addPoint().
But... couple that with the idea that Highchart (or maybe just Highstock) appears to have a max number of data points it will handle. I don't know if it is the same for all charts (or even for all users/browsers) but for me yours seems to disappear when the data count is 1000. See this fiddle: > jsfiddle.net/TEEdw/4/ you can watch the data length grow to 1000 and then the chart disappears. I was running into the same issue on my chart. My solution was more complicated due to other factors in my chart. But a simple solution is to monitor the data count and when it approaches 1000, switch to the addPoint() with shift method. See this fiddle: > jsfiddle.net/TEEdw/5/ There is probably other ways to allow the data set to grow and then shift at a certain point. But this one just used your existing code. You could probably dynamically set the shift flag based on data length and only set it true once the data reaches a certain length.
EDIT: Ok... there is also a plotOptions setting called turboThreshold (http://api.highcharts.com/highcharts#plotOptions.series.turboThreshold) that can be disabled. It defaults to 1000 (so that makes sense). Setting it to zero allowed your chart to keep going after 1000. See this fiddle: jsfiddle.net/TEEdw/6/
In a candlestick graph i am building, the latest bar is cut-off partially such that even the bar is not visible. Thus it's difficult to judge the high and low by seeing the bar.
I'm unable to post a pic now but it's like the last rectangle being cut in half.
I'm tried a lot of options in the api but can't figure out why this is not showing correctly. The chart margin and axis offset options havent' helped. Is there a way i can set the series margin from the plot area so that it displays right.
For this problem, the best solution is to insert a dummy series which should be hidden from every aspect of the chart. So try this, insert a dummy series from the last point of the data series to some extra buffer(as per need). Then remove this series from the chart by explicitly removing it from the legends (using showinlegend),chart(setting linewidth to 0) and from tooltip by having a check in formatter. Hope this solves your problem.
I had the same problem and couldn't figure it out, because no matter how I changed the xAxis.maxPadding or changed the xAxis.max, it would always cut off the last candlestick when I clicked on the range selector.
To solve it, (hack) I just added an extra data point in my series and set it 1 day past the last day and set all values to null.
Without any code or a pic, it's hard to tell the problem, but it sounds like you need to use the max padding option. http://api.highcharts.com/highcharts#xAxis.maxPadding. You may also want to look at endOnTick as well as whether you are setting max on the axis.