Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Delay entry execution following a signal

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

    Delay entry execution following a signal

    My love and appreciations to the NT development team - it a great application.

    I wonder how to program a delay entry execution following a signal.
    Say in the following examples:

    a) The buy signal is generated in bar[0], but I wish to delay the actual buy order after the next x bars.
    b) The buy signal is generated in bar[0], and I wish to limit the actual buy order to a certain price (say High[0] + x.

    Many thanks.

    bkool

    #2
    Hi bkool,

    1. You could use a variable and CurrentBar to record the bar number that the condition is met. Then wait until the CurrentBar reaches the variable plus x.

    More info at - http://www.ninjatrader.com/support/h...tml?CurrentBar

    2. You can use a Stop order for this....
    EnterLongStop() - http://www.ninjatrader.com/support/helpGuides/HelpGuideV6/helpguide.html?EnterLongStop

    EnterLongStopLimit() - http://www.ninjatrader.com/support/h...erLongStopLimt
    TimNinjaTrader Customer Service

    Comment


      #3
      Thanks Tim,

      This was helpful.

      I saw a nice exmple in the NT7 guide explaining about CancelOrder(IOrder order) :

      Examples
      private IOrder myEntryOrder = null;
      private int barNumberOfOrder = 0;

      protected override void OnBarUpdate()
      {
      // Submit an entry order at the low of a bar
      if (myEntryOrder == null)
      {
      myEntryOrder = EnterLongLimit(0, true, 1, Low[0], "Long Entry");
      barNumberOfOrder = CurrentBar;
      }

      // If more than 5 bars has elapsed, cancel the entry order
      if (CurrentBar > barNumberOfOrder + 5)
      CancelOrder(myEntryOrder);
      }




      best,

      bkool.
      Last edited by bkool; 05-23-2010, 11:45 AM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      64 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      35 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      59 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      62 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      51 views
      0 likes
      Last Post CarlTrading  
      Working...
      X