Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit position the same Bar at the close

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

    Exit position the same Bar at the close

    I would like some help to write these rules.
    Rule 1
    If high of the last 3 days = the of the last month and close < open
    Go Short at the open the next day
    I want to close the position at the close the same bar

    My attempt is working for the entry but I do not know how to write the exit the same bar at the close

    if (MAX(High, 3)[0] == MAX(High, 20)[0] && Close[0] < Open[0]


    )
    {
    EnterShort(200, "");
    }

    Thanks.

    #2
    rnr123, are you working on daily bars for this strategy? Then you could for example add a intraday series to the setup and work with the ExitOnClose option for this - http://www.ninjatrader-support.com/H...itOnClose.html

    You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by

    Comment


      #3
      next bar open

      Hi,
      how can I get the open value of the bar where I want to enter?
      I need to add condition if there is a gap down between close[0] and (actual) open, then enter the trade.

      if (Low[2] > Close[1]
      && Low[
      1] > Close[0]
      && Close[0] > Open????
      {
      EnterLongStop(DefaultQuantity, High[
      0], "");
      }
      many thanks
      Jiri

      Comment


        #4
        Jiri, unfortunately you can't access the next bars open on the current bar. You could reference the current bars open and if your gap down condition is present, place the order for the next bar. If you want to submit the order to a finer stream to simulate an intrabar fill, please check into this sample -

        You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by

        Comment


          #5
          Originally posted by smkal View Post
          Hi,
          how can I get the open value of the bar where I want to enter?
          I need to add condition if there is a gap down between close[0] and (actual) open, then enter the trade.

          if (Low[2] > Close[1]
          && Low[
          1] > Close[0]
          && Close[0] > Open????
          {
          EnterLongStop(DefaultQuantity, High[
          0], "");
          }
          many thanks
          Jiri
          Jiri,

          If you reference any indicators in your strategy buy/ sell orders this will not work.

          If you reference only bars, this should work.

          if (Low[3] > Close[2]
          && Low[
          2] > Close[1]
          && Close[1] > Open[0]
          {
          EnterLongStop(DefaultQuantity, Open[
          0], "");

          If the price jumps away, your screwed either way. No trade or bad fill.


          Unless you set it up a little differently.

          EnterLongStop(DefaultQuantity, Close[0], "");

          This should fill immediately.

          RJay
          RJay
          NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          648 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