R
You could just change the input values for any parameter that engages with Point, as in
extern double TakeProfit = 500.0; // Pip-sensitive extern double Lots = 0.1; extern double TrailingStop = 300.0; // Pip-sensitive extern double MACDOpenLevel=30.0; // Pip-sensitive extern double MACDCloseLevel=20.0; // Pip-sensitive
or you could use this quickly edited MACD Sample - see attached
-BB-
//++++ These are adjusted for 5 digit brokers. int pips2points; // slippage 3 pips 3=points 30=points double pips2dbl; // Stoploss 15 pips 0.0015 0.00150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init(){ if (Digits == 5 || Digits == 3){ // Adjust for five (5) digit brokers. pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
saed
Woop woop!
(sign of support slash enthusiasm)
No need to contain the enthusiasm any longer - here it is https://www.mql5.com/en/code/10317
-BB-
Well - not quite - wait for version 452 for more... definitive example..
-BB-
> really old MACD sample
Yes, I think the originals were the first of a new era for MQL
I believe the first uses were for indicators, scripts and literal 'advisers' that 'knew' all the systems rules & put up an arrow on chart or put up an order dialog box for confirmation by the user
Using advisers as total auto-traders then developed in the same era as XxxxxTrader, Xxxxxxxcharts and other systems
Nothing then new about algo-trading systems, banks had been using them for years but it was a new era for the retail trader
The snag with a completely sorted EA is that the structure would be completely opaque to the new coder
Also very, very hard to extend or change and very easy to break without means of fixing
So I kept as much of the vanilla original as I could while adding the necessary new functionality
FWIW
-BB-
PS
The fixed one (ver 452) is now available here

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I've been messing with the MACD Sample EA to help learn MQL4 programming. I've had a heck of a time figuring some things out though, since the trailing stop never worked. I finally understand now that since I'm using a broker that has 5 digits instead of 4, that messes things up in the code because it's assuming Points is the number of decimals for a pip, but it's really 1/10th of a pip.
I've seen various threads in my searching on ways to try and detect this automatically and adjust the Points value as needed. I'd like to suggest this be handled correctly in the MACD Sample script you provide with new MetaTrader installs, though. Providing an example script that won't work with certain brokers is a bit silly. ;)