Why mql5 don't have and ORDERCLOSE function like mql4 and have a library for that?
is there is a reason?
To get started, read the help: Basic Principles
Before you proceed to study the trade functions of the platform, you must have a clear understanding of the basic terms: order, deal and position.
- An order is an instruction given to a broker to buy or sell a financial instrument. There are two main types of orders: Market and Pending. In addition, there are special Take Profit and Stop Loss levels.
- A deal is the commercial exchange (buying or selling) of a financial security. Buying is executed at the demand price (Ask), and Sell is performed at the supply price (Bid). A deal can be opened as a result of market order execution or pending order triggering. Note that in some cases, execution of an order can result in several deals.
- A position is a trade obligation, i.e. the number of bought or sold contracts of a financial instrument. A long position is financial security bought expecting the security price go higher. A short position is an obligation to supply a security expecting the price will fall in future.
And to open and close positions you need to use the standard library and trading class CTrade
Operations with positions
Opens a position with specified parameters
Modifies position parameters by the specified symbol or position ticket
Closes a position for the specified symbol
Partially closes a position on a specified symbol or having a specified ticket
Closes a position with the specified ticket by an opposite position
Example script: it opens a BUY position. In this case, you can set Stop loss and Take profit.
- www.metatrader5.com
Why mql5 don't have and ORDERCLOSE function like mql4 and have a library for that?
#property script_show_inputs #include <MT4Orders.mqh> // https://www.mql5.com/en/code/16006 input TICKET_TYPE TicketToClose = 0; void OnStart() { if (OrderSelect(TicketToClose, SELECT_BY_TICKET) && (OrderType() <= OP_SELL)) OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 0); }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Why mql5 don't have and ORDERCLOSE function like mql4 and have a library for that?
is there is a reason?