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 llanqui, Today, 03:53 AM
    0 responses
    5 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    10 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    15 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Yesterday, 07:51 PM
    0 responses
    14 views
    0 likes
    Last Post strategist007  
    Working...
    X