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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    98 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    143 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    69 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    125 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    77 views
    0 likes
    Last Post PaulMohn  
    Working...
    X