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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      90 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      137 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      120 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      72 views
      0 likes
      Last Post PaulMohn  
      Working...
      X