ChartNavigate function doesn’t work, Please help

 

I can imagine that this is suppose to be simple, but I just can’t get it working.

This simple code:

ChartNavigate(0,CHART_BEGIN,4000);
Print(time[4000]);


Rather than scrolling the chart to the bar number 4000, it scrolls the chart to the beginning.

The line “Print(time[4000]); ” just give the confirmation of the existence of that bar.

Any help will be highly appreciated

Thanks in advance

 

Try vice verse

ChartNavigate(0,CHART_BEGIN,-4000);
Print(time[4000]);

 

Hi Rosh, still exactly the same, the chart scrolls to the very beginning (oldest price).

Maybe something has to be set inside the terminal …I don’t know…

I think inside the function ChartNavigate I’ve already tried all the possible combinations…

Documentation on MQL5: Standard Constants, Enumerations and Structures / Chart Constants / Positioning Constants
  • www.mql5.com
Standard Constants, Enumerations and Structures / Chart Constants / Positioning Constants - Documentation on MQL5
 
Thank you, we are investigating this issue.

 
Rosh:
Thank you, we are investigating this issue.

ThankYou very much.

I'll be waiting for an answer on this thread

 
Issue has been fixed and it will be available at next build.

 

That's great Rosh.

Thank you very much


 
Rosh:
Issue has been fixed and it will be available at next build.

I received the update.

Now my Metatrader is version: 5.00 Build 387 (31 Jan 2011)

Unfortunately the issue is still the same

I’ve tried the code

ChartNavigate(0,CHART_BEGIN,4000);

 and the viceversa one

ChartNavigate(0,CHART_BEGIN,-4000);
 
claudio:

I received the update.

Now my Metatrader is version: 5.00 Build 387 (31 Jan 2011)

Unfortunately the issue is still the same

I’ve tried the code

 and the viceversa one

Try this script, please.

//+------------------------------------------------------------------+
//|                                                      ChartID.mq5 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- get handle of the current chart
   long handle=ChartID();
   if(handle>0) // if successful, configure it
     {
      //--- disable autoscroll
      ChartSetInteger(handle,CHART_AUTOSCROLL,false);
      //--- set shift
      ChartSetInteger(handle,CHART_SHIFT,true);
      //--- show as candles
      ChartSetInteger(handle,CHART_MODE,CHART_CANDLES);
      //--- show tick volumes
      ChartSetInteger(handle,CHART_SHOW_VOLUMES,CHART_VOLUME_TICK);

      //--- Navigate to position 10 bars right from the beginning of the history
      Comment("Navigate to position 10 bars right from the beginning of the history");
      ChartNavigate(handle,CHART_BEGIN,10);
     
      Sleep(5000);
     }  

      //--- Navigate to position 10 bars left of the right border of the chart
      Comment("Navigate to position 10 bars left of the right border of the chart");
      ChartNavigate(handle,CHART_END,-10);
      Sleep(5000);
     
      //--- Navigate to position 300 bars right from the beginning of the history
      Comment("Navigate to position 300 bars right from the beginning of the history");
      ChartNavigate(handle,CHART_BEGIN,300);

      Comment("Navigate to position 300 bars left of the right border of the chart");
      Sleep(5000);
      //--- Navigate to position 300 bars left of the right border of the chart
      ChartNavigate(handle,CHART_END,-300);

      Comment("");
  }
//+------------------------------------------------------------------+
 

I’ve tried this code several times and I’ve add some more time(20000) to better understand what was going on.

That’s what I did:

-         I scroll the chart to a random point

-         I start the script: the chart scrolls to the absolute beginning

-         I scroll the chart to a random point

-         Second ChartNavigate: The chart doesn’t make a move

-         I scroll the chart to a random point

-         Third ChartNavigate: the chart scrolls to the absolute beginning

-         I scroll the chart to a random point

-         Fourth ChartNavigate: every time this last ChartNavigate runs, the chart is moving to a different place. It seems to be always between bar 1000-2000 from the beginning

 

Given that the last ChartNavigate was moving somewhere, I tried it alone. This time the chart just doesn’t move.

 

I run once again all this experiments, this time printing the return value of each ChartNavigate: the return value is always TRUE.

 

Hope this helps

 
claudio:

Given that the last ChartNavigate was moving somewhere, I tried it alone. This time the chart just doesn’t move.

 

I run once again all this experiments, this time printing the return value of each ChartNavigate: the return value is always TRUE.

 

Hope this helps



It's strange. I couldn't reproduce similar behaviour. Can you write to Servicedesk?
Get in touch with developers using Service Desk!
  • www.mql5.com
We therefore attach great importance to all user reports about issues in our programs and try to answer each one of them.
Reason: