1

The pinescript code is like the following

ha = heikinashi(tickerid)
ha_close = security(ha, res, close[1])
ma = ema(ha_close[1], 30)

I'm trying to use the above code in MetaTrader5.

So I tried the following,

[ Using https://www.mql5.com/en/code/33 for getting Heikin Ashi values ]

int handleHA = iCustom(_Symbol,PERIOD_CURRENT,"Heiken Ashi");

Then I got the CLOSE buffer value, Which is at the 4th position,

double haArray[];
CopyBuffer(handleHA,3,1,5,haArray);

And then I got the EMA of those CLOSE values,

int handleEMA = iMA(_Symbol,PERIOD_CURRENT,30,0,MODE_EMA,haArray[1]);
CopyBuffer(handleEMA,0,1,5,emaArray);

But in Metatrader 5 I'm getting different results compared to the TradingView. I think I did the first and third step right. But I have doubts on how I wrote ha_close = security(ha, res, close[1]) in MQL5. Need help :(

Bucky
  • 1,116
  • 2
  • 18
  • 34

0 Answers0