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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    23 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    33 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    51 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X