Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unable to change the set profit target for short orders

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

    Unable to change the set profit target for short orders

    Hello, I am unable to change the set profit target for short orders but the long orders are being changed normally with the same setup. I initially enter with 1 order with stop market and then enter a second as a limit order for averaging down. I then use SetProfitTarget(CalculationMode.Price, AverageDownTP); to amend both orders to have the same profit target if the limit order gets hit.

    Code:
    protected override void OnBarUpdate()
    {​[INDENT]SetStopLoss("Average Down Short", CalculationMode.Ticks, AverageDownSL, false);        
    EnterShortLimit(0, false, ReentryQty, AverageDownEntry, "Average Down Short");​
    
    if (AverageDownSet && !AverageDownExecuted)
    {
        SetProfitTarget(CalculationMode.Price, AverageDownTP);
        AverageDownExecuted = true;
    }​[/INDENT]
      }
    Code:
    protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
    {
        if (execution.Order.Name == "Average Down Long" || execution.Order.Name == "Average Down Short")
        {
            AverageDownSet = true;
        }
    }​
    Last edited by mintos; 11-16-2024, 10:57 PM.

    #2
    Hello mintos,

    Are you first confirming the order price is a valid price?

    Are you debugging by adding TraceOrders and printing the order.ToString() in OnOrderUpdate()?


    Have you printed the price being supplied to the Set method as well as the current ask if a buytocover or current bid if a sell order one line above where the Set method is called?

    Please provide the debugging print output saved to a text file.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I have confirmed that the price being supplied is correct. I have printed out the current ask/bid and supplied price as well as the order and attached it to the file.
      Attached Files

      Comment


        #4
        Hello,

        I am showing from the output the profit target change was successful.

        The order was initially submitted at 46235.5.

        orderId='NT-14744-13828' account='Backtest' name='Profit target' orderState=Submitted instrument='NQ 12-24' orderAction=Sell orderType='Limit' limitPrice=46235.5 stopPrice=0 quantity=1 tif=Gtc oco='NT-05202-13828' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-11-12 09:00:00' gtd='2099-12-01' statementDate='2024-11-14'
        orderId='NT-14744-13828' account='Backtest' name='Profit target' orderState=Accepted instrument='NQ 12-24' orderAction=Sell orderType='Limit' limitPrice=46235.5 stopPrice=0 quantity=1 tif=Gtc oco='NT-05202-13828' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-11-12 09:00:00' gtd='2099-12-01' statementDate='2024-11-14'​

        The current bid is way way below this when the order is changed.

        Current Ask21183.5
        Current Bid21183.5
        Supplied Price21220.035

        The output shows the supplied price as 21220.035 (which is not a valid price as this does not conform to the minimum price fluctuation (TickSize) of .25 for the NQ).

        11/12/2024 9:08:00 AM Strategy 'testcode/-1': Entered internal SetStopTarget() method: Type=Target FromEntrySignal='' Mode=Price Value=21220.035 IsSimulatedStop=False IsMarketIfTouched=False
        11/12/2024 9:08:00 AM Strategy 'testcode/-1': Amended target order orderId='NT-14744-13828' account='Backtest' name='Profit target' orderState=Working instrument='NQ 12-24'

        The TraceOrders show the set method is updated.

        orderAction=Sell orderType='Limit' limitPrice=46235.5 stopPrice=0 quantity=1 tif=Gtc oco='NT-05202-13828' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-11-12 09:00:00' gtd='2099-12-01' statementDate='2024-11-14' limitPriceChanged=21220

        orderId='NT-14744-13828' account='Backtest' name='Profit target' orderState=ChangePending instrument='NQ 12-24' orderAction=Sell orderType='Limit' limitPrice=21220 stopPrice=0 quantity=1 tif=Gtc oco='NT-05202-13828' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-11-12 09:00:00' gtd='2099-12-01' statementDate='2024-11-14'

        The order.ToString() shows the order change request to 21220.

        orderId='NT-14744-13828' account='Backtest' name='Profit target' orderState=ChangeSubmitted instrument='NQ 12-24' orderAction=Sell orderType='Limit' limitPrice=21220 stopPrice=0 quantity=1 tif=Gtc oco='NT-05202-13828' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-11-12 09:00:00' gtd='2099-12-01' statementDate='2024-11-14'

        orderId='NT-14744-13828' account='Backtest' name='Profit target' orderState=Accepted instrument='NQ 12-24' orderAction=Sell orderType='Limit' limitPrice=21220 stopPrice=0 quantity=1 tif=Gtc oco='NT-05202-13828' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-11-12 09:00:00' gtd='2099-12-01' statementDate='2024-11-14'

        orderId='NT-14744-13828' account='Backtest' name='Profit target' orderState=Working instrument='NQ 12-24' orderAction=Sell orderType='Limit' limitPrice=21220 stopPrice=0 quantity=1 tif=Gtc oco='NT-05202-13828' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-11-12 09:00:00' gtd='2099-12-01' statementDate='2024-11-14'​

        The order then is OrderState.Working with a price of 21220.


        When you say the price change did not work, the output shows differently. The output shows the price changed worked as it was supposed to, the order was changed to 21220.


        This order did not fill because after the change the price fell to 21180.75 and the stop loss filled.

        orderId='NT-14743-13828' account='Backtest' name='Stop loss' orderState=Filled instrument='NQ 12-24' orderAction=Sell orderType='Stop Market' limitPrice=0 stopPrice=21181 quantity=1 tif=Gtc oco='NT-05202-13828' filled=1 averageFillPrice=21180.75 onBehalfOf='' id=-1 time='2024-11-12 09:00:00' gtd='2099-12-01' statementDate='2024-11-14'

        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Here is a good example of the set profit target not working. This is only an issue with shorts, long orders seems to have no issue.

          Comment


            #6
            Here is an example that I found in the log file. It seems that it goes to set it but nothing occurs?
            Entered internal SetStopTarget() method at 21198. But then the subsequent logs show something different.

            Code:
            orderId='NT-14741-13828' account='Backtest' name='Stop loss' orderState=Submitted instrument='NQ 12-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=21227 quantity=1 tif=Gtc oco='NT-05199-13828' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-11-12 07:23:00' gtd='2099-12-01' statementDate='2024-11-14'
            orderId='NT-14741-13828' account='Backtest' name='Stop loss' orderState=Accepted instrument='NQ 12-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=21227 quantity=1 tif=Gtc oco='NT-05199-13828' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-11-12 07:23:00' gtd='2099-12-01' statementDate='2024-11-14'
            orderId='NT-14741-13828' account='Backtest' name='Stop loss' orderState=Working instrument='NQ 12-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=21227 quantity=1 tif=Gtc oco='NT-05199-13828' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-11-12 07:23:00' gtd='2099-12-01' statementDate='2024-11-14'
            orderId='NT-14740-13828' account='Backtest' name='Average Down Short' orderState=Filled instrument='NQ 12-24' orderAction=SellShort orderType='Limit' limitPrice=21218.5 stopPrice=0 quantity=1 tif=Gtc oco='' filled=1 averageFillPrice=21218.5 onBehalfOf='' id=-1 time='2024-11-12 07:03:00' gtd='2099-12-01' statementDate='2024-11-14'
            Current Ask21214.5
            Current Bid21214.5
            Supplied Price21198
            11/12/2024 7:24:00 AM Strategy 'SuperNQ/-1': Entered internal SetStopTarget() method: Type=Target FromEntrySignal='' Mode=Price Value=21198 IsSimulatedStop=False IsMarketIfTouched=False
            orderId='NT-14734-13828' account='Backtest' name='Stop loss' orderState=Filled instrument='NQ 12-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=21226.5 quantity=1 tif=Gtc oco='NT-05198-13828' filled=1 averageFillPrice=21226.75 onBehalfOf='' id=-1 time='2024-11-12 04:00:00' gtd='2099-12-01' statementDate='2024-11-14'
            orderId='NT-14741-13828' account='Backtest' name='Stop loss' orderState=Filled instrument='NQ 12-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=21227 quantity=1 tif=Gtc oco='NT-05199-13828' filled=1 averageFillPrice=21227.25 onBehalfOf='' id=-1 time='2024-11-12 07:23:00' gtd='2099-12-01' statementDate='2024-11-14'
            11/12/2024 9:00:00 AM Strategy 'SuperNQ/-1': Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Ticks Value=219 IsSimulatedStop=False IsMarketIfTouched=False
            11/12/2024 9:00:00 AM Strategy 'SuperNQ/-1': Entered internal SetStopTarget() method: Type=Target FromEntrySignal='' Mode=Ticks Value=99999 IsSimulatedStop=False IsMarketIfTouched=False​

            Comment


              #7
              Hello mintos,

              Where is TraceOrders message for Entered internal SetStopTarget() with the FromEntrySignal='Average Down Short'?

              Are you certain you are calling SetProfitTarget() with the fromEntrySignal supplied as '

              The TraceOrders is showing SetProfitTarget() was called with no fromEntrySignal applied after the entry already occurred.

              11/12/2024 9:00:00 AM Strategy 'SuperNQ/-1': Entered internal SetStopTarget() method: Type=Target FromEntrySignal='' Mode=Ticks Value=99999 IsSimulatedStop=False IsMarketIfTouched=False​

              Perhaps you are confusing this output for the output that shows be above the entry fill and using the FromEntrySignal='Average Down Short'?
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Hello, it says the same thing for the long orders where the Type=Target FromEntrySignal=''​ is blank.

                11/12/2024 9:08:00 AM Strategy 'testcode/-1': Entered internal SetStopTarget() method: Type=Target FromEntrySignal='' Mode=Price Value=21220.035 IsSimulatedStop=False IsMarketIfTouched=False
                This was from what you posted from the log for Long entries. The same entry for shorts does not give the same outcome. The
                11/12/2024 9:00:00 AM Strategy 'SuperNQ/-1': Entered internal SetStopTarget() method: Type=Target FromEntrySignal='' Mode=Ticks Value=99999 IsSimulatedStop=False IsMarketIfTouched=False​​
                is from me resetting the profit target as I cannot remove the profit target after it is set once in the strategy, so I just make it unattainable until the next time the strategy enters an "Average Down" order and sets the profit target again for both initial Entry and the Average Down Entry.

                The reason why I'm confused is because this is the same setup for Long entries which work fine. But using the same setup for short entries is not showing the same behavior. I have attached 2 screenshots, one for Longs and one for Shorts, and they show different behaviors with the same code.

                Comment


                  #9
                  The
                  11/12/2024 9:00:00 AM Strategy 'SuperNQ/-1': Entered internal SetStopTarget() method: Type=Target FromEntrySignal='' Mode=Ticks Value=99999 IsSimulatedStop=False IsMarketIfTouched=False​​
                  is set only before the 1st entry, not the average down entry. The flow of the code is like this.
                  Code:
                  if (AverageDownSet && !AverageDownExecuted)
                  {
                      Print("Current Ask" + GetCurrentAsk());
                      Print("Current Bid" + GetCurrentBid());
                      Print("Supplied Price" + AverageDownTP);
                      
                      SetProfitTarget(CalculationMode.Price, AverageDownTP);
                      AverageDownExecuted = true;
                  }
                  
                  SetStopLoss(CalculationMode.Ticks, (StopLossValueShort));
                  SetProfitTarget(CalculationMode.Ticks, 99999);
                  // Enter Short
                  if (GetCurrentBid() > ShortEntryPrice)
                  {
                      EnterShortStopMarket(0, false, Qty, ShortEntryPrice, "Stop Market Short");
                      AverageDownExecuted = false;
                  }​​
                  
                  if (Position.MarketPosition == MarketPosition.Short)
                  {
                          // Calculate average down entry point
                          AverageDownEntry = ###
                          AverageDownSL = ###
                          AverageDownTP = ###
                  
                          SetStopLoss("Average Down Short", CalculationMode.Ticks, AverageDownSL, false);        
                          EnterShortLimit(0, false, ReentryQty, AverageDownEntry, "Average Down Short");
                      }​
                  }
                  
                  protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
                  {
                      if (execution.Order.Name == "Average Down Long" || execution.Order.Name == "Average Down Short")
                      {
                          AverageDownSet = true;
                      }
                  }​
                  ​

                  Comment


                    #10
                    Here's another example, I recoded the signal names to make it clearer. It enters the average down, sets the profit and stop loss for the average down. Then attempts to set the profit target for the original Short, which doesn't seem to do anything. The position never gets closed until it gets picked up by the trailing stop loss that I coded into the program.

                    I have attached the log and the screenshot.
                    Attached Files

                    Comment


                      #11
                      Hello mintos,

                      orderId='NT-14992-14377' account='Backtest' name='Stop loss' orderState=Submitted instrument='NQ 12-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=20489.5 quantity=1 tif=Gtc oco='NT-05185-14377' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-10-22 02:43:00' gtd='2099-12-01' statementDate='2024-11-14'

                      orderId='NT-14993-14377' account='Backtest' name='Profit target' orderState=Submitted instrument='NQ 12-24' orderAction=BuyToCover orderType='Limit' limitPrice=20460.5 stopPrice=0 quantity=1 tif=Gtc oco='NT-05185-14377' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-10-22 02:43:00' gtd='2099-12-01' statementDate='2024-11-14'

                      orderId='NT-14991-14377' account='Backtest' name='Average Down Short' orderState=Filled instrument='NQ 12-24' orderAction=SellShort orderType='Limit' limitPrice=20481 stopPrice=0 quantity=1 tif=Gtc oco='' filled=1 averageFillPrice=20481 onBehalfOf='' id=-1 time='2024-10-22 02:03:00' gtd='2099-12-01' statementDate='2024-11-14'

                      A BuyToCover (to exit a short position) stop loss and profit target were submitted as the entry filled.

                      The stop loss was submitted at 20489.5.


                      orderId='NT-14990-14377' account='Backtest' name='Stop loss' orderState=Filled instrument='NQ 12-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=20430.25 quantity=1 tif=Gtc oco='NT-05184-14377' filled=1 averageFillPrice=20430.5 onBehalfOf='' id=-1 time='2024-10-22 02:00:00' gtd='2099-12-01' statementDate='2024-11-14'

                      The exit order that filled, 14990, is not showing as ever had been submitted in this output, but it had a lower price of 20430.25 and would have been hit first as the price rose and would have closed the position, which would cancel any other working orders on the position.

                      Likely that information was not included on when it was submitted.​
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Hello, As you can see the stop loss never hits and is below the 20489.25. So when the Profit Target (20460.5​) is submitted it should be filled when the price passes over it. The same way it is filled with the Average Down Short entry. I'm not too sure what you are saying is the issue here. Could you explain more in detail about why the profit target for the Short entry is getting ignored? Also I know that the stop loss was filled as it was later picked up by my trailing stop code so it changed the stop loss to move downward following price action. The issue is that the profit target should have been hit before the trailing stop code picked up the position.
                        Last edited by mintos; 11-15-2024, 08:45 AM.

                        Comment


                          #13
                          Hello mintos,

                          This is a BuyToCover stop order. The price must be above the stop price for the order to fill.

                          "As you can see the stop loss never hits and is below the 20489.25."

                          This would mean the order should not fill. The price is not above the order price.


                          "So when the Profit Target (20460.5​) is submitted it should be filled when the price passes over it.​"

                          Are you printing the bid after the profit target is working and seeing the price is below 20460.5?

                          Are you referring to this profit target which did fill?

                          orderId='NT-14993-14377' account='Backtest' name='Profit target' orderState=Filled instrument='NQ 12-24' orderAction=BuyToCover orderType='Limit' limitPrice=20460.5 stopPrice=0 quantity=1 tif=Gtc oco='NT-05185-14377' filled=1 averageFillPrice=20460.5 onBehalfOf='' id=-1 time='2024-10-22 02:43:00' gtd='2099-12-01' statementDate='2024-11-14'
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            Hello, I think we may be misunderstanding each other. So the Short order is submitted and is open. Then as the price goes up against the order the Average Down Short is opened with the profit and stop loss already set.
                            Code:
                            SetStopLoss("Average Down Short", CalculationMode.Ticks, AverageDownSL, false);
                            SetProfitTarget("Average Down Short", CalculationMode.Price, AverageDownTP);
                            EnterShortLimit(0, false, ReentryQty, AverageDownEntry, "Average Down Short");​
                            When the Average Down Short order is executed it triggers the AverageDownSet = true flag and on the next bar update the original Short order should have its profit target modified to be the same as the Average Down Short, which in this case is (20460.5​). So when the price is passing over the target it should be closing both the Average Down Short as well as the original Short order. The Print for Current Ask/Bid prices are printed right before the profit target submissions for the original Short order​. Which is this code here. (modified from previous to better show what it is doing.)
                            Code:
                            if (AverageDownSet && !AverageDownExecuted)
                            {
                                Print("Current Ask" + GetCurrentAsk());
                                Print("Current Bid" + GetCurrentBid());
                                Print("Supplied Price" + AverageDownTP);
                                
                                if (Position.MarketPosition == MarketPosition.Short)
                                {
                                    SetProfitTarget("Short", CalculationMode.Price, AverageDownTP);
                                }
                                if (Position.MarketPosition == MarketPosition.Long)
                                {
                                    SetProfitTarget("Long", CalculationMode.Price, AverageDownTP);
                                }
                                
                                AverageDownExecuted = true;
                            }​
                            Which is why I am confused as to why the profit target is not closing out the original Short position, it appears as if
                            Code:
                            Current Ask20482.75
                            Current Bid20482.75
                            Supplied Price20460.5
                            10/22/2024 2:44:00 AM Strategy 'testcode/-1': Entered internal SetStopTarget() method: Type=Target FromEntrySignal='Short' Mode=Price Value=20460.5 IsSimulatedStop=False IsMarketIfTouched=False
                            10/22/2024 2:53:00 AM Strategy 'testcode/-1: Cancelled pending exit order, since associated position is closed, orderId='NT-14992-14377' account='Backtest' name='Stop loss' orderState=Working instrument='NQ 12-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=20489.5 quantity=1 tif=Gtc oco='NT-05185-14377' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-10-22 02:43:00' gtd='2099-12-01' statementDate='2024-11-14'
                            orderId='NT-14992-14377' account='Backtest' name='Stop loss' orderState=CancelPending instrument='NQ 12-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=20489.5 quantity=1 tif=Gtc oco='NT-05185-14377' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-10-22 02:43:00' gtd='2099-12-01' statementDate='2024-11-14'
                            orderId='NT-14992-14377' account='Backtest' name='Stop loss' orderState=CancelSubmitted instrument='NQ 12-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=20489.5 quantity=1 tif=Gtc oco='NT-05185-14377' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-10-22 02:43:00' gtd='2099-12-01' statementDate='2024-11-14'
                            orderId='NT-14992-14377' account='Backtest' name='Stop loss' orderState=Cancelled instrument='NQ 12-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=20489.5 quantity=1 tif=Gtc oco='NT-05185-14377' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-10-22 02:43:00' gtd='2099-12-01' statementDate='2024-11-14'
                            orderId='NT-14993-14377' account='Backtest' name='Profit target' orderState=Filled instrument='NQ 12-24' orderAction=BuyToCover orderType='Limit' limitPrice=20460.5 stopPrice=0 quantity=1 tif=Gtc oco='NT-05185-14377' filled=1 averageFillPrice=20460.5 onBehalfOf='' id=-1 time='2024-10-22 02:43:00' gtd='2099-12-01' statementDate='2024-11-14'
                            10/22/2024 2:53:00 AM Strategy 'testcode/-1': Cancelled OCO paired order: BarsInProgress=0, orderId='NT-14992-14377' account='Backtest' name='Stop loss' orderState=Cancelled instrument='NQ 12-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=20489.5 quantity=1 tif=Gtc oco='NT-05185-14377' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-10-22 02:43:00' gtd='2099-12-01' statementDate='2024-11-14'
                            10/22/2024 4:26:00 AM Strategy 'testcode/-1': Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Price Value=20430.2 IsSimulatedStop=False IsMarketIfTouched=False
                            10/22/2024 4:26:00 AM Strategy 'testcode/-1': Amended stop order orderId='NT-14990-14377' account='Backtest' name='Stop loss' orderState=Working instrument='NQ 12-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=20489.25 quantity=1 tif=Gtc oco='NT-05184-14377' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-10-22 02:00:00' gtd='2099-12-01' statementDate='2024-11-14' stopPriceChanged=20430.25
                            orderId='NT-14990-14377' account='Backtest' name='Stop loss' orderState=ChangePending instrument='NQ 12-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=20430.25 quantity=1 tif=Gtc oco='NT-05184-14377' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-10-22 02:00:00' gtd='2099-12-01' statementDate='2024-11-14'
                            orderId='NT-14990-14377' account='Backtest' name='Stop loss' orderState=ChangeSubmitted instrument='NQ 12-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=20430.25 quantity=1 tif=Gtc oco='NT-05184-14377' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-10-22 02:00:00' gtd='2099-12-01' statementDate='2024-11-14'
                            orderId='NT-14990-14377' account='Backtest' name='Stop loss' orderState=Accepted instrument='NQ 12-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=20430.25 quantity=1 tif=Gtc oco='NT-05184-14377' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-10-22 02:00:00' gtd='2099-12-01' statementDate='2024-11-14'
                            orderId='NT-14990-14377' account='Backtest' name='Stop loss' orderState=Working instrument='NQ 12-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=20430.25 quantity=1 tif=Gtc oco='NT-05184-14377' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-10-22 02:00:00' gtd='2099-12-01' statementDate='2024-11-14'
                            orderId='NT-14990-14377' account='Backtest' name='Stop loss' orderState=Filled instrument='NQ 12-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=20430.25 quantity=1 tif=Gtc oco='NT-05184-14377' filled=1 averageFillPrice=20430.5 onBehalfOf='' id=-1 time='2024-10-22 02:00:00' gtd='2099-12-01'  ​​
                            Is not doing anything. Because according to the logs, it submits the change in profit target, does nothing, and then the trailing stop loss change is applied as the price action continues downward.
                            Last edited by mintos; 11-15-2024, 09:33 AM.

                            Comment


                              #15
                              Hello mintos,

                              There is no information about an order with the name 'Short' filling.
                              There is no information about a profit target being submitted at the same time this order fills.

                              Perhaps you should provide the entire output and not modify this to hide information about what is occurring.


                              10/22/2024 2:44:00 AM Strategy 'testcode/-1': Entered internal SetStopTarget() method: Type=Target FromEntrySignal='Short' Mode=Price Value=20460.5 IsSimulatedStop=False IsMarketIfTouched=False

                              This Set method call, is for a different entry named 'Short'.

                              orderId='NT-14992-14377' account='Backtest' name='Stop loss' orderState=Submitted instrument='NQ 12-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=20489.5 quantity=1 tif=Gtc oco='NT-05185-14377' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-10-22 02:43:00' gtd='2099-12-01' statementDate='2024-11-14'

                              orderId='NT-14991-14377' account='Backtest' name='Average Down Short' orderState=Filled instrument='NQ 12-24' orderAction=SellShort orderType='Limit' limitPrice=20481 stopPrice=0 quantity=1 tif=Gtc oco='' filled=1 averageFillPrice=20481 onBehalfOf='' id=-1 time='2024-10-22 02:03:00' gtd='2099-12-01' statementDate='2024-11-14'

                              10/22/2024 2:53:00 AM Strategy 'testcode/-1: Cancelled pending exit order, since associated position is closed, orderId='NT-14992-14377' account='Backtest' name='Stop loss' orderState=Working instrument='NQ 12-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=20489.5 quantity=1 tif=Gtc oco='NT-05185-14377' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-10-22 02:43:00' gtd='2099-12-01' statementDate='2024-11-14'

                              The cancelled order was NT-14992-14377 which was submitted for the entry 'Average Down Short'.

                              There is no information about any entry for 'Short' or any stop and target submitted for that entry.

                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              601 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              347 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              103 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              559 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              558 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X