Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple OnBarUpdate active

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

    #16
    This depends on your code in OnBarUpdate. In case it would return control to the windows event loop (not possible through any of the documented NinjaScript methods) then you could experience OnBarUpdate being called before the prior call return control.

    Again, this is way beyond what we provide support for. At this point we will stop contributing to this thread. May be the community wanted to step in?!?

    Comment


      #17
      Hallo Andreas,

      had a look at your OnBarUpdate code example with the thread. Wouldn't it be better to start the tread conditionally, i.e. once per minute?
      Imagine, OnBarUpdate is called several times per second under real time conditions and every invocation would run at least 5 seconds (caused by the sleep). That would build up a huge queue of pending OnBarUpdate events very rapidely.

      Regards
      Ralph

      Comment


        #18
        Hello Ralph,

        actually the code presented by me in this thread was never meant to be used in a real strategy. I just wrote this code snipped to find out how OnBarUpDate() behaves and especially if it might happen that more than one OnBarUpdate() could be active (for a given strategy only).
        seems though that NT waits for OnBarUpdate() to return before it is called again.

        My real problem is in this thread where I suspect

        Support for the development of custom automated trading strategies using NinjaScript.


        abnormal behaviour of SetProfitTarget, as during my trading I got errors with invalid orders.
        I do not understand yet what happens there.
        Using Sim01 Account these errors do not show up.

        More tomorrow when I can log real trades.

        andreas

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        56 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        143 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        160 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        96 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        276 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X