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 charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      65 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