The creation line is here:
AtmStrategyCreate(OrderAction.Buy, OrderType.StopLimit,
((Convert.ToInt32(High[1]/TickSize)+entryPad)*TickSize),
((Convert.ToInt32(High[1]/TickSize)+entryPad)*TickSize),
TimeInForce.Day,longOrderId, "X-STANDARD",longATMStrategyId);
SetShortTradeStopForLongReversal();
longTrend = true;
The order is placed and IMMEDIATELY and I check GetAtmStrategyEntryOrderStatus(longOrderId); and get the status[2] as "Filled"
Immediately in the next few lines I check GetAtmStrategyMarketPosition(longATMStrategyId) == MarketPosition.Flat and it returns a TRUE.
This only seems to happen in SIM mode. And the order is Still FILLED and STILL on my DOM and Chart Trader Screens!
In MARKET REPLAY I get FALSE when I check this value as GetAtmStrategyMarketPosition(longATMStrategyId) == MarketPosition.Long equal TRUE here when in market replay and that is correct!
In SIM mode it happens about 60% of the time that GetAtmStrategyMarketPosition(longATMStrategyId) equals MarketPosition.Flat even though I can still see the order.
This does not appear to be logical as in MARKET REPLAY I do not have this happen and wanted to know it it is possible there could be an issue with GetAtmStrategyMarketPosition() when in SIM
The Code Being executed:
string[] statusLong = GetAtmStrategyEntryOrderStatus(longOrderId);
if (statusLong.GetLength(0) > 0)
{
if (debug1==true)
if (lastlongstatus != statusLong[2] )
{
Print("################################## ");
Print("# statusLong = "+statusLong[2]);
Print("################################## ");
lastlongstatus = statusLong[2];
}
if (statusLong[2] == "Filled" )
{
Print ("--> Long "+(GetAtmStrategyMarketPosition(longATMStrateg yId) == MarketPosition.Long));
Print ("--> Flat "+(GetAtmStrategyMarketPosition(longATMStrateg yId) == MarketPosition.Flat));
Print("GetAtmStrategyMarketPosition(longATMStrateg yId) : " + GetAtmStrategyMarketPosition(longATMStrategyId));
if (GetAtmStrategyMarketPosition(longATMStrategyId) == MarketPosition.Long)
{. . .
the output window from this code...
CreateNewLongEntry();
Called Procedure CreateNewLongEntry() checking value: (longOrderId.Length == 0) True
***************************************
Long Entry High. :82.07
Long Entry. 82.08
***************************************
longATMStrategyId = GetAtmStrategyUniqueId()
**NT** Submitting order with strategy 'TradeDiv2/d6bf00b7b5574b5b83c867924e2c2bd2'
##################################
# statusLong = PendingSubmit
##################################
##################################
# statusLong = Accepted
##################################
##################################
# statusLong = Working
##################################
##################################
# statusLong = Filled
##################################
--> Long False
--> Flat True
GetAtmStrategyMarketPosition(longATMStrategyId) : Flat
Comment