If, suddenly, MQ decide to give access to commissions in the trading platform (this year 18 years since the beginning of development), the script will show it at once....
Has such a script been published? Try fixing DealToString, we'll discuss it. I don't understand at all what we are talking about.
Okay. Never posted.
Someone else did.
voidOnStart()
{
Print(SymbolToString());
}
Well, we're not suckers, we know how to use analogies. But here's the catch, the analogy doesn't work. Not good.
And seriously, I don't understand how to use your code to print all the fields of a transaction.
Let's take an example of a specific task. Let's say we have saved a ticket of a deal in the Expert Advisor and after some time we need to print out everything related to this deal.
HistoryDealSelect is the right way to do it, and you say that it is a mauvais thing to do. How would it not be mauvais?
//+------------------------------------------------------------------+//| Prints the account specification to the Experts tab. |//+------------------------------------------------------------------+void PrintAccount()
{
if(AccountInfoInteger(ACCOUNT_LOGIN))
{
PROPERTIES1(AccountInfoInteger,ENUM_ACCOUNT_INFO_INTEGER);
PROPERTIES1(AccountInfoDouble,ENUM_ACCOUNT_INFO_DOUBLE);
PROPERTIES1(AccountInfoString,ENUM_ACCOUNT_INFO_STRING);
}
}
Terminal info:
//+------------------------------------------------------------------+//| Prints the terminal properties to the Experts tab. |//+------------------------------------------------------------------+void PrintTerminal()
{
if(TerminalInfoString(TERMINAL_COMPANY)!="")
{
PROPERTIES1(TerminalInfoInteger,ENUM_TERMINAL_INFO_INTEGER);
PROPERTIES1(TerminalInfoDouble,ENUM_TERMINAL_INFO_DOUBLE);
PROPERTIES1(TerminalInfoString,ENUM_TERMINAL_INFO_STRING);
}
}
Chart info:
//+------------------------------------------------------------------+//| Prints the chart properties to the Experts tab. |//+------------------------------------------------------------------+void PrintChart(constlong chart_id) // 0 means the current chart
{
if(ChartSymbol(chart_id)!="")
{
PROPERTIES2(ChartGetInteger,chart_id,ENUM_CHART_PROPERTY_INTEGER);
PROPERTIES2(ChartGetDouble,chart_id,ENUM_CHART_PROPERTY_DOUBLE);
PROPERTIES2(ChartGetString,chart_id,ENUM_CHART_PROPERTY_STRING);
}
}
Symbol info:
//+------------------------------------------------------------------+//| Prints the symbol specification to the Experts tab. |//+------------------------------------------------------------------+void PrintSymbol(conststring symbol)
{
Print(Symbol(),", ",SymbolInfoString(Symbol(),SYMBOL_DESCRIPTION));
if(SymbolSelect(symbol,true))
{
PROPERTIES2(SymbolInfoInteger,symbol,ENUM_SYMBOL_INFO_INTEGER);
PROPERTIES2(SymbolInfoDouble,symbol,ENUM_SYMBOL_INFO_DOUBLE);
PROPERTIES2(SymbolInfoString,symbol,ENUM_SYMBOL_INFO_STRING);
}
}
Positions and deals:
//+------------------------------------------------------------------+//| Prints the position properties to the Experts tab. |//+------------------------------------------------------------------+void PrintPosition(constulong pos_ticket)
{
if(PositionSelectByTicket(pos_ticket))
{
PROPERTIES1(PositionGetInteger,ENUM_POSITION_PROPERTY_INTEGER);
PROPERTIES1(PositionGetDouble,ENUM_POSITION_PROPERTY_DOUBLE);
PROPERTIES1(PositionGetString,ENUM_POSITION_PROPERTY_STRING);
}
}
//+------------------------------------------------------------------+//| Prints the history deal properties to the Experts tab. |//+------------------------------------------------------------------+void PrintDeal(constulong deal_ticket)
{
if(HistoryDealSelect(deal_ticket))
{
PROPERTIES2(HistoryDealGetInteger,deal_ticket,ENUM_DEAL_PROPERTY_INTEGER);
PROPERTIES2(HistoryDealGetDouble,deal_ticket,ENUM_DEAL_PROPERTY_DOUBLE);
PROPERTIES2(HistoryDealGetString,deal_ticket,ENUM_DEAL_PROPERTY_STRING);
}
}
Orders:
//+------------------------------------------------------------------+//| Prints the order properties to the Experts tab. |//+------------------------------------------------------------------+void PrintOrder(constulong order_ticket)
{
if(OrderSelect(order_ticket))
{
PROPERTIES1(OrderGetInteger,ENUM_ORDER_PROPERTY_INTEGER);
PROPERTIES1(OrderGetDouble,ENUM_ORDER_PROPERTY_DOUBLE);
PROPERTIES1(OrderGetString,ENUM_ORDER_PROPERTY_STRING);
}
}
//+------------------------------------------------------------------+//| Prints the history order properties to the Experts tab. |//+------------------------------------------------------------------+void PrintHistoryOrder(constulong order_ticket)
{
if(HistoryOrderSelect(order_ticket))
{
PROPERTIES2(HistoryOrderGetInteger,order_ticket,ENUM_ORDER_PROPERTY_INTEGER);
PROPERTIES2(HistoryOrderGetDouble,order_ticket,ENUM_ORDER_PROPERTY_DOUBLE);
PROPERTIES2(HistoryOrderGetString,order_ticket,ENUM_ORDER_PROPERTY_STRING);
}
}
//+------------------------------------------------------------------+//| Prints the history deal properties to the Experts tab. |//+------------------------------------------------------------------+void PrintDeal(constulong deal_ticket)
{
if(HistoryDealSelect(deal_ticket))
{
PROPERTIES2(HistoryDealGetInteger,deal_ticket,ENUM_DEAL_PROPERTY_INTEGER);
PROPERTIES2(HistoryDealGetDouble,deal_ticket,ENUM_DEAL_PROPERTY_DOUBLE);
PROPERTIES2(HistoryDealGetString,deal_ticket,ENUM_DEAL_PROPERTY_STRING);
}
}
//+------------------------------------------------------------------+//| Prints the history order properties to the Experts tab. |//+------------------------------------------------------------------+void PrintHistoryOrder(constulong order_ticket)
{
if(HistoryOrderSelect(order_ticket))
{
PROPERTIES2(HistoryOrderGetInteger,order_ticket,ENUM_ORDER_PROPERTY_INTEGER);
PROPERTIES2(HistoryOrderGetDouble,order_ticket,ENUM_ORDER_PROPERTY_DOUBLE);
PROPERTIES2(HistoryOrderGetString,order_ticket,ENUM_ORDER_PROPERTY_STRING);
}
}
The maximum you can put in a function, but I wouldn't recommend doing that.
if (HistoryDealGetInteger(Ticket, DEAL_TICKET) != Ticket)HistoryDealSelect(Ticket);
Example of viciousness.
voidOnStart()
{
if (HistorySelect(0, INT_MAX))
{
constint Total = HistoryDealsTotal();
for (int i = MathMax(Total - 5, 0); i < Total; i++)
PrintDeal(HistoryDealGetTicket(i));
}
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Sometimes you need to look at all the properties of a symbol, chart, position, order, historical trade/order, etc.
There are a ton of property values that can be added, removed, etc.
Basically, you can succinctly get the values of these properties through such a preset.
Application.
This is how we get all the values of a symbol.
This way - transactions.
In general, the principle should be clear.
Result.
This is how it will be with the symbol.
If, suddenly, MQ decide to give access to commissions in the trading platform (this year 18 years since the beginning of development), the script will show it at once....
// All properties of the deal into a string. string DealToString( const long Ticket )
With and without HistoryDealSelect( Ticket ) different results, I checked.
With and without HistoryDealSelect( Ticket ) different results, checked.
Placing a transaction in the available history table and printing transaction properties are functionalities that do not overlap.
Running the script without HistoryDealSelect()
I add HistoryDealSelect() and run the script
The worst thing you can do in the function of printing a deal is to put HistoryDealSelect into it.
The worst thing you can do in a transaction printout function is to put a HistoryDealSelect in it.
What do you suggest?
To be satisfied with zeros in the printout?
The script prints zeros in this form
If HistoryDealSelect is uncommented, it prints all fields correctly.
Forum on trading, automated trading systems and testing trading strategies
Features of mql5 language, subtleties and techniques of work
Aleksandr Slavskii, 2025.02.13 13:18
The script prints zeros in this form
If HistoryDealSelect is uncommented, it prints all fields correctly.
Has such a script been published? Try to fix DealToString, we'll discuss it. It is not clear to me at all what we are talking about.
Has such a script been published? Try fixing DealToString, we'll discuss it. I don't understand at all what we are talking about.
Okay. Never posted.
Someone else did.
Well, we're not suckers, we know how to use analogies. But here's the catch, the analogy doesn't work. Not good.
And seriously, I don't understand how to use your code to print all the fields of a transaction.
Let's take an example of a specific task. Let's say we have saved a ticket of a deal in the Expert Advisor and after some time we need to print out everything related to this deal.
HistoryDealSelect is the right way to do it, and you say that it is a mauvais thing to do. How would it not be mauvais?how would that not be considered voguish?
Like in the script above.
At most, you can insert it into a function, but I wouldn't recommend it.
Sometimes you need to look at all the properties of a symbol, chart, position, order, historical trade/order, etc.
There are a ton of property values that can be added, removed, etc.
Here is my attempt using these 2 little macros:
Getting a ton of information from the platform:
Terminal info:
Chart info:
Symbol info:
Positions and deals:
Orders:
Print enumerations:
Test script:
Forum on trading, automated trading systems and testing trading strategies
Peculiarities of mql5 language, subtleties and techniques of work
amrali, 2025.02.14 05:37
Have done exactly what I warned about.
Forum on trading, automated trading systems and testing trading strategies
Peculiarities of mql5 language, subtleties and techniques of work
fxsaber, 2025.02.13 13:08
The worst thing you can do in the function of printing a deal is to put HistoryDealSelect in it.
Even that is not done.
Forum on trading, automated trading systems and testing trading strategies
Features of the mql5 language, subtleties and techniques of work
fxsaber, 2025.02.13 14:35
The maximum you can put in a function, but I wouldn't recommend doing that.
Example of viciousness.
Architecture.
Forum on trading, automated trading systems and testing trading strategies
Peculiarities of mql5 language, subtleties and techniques of work
fxsaber, 2025.02.13 10:23 AM
Putting a trade into the available history table and printing out the properties of a trade are functionalities that do not overlap.