only places buy trades

 

Can anyone please help me, My ea will only take buy trades and I am not sure why.

I will attach my ea, please can anyone have a look at the code and let me know what I have done wrong.


thanx in advance

Files:
mypea.mq4  7 kb
 

I took a quick look at your code... and couldn't find serious flaws. One thing could give unexpected results:

double bh = hh+bh;  // bh = Buy Higher
double sl = ll-sl;  // sl = Sell Lower

the bh and sl added / substracted are allways zero. Maybe these should be declared static double?


Are all the separate conditions for the sell action met?


Russell

 
Russell:

I took a quick look at your code... and couldn't find serious flaws. One thing could give unexpected results:

the bh and sl added / substracted are allways zero. Maybe these should be declared static double?


Are all the separate conditions for the sell action met?


Russell



Russell
wrote
>>

I took a quick look at your code... and couldn't find serious flaws. One thing could give unexpected results:

the bh and sl added / substracted are allways zero. Maybe these should be declared static double?


Are all the separate conditions for the sell action met?


Russell


Russell,

Thank you for your reply. Yes all the sell criteria are met often and yet it does not take a sell trade.

I can not unfortunately change the bh and sl values to a static number because they will always change as the highest high or lowest low changes...that function makes sure that the order is placed noless than 10 pips higher than the highest high or 10pips lower than the lowest low.


But thanx anyway for having a look at the code for me.

 

Yes all the sell criteria are met often...

Is price less than 1.000?

 
double bh = High[iHighest(NULL,PERIOD_M15,MODE_HIGH,1,0)];
double sl = Low[iLowest(NULL,PERIOD_M15,MODE_LOW,1,0)];

so this is true? in other words bh and sl are legacy vars?

 

it looks like Bid<sl is never met.


worked a bit on your code...


Russell


P.S. the modify function doesn't seem to work either

Files:
mypea_1.mq4  7 kb
 
phy:

Is price less than 1.000?


phy
wrote
>>

Is price less than 1.000?

phy,

no it is used on the Euro and the Gbp/Jpy so it is above 1.000

 
Russell:

it looks like Bid<sl is never met.


worked a bit on your code...


Russell


P.S. the modify function doesn't seem to work either

Thank you very much for your efforts, I will have a look at the adjustments you made.


Bid<sl should mean that when the bid price goes lower than the lowest low created by the last 2 fifteen minute candles. so if the last 2 candles created a lowest low of 1.2000 for example, then when bid goes to 1.1999 the criteria (bid<sl) should be met.

Hope that explains a bit better what I was trying to do.

 

Then it won't make a sell.

 
phy:

Then it won't make a sell.

ok I believe you because you are very knowlegable but I must admit I dont know why that would be so.

 
Russell:

it looks like Bid<sl is never met.


worked a bit on your code...


Russell


P.S. the modify function doesn't seem to work either

Russell,

Thanks for your help, the EA now takes sell trades as well. I am going to read the adjustments you made very carefully and see if I can understand what I did wrong.

Reason: