RaptorUK:
You don't need to "handle" error 130 . . . place your trade correctly and you will not have an error 130.
You don't need to "handle" error 130 . . . place your trade correctly and you will not have an error 130.
You didn't get me. Open prices are EA generated. So it is not possible to avoid error #130 all the time.
Most of the time it gives open price very nearer to the Ask/Bid. I tried a solution for that here.
OrderSend(Symbol(), 1, 1.0, Bid, 1, NULL, NULL, "Success #", 0, NULL, C...
TP and SL are doubles not STRINGS. Use zeros or #define NO_SL 0- On ECN brokers, you must open first and THEN set stops.
if(Bid<sell_price) sell_type = 3; //OP-SELLLIMIT if(Bid>sell_price) sell_type = 5; //OP-SELLSTOP
You can not open pending order closer than MarketInfo(chart.symbol, MODE_STOPLEVEL)*Pointif((OrderModify(buy_ticket, NULL, sell_bk, btgt_bk, NULL, NULL))== true)
NULL is not a valid price, datetime, or color.//++++ 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(){ OptParameters(); if (Digits % 2 == 1){ // DE30=1/JPY=3/EURUSD=5 https://www.mql5.com/en/forum/135345 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()); */
trade_flag != 1 && SSL_flag != 1 && BSL_flag != 1 && SSL_flag != 2 && BSL_flag != 2
This means SSL_flag and BSL_flag must be not 1 or 2. Do you mean that or did you mean (SSL != 1 and BSL != 1) or (SSL !=2 and BSL != 2) or some other combinations.- Don't hard code numbers. what does SSL_flag == 1 mean.
#define SSL_xxxx 1 #define SSL_yyyy 2 #define BSL_xxxx 1 #define BSL_yyyy 2 trade_flag != 1 && SSL_flag != SSL_xxxx && BSL_flag != BSL_xxxx && SSL_flag != SSL_yyyy && BSL_flag != BSL_yyyy
- If you use understandable names and bools you simplify your code
//trade_flag != 1 && SSL_flag != 1 && BSL_flag != 1 && SSL_flag != 2 && BSL_flag != 2 bool isTradingAllowed = true; : isTradingAllowed && SSL_flag != 1 && BSL_flag != 1 && SSL_flag != 2 && BSL_flag != 2
WHRoeder:
-
TP and SL are doubles not STRINGS. Use zeros or #define NO_SL 0
- On ECN brokers, you must open first and THEN set stops.
-
You can not open pending order closer than MarketInfo(chart.symbol, MODE_STOPLEVEL)*Point
-
NULL is not a valid price, datetime, or color.
- This means SSL_flag and BSL_flag must be not 1 or 2. Do you mean that or did you mean (SSL != 1 and BSL != 1) or (SSL !=2 and BSL != 2) or some other combinations.
- Don't hard code numbers. what does SSL_flag == 1 mean.
- If you use understandable names and bools you simplify your code
Very useful tips friends. I am a trader with little bit programming knowledge.
This is what I expected. Thanks A Lot.
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