Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Swing Indicator

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

    Swing Indicator

    Hello,

    I would like to understand how the swing indicator is processed during backtesting. I read that it is biased because it is calculated with values from future bars. I always understood that, being event driven, backtests in NT are market like.

    Does NT calculate at a point t with the swing value that is known at t+1? or the one known at t? This make a major difference since the first would lead to a future bias whereas the second would not.

    Thanks,

    Marco

    #2
    Hello,

    The swing indicator will likely not be effective when backtesting as its use is designed for display purposes. In other words it will plot the swing after the fact. For example if you used the default of 5 strength you wouldn't have the value plotted until 5 bars later than the swing point.

    If you want more details on how the swing plots its values you can go to tools -> edit ninjascript -> indicator -> swing

    Let me know if I can be of further assistance.
    LanceNinjaTrader Customer Service

    Comment


      #3
      Hi Lance,

      Thank you for coming back to me that soon.

      I understand the swing indicator and it seems normal to me that swing highs are plotted after the 5 following candles made lower highs. That's inherent to the definition of a swing.

      My question was more related to how this is processed when backtesting. In your example, if today (04.01.13) a swing high is detected and plotted after the fact for last monday (03.25.13). Now if I open strategy analyzer and backtest a strategy that calls the swing high on each bar close, what will be the value returned last monday (03.25.13)? (-1 because there was no swing known so far on that date or the swing high that was confirmed later (04.01.13))?

      I hope I express my question clearly enough.

      Marco

      Comment


        #4
        It will return the previous swing value and won't be different in backtesting in this regard.

        For example if I did the following within a strategy

        Code:
        Print(Time[0] +" "+Swing(5).SwingHigh[0]);
        I could then see the time stamp printed tot he output window along with the current bars most recent labeled swing value. It would not be able to pull future data (even though it exists) to see if it is currently at a swing point.

        Let me know if this doesn't fully clarify your question.
        LanceNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        649 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        370 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        573 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        576 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X