Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Send order at specific time

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

    Send order at specific time

    Hello Support,

    I looked through threads and didn't find answer for my question. How to send order at specific time (and cancel order at specific time too if it is not filled)?
    I'm using:
    Code:
    Unmanaged = true;
    CalculateOnBarClose = false; (for my trailing stop)
    And:
    Code:
    protected override void OnBarUpdate()
    {
    ...
        if (((ToTime(Time[0]) >= StartTime) && (ToTime(Time[0]) < EndTime)))
        {
            Print("Send orders");
            SendEntryOrders();
            _bAllowTrading = false;
         }
    ...
    }
    So, as I understand, if there is no any ticks during some period of time, I don't catch onBarUpdate callback and at this case I miss my time to send orders.
    Please advice how to make it better.

    Thank you for detailed answer in advance.

    P.S. Sorry for my English.

    #2
    Hello AlexFdv,

    If there is no data incoming, you could use a TriggerCustomEvent() to help manage your orders by a set time frame instead of having to wait the next tick. For a reference sample please view the following link.
    http://www.ninjatrader.com/support/f...ead.php?t=5965

    Please let me know if I can be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      Great, thanks.
      One more: Is it possible at this case use backtesting? Will it process correctly?

      Thank you.

      Comment


        #4
        Hello AlexFdv,

        Unfortunately, you would not be able to use it in a backtest since it is based on your local PC clock to check the time to trigger the event.
        JCNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        51 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        31 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        165 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        100 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        160 views
        2 likes
        Last Post CaptainJack  
        Working...
        X