-
if(OrderType()==OP_BUYSTOP)
There is no need to create pending orders in code.
-
The pending has the slight advantage, A) you are closer to the top of the queue (filled quicker), B) there's no round trip network delay (filled quicker.)
Don't worry about it unless you're scalping M1 or trading news.
-
Humans can't watch the screen 24/7, so they use pending orders; EAs can, so no need for pending orders, have it wait until the market reaches the trigger price and just open an order.
-
-
double BuyStopTrail=NormalizeDouble(OrderOpenPrice()-PendingStopTrail*Pips(),Digits); ⋮ if(BuyStopTrail>OrderOpenPrice())
When can OOP-n ever be greater than OOP?
-
if(OrderOpenPrice()-Ask>FreezeLevel*Pips())
OOP-Ask is a negative number.
-
There is no need to create pending orders in code.
-
The pending has the slight advantage, A) you are closer to the top of the queue (filled quicker), B) there's no round trip network delay (filled quicker.)
Don't worry about it unless you're scalping M1 or trading news.
-
Humans can't watch the screen 24/7, so they use pending orders; EAs can, so no need for pending orders, have it wait until the market reaches the trigger price and just open an order.
-
-
When can OOP-n ever be greater than OOP?
-
OOP-Ask is a negative number.
I got this from the mql4 documentation:
if(OrderOpenPrice()-Ask>FreezeLevel*Pips())
should I try change it to Bid?
I don't get a different price anymore I get the price that suppose to be the trailed price. The problem I encounter is Order modify error 1, do I need to put the pending trail under my ordersend of my stops (buy stops & sell stops) or I need to change my if statement of pending stops.
void PendingTrail() { double BuyPrice=Bid+PendingStopTrail*Pips(); double SellPrice=Bid-PendingStopTrail*Pips(); double BuySL=Bid-StopLoss*Pips(); double SellSL=Bid+StopLoss*Pips(); for(int i=OrdersTotal()-1;i>=0;i--) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber) if(OrderType()==OP_BUYSTOP) if(OrderOpenPrice()-Bid>PendingStopTrail*Pips()) if(OrderOpenPrice()-Bid>FreezeLevel*Pips()) { bool ModBuy=OrderModify(OrderTicket(),Bid+PendingStopTrail*Pips(),BuySL,0,0,clrNONE); Print("ErrorCode:",GetLastError()); } } for(int i=OrdersTotal()-1;i>=0;i--) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber) if(OrderType()==OP_SELLSTOP) if(Bid-OrderOpenPrice()>PendingStopTrail*Pips()) if(Bid-OrderOpenPrice()>FreezeLevel*Pips()) { bool ModSell=OrderModify(OrderTicket(),Bid-PendingStopTrail*Pips(),SellSL,0,0,clrNONE); Print("ErrorCode:",GetLastError()); } }
- Scalper8 #: The problem I encounter is Order modify error 1,
If you had used this, you would have found many threads: ERR_NO_RESULT
You Server Change the SL to X It is at X! Change the SL to X It is at X! Change the SL to X You are insane Insanity: doing the same thing over and over again and expecting different results.
UnknownCompute the new value, then check that you are moving the existing value at least a tick (in the currect direction).
What is a TICK? - MQL4 programming forum (2014) -
double BuyPrice=Bid+PendingStopTrail*Pips(); double SellPrice=Bid-PendingStopTrail*Pips(); double BuySL=Bid-StopLoss*Pips(); double SellSL=Bid+StopLoss*Pips();
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 -
Prices (open, SL, and TP) must be a multiple of ticksize. 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) -
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)
-
-
There is no need to create pending orders in code.
-
The pending has the slight advantage, A) you are closer to the top of the queue (filled quicker), B) there's no round trip network delay (filled quicker.)
Don't worry about it unless you're scalping M1 or trading news.
-
Humans can't watch the screen 24/7, so they use pending orders; EAs can, so no need for pending orders, have it wait until the market reaches the trigger price and just open an order.
-
-
If you had used this, you would have found many threads: ERR_NO_RESULT
You Server Change the SL to X It is at X! Change the SL to X It is at X! Change the SL to X You are insane Compute the new value, then check that you are moving the existing value at least a tick (in the currect direction).
What is a TICK? - MQL4 programming forum (2014) -
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 -
Prices (open, SL, and TP) must be a multiple of ticksize. 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) -
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)
-
-
There is no need to create pending orders in code.
-
The pending has the slight advantage, A) you are closer to the top of the queue (filled quicker), B) there's no round trip network delay (filled quicker.)
Don't worry about it unless you're scalping M1 or trading news.
-
Humans can't watch the screen 24/7, so they use pending orders; EAs can, so no need for pending orders, have it wait until the market reaches the trigger price and just open an order.
-
I'll take notes and insert it on my code, I've searched through MQL4 forum and I came across this function to add my trailing and I don't get order modify error 1 anymore.
double MinToModify=1; double FinalToMod=MinToModify*PendingStopTrail*Pips();
if(OrderOpenPrice()-Bid>PendingStopTrail*Pips()+FinalToMod) { /////modify buy pending } if(Bid-OrderOpenPrice()>PendingStopTrail*Pips()+FinalToMod) { /////modify sell pending }

- 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 All
I have a problem with my pending stop trail, as soon as I drop my EA. The pending stop trail's but give's me a different price instead of a new trailed price.
Here is the Image below:
As for my code:
Please help if you know the problem to this