Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1036
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
You write"A closed position (this is when there is no position and it is useless to talk about it as something tangible - there is no position) - the result of the execution of a deal to exit the market". It turns out that there is no such single entity in the history, but there is a set of events - order->trade (opening), order->trade (closing) and it all has no single name.
I just can't solve a trivial problem - I need to refer to this last entity (by tickit probably) and collect information about it - opening/closing time, volume, etc. Suppose that this something was opened by one order and closed by one order too. So, we should take the last two orders from HistoryOrderTotal and use them for some analysis? What if the ticket types are different...
How such a reference to the history is solved in practice?
Try to understand the structure of MqlTradeTransaction. After getting the last order or deal from the history, we can collect in an array all of the orders and/or deals that took part in the formation of the position. Thus, all of the information about the position can be gathered from these deals.
You write"A closed position (this is when there is no position and it is useless to talk about it as something tangible - there is no position) - the result of an exit trade". It turns out that there is no such single entity in the history, but there is a set of events - order->trade (opening), order->trade (closing) and it all has no single name.
I just can't solve a trivial problem - I need to access this last entity (by tickit probably) and collect information about it - opening/closing time, volume, etc. Suppose that this something was opened by one order and closed by one order too. So, we should take the last two orders from HistoryOrderTotal and use them for some analysis? But what if the tickets are different...
How would such a reference to the history be implemented in practice?
The position identifier is always equal to the ticket of its very first order - the order to open this position, and during the time of its existence it (identifier) never changes (unlike tickets). So, in order to find all orders and deals of a certain position, look for it by its identifier - they will all exactly belong to the position you are looking for.
The order has ORDER_POSITION_ID, the deal has DEAL_POSITION_ID, and the position has POSITION_IDENTIFIER
The position identifier is always equal to the ticket of its very first order - the order to open this position, and during the time of its existence it (identifier) never changes (unlike tickets). Therefore, in order to find all of the orders and deals of a certain position, look for them by their position identifier - they will all exactly belong to the position sought.
The order has an ORDER_POSITION_ID, the deal has a DEAL_POSITION_ID, and the position has a POSITION_IDENTIFIER.
Try to understand the structure of MqlTradeTransaction. By getting the last order or deal from the history, we can collect all orders and/or deals that were involved in the formation of the position in an array. Thus, all information about the position can be gathered from these deals.
If you give me a link to the example of implementation of this Stop Loss, it is all written cleverly, but in practice we mere mortals do not understand.
Use the MQL5 Wizard to generate any Expert Advisor. When selecting options, check that Trailing is required. This will give you an example.
Use the MQL5 Wizard to generate any Expert Advisor. When selecting options, check that Trailing is required. This will give you an example.
Hello!
There is a draw_none drawing style, the buffer is displayed in the data window, but is not drawn on the chart.
Is there a reverse property, it is not displayed in the data window, but is displayed on the graph?
Hello!
There is a draw_none drawing style, the buffer is displayed in the data window, but is not drawn on the chart.
There is a reverse property, it is not displayed in the data window, but it is displayed on the chart?
There are. PLOT_SHOW_DATA.