To get signal from expert advisor

 

Dear All,

 

I want to try a expert advisor for tester with a method but always it gave me fail. The method is ;

 1. Using MA and Bollinger bands.

2. The time H4.

3. If MA is lower than boolinger band main

    3.a if t-2 close is lower than MA and bollinger band main (bar must be bearish)

    3.b if t-1 close is lower than MA and bollinger band main (bar must be bearish) 

    for t time, open buy ticket.

 

4. If MA is greater than boolinger band main

    3.a if t-2 close is greater than MA and bollinger band main (bar must be bullish)

    3.b if t-1 close is greater than MA and bollinger band main (bar must be bullish)

    for t time ,open sell ticket.

 

For this strategy could you help me to write a code.

 
What is your strategy for closing open trades ?
 

Hi,

you can start modifying an existing example.

In standard MetaTrade distribution you can find the file MACD example.mq5 (I attached it anyway).

I suggest you to start from this example that is very clear. It is not difficult to add Bollinger Band in place of MACD.

Bye

Files:
MACD_Sample.mq5  18 kb
Reason: