- Questions from Beginners MQL4 MT4 MetaTrader 4
- Getting Error - no one of the overloads can be applied to the function call
- ea close position in loss with magic number
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Please, don't request help for ChatGPT (or other A.I.) generated code. It generates horrible code. Please consider using the Freelance section for such requests.
If you can find coding instruction in the reference documentation and MQL5 Programming Book:
I also recommend that you read the following too ...
Orders, Positions and Deals in MetaTrader 5
MetaQuotes, 2011.02.01 16:13
Creating a robust trading robot cannot be done without an understanding of the mechanisms of the MetaTrader 5 trading system. The client terminal receives the information about the positions, orders, and deals from the trading server. To handle this data properly using the MQL5, it's necessary to have a good understanding of the interaction between the MQL5-program and the client terminal.
Don't double post! You already had this thread open. Your other post has been deleted.
General rules and best pratices of the Forum. - General - MQL5 programming forum #6 (2017)-
// THIS IS THE FUNCTION THAT NEEDS CORRECT CODE
Show us your attempt (using the CODE button) and state the nature of your difficulty.
No free help (2017)Or pay someone. Top of every page is the link Freelance.
Hiring to write script - General - MQL5 programming forum (2018)We're not going to code it for you (although it could happen if you are lucky or the issue is interesting).
No free help (2017) -
// Forward declaration void DeletePendingOrders();
Unnecessary for function calls.
-
if(serverTime.hour == 0 && serverTime.min == 0) { ordersPlacedToday = false; }
What if there are no ticks during that specific period? There can be minutes between ticks during the Asian session.
"Free-of-Holes" Charts - MQL4 Articles (2006)
No candle if open = close ? - MQL4 programming forum (2010) -
double buyPrice = NormalizeDouble(asiaHigh + distance, _Digits); ⋮ double sellTP = NormalizeDouble(sellPrice - (rangeSize * Take_Profit_Multiplier), _Digits);
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)
-
-
You used NormalizeDouble, Its use is usually wrong, as it is in your case.
-
Floating point has an infinite number of decimals, it's you were not understanding floating point and that some numbers can't be represented exactly. (like 1/10.)
Double-precision floating-point format - Wikipedia, the free encyclopediaSee also The == operand. - MQL4 programming forum (2013)
-
Print out your values to the precision you want with DoubleToString - Conversion Functions - MQL4 Reference.
-
SL/TP (stops) need to be normalized to tick size (not Point) — code fails on non-currencies.
On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 programming forum #10 (2011)And abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 programming forum (2012)
-
Open price for pending orders need to be adjusted. On Currencies, Point == TickSize, so you will get the same answer, but it won't work on non-currencies. So do it right.
Trailing Bar Entry EA - MQL4 programming forum (2013)
Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 programming forum (2012) -
Lot size must also be adjusted to a multiple of LotStep and check against min and max. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.
(MT4 2013)) (MT5 2022)) -
MathRound() and NormalizeDouble() are rounding in a different way. Make it explicit.
MT4:NormalizeDouble - MQL5 programming forum (2017)
How to Normalize - Expert Advisors and Automated Trading - MQL5 programming forum (2017) -
Prices (and lots) you get from the terminal are already correct (normalized).
-
PIP, Point, or Tick are all different in general.
What is a TICK? - MQL4 programming forum (2014)
-
// THIS IS THE BROKEN FUNCTION void DeletePendingOrders() { for(int i = OrdersTotal() - 1; i >= 0; i--) { ulong ticket = OrderGetTicket(i); // Select the order by its ticket to work with it if(OrderSelect(ticket)) { // THIS LINE CAUSES THE ERROR if(OrderGetInteger(ORDER_PROP_MAGIC) == Magic_Number) { trade.OrderDelete(ticket); } } } }
Thank you for the detailed feedback on the overall code. I will review those points.
My primary problem right now is a specific compiler error in the DeletePendingOrders function that I have been unable to solve. The error message says 'no one of the overloads can be applied to the function call' for OrderGetInteger .
This is the specific function that is failing. Could you please show me the correct MQL5 syntax for this?
Violation of Terms and Conditions — 12.13. The User shall use only one unique MQL5 ID on the www.mql5.com website — https://www.mql5.com/en/about/terms
Don't create new account (i.e. Jacintha Jacott) only to just post the same code and asking a follow-up question. I have banned your other account.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use