For example, if I open an order with an ATM template with 1 contract, I know that the stoploss order name is "STOP1". However, if I have a template with more than 1 contract, I don't know how to tell which contract or stoploss order name to change the stop target. Here is the code I am running to attempt to reset the stoploss:
// Adjust initial stoploss price if this is the first OnBarUpdate() call since the order was filled
if (ATMStrategyID != string.Empty && GetAtmStrategyMarketPosition(ATMStrategyID) != MarketPosition.Flat)
{
for (int i = 1 ; i <= GetAtmStrategyPositionQuantity(ATMStrategyID) ; i++)
{
AtmStrategyChangeStopTarget(0, StopPrice, "STOP" + i.ToString(), ATMStrategyID);
}
}
**NT** AtmStrategyChangeStopTarget() method error: OrderName 'STOP2' is invalid
**NT** AtmStrategyChangeStopTarget() method error: OrderName 'STOP3' is invalid
How can I tell how many contracts an ATM template has and how to reset the stops when the order fills?
Thanks!
Bryan

Comment