Not logged in
Viewing 4 posts - 1 through 4 (of 4 total)

Forums>AlgoWizard / EA Wizard>General Discussion>Trend check Multiple Timeframes

  • #203466 |
    Participant
    126 Posts

    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

    #203508
    tomas262
    Administrator
    1826 Posts

    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

    #203654
    Participant
    126 Posts

    Hello, here´s my file…

    Attachments:
    You must be logged in to view attached files.
    #203685
    tomas262
    Administrator
    1826 Posts

    I believe the problem is SMA cross never meet Close > Bollinger Band. You need to modify entry rules

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.