Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strat Help

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

    Strat Help

    Hi
    I was wondering why when I use the below strategy if the Stop Order doesn't get filled on the One Minute Bar when it goes to the next bar it doesn't put a new Stop Order at the new parameters it waits until the next bar after that basically skipping a bar. It does erase the previous Stop order which is something I do want to have happen but I don't want to skip a bar before placing another new Stop Order. Thanks for any help.

    protected override void OnBarUpdate()
    {
    // Condition set 1
    if (Open[0] < Close[0])
    {
    EnterLongStop(DefaultQuantity, Close[0] + 1 * TickSize, "Long");
    }

    // Condition set 2
    if (Open[0] > Close[0])
    {
    EnterShortStop(DefaultQuantity, Close[0] - 1 * TickSize, "Short");
    }
    }

    #2
    Hello cre8it8,


    Some notes on this scenario:
    • The order is canceled if not filled on the bar it was submitted on, unless you use the advanced overload for the EnterShortStop() method that supports the liveUntilCanceled property. This overload can be found in all the Enter and Exit methods.
    • If the order is canceled, conditions are evaluated again and submitted on the next bar if you're running with CalculateOnBarClose = true. It sounds like this is what you're seeing.
    Example liveUntilCanceled order:
    EnterShortStop(0, true,DefaultQuantity, Close[0] - 1 * TickSize, "Short");


    If you use this overload to submit your orders, then you have to manually cancel. This reference sample can help with canceling orders and setting up the needed IOrder objects.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the data. I changed it to Calculate On Bar Close False and that helped the skipping a bar problem. I wanted the orders to be deleted on each new bar when it was not filled so that was not a problem.

      Thanks for the help.

      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