Yes, I get Error 130. I'm a beginner.
I'd like to learn the code if I want to move up Take Profit if price increases. Could you please help me out?
How can the TakeProfit price be below Bid for a BUY order?
OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),Bid-Point*trailing,0,Pink);
Maybe you mean:
if (OrderTakeProfit() - Bid < Point * trailing) { OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),OrderTakeProfit()+Point*trailing,0,Pink); return(0); }
Is your SL 200 Pips and your TP 300 Pips or 20 and 30 Pips? I only ask because I am not sure about the values in Pips you want for trailing (and for slippage in your OrderSend() function)?
OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),Bid-Point*trailing,0,Pink);
- What are Function return values ? How do I use them ? - MQL4 forum
- Tell me how the TP can be set below the bid on a buy order. You can not place stops closer to market than MarketInfo(chart.symbol, MODE_STOPLEVEL)*Point.
- Not adjusting for 4/5 digit brokers. (tp, sl, AND slippage.) Not adjusting for ECN brokers.
//++++ 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()); //}
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!
Could you please help me out with my code? Below I'm presenting my code:
I think that modification of orders does not work at all? Could you please take a look and advise me on this?
Cheers!