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 CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      58 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      34 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      196 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      362 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      281 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X