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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      647 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      369 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      572 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      573 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X