Add an EA to close a manually opened Trade

 

Hello

Need to know if this is possible. I have an open trade and want to add an EA to it in order to close the trade when the price closes below (or above depending on trade) a particular moving average.

Thanks in advance for any help

Pam

 

Take a look at this one : https://www.mql5.com/en/forum/175843/page2

It is not closing orders but is managing stop losses instead, but other than that, it does almost the same what you are looking for

 

Testing EMATrailingStop ea

Thank you - I really appreciate your reply. I am trying the EMATrailingStop EA now on US/YEN. Long trade showing profit. I changed the TrailAllSymbols to false, and the EMA to 50. The trailing stop seems to be working so far.

I am waiting for a candle to close below the MA and hope the EA will stoploss me out at that point. Do these settings sound right to you in order to do that? Will let you know what happens

Very much appreciate your help on this - it is so exciting!

 

hello again, This EA is working quite well, thank you but I would like to use an SMA rather than the EMA - how can I change this, or should I say, is it possible to change this?

Many thanks

 

In that EA you have a function (starts at line 297) that goes like this :

double stopValue(string symbol)

{

double ema = iMA(symbol,EMATimeFrame,EMAPeriod,0,MODE_EMA,Price,EMAShift);

return(ema);

}

Change the MODE_EMA to read MODE_SMA and it will use SMA from that moment on

Pam Hill:
hello again, This EA is working quite well, thank you but I would like to use an SMA rather than the EMA - how can I change this, or should I say, is it possible to change this? Many thanks
 

thank you, have changed that and it is working - now to see if my strategy works, and if so... will let you know!

 

Hello - Re EA_Based Trailing Stop

Thank you for this EA which works very well but not exactly what I am looking for. It works perfectly as a safety stop for those periods when I am not around to monitor and trade manually.

I would like to try and find an ea that only closes a trade on the CLOSE of a candle that begins on the other side of the moving average. I am not sure that that is possible?

Thank you for all your assistance

Pam

 

Pam, think this EA should do what your looking for, but would recommend to try it on demo first just coded it and it hasn't been tested.

 

Thank you mrtools for your help here. I used your indicator (the Ma cross Price_Closer) and it did exactly what I wanted, closing the trade at the close price of the candle that crossed the SMA from one side to the other. It left a wonderful dotted line and arrow to show the bought price that I had manually made and the sold price that it made. Perfect.

Would recommend this - but will continue to use and check its performance and confirm its accuracy at a later date.

 

I am looking for an add on EA that will add 2 positions every so many pips

 

hello mrtools, I newbie here, I have try your tool ea, it is good a tool but I am not programmer, could you add it some level (25,-25,100, -100, 200, -200, 400, -400, 800, -800), rules: if price is crossing ma level one of them and price is moving back to ma main with crossing ma level again, it will close order (ma main > 0 is close only buy order and ma main < 0 is close only sell order)