Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to get the Close price of bar emmediately after the bar is closed?

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

    How to get the Close price of bar emmediately after the bar is closed?

    How in NinjaScript to get the Close price of bar emmediately after the bar is closed ?

    Fo example:
    I use the 5-minute timeframe.
    The time now is 15:35:00
    The previous tick was on 15:34:58
    The next tick will come on 15:35:20

    I want to get the close price of bar [15:35] right now (on 15:35:00), but the next tick still did not come, so the OnBarUpdate() method still did not start (it will start only on 15:35:20 and I will get Close[0]).
    May be there is a method in NinjaScript wich is called whenever a bar is closed ?

    P.S.
    I need it for real-time export of data into the external program. The external program starts to analyse data by timer every 5 minutes (the timer starts at 15:35:10, 15:40:10, 15:45:10, ...). But sometimes (when the next tick does not come for a long time) in the moment when timer starts I still do not have data for analysis.
    Last edited by MaxNT; 07-11-2016, 05:55 AM.

    #2
    Hello,
    This would be possible by creating a timer that is synced to the bar and once the timer has counted down to 0 you could then print out the Close[0] which would be the closed bar.. The BarTimer indicator would be a great reference to get you start with creating a timer. You can view the code for the BarTimer by going to Tools > Edit NinjaScript > Indicator > BarTimer > press OK.
    Cody B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    46 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
    66 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