BIP = 0 = Day
BIP = 1 = Week
BIP = 2 = 10 minutes
Here is the jist of the problem code:
if (BarsInProgress == 2)
{
// Test for intraday
if (daily == true
&& Close[0] > CurrentDayOHL().CurrentOpen[0]
&& ToTime(Time[0]) >= 133500)
{
intraday = true;
}
else
{
intraday = false;
}
// Enter long position
if (Position.MarketPosition == MarketPosition.Flat
&& intraday == true)
{
EnterLong(2,1000,"Long");
SetProfitTarget("Long",CalculationMode.Ticks,ProfitTick);
}
//Exit one day after purchase
if (Position.MarketPosition == MarketPosition.Long)
{
if (BarsSinceEntry(2,"Long",0) > 0 //* 20 / BarsPeriods[2].Value
&& ToTime(Time[0]) >= 74000
&& ToTime(Time[0]) <= 83000)
{
Print("Exiting on Time" + ", " +Time[0] +", " + BarsSinceEntry(2,"Long",0)+" "+BarsPeriods[2].Value);
ExitLong("Long");
}
}
}
Output window yields:
Exiting on Time, 1/27/2010 7:40:00 AM, 1 10
In the course of testing, I set the critieria to > 0 just to see what happens. Setting the criteria to 1 changes the exit to 1/28/2010 7:40 a.m. It seems that the BarsSinceEntry is somehow using the primary BIP, which is not at all what I would expect from what I have gathered via forum and syntax references.
Any help?

Comment