Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to eliminate conflicts onTickUpdate with onBarUpdate

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

    How to eliminate conflicts onTickUpdate with onBarUpdate

    Hi,
    I run several strategies using onTickUpdate state. When a condition is met, the position gets closed. However I habe noticed that sometimes the strategy initiates an opposite position when the closing criteria is met. I have checked and noticed that this situation occurs when the strategy‘s onbarupdate state has a contrary position to the ontickupdate. There should not be any conflict since I run the strategy with ontickupdate.
    can you please advise? Thanks
    sergiu

    #2
    Hello serman,

    Thank you for your post.

    have checked and noticed that this situation occurs when the strategy‘s onbarupdate state has a contrary position to the ontickupdate
    What do you mean by "OnBarUpdate state has a contrary position to OnTickUpdate"?

    When you say "OnTickUpdate" you are referring to having the strategy run Calculate.OnEachTick, correct?

    Comment


      #3
      Hi, On each Tick, sorry. I thought it was clear.

      Comment


        #4
        Hello serman,

        I'm not quite clear on what this means.

        If the strategy is running with Calculate.OnEachTick, then the OnBarUpdate() override will be updated for every received tick in real-time (or in historical when TickReplay is enabled).

        The Strategy will have one position (per instrument) which updates when orders are filled (and is not updated when the bar updates).

        Can you clarify what you are comparing the strategy position to?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Ok, assuming that - can you help me understand why the strategy is initiating a reverse position although it has only a simple condition - if long and price hits position average price + x ticks = close position? I would like to understand that.
          Both initial long and short conditions do not overlap, I`ve checked many times - one is uptrend condition and the other for downtrend condition.
          Thanks.

          Comment


            #6
            Hello serman,

            The understand the behavior of your custom logic it is necessary to enable TraceOrders and add debugging prints.

            Print the time of the bar and all values in the condition that submits the order. Include labels for each value and comparison operator.
            Also print the order.ToString() in OnOrderUpdate().

            Below is a link to a support article on adding debugging prints to understand behavior.


            Save the output (right-click the output window > Save as) and attach the txt file to your next post.
            Chelsea 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