Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Average Price Calculations and Order exit criteria

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

    Average Price Calculations and Order exit criteria

    Hello,

    I'm optimizing my strategy to update my stop order to move to the breakeven price ("PositionAccount.AveragePrice").
    However the averagepositions results are getting skewed when the addon positions are getting filled or stopped out. Specifically I do want the order exit criteria to NOT follow the FIFO order/position fill criteria.

    Is there a setting/option where I can change the Average price calculations to a LIFO based criteria on my active NT brokerage account(cqg continuum data)?

    Thanks


    #2
    Hello DeltaTraderX,

    It is not possible to modify the First In First Out behavior of the historical fill engine or the real-time Simulation engine.

    To confirm, you are printing the Position.AveragePrice in OnPositionUpdate() and you feel this is incorrect? Are you comparing this to the Strategies tab of the Control Center, or is this based on printing the Entry price and current Close price?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      My strategy moves the consolidated stoploss from all addon positions to whatever the PositionAccount.AveragePrice is at that time.
      My problem is if any one of my addon position gets stopped out my avgprice moves up based on the entry price of the latest addon position.

      e.g. Here are my three entries and the avg prices calc based on FIFO order
      • 1 contract (Origin) SHORT @13425.75
        • Avg Price :- 13425.75
      • 1 contract Addon @13424.25
        • Avg Price :- 13425 (AVG Position 2)
      • 1 contract Addon @13420.25
        • Avg Price :- 13423.50 (AVG Position 3)
      After my 3'rd entry (2'nd addon) gets stopped out my averageprice decreases to 13422.25 ( (13424.25+13420.25) /2) because of the FIFO nature of the avgprice algo.

      What I would want to have is the LIFO order exit execution where in after the 3'rd addon stop out the avg position now would return to 13425 (AVG Position 2)

      Click image for larger version

Name:	Capture.JPG
Views:	628
Size:	82.7 KB
ID:	1157260




      It's not a question of mathematical accuracy but rather a physiological one where the state of the position turns negative briefly; as the realized profit is not taken into account; and the trader then closes out the position.

      Let me know if changing the position exist order is a possibility.

      Thanks

      Comment


        #4
        Hello DeltaTraderX,

        Use the order.AveragePrice instead of the account position average price if this is what stop movements are based on.

        It will not be possible to modify the position without placing orders.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          CQG IC offers this FIFO/LIFO capability. Is it possible for them to report the same for NT8?

          Comment


            #6
            Hello DeltaTraderX,

            All real-time orders to brokerages will be filled by the brokerage however the brokerage fills them and however the brokerage reports the account values. We have no control over that. We only have control over historical fill engine and simulation engine.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Thanks for your prompt information. I'll code in my own avg price calculator logic into my strategy.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              62 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              40 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              21 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              23 views
              0 likes
              Last Post TheRealMorford  
              Started by Mindset, 02-28-2026, 06:16 AM
              0 responses
              51 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Working...
              X