MACD EA

 

Hello,

I'm trying to optimize the MACD EA code, which I attached to this message. It has a great potential to create a good profit, but it desperately needs to add StopLoss. There is just a trailing stop, and as a result, huge losses come...I didn't succeed in my attempt to add stoploss, the thing is that I am a terrible programmer :-( Could someone help with the code?

Thanks in advance,

Martin

Files:
 

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,SL,Ask+TakeProfit*Point,"macd sample",16384,0,Green);

For 5 digit brokers you must adjust TP, SL, Slippage & send the tp & sl separately

 
qjol:

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,SL,Ask+TakeProfit*Point,"macd sample",16384,0,Green);

For 5 digit brokers you must adjust TP, SL, Slippage & send the tp & sl separately

Hello,

thanks for your advise! I did what you advised me plus defined SL at the begining of the code, but it still doesnť work and it started to enter only long positions... I'm in a dead end :( There should probably be another change... I attache the code after changes I did. Could you please go through it once more? I would be very grateful if you find what could be the problem.

Martin

Files:
macde2.mq4  6 kb
 

read more about OrderSend() (u can't send just 20 & BTW i'm wondering how it's workink for long position) & u didn't took care for 5 digit brokers

 
qjol:

read more about OrderSend() (u can't send just 20 & BTW i'm wondering how it's workink for long position) & u didn't took care for 5 digit brokers



It finalyl works now :-), thanks a lot!
Reason: