- EA's should adjust TP, SL, AND slippage for 5 digit brokers. On ECN brokers you must open the order and THEN set stops.
//++++ 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
- Print/Alert defaults to 4 digits. Try Alert(PriceToStr(p))
string PriceToStr(double p){ string pFrc = DoubleToStr(p, Digits); if(Digits.pips==0) return(pFrc); string pPip = DoubleToStr(p, Digits-1); if (pPip+"0" == pFrc) return(pPip); return(pFrc); }
Yes, ECN brokers require that you use the OrderSend() without a stop loss or take profit then you must modify the trade once it is open.
int OrderSend( | string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, int magic=0, datetime expiration=0, color arrow_color=CLR_NONE) https://docs.mql4.com/trading/OrderSend
|
Thank you.
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 MQL Community.
I am a really new user of the MetaTrader and MQL4.
I have been following the tutorial when I came across this problem.
And Alerts looks like this:
I am testing this code on MT4 from Oanda on EURUSD.
Why am I getting error code 130?
Any assistance is greatly appreciated.