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 SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        50 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        22 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        16 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        22 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        23 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X