Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

LimitOrder to hold more then 1 bar

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

    LimitOrder to hold more then 1 bar

    Hi All,

    I want to submit a limit order and to hold it for 2-3 bars without resubmitting and losing my position on the book, how can it be done?


    Thanks in advance!

    #2
    Hello freewind,

    Thank you for your note.

    You could use a LiveUntilCancelled Order. Please note that this is part of the Advanced Order Handling Concepts and the following Help Guide section should be read.



    The syntax for the EnterLongLimit with the liveUntilCancelled can be seen below:
    EnterLongLimit(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double limitPrice, string signalName)





    Note that you would need to then program a CancelOrder() method.
    CameronNinjaTrader Customer Service

    Comment


      #3
      Originally posted by freewind View Post
      Hi All,

      I want to submit a limit order and to hold it for 2-3 bars without resubmitting and losing my position on the book, how can it be done?


      Thanks in advance!
      Showing for Long entry only:
      Code:
      private int TriggerBar = 0;
      Code:
      if (ConditionsForLongEntry)
      {
      //setup stoploss and targets here first, then 
      TriggerBar = CurrentBar; //record the entry bar
      EnterLongLimit(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double limitPrice, string signalName);
      }
      Code:
      if (Position.MarketPosition == MarketPosition.Long && CurrentBar == TriggerBar + 3)
      {
      //Write code to Cancel the order here, then
      TriggerBar = 0; //reset the trigger
      }

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      651 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      370 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      109 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      574 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      577 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X