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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    89 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    135 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
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X