Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT ignoring sop market orders on strategy

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

    NT ignoring sop market orders on strategy

    I recreated the strategy directly from the strategy wizard then added, trace order and printing dots for the order location on the chart.

    It runs fine in backtest, but it doesn't seem to process an order for anything live. You can't get a simpler strat than this really. It worked in NT 6.5 but doesn't seem to work in NT 7.



    Finally salient code in question:

    Code:
    protected override void Initialize()
            {
    
                CalculateOnBarClose = true;
    			ExitOnClose = false;
    			TraceOrders = true;
            }
    
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
                // Condition set 1
                if (DefaultInput[0] > ChandelierSAR(6, 4).Chandelier[0])
                {
                    EnterShortStop(DefaultQuantity, ChandelierSAR(6, 4).Chandelier[0], "");
    				DrawDot("My dot" + CurrentBar, false, 0, ChandelierSAR(6, 4).Chandelier[0], Color.Blue);
                }
    
                // Condition set 2
                if (DefaultInput[0] < ChandelierSAR(6, 4).Chandelier[0])
                {
                    ExitShortStop(ChandelierSAR(6, 4).Chandelier[0], "", "");
    				DrawDot("My dot" + CurrentBar, false, 0, ChandelierSAR(6, 4).Chandelier[0], Color.Blue);
                }

    **NT** Enabling NinjaScript strategy 'FX6short4/ad1f88ddf4dd44998f1ba939ebc01405' : On starting a real-time strategy - StrategySync=WaitUntilFlat SyncAccountPosition=False EntryHandling=AllEntries EntriesPerDirection=1 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositio ns ExitOnClose=False Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=False CancelExitOrdersOnDisable=True MaxRestarts=4 in 5 minutes
    12/1/2010 11:10:28 AM Entered internal PlaceOrder() method at 12/1/2010 11:10:28 AM: BarsInProgress=0 Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=1.3130 SignalName='' FromEntrySignal=''
    12/1/2010 11:10:28 AM Ignore order amendment: Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=1.3130 SignalName=Sell short' FromEntrySignal='' Reason='Order already has this stop price/limit price/quantity'
    12/1/2010 11:14:05 AM Entered internal PlaceOrder() method at 12/1/2010 11:14:05 AM: BarsInProgress=0 Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=1.3130 SignalName='' FromEntrySignal=''
    12/1/2010 11:14:05 AM Ignore order amendment: Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=1.3130 SignalName=Sell short' FromEntrySignal='' Reason='Order already has this stop price/limit price/quantity'
    12/1/2010 11:17:15 AM Entered internal PlaceOrder() method at 12/1/2010 11:17:15 AM: BarsInProgress=0 Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3180 SignalName='' FromEntrySignal=''
    12/1/2010 11:19:17 AM Entered internal PlaceOrder() method at 12/1/2010 11:19:17 AM: BarsInProgress=0 Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3172 SignalName='' FromEntrySignal=''
    12/1/2010 11:19:17 AM Amended open order: Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3172 SignalName=Buy to cover' FromEntrySignal=''
    12/1/2010 11:24:12 AM Entered internal PlaceOrder() method at 12/1/2010 11:24:12 AM: BarsInProgress=0 Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3172 SignalName='' FromEntrySignal=''
    12/1/2010 11:24:12 AM Ignore order amendment: Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3172 SignalName=Buy to cover' FromEntrySignal='' Reason='Order already has this stop price/limit price/quantity'
    12/1/2010 11:25:50 AM Entered internal PlaceOrder() method at 12/1/2010 11:25:50 AM: BarsInProgress=0 Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3172 SignalName='' FromEntrySignal=''
    12/1/2010 11:25:50 AM Ignore order amendment: Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3172 SignalName=Buy to cover' FromEntrySignal='' Reason='Order already has this stop price/limit price/quantity'
    12/1/2010 11:30:07 AM Entered internal PlaceOrder() method at 12/1/2010 11:30:07 AM: BarsInProgress=0 Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3172 SignalName='' FromEntrySignal=''
    12/1/2010 11:30:07 AM Ignore order amendment: Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3172 SignalName=Buy to cover' FromEntrySignal='' Reason='Order already has this stop price/limit price/quantity'
    12/1/2010 11:30:41 AM Entered internal PlaceOrder() method at 12/1/2010 11:30:41 AM: BarsInProgress=0 Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3172 SignalName='' FromEntrySignal=''
    ...clipped....
    12/1/2010 10:58:38 PM Ignore order amendment: Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3138 SignalName=Buy to cover' FromEntrySignal='' Reason='Order already has this stop price/limit price/quantity'
    12/1/2010 11:54:27 PM Entered internal PlaceOrder() method at 12/1/2010 11:54:27 PM: BarsInProgress=0 Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3138 SignalName='' FromEntrySignal=''
    12/1/2010 11:54:27 PM Ignore order amendment: Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3138 SignalName=Buy to cover' FromEntrySignal='' Reason='Order already has this stop price/limit price/quantity'
    12/1/2010 11:57:22 PM Entered internal PlaceOrder() method at 12/1/2010 11:57:22 PM: BarsInProgress=0 Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3138 SignalName='' FromEntrySignal=''
    12/1/2010 11:57:22 PM Ignore order amendment: Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3138 SignalName=Buy to cover' FromEntrySignal='' Reason='Order already has this stop price/limit price/quantity'
    12/2/2010 12:04:39 AM Entered internal PlaceOrder() method at 12/2/2010 12:04:39 AM: BarsInProgress=0 Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3138 SignalName='' FromEntrySignal=''
    12/2/2010 12:04:39 AM Ignore order amendment: Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3138 SignalName=Buy to cover' FromEntrySignal='' Reason='Order already has this stop price/limit price/quantity'
    12/2/2010 12:31:36 AM Entered internal PlaceOrder() method at 12/2/2010 12:31:36 AM: BarsInProgress=0 Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3138 SignalName='' FromEntrySignal=''
    12/2/2010 12:31:36 AM Ignore order amendment: Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3138 SignalName=Buy to cover' FromEntrySignal='' Reason='Order already has this stop price/limit price/quantity'
    12/2/2010 12:43:17 AM Entered internal PlaceOrder() method at 12/2/2010 12:43:17 AM: BarsInProgress=0 Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3138 SignalName='' FromEntrySignal=''
    12/2/2010 12:43:17 AM Ignore order amendment: Action=BuyToCover OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.3138 SignalName=Buy to cover' FromEntrySignal='' Reason='Order already has this stop price/limit price/quantity'
    12/2/2010 12:43:39 AM Entered internal PlaceOrder() method at 12/2/2010 12:43:39 AM: BarsInProgress=0 Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=1.3095 SignalName='' FromEntrySignal=''
    12/2/2010 12:43:39 AM Ignored PlaceOrder() method at 12/2/2010 12:43:39 AM: Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=1.3095 SignalName='Sell short' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'
    12/2/2010 12:43:39 AM Cancelled expired order: BarsInProgress=0: Order='NT-00027/Sim101' Name='Buy to cover' State=Working Instrument='M6E 12-10' Action=BuyToCover Limit price=0 Stop price=1.3138 Quantity=0 Strategy='FX6short4' Type=Stop Tif=Gtc Oco='' Filled=0 Fill price=0 Token='8e534fc3d25c40918bacf2194c850f00' Gtd='12/1/2099 12:00:00 AM'

    12/2/2010 12:49:09 AM Entered internal PlaceOrder() method at 12/2/2010 12:49:09 AM: BarsInProgress=0 Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=1.3096 SignalName='' FromEntrySignal=''
    12/2/2010 12:49:09 AM Ignored PlaceOrder() method at 12/2/2010 12:49:09 AM: Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=1.3096 SignalName='Sell short' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'
    12/2/2010 1:12:13 AM Entered internal PlaceOrder() method at 12/2/2010 1:12:13 AM: BarsInProgress=0 Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=1.3096 SignalName='' FromEntrySignal=''
    12/2/2010 1:12:13 AM Ignored PlaceOrder() method at 12/2/2010 1:12:13 AM: Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=1.3096 SignalName='Sell short' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'
    12/2/2010 1:14:47 AM Entered internal PlaceOrder() method at 12/2/2010 1:14:47 AM: BarsInProgress=0 Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=1.3102 SignalName='' FromEntrySignal=''
    12/2/2010 1:14:47 AM Ignored PlaceOrder() method at 12/2/2010 1:14:47 AM: Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=1.3102 SignalName='Sell short' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'


    Do I have to disable calculate on bar close?

    My new theory is that NT was improperly programmed to use RANGE charts because of the bar close cancelation property.

    Maybe I am the only person in the world using range charts in NT....

    #2
    Hello RDPoS,

    Range bars and COBC = true are fine to use.

    What issue are you seeing with this exactly? The section you bolded looks OK. An entry order was ignored and then your exit order expired. These orders will expire unless you set the liveUntilCancelled parameter to true.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      I would rather avoid using the override because the last time I did and the order was still not filled (as a stop limit), I had to deactivate the strategy and close the order manually. Then NT kept insisting that I was not flat and every time I clicked close, it exited and reentered a new position costing me commissions. Over and over.

      I had to shut off NT and have the broker close the position because NT was useless to do that.

      Is there a way to have that order stay active for just one more bar or better yet, and additional 30 seconds on a range chart?

      Comment


        #4
        You can do these things but it requires setting liveUntilCancelled to true, and then defining your conditions for cancelling.

        There's an example of cancelling the order two bars after submission here:
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          The market is too illiquid to use limit orders and it appears there is no override available for market stops.

          I need to use market stops on this asset. How can I do that on a range chart to prevent the order from canceling every time?

          Comment


            #6
            You can define your condition as if (Close[0] == Desired stop price) and submit market orders when true.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              I don't want to be forced to take a closing bar price. That is why I did not program my indicator to use close at all. What other options are there?

              Comment


                #8
                There are problems with that strategy when your stop is at 1.31098, the bar of the close will be 1.31099 and the price jumps directly from 1.31097 to 1.3100. The order would still cancel.

                Comment


                  #9
                  Close[0] can be the last traded price when CalculateOnBarClose = false. You can substitute another value like GetCurrentBid() if you want.

                  I's the concepts you should focus on here. Either:
                  • Submit market orders when last trade = desired stop price
                  • Use liveUntilCancelled = true and define your conditions for cancelling order.
                  Ryan M.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by rocketman7, Today, 01:00 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post rocketman7  
                  Started by wzgy0920, 04-20-2024, 06:09 PM
                  2 responses
                  27 views
                  0 likes
                  Last Post wzgy0920  
                  Started by wzgy0920, 02-22-2024, 01:11 AM
                  5 responses
                  32 views
                  0 likes
                  Last Post wzgy0920  
                  Started by wzgy0920, 04-23-2024, 09:53 PM
                  2 responses
                  74 views
                  0 likes
                  Last Post wzgy0920  
                  Started by Kensonprib, 04-28-2021, 10:11 AM
                  5 responses
                  193 views
                  0 likes
                  Last Post Hasadafa  
                  Working...
                  X