Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

An order has been ignored since the stop price ‘13080.75’ near the bar stamped

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

    An order has been ignored since the stop price ‘13080.75’ near the bar stamped

    hi, i have a problem with the logic of historical orderfill process maybe someone can help me with a concrete example? after hours of research on this topic i can't come up with a solution
    Here is a concrete example (Calculate = Calculate.OnBarClose):
    a second data series added for orderfill: AddDataSeries(BarsPeriodType.Tick, 1);

    Code:
    stopPrice = RoundToTickSize(stopPrice > Bars.GetOpen(CurrentBar + 1) ? stopPrice : Bars.GetOpen(CurrentBar + 1) + TickSizeValue);
    
    SubmitOrderUnmanaged(1, OrderAction.BuyToCover, OrderType.StopMarket, bracket1Qty, stopPrice, stopPrice, oco1, signalName1);
    entry short @ 12777.50 stop filled @ 12782.75 (1. trade is done) all good
    2. entry short @ 12782.75 stop @ 12782.75 ???

    the stop is at the same price as the askprice which logically becomes a problem. my question now is how can i adjust the stop price for the historical part of the strategy so that if it is equal to or higher than the askprice it is automatically set to askprice + 1 tick?
    I am only concerned with the State.Historical mode, the State.Realtime is clear to me.

    Click image for larger version

Name:	Screenshot_1.jpg
Views:	261
Size:	42.6 KB
ID:	1148093Click image for larger version

Name:	Screenshot_2.jpg
Views:	219
Size:	31.8 KB
ID:	1148095Click image for larger version

Name:	Screenshot_3.jpg
Views:	236
Size:	25.9 KB
ID:	1148094
    Click image for larger version

Name:	Screenshot_4.jpg
Views:	221
Size:	108.7 KB
ID:	1148096
    sidlercom80
    NinjaTrader Ecosystem Vendor - Sidi Trading

    #2
    Hello sidlercom80,

    Thank you for your post.

    You'd need to use Tick Replay to get historical bid and ask prices. GetCurrentAsk() and GetCurrentBid() return the close price on historical data, so you can't just use those. There's an example of how to get historical bid/ask prices using Tick Replay here:



    Please let us know if we may be of further assistance to you.

    Comment


      #3
      Hi _Kate, is there also a solution without TickReplay? and what would it look like?
      sidlercom80
      NinjaTrader Ecosystem Vendor - Sidi Trading

      Comment


        #4
        Hello sidlercom80,

        Thank you for your reply.

        You could try adding single tick ask/bid series to your strategy and referencing that for the historical ask price and then add a tick to that. This won't necessarily be as accurate as using tick replay, but would work for historical calculations:



        Please let us know if we may be of further assistance to you.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        43 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        20 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        30 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        48 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        38 views
        0 likes
        Last Post CarlTrading  
        Working...
        X