How do I determine if it is profit Target or the Stop loss order that is causing it?
I have already set RealtimeErrorHandling = RealtimeErrorHandling.IgnoreAllErrors
and I am double checking my entry order modification like so below
private bool IsSameOrderPrice(Order entryOrder, double newPrice)
{
// Check if the order is not null and is in a working state
if (entryOrder == null || entryOrder.OrderState != OrderState.Working)
{
return false; // No valid order exists
}
// Compare the current limit price with the desired new price
return entryOrder.LimitPrice == newPrice;
}
_entryLimitOrder = EnterLongLimit(PosSize, entryPrice, EntryLimitLongName);
SetProfitTarget(EntryLimitLongName, CalculationMode.Price,targetPrice);
SetStopLoss(EntryLimitLongName, CalculationMode.Price,stopPrice,true);

Comment