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 Mestor, 03-10-2023, 01:50 AM
          16 responses
          388 views
          0 likes
          Last Post z.franck  
          Started by rtwave, 04-12-2024, 09:30 AM
          4 responses
          31 views
          0 likes
          Last Post rtwave
          by rtwave
           
          Started by yertle, Yesterday, 08:38 AM
          7 responses
          29 views
          0 likes
          Last Post yertle
          by yertle
           
          Started by bmartz, 03-12-2024, 06:12 AM
          2 responses
          22 views
          0 likes
          Last Post bmartz
          by bmartz
           
          Started by funk10101, Today, 12:02 AM
          0 responses
          7 views
          0 likes
          Last Post funk10101  
          Working...
          X