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 rjbtrade1, 11-30-2023, 04:38 PM
    2 responses
    75 views
    0 likes
    Last Post DavidHP
    by DavidHP
     
    Started by Stanfillirenfro, Today, 07:23 AM
    3 responses
    11 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by FitSpressoHonest, Today, 09:14 AM
    0 responses
    1 view
    0 likes
    Last Post FitSpressoHonest  
    Started by Davide999, 05-18-2023, 03:55 AM
    4 responses
    557 views
    1 like
    Last Post kcwasher  
    Started by rexsole, Today, 08:39 AM
    2 responses
    7 views
    0 likes
    Last Post NinjaTrader_Erick  
    Working...
    X