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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    57 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    78 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    41 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    101 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    61 views
    0 likes
    Last Post PaulMohn  
    Working...
    X