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
Sorry I realised my first post wasn't clear enough, i'm not writing an indicator, i'm working on an EA and directly putting the calculation inside the EA code. So i don't have any 'prev_calculated' variable :/
It means that I'm loosing every data on new candle, except if I create arrays outside of the OnTick and OnInit functions, is that what you suggest to do ?
Ok, thank you very much for your quick answer already ! Your help is really appreciated !
During this time I will try to understand the rest of the code you provided.
I'm looking forward to reading you.
Not sure to understand what should be in "prev_calculated" value as i'm working directly on an EA with all my arrays as series.
I know this is used mostly in indicators but how should I define it ?
EDIT : Sorry I realised my first post wasn't clear enough, i'm not writing an indicator, i'm working on an EA and directly putting the calculation inside the EA code. So i don't have any 'prev_calculated' variable :/Why are you reinventing the wheel ?
Use an indicator and get the values in your EA. LWMA or indicator is not the problem, the original problem about slowness is bad code and/or bad algorithm. iMAOnArray() on mql5 is just an horror, for sure it's slow.
Use a good one.
Why are you reinventing the wheel ?
Use an indicator and get the values in your EA. LWMA or indicator is not the problem, the original problem about slowness is bad code and/or bad algorithm. iMAOnArray() on mql5 is just an horror, for sure it's slow.
Use a good one.
I never learned how to code Indicator in mql5 or managing buffers, so it's not very clear how it works for me yet :/
I never learned how to code Indicator in mql5 or managing buffers, so it's not very clear how it works for me yet :/
You don't need to code an indicator to use it. Pick one that exists and works well, and use it on your EA.
Of course we can also learn to code all yourself, just want to be sure we know you have this choice.
But if you are not experimented yet, I would say embedding all the code in the EA is not an easy solution., so my suggestion to search for a good one and use it (see iCustom).
You don't need to code an indicator to use it. Pick one that exists and works well, and use it on your EA.
Of course we can also learn to code all yourself, just want to be sure we know you have this choice.
But if you are not experimented yet, I would say embedding all the code in the EA is not an easy solution., so my suggestion to search for a good one and use it (see iCustom).
I will try to understand the OnCalculate function, and try to code an indicator, probably using the code you provided me (and thanks again !). If you have any piece of material or anything that could help me learning quicker I'll take it :)
Regarding Alain's suggestion, I don't know how to get what I want with existing indicators given the fact that I'm trying to calcule LWMA of LWMA of LWMA of LWMA [...] of LWMA (of price).
I will try to understand the OnCalculate function, and try to code an indicator, probably using the code you provided me (and thanks again !). If you have any piece of material or anything that could help me learning quicker I'll take it :)
Regarding Alain's suggestion, I don't know how to get what I want with existing indicators given the fact that I'm trying to calcule LWMA of LWMA of LWMA of LWMA [...] of LWMA (of price).
Do you mean directly in the EA ? using IMa of iMa of iMa ? I didn't know that the handle will pass the result of the previous calculation. If confirmed I will give it a try !
EDIT : Just to be sure, I will need to create the handle outside of the OnTick function to hold the previous calculated result ? and manually shifting it on every candle ? How ?Do you mean directly in the EA ? using IMa of iMa of iMa ? I didn't know that the handle will pass the result of the previous calculation. If confirmed I will give it a try !
EDIT : Just to be sure, I will need to create the handle outside of the OnTick function to hold the previous calculated result ? and manually shifting it on every candle ? How ?