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:	160
Size:	31.8 KB
ID:	1148095Click image for larger version

Name:	Screenshot_3.jpg
Views:	175
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 f.saeidi, Today, 08:01 PM
        0 responses
        1 view
        0 likes
        Last Post f.saeidi  
        Started by Rapine Heihei, Today, 07:51 PM
        0 responses
        3 views
        0 likes
        Last Post Rapine Heihei  
        Started by frslvr, 04-11-2024, 07:26 AM
        5 responses
        96 views
        1 like
        Last Post caryc123  
        Started by algospoke, 04-17-2024, 06:40 PM
        6 responses
        49 views
        0 likes
        Last Post algospoke  
        Started by arvidvanstaey, Today, 02:19 PM
        4 responses
        11 views
        0 likes
        Last Post arvidvanstaey  
        Working...
        X