Announcement

Collapse
No announcement yet.

bug in 7.3 DiNapoli DMA indicators

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • bug in 7.3 DiNapoli DMA indicators

    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.
    Tim Johnston

  • #2
    Tim
    FYI none of the DiNapoli efs in 7.4 are showing those errors.
    Here below for example is the 3x3 code.
    FWIW the purpose of having them as an efs is if one needs to implement strategies based on them which is not otherwise possible with the Basic Studies.
    Alex

    PHP Code:
    function preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("3X3 DMA");
        
    setCursorLabelName("3X3 DMA"0);
        
    setDefaultBarThickness(10);
        
    setDefaultBarFgColor(Color.cyan0);
    }

    var 
    v3x3dma = new MAStudy(33"Close"MAStudy.SIMPLE);

    function 
    main() {
        

        return 
    v3x3dma.getValue(MAStudy.MA)


    Comment


    • #3
      That's great! When will 7.4 be available?

      tim
      Tim Johnston

      Comment


      • #4
        Tim
        7.4 Release Candidate 4 is already available here.
        Alex

        Comment

        Working...
        X