Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Ignored SubmitOrderManaged() method

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

    Ignored SubmitOrderManaged() method

    •By default, orders submitted via Entry() and Exit() methods automatically cancel at the end of a bar if not re-submitted.
    I'm using Managed approach,Calculate.OnBarClose, my orders EnterLongStopMarket/EnterShortStopMarket, EntryHandling.AllEntries, EntriesPerDirection = 1.

    My strategy placed EnterLongStopMarket 1 tick above 23 bar (see pic). As I know if it didn't trigger next bar it will be cancelled. But before that the strategy places another order at 24 bar but it's not possible bc previous order is still there. So this behavior is ok?

    Trace:
    Code:
    9/28/2020 1:11:31 PM Strategy 'Strategy16/-1': Entered internal SubmitOrderManaged() method at 9/28/2020 1:11:31 PM: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=11275.75 SignalName='23' FromEntrySignal='' NQ 03-21
    9/28/2020 1:11:31 PM Strategy 'Strategy16/-1': Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='23' Mode=Price Value=11266.25 IsSimulatedStop=False IsMarketIfTouched=False NQ 03-21
    9/28/2020 1:11:31 PM Strategy 'Strategy16/-1': Entered internal SetStopTarget() method: Type=Target FromEntrySignal='23' Mode=Price Value=11329.75 IsSimulatedStop=False IsMarketIfTouched=False NQ 03-21
    9/28/2020 1:12:17 PM Strategy 'Strategy16/-1': Entered internal SubmitOrderManaged() method at 9/28/2020 1:12:17 PM: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=11271.00 SignalName='24' FromEntrySignal='' NQ 03-21
    9/28/2020 1:12:17 PM Strategy 'Strategy16/-1': Ignored SubmitOrderManaged() method at 9/28/2020 1:12:17 PM: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=11271.00 SignalName='24' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties' NQ 03-21
    9/28/2020 1:12:17 PM Strategy 'Strategy16/-1': Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='24' Mode=Price Value=11263.5 IsSimulatedStop=False IsMarketIfTouched=False NQ 03-21
    9/28/2020 1:12:17 PM Strategy 'Strategy16/-1': Entered internal SetStopTarget() method: Type=Target FromEntrySignal='24' Mode=Price Value=11327 IsSimulatedStop=False IsMarketIfTouched=False NQ 03-21
    9/28/2020 1:12:17 PM Strategy 'Strategy16/-1': Cancelled expired order: BarsInProgress=0, orderId='NT-00029-12744' account='Backtest' name='23' orderState=Working instrument='NQ 03-21' orderAction=Buy orderType='Stop Market' limitPrice=0 stopPrice=11275.75 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2020-09-28 13:11:31' gtd='2099-12-01' statementDate='2020-12-14' NQ 03-21
    Attached Files

    #2
    Hello Leeroy_Jenkins, thanks for writing in.

    If you give the order a unique signal name it will not submit the same order twice. On the second submission if the order has the same signal name and is called twice it will not submit again, but it will keep the order alive if the order was submitted on the previous bar. If you are not using a signal name and the order prices are different It would submit a different order.

    Please let me know if I can assist any further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      But they do have different SignalName.

      my code looks like this:

      if(..) //condition to go long
      {
      Count++; //count trades
      EnterLongStopMarket(High[0] + TickSize, "" + Count);
      SetStopLoss("" + Count, CalculationMode.Price, Low[0] - TickSize, false);
      SetProfitTarget("" + Count, CalculationMode.Price, TargetLong);
      }

      As I see in my trace SignalName='23' FromEntrySignal=''

      Next trade: SignalName='24' FromEntrySignal=''

      So they have different SignalName but empty FromEntrySignal in both cases. And different prices of course.



      Comment


        #4
        Hello Leeroy_Jenkins, thanks for your reply.

        This is expected to happen. The first order, 23, gets submitted, then on the next bar the 24 order is submitted and the 23 order is canceled. If you wanted to keep the 23 order alive on subsequent bars you would need to save the signal name as a variable and re-submit the order with the saved signal name.

        Please let me know if I can provide any further information.

        Chris L.NinjaTrader Customer Service

        Comment


          #5
          It works, thanks.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Belfortbucks, Today, 09:29 PM
          0 responses
          6 views
          0 likes
          Last Post Belfortbucks  
          Started by zstheorist, Today, 07:52 PM
          0 responses
          7 views
          0 likes
          Last Post zstheorist  
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          151 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Started by mattbsea, Today, 05:44 PM
          0 responses
          6 views
          0 likes
          Last Post mattbsea  
          Started by RideMe, 04-07-2024, 04:54 PM
          6 responses
          33 views
          0 likes
          Last Post RideMe
          by RideMe
           
          Working...
          X