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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      84 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      46 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      66 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      69 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      58 views
      0 likes
      Last Post CarlTrading  
      Working...
      X