Assuming I am correct, then I have to add a second 1-tick time frame and now I have to deal with coding a multiple time frame strategy.
This is not my actual strategy, but here's a similar situation:
Let's say I have an SMA(20) and an SMA(50) and an SMA(200). I buy when the 20 crosses above the 50, but only when the 50 is above the 200. So I want to buy if the 50 is above the 200 on the 5min time frame (calculated on bar close) but i want to enter once the 20 crosses above the 50 intrabar, not wait for the 5min bar to close.
However, I want the buys to happen if the 20/50 bars cross intrabar, not on bar close. So I am trying something like this.
Let's say I'm running the strat on 5min bars (primary time frame)
In my class
private bool _upTrend;
_upTrend = false; Add(PeriodType.Tick, 1);
if (BarsArray == 0 && FirstTickOfBar) // the 5-min bars
{
_upTrend = (SMA(50)[1] > SMA(200)[1];
}
else if (BarsArray == 1) // the 1-tick bars
{
if (SMA(20)[0] > SMA(50)[0] && _upTrend)
EnterLong();
}

Comment