Here is what the code looks like:
#region IfFlat
// If no position is on follow these rules...(enterOkay bool variable is to prevent same bar re-entry)
if (Position.MarketPosition == MarketPosition.Flat && enterOkay == true)
{
// reset bool control variable for dynamic stop resetting
stopControl = true;
entryOffset = entryOffset1;//setting offset variables based on current setup bar type
iniOffset = iniOffset1;
mdOffset = mdOffset1;
oneDone = oneDone1;
if (( kciLong ) == true && ToTime(Time[0])>=startTime && ToTime(Time[0])< endTime && Math.Abs(Close[2]-Close[1])<2*BarsPeriod.Value*TickSize && Close[0]>= High[1]+ entryOffset*TickSize && tradeLong == true)
{
orderName = orderLabel;
theoEntry = High[1] + entryOffset*TickSize;//variable to manage stops against theoretical no-slippage entry
stopPrice = Low[1] - iniOffset*TickSize;
SetStopLoss(CalculationMode.Price,stopPrice);//initial stop set to entry plus wiggle room
SetProfitTarget(orderName+"FIRSTTARGET",CalculationMode.Price,High[1] + entryOffset*TickSize + firstTarget*TickSize);//targets set from strategy setup user parameters
SetProfitTarget(orderName+"SECONDTARGET",CalculationMode.Price,High[1] + entryOffset*TickSize + secondTarget*TickSize);
SetProfitTarget(orderName+"THIRDTARGET",CalculationMode.Price,High[1] + entryOffset*TickSize + thirdTarget*TickSize);
// 4 unique orders and order names to facillatate scaling out
EnterLong(lotSize, orderName+"FIRSTTARGET");
EnterLong(lotSize, orderName+"SECONDTARGET");
EnterLong(lotSize, orderName+"THIRDTARGET");
EnterLong(lotSize, orderName+"RUNNER");
enterOkay = false;
}
}
#endregion
From the log file times, it really appears as though the EnterLong was not even submitted to the brokers until 1 minute 15 seconds later. So far, this type of problem has been very rare, but still needs to be understood.
Thanks much for your help on a difficult problem.


Comment