CL 09-10 (09:30:23) Set Target ATM_S_ID: 4b442f8ee62a4ef0ab98c5a789188724 Is the Order Filled: True
**NT** AtmStrategyChangeStopTarget() method error: AtmStrategyId '4b442f8ee62a4ef0ab98c5a789188724' does not exist or is already in terminated state
09:30:23 First Tick Of Bar * Reset Inactive Order Values
I am trying to eliminate the AtmStrategyChangeStopTarget() method error
This above output and error occur when the OnBarUpdate Event is called IMMEDIATELY after the orders STOP is filled. I seem to be confused her. How do I know this order has been stopped out so I do not call this method.
Thanks!
protected override void OnBarUpdate()
{
if (Historical)
return;
if (FirstTickOfBar)
{
ManageTradeOnFirstTick( 1, ref longTradeValues, ref configValues);
...
}
}
public void ManageTradeOnFirstTick( int BarsBack, ref string[] tradeValues,ref string[] configValues)
{
if(!IsTheOrderFilled(ref tradeValues, ref configValues))
return;
Print(Instrument.FullName+" ("+Bars.GetTime(CurrentBar).TimeOfDay+") Set Target ATM_S_ID: " +tradeValues[ATM_S_ID] + " Is the Order Filled: " +IsTheOrderFilled(ref tradeValues, ref configValues));
AtmStrategyChangeStopTarget((Math.Round(EMA(GetCon figValueInt(ref configValues, CHECKEMA))[1],2)),0 , "TARGET1",tradeValues[ATM_S_ID]);
}
public bool IsTheOrderFilled(ref string[] tradeValues ,ref string [] configValues)
{
if (tradeValues[ORD_ID].Length > 0)
{
string[] status = GetAtmStrategyEntryOrderStatus(tradeValues[ORD_ID]);
if (status.GetLength(0) > 0)
{
if (status[2] != "Filled" && status[2] != "PartFilled" )
return false;
}
}
///
/// THIS NEXT LINE IS GENERATING THE ERROR. HOW DO I ELIMINATE THIS ERROR
/// THIS CODE USED ACCORDING TO YOUR SAMPLE ATM STRATEGY
///
else if (tradeValues[ATM_S_ID].Length > 0 && GetAtmStrategyMarketPosition(tradeValues[ATM_S_ID]) == Cbi.MarketPosition.Flat)
{
ResetOrderValues(ref tradeValues,ref configValues) ;
return false;
}
return true;
}
public void ResetOrderValues(ref string[] TradeValues,ref string[] configValues)
{
TradeValues[ATM_S_ID] = string.Empty;
TradeValues[ORD_ID] = string.Empty;
Print( Bars.GetTime(CurrentBar).TimeOfDay +" First Tick Of Bar * Reset Inactive Order Values");
}

and On the next bar. is what I have done...First Tick Of Next Bar...
Comment