You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
MT4 version: 4.00 Build 1045
(3 Feb 2017)
Experiencing a failure when using function ChartNavigate, could someone help to look at this or have the same issue?
Here is the code, please also see the same in attachement:
//| chartNavigate_test.mq4 |
//| Copyright 2017, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- create timer
EventSetTimer(1);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//--- destroy timer
EventKillTimer();
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
}
//+------------------------------------------------------------------+
//| Timer function |
//+------------------------------------------------------------------+
int i = 0;
void OnTimer()
{
//---
i++;
bool result = ChartNavigate(ChartID(), CHART_END, -i);
printf(result + " " + i);
if (result == false) {
printf(GetLastError());
}
}
//+------------------------------------------------------------------+
Here are the logs:
2017.02.14 18:02:23.264 Expert chartNavigate_test AUDCADmicro,H1: removed
2017.02.14 18:02:23.259 chartNavigate_test AUDCADmicro,H1: uninit reason 1
2017.02.14 18:02:23.218 chartNavigate_test AUDCADmicro,H1: 4211
2017.02.14 18:02:23.218 chartNavigate_test AUDCADmicro,H1: false 152
2017.02.14 18:02:22.217 chartNavigate_test AUDCADmicro,H1: 4211
2017.02.14 18:02:22.217 chartNavigate_test AUDCADmicro,H1: false 151
2017.02.14 18:02:21.217 chartNavigate_test AUDCADmicro,H1: 4211
2017.02.14 18:02:21.217 chartNavigate_test AUDCADmicro,H1: false 150
Thanks,