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 sjsj2732, Yesterday, 04:31 AM
        0 responses
        33 views
        0 likes
        Last Post sjsj2732  
        Started by NullPointStrategies, 03-13-2026, 05:17 AM
        0 responses
        286 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        285 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        133 views
        1 like
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        91 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Working...
        X