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.

    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 NullPointStrategies, Today, 05:17 AM
      0 responses
      41 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      124 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      64 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      41 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X