Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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

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

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

Name:	Screenshot_4.jpg
Views:	160
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.
    Kate W.NinjaTrader Customer Service

    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.
        Kate W.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by rhyminkevin, Today, 04:58 PM
        2 responses
        45 views
        0 likes
        Last Post loosek
        by loosek
         
        Started by iceman2018, Today, 05:07 PM
        0 responses
        5 views
        0 likes
        Last Post iceman2018  
        Started by lightsun47, Today, 03:51 PM
        0 responses
        7 views
        0 likes
        Last Post lightsun47  
        Started by 00nevest, Today, 02:27 PM
        1 response
        14 views
        0 likes
        Last Post 00nevest  
        Started by futtrader, 04-21-2024, 01:50 AM
        4 responses
        49 views
        0 likes
        Last Post futtrader  
        Working...
        X