Is this correct code for two faster MAs crossing slow MA?
// Conditions to enter long positions
indicator1 = ExponentialAverage[fast 1](close)
indicator2 = ExponentialAverage[fast 2](close)
indicator3 = ExponentialAverage[slow](close)
c1 = (indicator1 and indicator2) CROSSES OVER indicator3
IF c1 THEN
BUY Positionsize PERPOINT AT MARKET
ENDIF
Thank you.
fast1 and fast2 variables must be set of course and they can’t have blank space in their names.
Also, I don’t know what is your fast moving average periods, but I believe that 2 of them can cross a long term one at the same moment and that’s what you have coded at line 5 with your c1 condition. I don’t know what is your strategy all about but maybe you could test if the first fast MA is already above the slowest one and then test the fast2 cross over the slow MA.
It is basically to reduce the noise and not to enter position until two faster averages crossed slow average.
Nicolas, thank you for your replies. I also looked at your previous post on adaptive moving averages. Do you know if there is a way to code a difference between AMA(n),AMA(n-1) etc, where ‘n’ is a current bar? Is it possible to code change in direction of AMA as a signal?
Seems i found it AMA>AMA[1]>AMA[2] etc.