2 SMA Crossover Help Needed Please

 

Hi,

I am new at writing an expert adviser, and I need help with my double crossover simple moving average expert adviser. My code is very basic. It sells/buys when the smaller moving average moves below/above the greater moving average.

What I am wanting to do is this.. An order is placed when the smaller moving average crosses above the greater moving average, so the EA buys. When the smaller moving average then crosses below the greater moving average I want to sell that order. This is all fine! And at the same time I want to place another/new order to buy/sell depending on the last order. I don't want to wait for the next crossover. So when one order is closed another one needs to be placed. Get it?

Please can someone help modify my existing code? Seeing that I am a newbie, can someone please comment on the code that was written?

I have attached my current file.

Regards,

Brendan

(South Africa)

Files:
 

i hope it can help.

Files:
 

hi, i am actually looking for the same thing ... but could you add the stop loss in too?