fuction ChartNavigate is not working, return 4211 error code New comment James 2017.02.15 00:07 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: removed2017.02.14 18:02:23.259 chartNavigate_test AUDCADmicro,H1: uninit reason 12017.02.14 18:02:23.218 chartNavigate_test AUDCADmicro,H1: 42112017.02.14 18:02:23.218 chartNavigate_test AUDCADmicro,H1: false 1522017.02.14 18:02:22.217 chartNavigate_test AUDCADmicro,H1: 42112017.02.14 18:02:22.217 chartNavigate_test AUDCADmicro,H1: false 1512017.02.14 18:02:21.217 chartNavigate_test AUDCADmicro,H1: 42112017.02.14 18:02:21.217 chartNavigate_test AUDCADmicro,H1: false 150 Thanks, Automated Trading and Strategy Testing www.mql5.com MQL5: language of trade strategies built-in the MetaTrader 5 Trading Platform, allows writing your own trading robots, technical indicators, scripts and libraries of functions Files: chartNavigate_test.mq4 2 kb expert advisor - miscellaneous questions A new problem with EventSetTimer help me please [solved] New comment
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,