There is a simple bug in the implementation of the 3 DiNapoli DMA indicators in 7.3. I'll use 3x3DMA.efs for discusion, but all 3 have the same error.
the 3x3 DMA is a 3 bar simple MA displaced by 3 bars. The 3 bar displacement is handled correctly as the 2nd argument of the new MAStudy statement:
var ma = new MAStudy(3, 3, "Close", MAStudy.SIMPLE);
but then in function main(), the MA is displaced another 3 bars by the -3 argment to the getValue() function:
return ma.getValue(MAStudy.MA,-3);
The net effect is that this indicator displaces the MA by 6 bars instead of 3.
You can fix this by deleting ",-3" from the getValue() call.
A superior solution is to add a simple moving average to your chart from the Basic Indicators, with length=3, offset=3, source=Close. This is superior because the chart will plot the MA 3 bars ahead of the current bar, so that you can see where the DMA is 3 bars ahead of the price action. That's useful trading information that the programmed indicator doesn't display.
the 3x3 DMA is a 3 bar simple MA displaced by 3 bars. The 3 bar displacement is handled correctly as the 2nd argument of the new MAStudy statement:
var ma = new MAStudy(3, 3, "Close", MAStudy.SIMPLE);
but then in function main(), the MA is displaced another 3 bars by the -3 argment to the getValue() function:
return ma.getValue(MAStudy.MA,-3);
The net effect is that this indicator displaces the MA by 6 bars instead of 3.
You can fix this by deleting ",-3" from the getValue() call.
A superior solution is to add a simple moving average to your chart from the Basic Indicators, with length=3, offset=3, source=Close. This is superior because the chart will plot the MA 3 bars ahead of the current bar, so that you can see where the DMA is 3 bars ahead of the price action. That's useful trading information that the programmed indicator doesn't display.
Comment