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 gameuled, Yesterday, 11:18 PM
    0 responses
    12 views
    0 likes
    Last Post gameuled  
    Started by futurenow, 12-06-2021, 05:49 PM
    19 responses
    989 views
    0 likes
    Last Post Redders
    by Redders
     
    Started by Josephina55, 06-14-2025, 06:30 PM
    0 responses
    29 views
    0 likes
    Last Post Josephina55  
    Started by mathfrick2023, 05-08-2025, 12:51 PM
    8 responses
    92 views
    0 likes
    Last Post Yogaman
    by Yogaman
     
    Started by several, 04-22-2025, 05:21 AM
    2 responses
    264 views
    0 likes
    Last Post Lukasxgtx  
    Working...
    X