master_dude: however, it is not working properly. at the onset of the EA and they never change. |
|
WHRoeder:
thanks again WHRoeder. this was extremely helpful. the code you wrote gave me the chance to learn a lot about arrays and how to use for loops better. truly appreciated!
master_dude: however, it is not working properly. at the onset of the EA and they never change. |
|
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
good day to you all!
attached code is of a 10 period rolling window with linear descreasing weights. this is my first and very rudimentary step towards implementing an adaptive feature into EAs so that parameter values adapt to changing market conditions with weight on more recent data.
however, it is not working properly. i initially wanted to use the switch() operator to set the parameters values (Vertical_Shift_Up/Down) based on the value of MA_Direction. but switch() only takes integer values. instead i decided to code these many lines of if() statements. but it only sets the value for Vertical_Shift_Up/Down at the onset of the EA and they never change.
anyone who can see what I have done wrong? the overall function itself is embedded in code that runs once pr new candle, and thus the aim is for the parameters Vertical_Shift_Up/Down to update values once pr candle.
the variables, MA_Direction andVertical_Shift_Up/Down have been initialized globally. the MA_Direction part of code is working fine...