Ive been having some troubles trying to identify a target of stop being filled on an ATM based strategy. Mainly on the last targt/stop of the ATM because it usually gets an error indicating that ATM id is terminated...
I placed the condition on OnMarketData and it usually works fine on first targets or stops ( while still remains a position )..
Any idea of how can I monitor this event or how can I know the result of a terminated ATM id ?
Part of the code ( it just plots a line from start to end of trade )...:
protectedoverridevoid OnMarketData(MarketDataEventArgs e)
{
if(atmLongId.Length!=0 && orderLongId.Length==0 )
{
string[,] orders = GetAtmStrategyStopTargetOrderStatus("TARGET"+checkL, atmLongId);
//Print(" TARGET+checkL "+checkL+" "+orders[0,0]+orders[0,1]+orders[0,2]);
// Check length to ensure that returned array holds order information
if (orders.Length > 0)
{
//for (int i = 0; i < orders.GetLength(0); i++)
if(orders[0, 2]=="Filled")
{
DrawTriangleDown("TL"+CurrentBar+checkL,false,0, Convert.ToDouble(orders[0,0]), lineColorS);
Thanks !
Pablo

Comment