Also, Is there a way for the EA to detect if it is ECN? that way could bypass the external variable...
Thanks again.
Sam
Hello, Just want to say this board rocks! I have gained so much knowledge just from reading the posts that I have been able to program my own ea! Thanks to all those who freely give their time on here... Kudos!
I have moved over to an ECN broker, and naturally I cant enter the stop and target on the OrderSend() command. I realize I need use OrderModify() to change these parameters.. What I have done is added an external variable 'extern bool ECNbroker = true'. that way i can use with either ECN or Non ECN broker. The problem is I am still getting the Error 130 Invalid Stops and I am not getting entered in the first place, needless to say not even getting to the OrderModify() function.. Could anyone see where I am messing up??
QUESTION: Is it my use of the variables 'stop' and 'target'? can variables be used for an OrderSend() that opens a trade for ECN even if they are valued at 0? Or does it need to be an ACTUAL "0"?
You can use a variable that equals 0.0 it's just the same as using 0.0
What was the spread at the time ? what are your STOP and FREEZE levels ? have you read this ? Requirements and Limitations in Making Trades
Also, Is there a way for the EA to detect if it is ECN? that way could bypass the external variable...
You can use a variable that equals 0.0 it's just the same as using 0.0
What was the spread at the time ? what are your STOP and FREEZE levels ? have you read this ? Requirements and Limitations in Making Trades
Thanks for your quick reply Raptor!
so I should make the variable = 0.0 and NOT 0?
also my stop and freeze levels are both 0.. according to your resource link (thanks, btw) if i am reading it right, it says order cannot be modified if
Buy | Modification is prohibited | Bid-SL ≥ StopLevel | TP-Bid ≥ StopLevel |
Sell | Modification is prohibited | SL-Ask ≥ StopLevel | Ask-TP ≥ StopLevel |
according to these formulas it seems I can NEVER modify trade because Bid-SL will always be more than 0.. Am i missing something?
Not with 100% reliability . . as far as I know.
ok thanks, would be nice if there was..
also, does rest of code i posted above look right? or at least looks like it will work?
sam
What was the spread at the time ?
spread was pretty normal about 1.5-2.5 pips
//++++ 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(){ 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()); //}
Thanks for your quick reply Raptor!
so I should make the variable = 0.0 and NOT 0?
also my stop and freeze levels are both 0.. according to your resource link (thanks, btw) if i am reading it right, it says order cannot be modified if
Buy | Modification is prohibited | Bid-SL ≥ StopLevel | TP-Bid ≥ StopLevel |
Sell | Modification is prohibited | SL-Ask ≥ StopLevel | Ask-TP ≥ StopLevel |
according to these formulas it seems I can NEVER modify trade because Bid-SL will always be more than 0.. Am i missing something?
For a double 0 == 0.0
Modification of the Open Price is prohibited . . . look at the column headers.
spread was pretty normal about 1.5-2.5 pips
This is your issue . . .
else stop = Ask-BreakoutStop*Point; target = Ask+BreakoutTarget*Point;
. . . if you had printed the SL and TP values as part of your error reporting you would have seen this yourself.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello, Just want to say this board rocks! I have gained so much knowledge just from reading the posts that I have been able to program my own ea! Thanks to all those who freely give their time on here... Kudos!
I have moved over to an ECN broker, and naturally I cant enter the stop and target on the OrderSend() command. I realize I need use OrderModify() to change these parameters.. What I have done is added an external variable 'extern bool ECNbroker = true'. that way i can use with either ECN or Non ECN broker. The problem is I am still getting the Error 130 Invalid Stops and I am not getting entered in the first place, needless to say not even getting to the OrderModify() function.. Could anyone see where I am messing up??
QUESTION: Is it my use of the variables 'stop' and 'target'? can variables be used for an OrderSend() that opens a trade for ECN even if they are valued at 0? Or does it need to be an ACTUAL "0"?
Any help would be GREATLY appreciated.. Thanks!
Sam