If I prefer to include indicator calculation into EA rather than the iCustom call, probably the easiest way is setting correct parameters for OnCalculate() function.
Did anyone already invest some effort into coding? I guess it should use CopyClose(), CopyHigh() etc. to create the parameter arrays, but I am not familiar with them. I found an article about inclusion of indicators, which might help.
In OnCalculate(), the use of prev_calculated and rates_total just replicates the old IndicatorCounted() function and Bars. The other parameters passed to it are the same as are in the series arrays. I dont really see the point of the change. But anyway, you can use the regular High[] Low[] etc series arrays and make the equivalent of indicator buffers by identify first tick of newbar and use ArraySetAsSeries() and ArrayResize(). You probably dont need to size the arrays to the entire chart like you would in a real indicator, just big enough to cover lookbacks.
In OnCalculate(), the use of prev_calculated and rates_total just replicates the old IndicatorCounted() function and Bars. The other parameters passed to it are the same as are in the series arrays. I dont really see the point of the change. But anyway, you can use the regular High[] Low[] etc series arrays and make the equivalent of indicator buffers by identify first tick of newbar and use ArraySetAsSeries() and ArrayResize(). You probably dont need to size the arrays to the entire chart like you would in a real indicator, just big enough to cover lookbacks.
I don't see the point of the change either, especially as the new arrays can't be used easily outside of OnCalculate and not used at all in EAs and Scripts.
Added to which errors such as mistyping High[i] instead of high[i] can mess things up big time and the compiler will not detect the error.
Yes I know, and I have made the mistake you mentioned too. Ive been passing the new arrays from OnCalculate as parameters to other functions to keep them all using the same new arrays, angevoyageurs comment was interesting I did not know indicators can now be embedded ...
I don't see the point of the change either, especially as the new arrays can't be used easily outside of OnCalculate and not used at all in EAs and Scripts.
Added to which errors such as mistyping High[i] instead of high[i] can mess things up big time and the compiler will not detect the error.
The main point in my opinion is you can build indicator for MT4 and MT5 with the same code if you are using the new syntax.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Wow, I am not yet so advanced. Good clue. I have to read it later, now is the time to give a lift kids from schools.
There are a lot of features I missed...
I wonder why an event such as OnTradeAction, or OnAccountBalanceChange ...etc is not thought of.
It's very important when such an event occurs and we know to react with trading. Any thoughts?
Cung
If I prefer to include indicator calculation into EA rather than the iCustom call, probably the easiest way is setting correct parameters for OnCalculate() function.
Did anyone already invest some effort into coding? I guess it should use CopyClose(), CopyHigh() etc. to create the parameter arrays, but I am not familiar with them. I found an article about inclusion of indicators, which might help.
In OnCalculate(), the use of prev_calculated and rates_total just replicates the old IndicatorCounted() function and Bars. The other parameters passed to it are the same as are in the series arrays. I dont really see the point of the change. But anyway, you can use the regular High[] Low[] etc series arrays and make the equivalent of indicator buffers by identify first tick of newbar and use ArraySetAsSeries() and ArrayResize(). You probably dont need to size the arrays to the entire chart like you would in a real indicator, just big enough to cover lookbacks.
In OnCalculate(), the use of prev_calculated and rates_total just replicates the old IndicatorCounted() function and Bars. The other parameters passed to it are the same as are in the series arrays. I dont really see the point of the change. But anyway, you can use the regular High[] Low[] etc series arrays and make the equivalent of indicator buffers by identify first tick of newbar and use ArraySetAsSeries() and ArrayResize(). You probably dont need to size the arrays to the entire chart like you would in a real indicator, just big enough to cover lookbacks.
I don't see the point of the change either, especially as the new arrays can't be used easily outside of OnCalculate and not used at all in EAs and Scripts.
Added to which errors such as mistyping High[i] instead of high[i] can mess things up big time and the compiler will not detect the error.
I don't see the point of the change either, especially as the new arrays can't be used easily outside of OnCalculate and not used at all in EAs and Scripts.
Added to which errors such as mistyping High[i] instead of high[i] can mess things up big time and the compiler will not detect the error.
I wonder why an event such as OnTradeAction, or OnAccountBalanceChange ...etc is not thought of.
It's very important when such an event occurs and we know to react with trading. Any thoughts?
Cung
You could give the suggestions to Service Desk at mql5.com
Thanks deysmacro, I will try
You can manage your own custom events, see EventChartCustom.
Hmm,
I am not sure I made myself clear. E.g when your trade gets stop triggered, how would you know if the system does not fire an event?
You could give the suggestions to Service Desk at mql5.com
Could you or somebody send me the link to such Service Desk? I could not find a clue.