Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to reference value later on in strategy

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

    How to reference value later on in strategy

    Hello
    I am wondering how to reference a certain value/ point on chart later on in a strategy/ ninjascript. Say a defined condition happens and you want to "bookmark" a certain value and reference it later. How would you do that? thanks

    #2
    Hello behindthewheel,

    Thanks for your post.

    You could check CurrentBar to see the bar index when this occurred and assign the value to a variable. If you need to reference that bar later on in the script, you can use a BarsAgo reference like the following: Close[CurrentBar - YourVariable] (This will return the Close price for when you gave YourVariable a value.)

    We look forward to being of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      I figure the simplest way to do this is assign the value to a variable. I don't see the need for the BarsAgo reference for the question as stated.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by arvidvanstaey, Today, 02:19 PM
      4 responses
      11 views
      0 likes
      Last Post arvidvanstaey  
      Started by samish18, 04-17-2024, 08:57 AM
      16 responses
      61 views
      0 likes
      Last Post samish18  
      Started by jordanq2, Today, 03:10 PM
      2 responses
      9 views
      0 likes
      Last Post jordanq2  
      Started by traderqz, Today, 12:06 AM
      10 responses
      18 views
      0 likes
      Last Post traderqz  
      Started by algospoke, 04-17-2024, 06:40 PM
      5 responses
      48 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X