eleven
07-17-2010, 11:30 PM
// Primary bars 60 min //
protected override void Initialize()
{
Add(PeriodType.Minute, 15);
}
protected override void OnBarUpdate()
{
if (BarsInProgress == 1)
{
Var.Set(<my_custom_dataseries>(using "close" as input and not index "closes");
}
if (BarsInProgress == 0)
{
if (Var[0] > 0)
{
EnterLong(DefaultQuantity, "")
}
if (Var[0] < 0)
{
EnterShort(DefaultQuantity, "")
}
}
if (BarsInProgress == 1)
{
if (Var[0] < 0)
{
ExitLong("", "")
}
if (Var[0] > 0)
{
ExitShort("", "")
}
}
}Please look at the code above. 60 min primary bars and 15 min secondary bars. I have the following question.
1. In theory would value of "Var" be identical for both primary(60min) and secondary(15min) series since 60 is divisable by 15?
My strategy will enter on the primary bars, 8:30am for example, and then the exit order will take place at 8:30am with the secondary bar. Running realtime a order is entered and then 15 minutes later it exits. Since both enter and exit occur at the same time (8:30am), how can I prevent the enter order to take in the first place?
protected override void Initialize()
{
Add(PeriodType.Minute, 15);
}
protected override void OnBarUpdate()
{
if (BarsInProgress == 1)
{
Var.Set(<my_custom_dataseries>(using "close" as input and not index "closes");
}
if (BarsInProgress == 0)
{
if (Var[0] > 0)
{
EnterLong(DefaultQuantity, "")
}
if (Var[0] < 0)
{
EnterShort(DefaultQuantity, "")
}
}
if (BarsInProgress == 1)
{
if (Var[0] < 0)
{
ExitLong("", "")
}
if (Var[0] > 0)
{
ExitShort("", "")
}
}
}Please look at the code above. 60 min primary bars and 15 min secondary bars. I have the following question.
1. In theory would value of "Var" be identical for both primary(60min) and secondary(15min) series since 60 is divisable by 15?
My strategy will enter on the primary bars, 8:30am for example, and then the exit order will take place at 8:30am with the secondary bar. Running realtime a order is entered and then 15 minutes later it exits. Since both enter and exit occur at the same time (8:30am), how can I prevent the enter order to take in the first place?