only takes buy positions???

[Deleted]  

Can any one please help me and tell me why my EA only takes buy positions...I will attach the mql4 file.


Many thanx in advance for the help.

Files:
myvea.mq4  11 kb
 
how do we know? we dont even have neccessary indicators for its testing ...
[Deleted]  

I was reading your code and found some double declarations: EMA_DIST and ENTRY_DIST were declared as external variables, no need to re-declare them inside...

      //==================// 
//-- ENTRY POINTS --//
//==================//

int EMA_DIST = 80; <-----------------------------warning: declared as ext parameter!------------ext int EMA_DIST = 80;
double b = EMA_DIST*Point;
double c = sema+b;
double d = sema-b;

int ENTRY_DIST = 10; <-----------------------------warning: declared as ext parameter!------------ext int ENTRY_DIST= 10;
double e = ENTRY_DIST*Point;
double f = sema+e;
double g = sema-e;


About your question, I'll see if I have some more time to check later.
[Deleted]  
Here could be your problem:

//--- BUY CRITERIA ---//

if(Close[2]>mpl && Close[1]>mpl && rsi>50 && Bid>=f && c<Bid || d>Bid) <---It buys when all the green OR the blue condition is true
{
...
//--- SELL CRITERIA ---//

if(Close[2]<mpl && Close[1]<mpl && rsi<50 && Bid<=g && (d>Bid || c<Bid)) <---Remove red parenthesis!!!:
It will sell ONLY IF all the red become true together
[Deleted]  

Thank you very much robotalfa, I will try that.


Im sorry I forgot to add the custom indicator, I will attach it if robotalda's suggestion does not solve the problem.

Thanks for all your responses! Much appreciated.

[Deleted]  

AAAH! Sorry guys! I have 2 EA's that are almost the same, I attached the wrong EA.

I will attach the EA that does not take shorts, to this EA with its custom indicator.

Sorry again...its this EA that does not take shorts.

Files:
15mhglmea.mq4  7 kb
[Deleted]  
here is the custom indicator
Files:
mpittl.mq4  3 kb