If you are on 5 digit broker, 15*Point is effectively 1.5 pips which means you are probably trying to place your SL or TP within the spread - hence the error.
Try using:
Bid+150*Point
and
Bid-150*Point
- Your EA must adjust for 4/5 digit brokers. Pips (tp, sl) and Points (Slippage) EA's must adjust for ECN brokers (open first 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.015 0.0150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init(){ OptInitialization(); if (Digits % 2 == 1){ // DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262 pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl //---- These are adjusted for 5 digit brokers. /* On ECN brokers you must open first and THEN set stops int ticket = OrderSend(..., 0,0,...) if (ticket < 0) Alert("OrderSend failed: ", GetLastError()); else if (!OrderSelect(ticket, SELECT_BY_TICKET)) Alert("OrderSelect failed: ", GetLastError()); else if (!OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0)) Alert("OrderModify failed: ", GetLastError()); */
- What are Function return values ? How do I use them ? - MQL4 forum
For large amounts of code, attach it
jp_forex:
Follow this link and read some of the threads: ECN
Hello All,
The Bid-15*Point & Bid+15*Point always gives me error 130. i read all about the error in the book. Checked the next version on the code "modified.mq4" but still the same error. I tried to Print the values of the Bid, Ask & Point. Bid & Ask are Fine but the Point returns me 0 everytime. I dont understand why it is so? Examples explained in the book are all fine but when i try the same code on my system it gives such errors. I am using demo account. Kindly Help me with this problem.
Thank You Everyone. @Paul B, Sir I have tried changing 15 to 150, but its not helping. I guess the problem is with the account. Thank You guys for your help & all the information.
jp_forex: I guess the problem is with the account.
What part of adjusting for ECN brokers did you NOT READ?
WHRoeder:
What part of adjusting for ECN brokers did you NOT READ?
All of it :-)
What part of adjusting for ECN brokers did you NOT READ?

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 All,
I am reading the book section above. Im at the section "Opening and Placing Orders". there is a code named "simpleopen.mq4" and some more based on the same logic.
int start() // Special function start()
{ // Opening BUY
OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Bid-15*Point,Bid+15*Point);
return; // Exit start()
}
The problem is in the line " OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Bid-15*Point,Bid+15*Point); "
The Bid-15*Point & Bid+15*Point always gives me error 130. i read all about the error in the book. Checked the next version on the code "modified.mq4" but still the same error. I tried to Print the values of the Bid, Ask & Point. Bid & Ask are Fine but the Point returns me 0 everytime. I dont understand why it is so? Examples explained in the book are all fine but when i try the same code on my system it gives such errors. I am using demo account. Kindly Help me with this problem.