If H0 < H1 a H1 > H2 and Open0 < Close1 and Open1 > Close2
then Sell
If L0 > L1 a L1 < L2 and Open0 = or > Close1 a Open1 = or < Close2
then Byu
Everything is correct here except using High[0] and Low[0]. These values change dynamically on every tick; at some moment, your inequalities can work, though at the moment of the current bar closing, the condition will not be fulfilled anymore.
Remedy: Replace with:
if( Low[3]>Low[2] && Low[2]<Low[1]
&& Close[3]>=Open[2} && Close[2]]<=Open[1] ){
Покупаем на открытии бара
}
if( High[3]<High[2] && High[2]> High[1]
&& Close[3]<=Open[2} && Close[2]]>=Open[1] ){
Продаем на открытии бара
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
The point is to
To catch these kinds of U-turns
What's wrong with fractals in that case?
they show exactly these kinds of reversals...
The point is to get the thing to handle conditions correctly.
Otherwise it trades but, not according to the rules
Where is the wave analysis here? Checking compliance with one or two bars from the current one is far from wave analysis.
Write in words the algorithm according to which rules your TS should work...
If H0 < H1 a H1 > H2 and Open0 < Close1 and Open1 > Close2
then Sell
If L0 > L1 a L1 < L2 and Open0 = or > Close1 a Open1 = or < Close2
then Byu
If H0 < H1 a H1 > H2 and Open0 < Close1 and Open1 > Close2
then Sell
If L0 > L1 a L1 < L2 and Open0 = or > Close1 a Open1 = or < Close2
then Byu
Everything is correct here except using High[0] and Low[0]. These values change dynamically on every tick; at some moment, your inequalities can work, though at the moment of the current bar closing, the condition will not be fulfilled anymore.
Remedy: Replace with:
... although the condition will no longer be met at the close of the current bar....
Remedy: Replace with:
A very important point indeed. Thank you.
Where can I read about how to set a stop loss?
I need, say, a stop at Low bar 2