BUG? ChartNavigate does not work

 

I believe I've coded this correctly, but as you can see, the first visible bar value does not change and I confirm that the chart is positioned after running the script exactly as it was before running it.k

As you can also see, the ChartNavigate function reports true even though it changed nothing.

The new first visible bar value should be 97.

Can someone help?

Here's the code for you with weary fingers. 😁

I'm on Build 3031 as of this morning before hitting this problem.

#property strict
   
void OnStart()
{
   bool bRslt1 = ChartSetInteger(0,CHART_AUTOSCROLL,false);
   long lLftBar1 = (int)ChartGetInteger(0,CHART_FIRST_VISIBLE_BAR,0);   
   bool bRslt2 = ChartNavigate(0,CHART_CURRENT_POS,(int)lLftBar1+20);
   ChartRedraw();
   long lLftBar2 = (int)ChartGetInteger(0,CHART_FIRST_VISIBLE_BAR,0);     
}


 
Millard Melnyk: , the ChartNavigate function reports true even though it changed nothing.

You don't understand how it works. Nothing can happend until the code exits. All it does is add an event to the queue. Once the code exits, the event will normally start the chart changing.

But you are debugging, so the return ends the debug session.

Reason: