Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MA + (Single Dot) Swing calling

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

    MA + (Single Dot) Swing calling


    hello everyone,

    I found for anyone a problem to solve (you are very much welcome XD) :

    Attached is an indicator sample that is supposed to plot one Sma and ONE DOT each swing.
    Included with this indicator is another : a copy of the SingleDotSwing that we can find in this post (thank Chris) :
    https://ninjatrader.com/support/foru...822#post822822 .
    Also attached is a picture showing the discrepancies that we may try to correct.

    1- why is the relay indicator missing some of the swings ?
    2- is it possible to make this relay indicator (a1SampleSmaSwing) respect the SingleDot logic ? and plot only one dot every swing, instead of the swing value every bar.
    If so, would the curious brilliant reader care enough to tell us clues about how ?

    3- I guess we also could add the very few lines needed to plot the sma, to the SingleDotSwing and have it right immediatly, instead of creating a "relay" indicator that calls both swing and sma.
    Do experts think this would be better idea and why ? What about efficiency wise, would it really make a difference ?
    Having each scripts separated was a bit more seducing.
    Attached Files
    Last edited by Amedeus; 03-12-2022, 11:42 AM.

    #2
    Hello Amedeus,

    For understanding any behavior it would be necessary to debug using prints to look at the values used in the conditions and actions.

    Below is a link to a forum post that demonstrates using prints to understand behavior.


    The screenshot suggests this is drawing either dots or a dot plot added with AddPlot(), however the swing lines themselves appear similar to the Swing indicator which can provide sample code.
    The logic would need to be changed to affect when dots are being drawn or bars are being set.

    You may need to upload the attached file again. This appears to be invalid to me when trying to download and view.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea, thank you.

      The first post was edited because we could not see the file... I don't get why.
      Here it is again.

      About the prints, we are calling SwingHigh or swingHighSeries series, so the result is not really a surprise.
      I just have no clue about where to start to appliy the single dot logic from the parent single dot swing.

      I also had a shot at calling the specific swing bar like this unsuccessfully : sw0h[0] = sw0.SwingHigh[sw0.SwingHighBar(1,1,50)];

      also, I attempted to "break down" the parent SDSwing with #regions here and there but no changes in the logic.
      Attached Files

      Comment


        #4
        Hello Amedeus,

        The SwingHigh plot would use barsAgo values as the indexes instead of absolute bar indexes. To get a barsAgo value subtract the number from CurrentBar.

        if (CurrentBar > sw0.SwingHighBar(1,1,50))
        {
        sw0.SwingHigh[CurrentBar - sw0.SwingHighBar(1,1,50)];
        }

        You can set plot values by adding a plot with AddPlot().


        You could also draw dots with Draw.Dot().
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        579 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        334 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X