Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order cancellation – "bar" lifetime limitation

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

    Order cancellation – "bar" lifetime limitation

    Hi to all,
    I’m building automated strategy, and I’d like to limit time when my order is active. Now, by default, is canceled after next bar if it’s not filled.
    My target is to have possibility to have active order next 3 bars.

    Any tip pls ?

    Regards

    RaD

    From LOG:
    >>Entered internal PlaceOrder() method at 3/20/2009 9:13:03 PM: Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=1185.75 SignalName='myShort111' FromEntrySignal=''

    after one bar, if it's not filled:

    >>Cancelled expired order: BarsInProgress=0: Order='1dca52ead0d540019c75f8dc38f7cfa1/Replay101' Name='myShort111' State=Accepted Instrument='NQ 06-09' Action=SellShort Limit price=0 Stop price=1185.75 Quantity=1 Strategy='ForTemp2' Type=Stop Tif=Gtc Oco='' Filled=0 Fill price=0 Token='1dca52ead0d540019c75f8dc38f7cfa1' Gtd='12/1/2099 12:00:00 AM'

    #2
    Hello,

    So you are trying to keep the order working for 3 bars then cancel it?

    Try counting the bars since you placed the order. Maybe start with something like the below code (where i_have_an_order_open is a bool that is set to true when you place the order initially):

    if(FirstTickOfBar && i_have_an_order_open)
    {
    count++;
    }

    if(count < bars_to_cancel && FirstTickOfBar)
    {
    //place order on the new bar here
    }

    Hope that helps.
    DenNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Aviram Y, Today, 05:29 AM
    0 responses
    2 views
    0 likes
    Last Post Aviram Y  
    Started by quantismo, 04-17-2024, 05:13 PM
    3 responses
    25 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by ScottWalsh, 04-16-2024, 04:29 PM
    7 responses
    34 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by cls71, Today, 04:45 AM
    0 responses
    6 views
    0 likes
    Last Post cls71
    by cls71
     
    Started by mjairg, 07-20-2023, 11:57 PM
    3 responses
    216 views
    1 like
    Last Post PaulMohn  
    Working...
    X