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 tkaboris, Today, 05:13 PM
    0 responses
    2 views
    0 likes
    Last Post tkaboris  
    Started by GussJ, 03-04-2020, 03:11 PM
    16 responses
    3,281 views
    0 likes
    Last Post Leafcutter  
    Started by WHICKED, Today, 12:45 PM
    2 responses
    19 views
    0 likes
    Last Post WHICKED
    by WHICKED
     
    Started by Tim-c, Today, 02:10 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by Taddypole, Today, 02:47 PM
    0 responses
    5 views
    0 likes
    Last Post Taddypole  
    Working...
    X