&& (BarsSinceEntryExecution(@"Long") > 3 || BarsSinceEntryExecution(@"Long") == -1)
&& (BarsSinceEntryExecution(@"Short") > 3 || BarsSinceEntryExecution(@"Short") == -1)
This led me down the rabbithole of reading the manual section on Mutliple Timeframes & instruments, but I'm not sure I quite understand what I need to do to make this work. I thought I only have one dataseries loaded as I'll show below but I suppose loading the tick data also counts as a different index value than the primary? Otherwise I'm not sure why I would get this issue because I'm only accessing one time frame.
I have my data set as follows
else if (State == State.Configure)
{
AddDataSeries(Data.BarsPeriodType.Minute, 1);
AddDataSeries(Data.BarsPeriodType.Tick, 1);
}
The above is within protected override on state change and follows if state set defaults.
Then in protected override OnBarUpdate I have the following:
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 2)
return;
Then below that I have my entry conditions as normal (working fine as I have been testing them with playback for a while) followed by the new entry conditions to check when our most recent trade was and if we are 3 bars away for both our long and short positions.
if ( //other entry condition stuff
&& (BarsSinceEntryExecution(@"Long") > 3 || BarsSinceEntryExecution(@"Long") == -1)
&& (BarsSinceEntryExecution(@"Short") > 3 || BarsSinceEntryExecution(@"Short") == -1))
{
Enter the trade
}
This is how I set it up and its giving the said error above, what am I missing? It may be worth noting I have the new entry conditions added both in my if statement conditions for entering my long setup and also within my if conditions for entering my short setup. The reason I doubled the barssinceentry for both Long and Short is because I want it to wait to take another trade if either a long or short was recently traded.
Appreciate any help as I had some minimal prior coding experience but am new to coding strategies.
Comment