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 NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      54 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      130 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      72 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X