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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        61 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        149 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        99 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        286 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X