Please can someone code the following EA

 

Hi, Can someone please Code the following EA:

EA starts by openng a buy and sell order each of 0.1lots. Thereafter if the price goes up 20pips then another buy order is opened at 0.2lots. If price then moves up another 20pips all orders are closed and EA stops trading. In this scenario we would have made approx $80 on the buys and -$40 on the sell giving us a profit of approx $40. The same would apply if the price dropped 20pips from the first two orders being opened.

Scenario 2: We again start by opening the buy and sell of 0.1lots. Now the price moves up 20pips and the second buy order is opened at 0.2lots. After this the price does not move up anymore but instead drops and moves 20 pips below where the first two orders were opened. Now it opens a sell order of 0.2 lots. We now have buys equal to 0.3 and sells equal to 0.3. If price moves down further 20pips we close all orders once again and we take a small loss in this case ( the buys of 0.3 and the sells of 0.3 cancel each other out so loss would be fairly small). After this ea stops and you can restart ea again to hopefully make profit again.

I have manually checked this on EURUSD and will work well when EURUSD is trending which it seems to do more nowadays.

The above concept works on the principle that we only trade a 40pip range either upwards or downwards. That way we prevent our acc from reaching big drawdowns and a possible wipeout. please can someone Code the above. I will then test and report back on results. I believe it could work on any strong trending currency pair. The 20pips range is an example and should be a variable so we can test different settings.

Thank you and Best rgds.

 

Hi All, sorry about the above idea. Wont work and i need to think it thru again...

Reason: