• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Mutiple entries not working in strategy develpment

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

  • NinjaTrader_ChelseaB
    replied
    Hello im197,

    Are we still looking for 5/22 at 11:00?

    What was skipped?

    Is this the complete output?

    As a heads up, when orders are ignored for violating the internal order handling rules, only the first order to violate the rules will show a trace orders message.

    In the previous ouput file provided, this was on 2/12 at 17:00.

    2/12/2019 5:00:00 PM Strategy 'ATRTrailStrat/-1': Ignored SubmitOrderManaged() method at 2/12/2019 5:00:00 PM: BarsInProgress=0 Action=SellShort OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3037 SignalName='Short 1' FromEntrySignal='' Reason='An Enter() method to submit an entry order has been ignored. Please search on the term 'Internal Order Handling Rules' in the Help Guide for detailed explanation.'

    Many orders after this also are violating the rules, but these do not show the message as it has already appeared once.

    Leave a comment:


  • im197
    replied
    Hi Chelsea,

    You are right that there was indeed a typo in the in the Target order. Once I fixed the typo the strategy would keep the initial position and would not reverse at all - so I removed all target orders.

    As it stands now the strategy submits 1 order on stop and the 2nd order on confirmation of the 1st order - both on long and on short with no targets.

    I again see skips when testing the strategy.

    Here are the order prints


    9/25/2019 9:00:00 PM Strategy 'ATRTrailStrat/-1': Entered internal SubmitOrderManaged() method at 9/25/2019 9:00:00 PM: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3538 SignalName='Long 1' FromEntrySignal=''
    9/25/2019 9:00:00 PM Strategy 'ATRTrailStrat/-1': Ignored SubmitOrderManaged() method at 9/25/2019 9:00:00 PM: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3538 SignalName='Long 1' FromEntrySignal='' Reason='Order already has this stop price/limit price/quantity'
    9/25/2019 11:00:00 PM Strategy 'ATRTrailStrat/-1': Entered internal SubmitOrderManaged() method at 9/25/2019 11:00:00 PM: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3537 SignalName='Long 1' FromEntrySignal=''
    orderId='NT-00062-10545' account='Backtest' name='Close position' orderState=ChangePending instrument='FESX 12-19' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=3537 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2019-09-23 17:00:00' gtd='2099-12-01' statementDate='2019-10-03'
    orderId='NT-00062-10545' account='Backtest' name='Close position' orderState=ChangeSubmitted instrument='FESX 12-19' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=3537 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2019-09-23 17:00:00' gtd='2099-12-01' statementDate='2019-10-03'
    orderId='NT-00062-10545' account='Backtest' name='Close position' orderState=Accepted instrument='FESX 12-19' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=3537 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2019-09-23 17:00:00' gtd='2099-12-01' statementDate='2019-10-03'
    orderId='NT-00062-10545' account='Backtest' name='Close position' orderState=Working instrument='FESX 12-19' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=3537 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2019-09-23 17:00:00' gtd='2099-12-01' statementDate='2019-10-03'
    orderId='NT-00063-10545' account='Backtest' name='Long 1' orderState=ChangePending instrument='FESX 12-19' orderAction=Buy orderType='Stop Market' limitPrice=0 stopPrice=3537 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2019-09-23 17:00:00' gtd='2099-12-01' statementDate='2019-10-03'
    orderId='NT-00063-10545' account='Backtest' name='Long 1' orderState=ChangeSubmitted instrument='FESX 12-19' orderAction=Buy orderType='Stop Market' limitPrice=0 stopPrice=3537 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2019-09-23 17:00:00' gtd='2099-12-01' statementDate='2019-10-03'
    orderId='NT-00063-10545' account='Backtest' name='Long 1' orderState=Accepted instrument='FESX 12-19' orderAction=Buy orderType='Stop Market' limitPrice=0 stopPrice=3537 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2019-09-23 17:00:00' gtd='2099-12-01' statementDate='2019-10-03'
    orderId='NT-00063-10545' account='Backtest' name='Long 1' orderState=Working instrument='FESX 12-19' orderAction=Buy orderType='Stop Market' limitPrice=0 stopPrice=3537 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2019-09-23 17:00:00' gtd='2099-12-01' statementDate='2019-10-03'
    9/25/2019 11:00:00 PM Strategy 'ATRTrailStrat/-1': Amended open order at 9/25/2019 11:00:00 PM: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3537 SignalName='Long 1' FromEntrySignal=''
    9/26/2019 1:00:00 PM Strategy 'ATRTrailStrat/-1': Entered internal SubmitOrderManaged() method at 9/26/2019 1:00:00 PM: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3537 SignalName='Long 1' FromEntrySignal=''
    9/26/2019 1:00:00 PM Strategy 'ATRTrailStrat/-1': Ignored SubmitOrderManaged() method at 9/26/2019 1:00:00 PM: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3537 SignalName='Long 1' FromEntrySignal='' Reason='Order already has this stop price/limit price/quantity'
    9/26/2019 5:00:00 PM Strategy 'ATRTrailStrat/-1': Entered internal SubmitOrderManaged() method at 9/26/2019 5:00:00 PM: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3537 SignalName='Long 1' FromEntrySignal=''
    9/26/2019 5:00:00 PM Strategy 'ATRTrailStrat/-1': Ignored SubmitOrderManaged() method at 9/26/2019 5:00:00 PM: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3537 SignalName='Long 1' FromEntrySignal='' Reason='Order already has this stop price/limit price/quantity'
    9/26/2019 9:00:00 PM Strategy 'ATRTrailStrat/-1': Entered internal SubmitOrderManaged() method at 9/26/2019 9:00:00 PM: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3537 SignalName='Long 1' FromEntrySignal=''
    9/26/2019 9:00:00 PM Strategy 'ATRTrailStrat/-1': Ignored SubmitOrderManaged() method at 9/26/2019 9:00:00 PM: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3537 SignalName='Long 1' FromEntrySignal='' Reason='Order already has this stop price/limit price/quantity'
    9/26/2019 11:00:00 PM Strategy 'ATRTrailStrat/-1': Cancelled expired order: BarsInProgress=0, orderId='NT-00062-10545' account='Backtest' name='Close position' orderState=Working instrument='FESX 12-19' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=3537 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2019-09-23 17:00:00' gtd='2099-12-01' statementDate='2019-10-03'
    orderId='NT-00062-10545' account='Backtest' name='Close position' orderState=CancelPending instrument='FESX 12-19' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=3537 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2019-09-23 17:00:00' gtd='2099-12-01' statementDate='2019-10-03'
    orderId='NT-00062-10545' account='Backtest' name='Close position' orderState=CancelSubmitted instrument='FESX 12-19' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=3537 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2019-09-23 17:00:00' gtd='2099-12-01' statementDate='2019-10-03'
    orderId='NT-00062-10545' account='Backtest' name='Close position' orderState=Cancelled instrument='FESX 12-19' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=3537 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2019-09-23 17:00:00' gtd='2099-12-01' statementDate='2019-10-03'
    9/26/2019 11:00:00 PM Strategy 'ATRTrailStrat/-1': Cancelled expired order: BarsInProgress=0, orderId='NT-00063-10545' account='Backtest' name='Long 1' orderState=Working instrument='FESX 12-19' orderAction=Buy orderType='Stop Market' limitPrice=0 stopPrice=3537 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2019-09-23 17:00:00' gtd='2099-12-01' statementDate='2019-10-03'
    orderId='NT-00063-10545' account='Backtest' name='Long 1' orderState=CancelPending instrument='FESX 12-19' orderAction=Buy orderType='Stop Market' limitPrice=0 stopPrice=3537 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2019-09-23 17:00:00' gtd='2099-12-01' statementDate='2019-10-03'
    orderId='NT-00063-10545' account='Backtest' name='Long 1' orderState=CancelSubmitted instrument='FESX 12-19' orderAction=Buy orderType='Stop Market' limitPrice=0 stopPrice=3537 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2019-09-23 17:00:00' gtd='2099-12-01' statementDate='2019-10-03'
    orderId='NT-00063-10545' account='Backtest' name='Long 1' orderState=Cancelled instrument='FESX 12-19' orderAction=Buy orderType='Stop Market' limitPrice=0 stopPrice=3537 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2019-09-23 17:00:00' gtd='2099-12-01' statementDate='2019-10-03'
    orderId='NT-00064-10545' account='Backtest' name='Exit on session close' orderState=Submitted instrument='FESX 12-19' orderAction=BuyToCover orderType='Market' limitPrice=0 stopPrice=0 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2019-10-01 23:00:00' gtd='2099-12-01' statementDate='2019-10-03'
    orderId='NT-00064-10545' account='Backtest' name='Exit on session close' orderState=Accepted instrument='FESX 12-19' orderAction=BuyToCover orderType='Market' limitPrice=0 stopPrice=0 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2019-10-01 23:00:00' gtd='2099-12-01' statementDate='2019-10-03'
    orderId='NT-00064-10545' account='Backtest' name='Exit on session close' orderState=Working instrument='FESX 12-19' orderAction=BuyToCover orderType='Market' limitPrice=0 stopPrice=0 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2019-10-01 23:00:00' gtd='2099-12-01' statementDate='2019-10-03'
    orderId='NT-00064-10545' account='Backtest' name='Exit on session close' orderState=Filled instrument='FESX 12-19' orderAction=BuyToCover orderType='Market' limitPrice=0 stopPrice=0 quantity=2 tif=Gtc oco='' filled=2 averageFillPrice=3500 onBehalfOf='' id=-1 time='2019-10-01 23:00:00' gtd='2099-12-01' statementDate='2019-10-03'

    Attached Files

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello im197,

    It looks like the position might be long and there is a working order named 'MyTarget' and this order would be taking the position short (into the opposite direction).

    orderId='NT-00026-6647' account='Backtest' name='MyTarget' orderState=Working instrument='FESX 12-19' orderAction=Sell orderType='Limit' limitPrice=3439 stopPrice=0 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2019-05-16 13:00:00' gtd='2099-12-01' statementDate='2019-10-02'

    If that is the case, this would violate the internal order handling rules for managed strategies.
    "Methods that generate orders to enter a position will be ignored if
    A position is open and an order submitted by a non market order exit method (ExitLongLimit() for example) is active and the order is used to open a position in the opposite direction"
    https://ninjatrader.com/support/help...antedPositions

    What is the position when this occurs?
    Is the position long?

    Leave a comment:


  • im197
    replied
    Hello,

    this is the print without any conditions

    5/22/2019 5:00:00 PM Strategy 'ATRTrailStrat/-1': Entered internal SubmitOrderManaged() method at 5/22/2019 5:00:00 PM: BarsInProgress=0 Action=SellShort OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3325 SignalName='Short 1' FromEntrySignal=''
    5/22/2019 9:00:00 PM Strategy 'ATRTrailStrat/-1': Entered internal SubmitOrderManaged() method at 5/22/2019 9:00:00 PM: BarsInProgress=0 Action=SellShort OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3325 SignalName='Short 1' FromEntrySignal=''
    5/22/2019 11:00:00 PM Strategy 'ATRTrailStrat/-1': Entered internal SubmitOrderManaged() method at 5/22/2019 11:00:00 PM: BarsInProgress=0 Action=SellShort OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3325 SignalName='Short 1' FromEntrySignal=''
    5/23/2019 1:00:00 PM Strategy 'ATRTrailStrat/-1': Entered internal SubmitOrderManaged() method at 5/23/2019 1:00:00 PM: BarsInProgress=0 Action=SellShort OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3325 SignalName='Short 1' FromEntrySignal=''
    5/23/2019 1:00:00 PM Strategy 'ATRTrailStrat/-1': Ignored SubmitOrderManaged() method at 5/23/2019 1:00:00 PM: BarsInProgress=0 Action=SellShort OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3325 SignalName='Short 1' FromEntrySignal='' Reason='Invalid order price, please see log tab'
    6/4/2019 9:00:00 PM Strategy 'ATRTrailStrat/-1': Entered internal SubmitOrderManaged() method at 6/4/2019 9:00:00 PM: BarsInProgress=0 Action=SellShort OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3242 SignalName='Short 1' FromEntrySignal='

    I attach the save from the output
    Attached Files

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello im197,

    Print the order object from OnOrderUpdate() outside of any conditions.

    Leave a comment:


  • im197
    replied
    I used OnOrderUpdate. Please see my previous post

    Leave a comment:


  • im197
    replied
    I attach my code with the latest additions
    Attached Files

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello im197,

    There is no order object in OnBarUpdate().

    Print the order object in OnOrderUpdate().
    https://ninjatrader.com/support/help...rderupdate.htm

    To answer your question, a stop will not be executed if the order is cancelled or if the price does touch the order.

    Leave a comment:


  • im197
    replied
    Hello again,

    I used OnOrderUpdate and this is what I get

    5/22/2019 9:00:00 PM Strategy 'ATRTrailStrat/-1': Entered internal SubmitOrderManaged() method at 5/22/2019 9:00:00 PM: BarsInProgress=0 Action=SellShort OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3325 SignalName='Short 1' FromEntrySignal=''
    Market going up, trail stop @ 3325
    5/22/2019 11:00:00 PM Strategy 'ATRTrailStrat/-1': Entered internal SubmitOrderManaged() method at 5/22/2019 11:00:00 PM: BarsInProgress=0 Action=SellShort OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3325 SignalName='Short 1' FromEntrySignal=''
    Market going up, trail stop @ 3325
    5/23/2019 1:00:00 PM Strategy 'ATRTrailStrat/-1': Entered internal SubmitOrderManaged() method at 5/23/2019 1:00:00 PM: BarsInProgress=0 Action=SellShort OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3325 SignalName='Short 1' FromEntrySignal=''
    5/23/2019 1:00:00 PM Strategy 'ATRTrailStrat/-1': Ignored SubmitOrderManaged() method at 5/23/2019 1:00:00 PM: BarsInProgress=0 Action=SellShort OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3325 SignalName='Short 1' FromEntrySignal='' Reason='Invalid order price, please see log tab'
    Market going up, trail stop @ 3325
    6/4/2019 9:00:00 PM Strategy 'ATRTrailStrat/-1': Entered internal SubmitOrderManaged() method at 6/4/2019 9:00:00 PM: BarsInProgress=0 Action=SellShort OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3242 SignalName='Short 1' FromEntrySignal=''
    Market going up, trail stop @ 3242

    After 5/23, the next order is 6/4 !!!

    Leave a comment:


  • im197
    replied
    I cannot print the orders in OnBarUpdate - because when one is rejected I get

    Strategy 'ATRTrailStrat/-1': An Enter() method to submit an entry order at '2/12/2019 5:00:00 PM' has been ignored. Please search on the term 'Internal Order Handling Rules' in the Help Guide for detailed explanation.
    Market going up, trail stop @ 3037
    Strategy 'ATRTrailStrat': Error on calling 'OnBarUpdate' method on bar 117: Object reference not set to an instance of an object.

    So the analyzer stops.

    If I print only when order != null I get the msg working

    2/11/2019 11:00:00 PM Strategy 'ATRTrailStrat/-1': Entered internal SubmitOrderManaged() method at 2/11/2019 11:00:00 PM: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3100 SignalName='Long 1' FromEntrySignal=''
    2/11/2019 11:00:00 PM Strategy 'ATRTrailStrat/-1': Amended open order at 2/11/2019 11:00:00 PM: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3100 SignalName='Long 1' FromEntrySignal=''
    Market going down, trail stop @ 3100
    Long Stop Order is: Working

    The problem is why is the stop order not obeyed at all times?

    Please have a look at my code and tell me if you see something that is wrong and that I need to alter.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello im197,

    Print the order object in OnOrderUpdate().
    https://ninjatrader.com/support/help...rderupdate.htm

    This would let us see what happens to this order.

    Below is a link to a forum post that demonstrates how to use prints to understand behavior.
    https://ninjatrader.com/support/foru...121#post791121

    What is the bar after 5/22 at 11:00?

    What is the high and low of that bar?

    Leave a comment:


  • im197
    replied
    Hello again,

    The bar on 5/22/2019 @ 23:00 has high 3366 and low 3359 the position is 1+1 long and the order is to sell short 1 lot on stop @ 3325

    The bar om 5/23/2019 @ 11:00 has high 3348 and low 3306. For some reason the position is kept as is. Of course the order to sell on stop @ 3325 after this bar is rejected as the close of the bar is 3312.

    I attach the save of the output window and a photo of the skip
    Attached Files
    Last edited by im197; 10-02-2019, 10:58 AM.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello im197,

    What is the high and low of the 11:01 PM bar (or whatever the next bar is)?

    What happens to the order in the prints to the output window of the order object or on the Orders display in the Strategy Analyzer?

    To save the output from the output window, right-click the output window -> select Save As.

    Leave a comment:


  • im197
    replied
    Hi Chelsea,

    the order @ 13:00 on 5/23/2019 was rejected because the price is no longer applicable.

    The candle that ends at 13:00 closed lower than the stop price that was submitted @ 23:00 the previous night.

    The order was a sell short on stop @ 3325 and was not executed.

    5/22/2019 11:00:00 PM Strategy 'ATRTrailStrat/-1': Entered internal SubmitOrderManaged() method at 5/22/2019 11:00:00 PM: BarsInProgress=0 Action=SellShort OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3325 SignalName='Short 1' FromEntrySignal=''
    Market going up, trail stop @ 3325

    I am asking why it was not executed.



    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello im197,

    So.. Is the order submitted at 11:00 or 13:00?

    Are you asking about the ignored message?

    5/23/2019 1:00:00 PM Strategy 'ATRTrailStrat/-1': Ignored SubmitOrderManaged() method at 5/23/2019 1:00:00 PM: BarsInProgress=0 Action=SellShort OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=3325 SignalName='Short 1' FromEntrySignal='' Reason='Invalid order price, please see log tab'

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by RB104, Today, 06:06 PM
1 response
8 views
0 likes
Last Post NinjaTrader_ShawnB  
Started by jtrading82, 05-25-2018, 09:59 AM
9 responses
977 views
0 likes
Last Post NinjaTrader_ShawnB  
Started by syxforex, Today, 12:11 AM
2 responses
15 views
0 likes
Last Post syxforex  
Started by aslane, Today, 02:31 PM
1 response
10 views
0 likes
Last Post NinjaTrader_Kate  
Started by stoner, 10-16-2019, 01:38 PM
5 responses
51 views
0 likes
Last Post sledge
by sledge
 
Working...
X