I have a strategy I tested using the simulator that trades based on the first 5 minute bar of the day. It uses the open price and the high and low of the first 5 minute bar of the day. It works fine when using the simulated feed and account.
However when I connect to my IB account, the same code sends out trades as soon as it gets an open price. Why is there this difference in sim vs IB?
Here is the code that detects bars
if (BarsInProgress == 1)
{
if (!Period1Elapsed)
{
if (CurrentBar > 0)
{
Print(String.Format("Opening " + period1
+ "Bar Hi:{0} Lo:{1}", Highs[1][Bars.BarsSinceSession],
Lows[1][Bars.BarsSinceSession]) + "Bars since session " + Bars.BarsSinceSession);
Period1HighPrice = Highs[1][Bars.BarsSinceSession];
Period1LowPrice = Lows[1][Bars.BarsSinceSession];
if (Period1HighPrice != 0 && Period1LowPrice != double.MaxValue)
{
Period1Elapsed = true;
if(true)
{
HI = Period1HighPrice;
LO = Period1LowPrice;
STOP_PRICE = Period1LowPrice;
Print(String.Format("{0} will use period 1 prices HI:{1} LO:{2}",
Instrument.FullName.PadRight(5, ' '), Period1HighPrice, Period1LowPrice));
//send trades if this is real time
if (!Historical)
{
//SEND OUT BUY TRADE
}
}
}
}
}
}

Comment