mql funtion - page 2

 
aldus011:

Hi all,

I have changed my code and now is working, it opens the selling orders. 

After many attempts I made it, but  I had to change one important condition that I would like to implement again :-(   the reason is it

assures me that the bearish candle when closes,  the closing price is less than my fixed broken support line.

That condition assures me that the the break of the support is not a fake ( I want that the candle not only has to be bearish by creating a shadow but also has to be a full

and clear break of the support.)


below I copied my EA  , under the code I highlited the condition that I commented and replaced with a simple one

I wold like to ask you why is not working the commented condition I thought maybe is too long and needs to be managed into another inner If condition or because the variable called " ChiusIura" is used twice into the  If statement

What value do you have for Bars ?  are you sure you want to be using Open and Close of a bar that old ?  do you know what Bars is ?
 
RaptorUK:
What value do you have for Bars ?  are you sure you want to be using Open and Close of a bar that old ?  do you know what Bars is ?


Hi Raptor,  for Bars I have a progressive integer which identify the candles into my timeframe, so when the break of the support line occures , for this event I set up the boolean variable equal to true , before checking the other event  the condition Bars >FirstBar assures that the breaking bar is closed , and so I can  start making all the following checks.

 It is also true that the EA once the break has occured might wait for many candles to open the order before the price will be less than the support level price.

Now I am testing it on TM of 1 min or 5 minut, but my intention is to use it on TM of 1 hour or 4 hours, it would be usefull for the continuation of a trend or a breach of a channel, but not good for skalping.

so that I don't need to watch continuesly my  TM at work where I cannot connect to internet ;-)  , of course if I see that the price, on  a 1 hour or 4 hour TM goes on the different direction I will remove the EA.

 Maybe in the feature I will improve the EA ;-)

Thank you for your suggestion

 

Aldo 

 

if (Fact_1 == true && Bars>FirstBar)
       { SecondBar=Bars;
 
aldus011:


Hi Raptor,  for Bars I have a progressive integer which identify the candles into my timeframe, so when the break of the support line occures , for this event I set up the boolean variable equal to true , before checking the other event  the condition Bars >FirstBar assures that the breaking bar is closed , and so I can  start making all the following checks. 

Add a Print("Bars is ", Bars); statement in your code  . . .  so you can see  what bar you are working with,  bear in mind the currently forming bar is bar 0. 
Reason: