Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
    Paul H.NinjaTrader Customer Service

    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 xiinteractive, 04-09-2024, 08:08 AM
      7 responses
      27 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by Skifree, Today, 03:41 AM
      2 responses
      8 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by trimpy, Today, 04:38 AM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by dpolyakov, 03-29-2024, 11:30 AM
      4 responses
      150 views
      2 likes
      Last Post NinjaTrader_RyanS  
      Started by traderqz, Today, 12:06 AM
      1 response
      2 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X