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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    36 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    14 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    19 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    22 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X