Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
SL=Ask + New_Stop(StopLoss)*Point; // Calculating SL of opened TP=Ask - New_Stop(TakeProfit)*Point; // Calculating TP of opened
You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit by 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 at 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 shows average spread = 26 points, average maximum spread = 134.
My EURCHF shows average spread = 18 points, average maximum spread = 106.
(your broker will be similar).
Is it reasonable to have such a huge spreads (20 PIP spreads) in EURCHF? - General - MQL5 programming forum (2022)
You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit by 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 at 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 shows average spread = 26 points, average maximum spread = 134.
My EURCHF shows average spread = 18 points, average maximum spread = 106.
(your broker will be similar).
Is it reasonable to have such a huge spreads (20 PIP spreads) in EURCHF? - General - MQL5 programming forum (2022)
Hi, thank for your reply.
Maybe I expressed the concept bad, my fault. As you can see from the attachment, the position looks closed automatically some instant after the opening. This is the bad behaviour that I want to fix, reverting the OP_BYULIMIT to OP_BUY the code close the position as expected. Some idea?
NormalizeDouble(Bid-TS*Point,Digits))
PIP, Point, or Tick are all different in general.
Ticks, PIPs or points in the GUI. Make up your mind. - MQL4 programming forum #1 (2014)
Percentage in point - Wikipedia
Unless you manually adjust your SL/TP for each separate symbol, using Point means code breaks on 4 digit brokers (if any still exists), exotics (e.g. USDZAR where spread is over 500 points), and metals. Compute what a logical PIP is and use that, not points.
How to manage JPY pairs with parameters? - MQL4 programming forum (2017)
Slippage defined in index points - Expert Advisors and Automated Trading - MQL5 programming forum (2018)
- 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 developing this mql4 EA, long story short, I´m stuck trying to place a pending order when all the condition are satisfied, and with an open price 10 pips less that the Ask value when all the condition are satisfied.
The EA works well until the opening price is "Ask". I did a couple of try modifing "Ticket=OrderSend(Symb,OP_BUY,Lts,Ask,2,SL,TP)" with "Ticket=OrderSend(Symb,OP_BUYLIMIT,Lts,"New variable for opening 10 pips less than Ask",2,SL,TP)" and the position is opened as expected but the closing no, basically the trade is close late and with a logic that I cannot understand actually.
Someone have an idea how to fix it? Or a better way to implement my idea?
Thanks