Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Market price not matching close[0]

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

    Market price not matching close[0]

    My strategy moves ExitShortStopMarket (or Long depending on the trade) to new price once a PnL is achieved. Running on Playback, I occasionally receive the error: "Plauback101: Buy stop or buy stop limit orders can't be placed below the market." I expect the error is related to a gap in market price. I put a check in the code to return from OnBarUpdate (Calculate.OnPriceChange) if the price jumps by more than one tick. I still receive the error even though the chart shows that Close[0] is at right price compared to the buy or sell stop limit. I attached a screen capture from the chart window to explain more. Is there a way around this problem?
    Attached Files
    Last edited by hgheith; 05-14-2017, 02:08 PM. Reason: Upload attachement

    #2
    Hello hgheith,

    I would recommend adding a check that the price you are about to change the order to is below the ask (for a buy order).

    if (myNewPrice < GetCurrentAsk())
    {
    myStop = ExitShortStopMarket(myNewPrice);
    }
    else
    {
    myStop = ExitShortStopMarket(GetCurrentAsk());
    }

    In a fast moving market, it is possible for the price to change before the order can be submitted. Placing further below the ask would help for the change order to be accepted.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    571 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    330 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    548 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    549 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X