Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Swing indicator modification

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

    Swing indicator modification

    Hi All,

    I'm new to NinjaScript but have some experience with PineScript. I'm trying to modify the Swing indicator that comes with NinjaTrader. Currently, it draws a dotted line whenever a new high or low is found. However, I want to change it so that the dotted line is only drawn when the last high or low is broken by a candle.

    Can anyone help guide me in the right direction?

    #2
    Hello CrissCross,

    Welcome to the NinjaTrader forums!

    Below I am providing a link to a support article with helpful resources on getting started with C# and NinjaScript.


    For the Swing indicator the previous high and low can be found with
    High[Math.Max(0, Swing(5).SwingHighBar(0, 1, CurrentBar))]
    Low[Math.Max(0, Swing(5).SwingLowBar(0, 1, CurrentBar))]

    Below is a link to the help guide.


    You can compare the high of the swing high bar to the current bar's high.

    If (High[0] > High[Math.Max(0, Swing(5).SwingHighBar(0, 1, CurrentBar))])
    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
    596 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    343 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    556 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    554 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X