I am trying to close all the trades if the unrealized loss is greater than, say $1000. I am able to do this but not in realtime. The code works only on the BAR CLOSE. See below:
--------------------------
if (Position.MarketPosition != MarketPosition.Flat)
{
double unrealizedProfit = Position.GetUnrealizedProfitLoss(PerformanceUnit.C urrency, Close[0]);
if (unrealizedProfit > ProfitThreshold)
ExitLong();
}
----------------------------
Thanks for the help!

Comment