Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Capture previous swing low

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

    Capture previous swing low

    I have a script which sets a variable (SwingLow) to the current swing low value. I am using a double as the variable type.

    I need to be able to access the previous swing low value also.


    What is the proper way / easiest way to capture or reference the previous value of this variable?

    I am not that familiar with C# terminology but I think I need to create a series.

    I would appreciate any guidance.


    #2
    Hello sdauteuil,

    Thanks for your post.

    What I would suggest is that you create a second variable to hold the value of the previous swinglow. When a new swing low is found, step 1 is to move the existing swing low variable value into the previous swing low variable and then step 2 is save the new swing low into the current swing low variable.

    Alternately, if you are using Ninjascript directly, you can pull the prior swing levels within the look back period by changeing the "instance": 1 would be the current swing low, 2 would be the previous swing low. https://ninjatrader.com/support/help...nt8/?swing.htm

    Comment


      #3
      Using the second variable worked. I was actually trying to do that but couldn't quite figure out the proper code.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      477 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      317 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      255 views
      1 like
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      340 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      306 views
      0 likes
      Last Post CarlTrading  
      Working...
      X