CatDog:
... What's wrong here?
Your topic's title.
if (High[2]+0.0001==Low[1] && Close[2]+0.0001==Open[1]&&2*(Close[2]-Open[2])<Close[1]-Open[1]&& Close[1]-Open[1]>0.0025)
- Doubles are rarely equal. Understand the links in:
The == operand. - MQL4 programming forum - Your constants (0.0001 and 0.0025) are 1 and 25 PIPs only on non-JPY pairs. Code breaks on JPY and exotics (e.g. USDZAR where spread is over
500 points,) and metals. Compute what a PIP is and use it, not points and not hard coded constants.
How to manage JPY pairs with parameters? - MQL4 programming forum
Slippage defined in index points - Currency Pairs - Expert Advisors and Automated Trading - MQL5 programming forum - You should be able to read your code out loud and have it make sense.
You would never write if( (2+2 == 4) == true) would you? if(2+2 == 4) is sufficient. So don't write if(bool == true), just use if(bool) or if(!bool). Code becomes self documenting when you use meaningful variable names, like bool isLongEnabled where as Long_Entry sounds like a trigger price or a ticket number and "if long entry" is an incomplete sentence.
This is unreadable:
if(… && 2*(Close[2]-Open[2])<Close[1]-Open[1]&& Close[1]-Open[1]>0.0025)
Write self documenting code.
double pips25 = 0.0025; double upCandle2Range = Close[2]-Open[2]; double upCandle1Range = Close[1]-Open[1]; bool smallUpCandle2 = 2*upCandle2Range < upCandle1Range; bool largeUpCandle1 = upCandle1Range > pips25; if(… && smallUpCandle2 && largeUpCandle1) // This you can read and understand.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I will ask for help. What's wrong here?
This is the code for USDPLN.
Why is it not working?
Below is the whole code.