-
EMA_Buffer[i] = iMA(_Symbol, PERIOD_CURRENT, EMA, i, 1, PRICE_CLOSE);
Perhaps you should read the manual, especially the examples.
They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick (after the indicator has updated its buffers,) you use the handle, shift and count to get the data.
How To Ask Questions The Smart Way. 2004
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 2020.03.08
How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 2020.07.05
How to call indicators in MQL5 - MQL5 Articles 12 March 2010 -
int OnCalculate(const int rates_total, const int prev_calculated, const int begin, const double &price[])]{ int pos; if(PlotBegin != EMA + begin) { PlotBegin = EMA + begin; PlotIndexSetInteger(0, PLOT_DRAW_BEGIN, PlotBegin);
You alread set that in OnInit. Why are you setting it again? -
for(int i = 0; i < rates_total; i++)
Why are you computing all bars each tick?
How to do your lookbacks correctly #9 - #14 & #19
William Roeder:
-
Perhaps you should read the manual, especially the examples.
They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick (after the indicator has updated its buffers,) you use the handle, shift and count to get the data.
How To Ask Questions The Smart Way. 2004
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 2020.03.08
How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 2020.07.05
How to call indicators in MQL5 - MQL5 Articles 12 March 2010 - You alread set that in OnInit. Why are you sett9ng it again?
- Why are you computing all bars each tick?
How to do your lookbacks correctly #9 - #14 & #19
I did not read anything from the first three links that you attached, but I'll look into the other stuff that you sent through. I see now that including the iMa and IStdDev functions in the OnCalculate section, and not including handles, was a pretty dumb mistake, thanks for pointing it out.

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
Hi all,
Can't seem to get this custom indicator to work. When I try to load it on MT5 nothing comes up at all. I've built some EAs but never made a custom indicator, honestly it could be something really basic that's wrong with my code. If anybody has any tips, I'd really appreciate it. Thanks