I need some help. This problem is purely cosmetic and me being lazy (sorry).
When I'm looking the chart, I want to zoomed in the H4, D1 and W1 timeframe.
I can do that using
When I'm at H4, I want it to show the line chart using
Lastly, when I'm looking at H1 and below, I want to zoom out to the third scale
I put all the code in the OnInit() section so that every time I change the timeframe, the chart change the way I wanted.
It is all good when going up the timeframe (M1 to MN1) but the problem appears when going down the timeframe.
On higher timeframe, there are only a few candle bars on display because of CHART_SCALE,5. When I change to the lower time frame, the scale changes but the chart keeps the previous bar counts so the chart is shifted the left which I don't want.
Even though the problem corrected itself after receiving a tick (because of chart autoscroll is on), waiting for a tick to come takes too long.
Disabling and reenabling chart shift or autoscroll (in the code) does not help (or I'm not using it the right way?). WindowBarsPerChart() and CHART_VISIBLE_BARS is read only. WindowRedraw() is doing nothing too.
Any idea or solution is greatly appreciated. Thanks.
Here is the code that I am using
if(ChartPeriod()==PERIOD_MN1 ||ChartPeriod()==PERIOD_W1 ||ChartPeriod()==PERIOD_D1)
ChartSetInteger(ChartID(),CHART_MODE,1);//to be safe
else if(ChartPeriod()==PERIOD_H1 ||ChartPeriod()==PERIOD_M30 ||ChartPeriod()==PERIOD_M15 ||ChartPeriod()==PERIOD_M5 ||ChartPeriod()==PERIOD_M1)
Please enable the necessary setting in your browser, otherwise you will not be able to log in.