Build 500 № 9 2013.05.09
Need help me mql4 guru add take profit to this EA - Take Profit - MQL4 programming forum 2017.09.27
There is no need to open an order and then set the stops. Simplify your code - do it in one step. TP/SL on OrderSend has been fine for years.
Build 500 № 9 2013.05.09
Need help me mql4 guru add take profit to this EA - Take Profit - MQL4 programming forum 2017.09.27
There is no need to open an order and then set the stops. Simplify your code - do it in one step. TP/SL on OrderSend has been fine for years.
Build 500 № 9 2013.05.09
Need help me mql4 guru add take profit to this EA - Take Profit - MQL4 programming forum 2017.09.27
If you change it as follows, your code will work. You need to change other parts in this way.
ticket = OrderSend(sym, OP_BUY, Lots, ask, Slippage, mySL, myTP, CommentStringInfo, Magic, 0, clrBlue); /// /////////If you change it as follows, your code will work. You need to change other parts in this way. { ticket = OrderSend(sym, OP_BUY, Lots, ask, Slippage, 0,0, CommentStringInfo, Magic, 0, clrBlue); // NormalizeDouble(mySL,digits), NormalizeDouble(myTP,digits) if (OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES)) OrderModify(ticket,OrderOpenPrice(),NormalizeDouble(mySL,digits), NormalizeDouble(myTP,digits),0,clrBlue); } //
double SL = ask - StopLoss*PipValue*point; ⋮ double TP = ask + TakeProfit*PipValue*point;
You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit and open at the Ask.
-
Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?
-
Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger close to a specific Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25 -
The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (control+O) → charts → Show ask line.)
Most brokers with variable spreads widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY (OANDA) shows average spread = 26 points, but average maximum spread = 134 (your broker will be similar).
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
So I’m working on my first Multi-Currency EA from the template given by DADALI ARWALY
https://www.mql5.com/en/code/28181.
I’m using <Deleted> as my Buy Sell Signal and TP & SL.
This works very well now but I’m having one problem that only happens sometimes and that is that my EA don’t ad the TP & SL to the order, so the order is without TP & SL. I need help finding out why this is happening and how to prevent it.
The Signal:
BuyOrder
I'm guesing my problem lies here
But changing that to mySL & myTP gives me this error:
2020.11.09 21:01:15.772 Multi Currency Template V1.1 EURJPY,M30: OrderSend() error - invalid stops