Download MetaTrader 5

Request for help on how to write an EA enter condition

To add comments, please log in or register
Find out how your rating can be improved
andrea 2016.01.18 14:25 

Hi everybody,

I'm just a beginner trying to build up very simple EAs. At the moment I'm able to build the just using standard indicators for enter or exit conditions.

Actually I'm testing a very stupid EA just for practice where the buy enter rule is something like:

if (close[1]>open[1])&&(close[2]>open[2])

and buy exit rule is

if (close[1]<open[1])

Viceversa the sell enter rule is

if (close[1]<open[1])&&(close[2]<open[2])

and sell exit is:

if (close[1]>open[1])

I'm not expecting that this works for making money but I'm looking for someone who could explain how to write this additional condition:

if the candle at time [1] makes me exit from the market (e.g. close[1]<open[1] for buy exit) and at the same time this condition satisfies an enter in the market (e.g enter sell),  do not enter:

never enter if on previous candle there was an exit from the market.

Thank you for your help

whroeder1 2016.01.18 15:00  
portharcourt: Thank you for your help
  1. No question asked.
  2. learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
andrea 2016.01.18 15:03  

Ok, thank you. I'm sorry.

I'll try to solve and post questions just for specific doubts non my attempts

barnacle7 2016.01.19 07:08  

To get more understanding:

In Mql4 there are a lot of examples of different ea's:  

Look on youtube: Seacrch " MQL4 Programming" , " jimdandy " does a lot of videos to learn MQL4. 

For what you want a few ways to do it:

1/Read account History , Checking the last trades close Time.

2/Create a Static,

Good Luck with learning MQL4. 

andrea 2016.01.19 13:33  

Thank you both for your suggestions and for providing such useful links.

To add comments, please log in or register