BlackDragon02: Can you tell me if the code in this way can be correct or where i`m doing wrong?
-
Play videoPlease edit your post.
For large amounts of code, attach it extern double MaxSpread = 5.0;
What unit, points or pips. Use pips and adjust 4/5 digit brokers.Spread = (Ask-Bid)*100; } else {Spread = (Ask-Bid)*10000;
You hard coded values, works on 5 digit Forex only.Spread = (Ask-Bid)/_Point; // Spread in points. Equivalent to MarketInfo(spread)
- 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; switch (MarketInfo(Symbol(), MODE_DIGITS)) { case 3: case 5: Spread = MarketInfo(Symbol(), MODE_SPREAD) / 10; break; default: Spread = MarketInfo(Symbol(), MODE_SPREAD); break;}
Verbose. Simplified:Spread = MarketInfo(Symbol(), MODE_SPREAD) / pipsToPoints; // Spread in pips
Comments that do not relate to this topic, have been moved to "Request for free coding. No work, no learning, no reading".
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
Hello guys.
Can you tell me if the code in this way can be correct or where i`m doing wrong?
Thanks to everyone.