I have created an ATM strategy which works great on the NQ 09-24 chart but when I enable this strategy on ES, or CL or GC (for example), it works correctly for the custom ATM but it does not show the order brackets for the ATM on the chart, when the order is live/placed. Again this works fine on the NQ 09-24, it just does not show on other instruments which is confusing? I have been working on this code for many months and have manually drawn rectangles to make up for the lack of ATM brackets but this makes keeping track of or cancelling or modifying the order too complex (for a chart trader). I also have to duplicate the profit and stop loss values as manual input along with a custom ATM name since those values cannot be retrieved in the program. As I go deeper down the rabbit hole I realize I am reprogramming something that should work in the base script (ATM order brackets on chart). Can you please help me to get the ATM order & brackets to show on the chart for all instruments?
I know the orders placed on ATM strategy won't show historically on the chart...but the ATM brackets should show each time an ATM order is placed. Is this another known issue? Is there any solution?
Thanks,
H
Here are the relevant routines for the ATM, let me know what else you might need:
private void StartAtmStrategy(OrderAction orderAction)
{
if (!isAtmStrategyCreated)
{
atmStrategyId = GetAtmStrategyUniqueId();
atmStrategyOrderId = GetAtmStrategyUniqueId();
atmStartTime = Times[0][0];
PrintWithTimestamp("Attempting to start ATM Strategy: atmStrategyId = " + atmStrategyId + ", atmStrategyOrderId = " + atmStrategyOrderId + ", OrderAction = " + orderAction);
AtmStrategyCreate(orderAction, OrderType.Market, 0, 0, TimeInForce.Day,
atmStrategyOrderId, AtmStrategyName, atmStrategyId,
(atmCallbackErrorCode, atmCallBackId) =>
{
if (atmCallbackErrorCode != ErrorCode.NoError)
{
PrintWithTimestamp("Error starting ATM Strategy: " + atmCallbackErrorCode);
isAtmStrategyCreated = false;
}
else
{
PrintWithTimestamp("ATM Strategy started for " + orderAction + " entry with ID: " + atmStrategyId);
isAtmStrategyCreated = true;
lastRealizedProfit = GetAtmStrategyRealizedProfitLoss(atmStrategyId);
}
});
Thread.Sleep(100);
}
}
private void CancelAtmStrategy()
{
if (isAtmStrategyCreated)
{
PrintWithTimestamp("Cancelling ATM Strategy: " + atmStrategyId);
try
{
double realizedProfit = GetAtmStrategyRealizedProfitLoss(atmStrategyId);
if (lastRealizedProfit != realizedProfit)
{
sessionRealizedProfit += realizedProfit - lastRealizedProfit;
lastRealizedProfit = realizedProfit;
}
sessionProfit = sessionRealizedProfit;
PrintWithTimestamp("Updating session profit on ATM cancel: sessionProfit = " + sessionProfit);
if (State == State.Realtime)
{
AtmStrategyClose(atmStrategyId);
}
else
{
PrintWithTimestamp("Cannot close ATM strategy in non-realtime state");
}
}
catch (Exception e)
{
PrintWithTimestamp("Error cancelling ATM strategy: " + e.Message);
}
isAtmStrategyCreated = false;
}
}

Comment