• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

what is the difference between these 2 methods?

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

    what is the difference between these 2 methods?

    Hello,

    What is the difference between using these 2 seemingly real time methods?

    1) placing code in the OnBarUpdate section while Calculate On Bar Close is set to false
    2) placing code in the OnMarketData section

    also, when is it preferable to use one over the other?

    thanks again

    #2
    Originally posted by gubbar924 View Post
    Hello,

    What is the difference between using these 2 seemingly real time methods?

    1) placing code in the OnBarUpdate section while Calculate On Bar Close is set to false
    2) placing code in the OnMarketData section

    also, when is it preferable to use one over the other?

    thanks again
    Not much, other than OnMarketData() is realtime only, so cannot be backtested or optimized.

    Comment


      #3
      thank you for the explanation

      Comment


        #4
        Hello gubbar924,

        Thank you for your post.

        OnBarUpdate() is called whenever the bar is updated. Where OnMarketData() is real-time only and is called whenever market data is updated. So updates to Bid, Ask, Last and Volume would be seen in OnMarketData() and only in OnBarUpdate() if the change updated the bar. OnBarUpdate() can also be restricted solely to when a bar closes by setting CalculateOnBarClose to True.

        OnMarketData(): http://www.ninjatrader.com/support/h...marketdata.htm
        OnBarUpdate(): http://www.ninjatrader.com/support/h...nbarupdate.htm
        CalculateOnBarClose: http://www.ninjatrader.com/support/h...onbarclose.htm

        Please let me know if I may be of further assistance.
        Patrick H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ksarin, Today, 12:39 PM
        3 responses
        12 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Started by ttodua, Today, 12:03 PM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by tomtr27, Today, 11:35 AM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Uregon, Today, 07:30 AM
        2 responses
        13 views
        0 likes
        Last Post bltdavid  
        Started by Induna, 02-20-2020, 05:38 AM
        4 responses
        26 views
        0 likes
        Last Post NinjaTrader_Kate  
        Working...
        X