I'm working through some ways to avoid these error messages in my strategy so my order is placed correctly based on the LastPrice which I have from OnMarketData. This works 75% of the time but there must be one or more choices to avoid the error message entirely. Maybe I need more ticks between the stop and limit prices...
//NEW TEST
//entryPrice is my desired LimitPriceEntry
if (entryPrice> 0){
//Limit price can't be less than stop price - is this true?
//not sure the best adjustment to use for the limit and stop prices
limitOrderPriceL = entryPrice + 0 * TickSize;
stopOrderPriceL = entryPrice - 1 * TickSize;
}
//Buy stop or buy stop limit orders can't be placed below the market
//Therefore BuyStop or BuyStopLimit must be placed above the market
//Therefore BuyLimit must be placed below the market
if (entryPrice > LastPrice)//testing "="?
{
entryOrder = EnterLongStopLimit(0, true, 1, limitOrderPriceL,stopOrderPriceL, "long stop limit entry");
}
else
{
entryOrder = EnterLongLimit(0, true, 1, limitOrderPriceL, "long limit entry");
}
Thanks,

Comment