While trying out DoubleMA in a strategy, I notice Signal (not plotted in DoubleMA but available as output) most of the time tally with the Rising and Falling plots, but sometimes it does not. If you open the DoubleMA code, it is very simple:
if (rising)
{ RisingPlot.Set(1, val2); RisingPlot.Set (0,val1); Signal.Set(1); }
else if (falling)
{ FallingPlot.Set(1,val2); FallingPlot.Set(0,val1); Signal.Set(-1); }
else
{ NeutralPlot.Set(1, val2); NeutralPlot.Set(0,val1); Signal.Set(-1); }
So I would expect when FallingPlot is plotted (from previous bar to current bar) Signal is -1, but when I test it in a cript sometimes Signal is still 1. This results in an incorrect entry filtering. Vice versa for the RisingPlot.
I also do a test on DoubleMA(...).FallingPlot.ContainsValue(0), sometimes it returns false, while FallingPlot is plotted to current bar. (ie. when Signal is incorrect 1).
This behaviour is annoying. What is going on? How to fix it ?
Thanks.
Best Regards.
EdwardK.
Comment