Hi, doing some backtesting with different MA crossing on a 10 minute basis. I’d like to add a filter with the price being > 200 days MA, or possibly 12 months MA. Is it possible to use combine different periods in the code?
You can use multiple averages wiyh different periods, of course (which you probably already know), something like:
IF average[10](close) CROSSES OVER average[30](close) THEN
but you cannot access multiple timeframes at the same time. If you launch your strategy for a 4h TF, you can only access data referring to that TF, you cannot combine a MA for the daily TF in a 4h TF. You could try to simulate, say, a 200-period daily MA in a 4h TF by multiplying it by 6 (there are 6 4h bars in a day), so an average[200](close) would become an average[1200](close), but it will not yield the very same results.
At least until the MTF (Multi Time Frame) version is released to traders.