Trend check Multiple Timeframes
3 replies
Uwe6000
6 years ago #203466
To check the trend you need different time frames.
I have created a test file, but it does not work … No long order will be opened.
In the strategy tester “M5” is chosen.
I use different MA`s in H1 and M5.
My example:
Go long (H1): SMA 9 SMA100 crosses up
and
M5: Close 1> Upper Bollinger Band
my code:
// go long
IF (((Market Position () is Flat)
And ((SMA (PERIOD_H1, 9, Close) [1] Crosses Above SMA (PERIOD_H1, 100, Close) [1])
And (Close (PERIOD_M5) [1]> BollingerBand_Upper (PERIOD_M5, 20, 2, 0, Close) [0]))))
THEN
Buy 0.1 lots at Market
Magic number = 1000;
END IF;
Why does not this work? How can I use multiple time frames?
Best regards and thanks for a solution
tomas262
6 years ago #203508
Hello,
try to change BollingerBand_Upper (PERIOD_M5, 20, 2, 0, Close) [0] to BollingerBand_Upper (PERIOD_M5, 20, 2, 0, Close) [1]
You can also attached ZIPped Wizard project file
Uwe6000
6 years ago #203654
Hello, here´s my file…
tomas262
6 years ago #203685
I believe the problem is SMA cross never meet Close > Bollinger Band. You need to modify entry rules
Viewing 3 replies - 1 through 3 (of 3 total)