Hi all.
I am getting crazy with this issue.
I have a MT5 EA using the native MT5 Heiken Ashi indicator. It just displays the values of open, high, low, close of the current Heiken Ashi candle.
When applying the EA to a graph which has the indicator applied, values printed by the EA do match the one I see on the graph, in real time.
When launching the EA in back test mode, with option “open price only”, displayed values do not match the Heiken Ashi candles I can see on the graph.
Anybody has a clue why and how I can fix that?
Here is the EA code:
#property copyright "Copyright 2017, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
double bufferOpen[], bufferHigh[], bufferLow[], bufferClose[];
double openH, highH, lowH, closeH;
int handle;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
handle=iCustom(Symbol(),Period(),"Examples\\Heiken_Ashi");
//---
return(INIT_SUCCEEDED);
}
void OnTick()
{
CopyBuffer(handle,0,0,1,bufferOpen);
CopyBuffer(handle,1,0,1,bufferHigh);
CopyBuffer(handle,2,0,1,bufferLow);
CopyBuffer(handle,3,0,1,bufferClose);
openH = bufferOpen[0];
highH = bufferHigh[0];
lowH = bufferLow[0];
closeH = bufferClose[0];
printf(openH + " " + highH + " " + lowH + " "+closeH);
return;
}
Thanks in advance for your help!