-
TPBuy=((OrderOpenPrice()-OrderStopLoss())*5) ; TPSell=((OrderStopLoss()-OrderOpenPrice())*5) ;
MT4: You can not use any Trade Functions until you first select an order.
-
OrderSend(_Symbol,OP_BUY,0.1,Ask,5,FractalDown[0]-1*_Point,Ask+TPBuy*_Point,NULL,MagicNumber,0,clrGreen);
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).
-
- TP/SL are prices. Your TPBuy is a change of price. (0.01234) Your Ask+ TPBuy * _Point is garbage. (Ask + 0.1234 × 0.00001 == Ask)
-
MT4: You can not use any Trade Functions until you first select an order.
-
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).
-
- TP/SL are prices. Your TPBuy is a change of price. (0.01234) Your Ask+ TPBuy * _Point is garbage. (Ask + 0.1234 × 0.00001 == Ask)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi
i'm new on mql4 and stuck with error 130 becuase of 'invalid stops.' i place my stops as multiples of the stoploss value in order to enhance my risk to reward ratio. when i use fixed pip values for my stops i don't receive such error but becuase volatility can change anytime in the market i do not want to use fixed stops like 50pips for takeprofit and 15pips for SL. kindly help me convert the follow code into price in order to stop this erro 130.
in the code my Takeprofit for a buy trade is 5x Stoploss. in the code my stoploss is predetermined below or above the cuurent fractal before the position was opened. when im testing it, some of the orders go through but majority of them return error 130. i know this topic is supposed to be on Mql4 forum but whenever i open the link it directs me here.