I am planning to use Position.AveragePrice for create a stoploss below the price when going long.
However, the price wasn't update until the next 2 loops of OnBarUpdate.
Is this a normal situation ? Is there any alternative function ?
Please see the code example below
protected override void OnBarUpdate()
{
// Order entry
if(Low[0] > FastEMAT && Low[0] > FastEMAB && Position.MarketPosition == MarketPosition.Flat )
{
EnterLong(Convert.ToInt32(DefaultQuantity),"");
Print("EnterLong");
Print(Position.AveragePrice);
}
The code output will be as below.
EnterLong
0
Thank you for your help!

Comment