• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Average Fill Price in Simulation mode outside Bars High/Low spread

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

    Average Fill Price in Simulation mode outside Bars High/Low spread

    Hello all,

    I have the following order activity (my own trace using OnOrderUpdate):

    2019-08-08 23:50:22::NEW LONG ORDER oName=DD-L1588 2019-08-08 01:25:00 Price=1.12675
    2019-08-08 23:50:22::New order DD-L1588 2019-08-08 01:25:00, action=Buy, state=Submitted quantity=1 action=Buy type=Market time:8/8/2019 1:25:00 AM
    ...
    2019-08-08 23:50:22::Update order DD-L1588 2019-08-08 01:25:00, action=Buy, state=Filled qty=1 limP=0.00000 stopP=0.00000 filled=1 avgFillP=1.12680 time=8/8/2019 1:25:00 AM
    2019-08-08 23:50:22:: EXIT LONG: avgPositionPrice=1.12680 incomingPrice=1.12600
    2019-08-08 23:50:22::Update order Sell, action=Sell, state=Submitted qty=0 limP=0.00000 stopP=0.00000 filled=0 avgFillP=0.00000 time=8/8/2019 1:35:00 AM
    ...
    2019-08-08 23:50:22::Update order Sell, action=Sell, state=Filled qty=1 limP=0.00000 stopP=0.00000 filled=1 avgFillP=1.12600 time=8/8/2019 1:35:00 AM

    The "incomingPrice" shown is the Inputs[0][0] in the following code:
    OnBarUpdate()
    {
    if (Position.MarketPosition == MarketPosition.Long && Inputs[0][0] < (Position.AveragePrice-10*TickSize)) {
    ExitLong();
    }
    }

    The issue I have is that this "incomingPrice" is not in the range (<High or >Low) of the CurrentBar nor of the next Bar. Strategy is being executed with Calculate.OnBarClose but this can also be seen if OnEachTick is used.

    If we are in OnBarClose mode, and DataSeries is set to "Last" then Inputs[0][0] in OnBarUpdate() should be a price that is in the range Low[0] to High[0], however the chart is showing a Low of 1.12615 and a High of 1.12695 so in this case (and others) its below the Low[0] price.
    Furthermore, this price is also outside the high/low of the next bar: 1.12625 to 1.12680.

    To my understanding, some incoming prices are being ignored in the bar formation, could this be possible?

    #2
    Please ignore this. My mistake, several bars had gone by.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by guvenators, Today, 05:18 PM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_ShawnB  
    Started by LANwarr1or, Today, 03:00 PM
    2 responses
    8 views
    0 likes
    Last Post LANwarr1or  
    Started by Newtrader101, Today, 02:53 PM
    2 responses
    10 views
    0 likes
    Last Post Newtrader101  
    Started by JuanPabloQuevedo, Today, 02:53 PM
    2 responses
    9 views
    0 likes
    Last Post JuanPabloQuevedo  
    Started by samir, Today, 03:16 PM
    2 responses
    14 views
    0 likes
    Last Post samir
    by samir
     
    Working...
    X