I managed to code double crossing in two time frames, with different variables in the two time frames, see attached for the itf file with the code.
Main issue here is that the combinations possible are way too high, 70 x 70 x 70 x 70, so optimizing with all variables needs several simulations with each limited variables.
The trading concept below generates too few trades (no very reliable, risky to say it would be a robust trading system), as thought and mentioned above by Nonetheless.
if AvType (short time frame) crosses above AvTypeV2 (short time frame) and AvTypeV3 (long time frame) crosses above AvTypeV4 (long time frame), go long
Vice versa if AvType (short time frame) crosses under AvTypeV2 (short time frame) and AvTypeV3 (long time frame) crosses under AvTypeV4 (long time frame), go short
An alternative trading concept below can be tried as well:
if AvType (short time frame) crosses above AvTypeV2 (short time frame) and AvTypeV3 (long time frame) is higher as the previous and AvTypeV4 (long time frame) is higher as the previous, go long
Vice versa if AvType (short time frame) crosses under AvTypeV2 (short time frame) and AvTypeV3 (long time frame) is smaller as the previous, and AvTypeV4 (long time frame) is smaller as the previous, go short
Endless variations possible !!!
At the bottom of the code, I arbitrary add the code below, to stop trading after 120 bars, when the position is not positive (regardless the stoploss, which was not triggered sofar)
if barindex - tradeindex > 120 and positionperf < 0 then //kill non performing long lasting trades
sell at market
exitshort at market
endif
If you have trading concepts, please let me know !!