double Spread = (Bid-Ask)*10000;
That fails for JPY pairs. Don't hard code numbers.double Spread = (Bid-Ask)/_Point; // spread in points.
- The spread is Ask - Bid, your number is always negative.
- 0 eg 500 for a take profit of 50And if you forget, there goes your money. adjusting SL, TP, and slippage; for 4/5 digit brokers and for JPY pairs.double pip = StringFind(_Symbol,"JPY") < 0 ? 0.01 : 0.0001;
int pipsToPoints = int(pip / _Point);
int pipDigits = (int)MathLog10(pipsToPoints);
int slippage = 3 * pipsToPoints;
if((Spread < Maxspread || Spread==Maxspread)
Doubles are rarely equal. The == operand. - MQL4 forum- Simplify
if(Spread <= Maxspread)
if(Spread <= Maxspread)Spre=true;
Are you unsetting your flag? SimplifySpre= Spread <= Maxspread;
- Code becomes self
documenting when you use meaningful variable names, like bool isLongEnabled.
Long_Entry sounds like a trigger price or a ticket number and "if long entry" is
an incomplete sentence. Spre doesn't have any meaning.
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
Please help with my spread filter. I'm using ECN 5 digit broker but when I use this code, the ea doesn't seem to read the spread correctly.
On my EA I do normally put an extra 0 eg 500 for a take profit of 50, just as an example ( I've tried to add/take away 0s with no luck). Is there and easier code that workes
The code is as follows:
This means Spre is included on the buying condition if is spread is less than maximum spread.
Please help.