This question is for when the volatility is high OR execution time of server and computer is high OR when the internet speed is low.
For "Market Execution" policy , used by ECN/STP/NDD brokers, you can NEVER avoid slippage. You can only:
- Wait for a more favourable price condition, and then place your order, or ...
- Try to adjust your trading to compensate for it as best you can.
For "Market Execution" policy , used by ECN/STP/NDD brokers, you can NEVER avoid slippage. You can only:
- Wait for a more favourable price condition, and then place your order, or ...
- Try to adjust your trading to compensate for it as best you can.
My main question is : set the price by code :
myrequest.price = ...//(Ask or Bid)
in Fill or Kill method affects the Function or in anyway the position will open?
If giving price to the function is maintained by the function, the position will not open if the price changes more than slippage allowed.
And it's good , Because rejecting by market is better than opening position with big slippage.
Thanks.
As I have already explained, for "Market Execution" policy, the opening price is ignored and you will get whatever price is available at the time.
With "Instant Execution" policy, then the price is important and if it deviates too far away from the current price, you will get a "requote" error.
Remember that Buy orders open at the Ask price and close at the Bid price, and Sell orders open at the Bid price and close at the Ask price.
EDIT: Also read the following:
- Instant Execution Policy
- Market Execution Policy
- Request Execution Policy (I know nothing about this one. I've never encountered it before)
- Exchange Execution Policy (I also have no experience with this one)
Hello Friends ,I have a question in mq5 EA coding:
How could I open position when the price = A .
without using Pending (limit / stop) order...
I mean instantly , and let Max Slippage = 1 pip for example ... And avoid more slippage
This question is for when the volatility is high OR execution time of server and computer is high OR when the internet speed is low.
Here is my Code:
Is :
Works or not?
Thanks a lot.
//+------------------------------------------------------------------+ //| EATest.mq5 | //| Copyright 2021, Haskaya | //| https://www.haskayayazilim.net | //+------------------------------------------------------------------+ #property copyright "Copyright 2021, Haskaya" #property link "https://www.haskayayazilim.net" #property version "1.00" //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { double lots=0.10; double TheTP=300;// 30 Pips double TheSL=400; int slip=30; string commentID=" Deneme"; ulong MgcNumber=99243; MqlTick last_tick={}; SymbolInfoTick(_Symbol,last_tick); // BUY Orders OpenPosition(Symbol(),ORDER_TYPE_BUY, last_tick.bid,lots, TheTP, TheSL, slip, commentID, MgcNumber); // SELL Orders OpenPosition(Symbol(),ORDER_TYPE_SELL, last_tick.ask, lots, TheTP, TheSL, slip, commentID, MgcNumber); ExpertRemove();// exit EA } //+------------------------------------------------------------------+ void OpenPosition(string symbol, ENUM_ORDER_TYPE OrdType, double op_price, double lots, double TheTP, double TheSL, int slip, string commentID, ulong MgcNumber) { MqlTradeRequest myrequest; MqlTradeResult myresult; ZeroMemory(myrequest); ZeroMemory(myresult); myrequest.type = OrdType; myrequest.price = op_price; myrequest.action = TRADE_ACTION_DEAL; myrequest.symbol = symbol; //myrequest.type_filling = OrderFilling; myrequest.comment = commentID; myrequest.magic = MgcNumber; myrequest.volume = lots; if(OrdType==ORDER_TYPE_BUY) { myrequest.tp = op_price+TheTP*SymbolInfoDouble(symbol,SYMBOL_POINT); myrequest.sl = op_price-TheSL*SymbolInfoDouble(symbol,SYMBOL_POINT); } if(OrdType==ORDER_TYPE_SELL) { myrequest.tp = op_price-TheTP*SymbolInfoDouble(symbol,SYMBOL_POINT); myrequest.sl = op_price+TheSL*SymbolInfoDouble(symbol,SYMBOL_POINT); } myrequest.deviation = slip; int aord = OrderSend(myrequest, myresult); if(GetLastError()!=0) Print(" Error Codes is :"+ string(GetLastError())+" "); } //////////////// //Is : myrequest.price = op_price; >>> Works or not?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello Friends ,I have a question in mq5 EA coding:
How could I open position when the price = A .
without using Pending (limit / stop) order...
I mean instantly , and let Max Slippage = 1 pip for example ... And avoid more slippage
This question is for when the volatility is high OR execution time of server and computer is high OR when the internet speed is low.
Here is my Code:
Is :
Works or not?
Thanks a lot.