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:	255
Size:	42.6 KB
ID:	1148093Click image for larger version

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

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

Name:	Screenshot_4.jpg
Views:	216
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 NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        54 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        131 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        73 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        44 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        49 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X