Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Recalling order's bar information

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

    Recalling order's bar information

    Hi there,
    I have a question about recalling the number of the bar where an order was placed in Ninjascript. Let's say I submit an order at bar number 100 based on a certain condition. After that, I need to know the number of the bar where the order was placed (i.e., 100) at every subsequent bar.
    Right now, I'm using a for loop to check this condition at all previous bars and find the bar where the condition was met. However, I'm wondering if there's a smarter way to do this. Is it possible to move the information about the order's bar to the next bars so that I can easily retrieve it without having to search through all previous bars?
    Thanks for your help!




    #2
    Hello, thanks for writing in.

    There could be a few ways of doing this. First, see BarsSinceEntryExecution:



    Alternatively, you can save bar data within your own class-level variables at the same time you submit the order, so save the bar data to variables right before or right after calling the EnterLong() method, for instance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    44 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    126 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    65 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 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