Help turning Indicator into EA

 

Hi everyone,

I am trading using the attached indicator, when a sell signal is triggered I buy, and vice versa. It works strangely enough. I would like to surn this indicator into an EA, would someone be able to help me adjust the code, instead of printing the signal and setting of an alarm I would like it to open an order on the open of the next bar. For example:


Sell signal triggered: OrderSend(Symbol(), OP_BUY, lots * 2, Bid, 3, // at the open of the next bar


Buy signal triggered: OrderSend(Symbol(), OP_BUY, lots * 2, Bid, 3, // at the open of the next bar


if there is a position open it is reversed when the opposing signal is triggered. if no position trade as above. If a position is open and another signal is triggered in the same direction, ignore.


To someone who knows what they are doing I guess it would take then a few min to adjust the code, I have been trying now for days and its driving me crazy. Please can someone help me out. It would be greatly appreciated.

 

Forum on trading, automated trading systems and testing trading strategies


Hello,

This forum is about MT5/mql5, please post your question about MT4/mql4 on mql4.com forum.

  • They are more people who can answer there.
  • They are more people who can have similar problem there.
  • A forum is not only to get help but to share with the community, mql4/MT4 community isn't the same as mql5/MT5 community.

 
angevoyageur:

I know this is MT5 but i guess the code is the same right|?


I managed to make a start, I have no clue when it comes to coding at all but am i heading in the right direction? I cant get the EA to open positions?  Can you please help  with some pointers and where am I going wrong.


I would really appreciate it.


Thanks,

Files:
 
Mccallum28:

I know this is MT5 but i guess the code is the same right|?


I managed to make a start, I have no clue when it comes to coding at all but am i heading in the right direction? I cant get the EA to open positions?  Can you please help  with some pointers and where am I going wrong.


I would really appreciate it.


Thanks,

The code isn't the same. mql4 and mql5 have some common parts but are not fully compatible, mainly on trading functions.
 
ah I see, thank you.
Reason: