English Русский Español Deutsch 日本語 Português
preview
StringFormat(). 回顾和现成的例子

StringFormat(). 回顾和现成的例子

MetaTrader 5示例 | 12 二月 2024, 14:38
389 0
Artyom Trishkin
Artyom Trishkin

目录


概述

当使用PrintFormat()记录结构化和格式化的信息时,我们只需根据指定的格式格式化数据,并将其显示在终端日志中。这种格式化的信息不再可供后续使用。要再次显示它,我们需要再次使用PrintFormat()进行格式化。一旦将数据格式化为所需类型,就能够重用数据,这将是一件好事。实际上,存在这样一种可能性——StringFormat()函数。与PrintFormat()不同,它只是将数据打印到日志中,此函数返回一个格式化的字符串。这允许我们在程序中进一步使用此字符串。换句话说,格式化为所需形式的数据不会丢失,这要方便得多。您可以将格式化的字符串保存到变量或数组中,并将它们重复使用。它更加灵活方便。

当前的文章不是教育性的,而是一个扩展的参考资料,重点在于现成的函数模板。


StringFormat(). 汇总

函数的作用是格式化接收到的参数并返回格式化后的字符串。字符串格式设置规则与PrintFormat()函数完全相同。在“研究PrintFormat()并应用现成的示例”一文中详细探讨了这些问题。首先传递带有文本和格式说明符的字符串,然后传递逗号分隔的必要数据,这些数据应替换字符串中的说明符。每个说明符都必须按照严格的顺序拥有自己的数据集。

该函数允许在程序中重用格式化的字符串,我们将在创建用于向日志显示符号属性的模板时使用此功能。我们将为每个属性创建两个函数:第一个函数将格式化并返回字符串,而第二个函数将在日志中打印结果字符串。


格式化字符串

为了熟悉格式化字符串的规则,您可以阅读关于PrintFormat()的文章中关于所有说明符的部分。为了阐明指示数据大小的说明符的操作(h|l|ll|I32|I64),您可以使用此脚本,它清楚地显示了不同大小的数据输出之间的差异:

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   long x = (long)0xFFFFFFFF * 1000;

   Print("\nDEC: ",  typename(x)," x=",x,"\n---------");
   Print("%hu: ",  StringFormat("%hu",x));
   Print("%u: ",   StringFormat("%u",x));
   Print("%I64u: ",StringFormat("%I64u",x));
   Print("%llu: ", StringFormat("%llu",x));
   Print("\nHEX: ",  typename(x)," x=",StringFormat("%llx",x),"\n---------");
   Print("%hx: ",  StringFormat("%hx",x));
   Print("%x: ",   StringFormat("%x",x));
   Print("%I64x: ",StringFormat("%I64x",x));
   Print("%llx: ", StringFormat("%llx",x));

  }

Result:

2023.07.12 17:48:12.920 PrinFormat (EURUSD,H1)  DEC: long x=4294967295000
2023.07.12 17:48:12.920 PrinFormat (EURUSD,H1)  ---------
2023.07.12 17:48:12.920 PrinFormat (EURUSD,H1)  %hu: 64536
2023.07.12 17:48:12.920 PrinFormat (EURUSD,H1)  %u: 4294966296
2023.07.12 17:48:12.920 PrinFormat (EURUSD,H1)  %I64u: 4294967295000
2023.07.12 17:48:12.920 PrinFormat (EURUSD,H1)  %llu: 4294967295000
2023.07.12 17:48:12.920 PrinFormat (EURUSD,H1)  
2023.07.12 17:48:12.920 PrinFormat (EURUSD,H1)  HEX: long x=3e7fffffc18
2023.07.12 17:48:12.920 PrinFormat (EURUSD,H1)  ---------
2023.07.12 17:48:12.920 PrinFormat (EURUSD,H1)  %hx: fc18
2023.07.12 17:48:12.920 PrinFormat (EURUSD,H1)  %x: fffffc18
2023.07.12 17:48:12.920 PrinFormat (EURUSD,H1)  %I64x: 3e7fffffc18
2023.07.12 17:48:12.920 PrinFormat (EURUSD,H1)  %llx: 3e7fffffc18

这可能是关于PrintFormat()的文章中没有完全涵盖的唯一说明符。


交易品种属性的格式化输出

对于本文,我们需要为每个交易品种属性编写两个函数。第一个函数将字符串格式化为打印所需的形式,第二个函数将第一个函数接收的字符串打印到日志中。为了遵循关于PrintFormat()的文章中采用的字符串格式化的相同原理,我们还将从左边缘和头字段的宽度向每个函数传递字符串缩进。通过这种方式,我们将维护日志帐户和交易品种属性的统一格式。

为了获得以毫秒为单位的时间,让我们创建一个函数,该函数返回一个日期-时间中包含时间的字符串。Msc格式基于上一篇关于PrintFormat()的文章中讨论的函数

//+------------------------------------------------------------------+
//| Accept a date in ms, return time in Date Time.Msc format         |
//+------------------------------------------------------------------+
string TimeMSC(const long time_msc)
  {
   return StringFormat("%s.%.3hu",string((datetime)time_msc / 1000),time_msc % 1000);
   /* Sample output:
   2023.07.13 09:31:58.177
   */
  }

与之前创建的函数不同,这里我们将只返回字符串中的日期和时间(以毫秒为单位)。其余的格式化将在以这种时间格式显示数据的函数中完成。

因此,让我们按以下顺序开始:整数、实数和字符串符号属性。函数将按照交易品种属性文档部分中设置的顺序进行设置。


接收并显示交易品种 ENUM_SYMBOL_INFO_INTEGER 的整数属性

数据延迟 (SYMBOL_SUBSCRIPTION_DELAY)

交易品种数据延迟到达,只能为在市场报价中选择的交易品种请求这个属性(SYMBOL_SELECT=<s0>true</s0>),对于其它交易品种会产生 ERR_MARKET_NOT_SELECTED (4302) 的错误。

返回带标题的属性的字符串值。对于格式化的字符串,可以指定标题字段的左边距和宽度:

//+------------------------------------------------------------------+
//| Return the flag                                                  |
//} of symbol data latency as a string                               |
//+------------------------------------------------------------------+
string SymbolSubscriptionDelay(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Create a variable to store the error text
   //string error_str;
//--- If symbol does not exist, return the error text
   if(!SymbolInfoInteger(symbol,SYMBOL_EXIST))
      return StringFormat("%s: Error. Symbol '%s' is not exist",__FUNCTION__,symbol);
//--- If a symbol is not selected in MarketWatch, try to select it
   if(!SymbolInfoInteger(symbol,SYMBOL_SELECT))
     {
      //--- If unable to select a symbol in MarketWatch, return the error text
      if(!SymbolSelect(symbol,true))
         return StringFormat("%s: Failed to select '%s' symbol in MarketWatch. Error %lu",__FUNCTION__,symbol,GetLastError());
     }
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Subscription Delay:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,(bool)SymbolInfoInteger(symbol,SYMBOL_SUBSCRIPTION_DELAY) ? "Yes" : "No");
   /* Sample output:
      Subscription Delay: No
   */
  }

这里,在请求数据之前,首先检查这种交易品种的存在,然后,如果存在检查成功,则在市场报价窗口中选择该交易品种。如果没有这样的交易品种,或者无法选择它,函数将返回错误文本。

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the flag                                                 |
//| of the symbol data latency in the journal                        |
//+------------------------------------------------------------------+
void SymbolSubscriptionDelayPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSubscriptionDelay(symbol,header_width,indent));
  }


经济部门 (SYMBOL_SECTOR)

交易品种所属的经济部门。

//+------------------------------------------------------------------+
//| Return the economic sector as a string                           |
//| a symbol belongs to                                              |
//+------------------------------------------------------------------+
string SymbolSector(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Get the value of the economic sector
   ENUM_SYMBOL_SECTOR symbol_sector=(ENUM_SYMBOL_SECTOR)SymbolInfoInteger(symbol,SYMBOL_SECTOR);
//--- "Cut out" the sector name from the string obtained from enum
   string sector=StringSubstr(EnumToString(symbol_sector),7);
//--- Convert all obtained symbols to lower case and replace the first letter from small to capital
   if(sector.Lower())
      sector.SetChar(0,ushort(sector.GetChar(0)-0x20));
//--- Replace all underscore characters with space in the resulting line
   StringReplace(sector,"_"," ");
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Sector:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,sector);
   /* Sample output:
      Sector: Currency
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the Economy sector the symbol belongs to in the journal  |
//+------------------------------------------------------------------+
void SymbolSectorPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSector(symbol,header_width,indent));
  }


行业类型 (SYMBOL_INDUSTRY)

交易品种所属的行业或经济分支

//+------------------------------------------------------------------+
//| Return the industry type or economic sector as a string          |
//| the symbol belongs to                                            |
//+------------------------------------------------------------------+
string SymbolIndustry(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Get industry type value
   ENUM_SYMBOL_INDUSTRY symbol_industry=(ENUM_SYMBOL_INDUSTRY)SymbolInfoInteger(symbol,SYMBOL_INDUSTRY);
//--- "Cut out" the industry type from the string obtained from enum
   string industry=StringSubstr(EnumToString(symbol_industry),9);
//--- Convert all obtained symbols to lower case and replace the first letter from small to capital
   if(industry.Lower())
      industry.SetChar(0,ushort(industry.GetChar(0)-0x20));
//--- Replace all underscore characters with space in the resulting line
   StringReplace(industry,"_"," ");
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Industry:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,industry);
   /* Sample output:
      Industry: Undefined
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the industry type or economic sector                     |
//| the symbol belongs to                                            |
//+------------------------------------------------------------------+
void SymbolIndustryPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolIndustry(symbol,header_width,indent));
  }


自定义交易品种 (SYMBOL_CUSTOM)

这是一个自定义交易品种 – 该交易品种是基于来自市场报价和/或外部数据源的另一个交易品种而综合创建的

//+------------------------------------------------------------------+
//| Return the flag                                                  |
//| of a custom symbol                                               |
//+------------------------------------------------------------------+
string SymbolCustom(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Custom symbol:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,(bool)SymbolInfoInteger(symbol,SYMBOL_CUSTOM) ? "Yes" : "No");
   /* Sample output:
   Custom symbol: No
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the flag                                                 |
//| of a custom symbol                                               |
//+------------------------------------------------------------------+
void SymbolCustomPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolCustom(symbol,header_width,indent));
  }


市场报价中的背景色 (SYMBOL_BACKGROUND_COLOR)

市场报价中的交易品种所使用的背景色。

//+------------------------------------------------------------------+
//| Return the background color                                      |
//| used to highlight the Market Watch symbol as a string            |
//+------------------------------------------------------------------+
string SymbolBackgroundColor(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Background color:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the symbol background color in Market Watch
   color back_color=(color)SymbolInfoInteger(symbol,SYMBOL_BACKGROUND_COLOR);
//--- Return the property value with a header having the required width and indentation
//--- If a default color is set for a symbol (0xFF000000), return 'Default', otherwise - return its string description
   return StringFormat("%*s%-*s%-s",indent,"",w,header,back_color==0xFF000000 ? "Default" : ColorToString(back_color,true));
   /* Sample output:
   Background color: Default
   */
  }

背景色可以设置为完全透明的颜色,ColorToString()返回黑色(0,0,0)。然而,事实并非如此。这就是所谓的默认颜色:0xFF000000--CLR_DEFAULT。它的RGB为零,相当于黑色,但它是完全透明的。默认颜色具有一个alpha通道,该通道为背景设置完全透明0xFF000000。因此,在使用ColorToString()显示颜色名称之前,我们检查它是否与CLR_DEFAULT相等。

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Displays the background color                                    |
//| used to highlight the Market Watch symbol as a string            |
//+------------------------------------------------------------------+
void SymbolBackgroundColorPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolBackgroundColor(symbol,header_width,indent));
  }


用于构建柱形的价格 (SYMBOL_CHART_MODE)

生成交易品种柱形图所使用的价格类型 – 例如卖价或最后价格。

//+------------------------------------------------------------------+
//| Return the price type for building bars as a string              |
//+------------------------------------------------------------------+
string SymbolChartMode(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Get price type used for generating bars
   ENUM_SYMBOL_CHART_MODE symbol_chart_mode=(ENUM_SYMBOL_CHART_MODE)SymbolInfoInteger(symbol,SYMBOL_CHART_MODE);
//--- "Cut out" price type from the string obtained from enum
   string chart_mode=StringSubstr(EnumToString(symbol_chart_mode),18);
//--- Convert all obtained symbols to lower case and replace the first letter from small to capital
   if(chart_mode.Lower())
      chart_mode.SetChar(0,ushort(chart_mode.GetChar(0)-0x20));
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Chart mode:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,chart_mode);
   /* Sample output:
      Chart mode: Bid
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Log the price type for building bars                             |
//+------------------------------------------------------------------+
void SymbolChartModePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolChartMode(symbol,header_width,indent));
  }


交易品种存在 (SYMBOL_EXIST)

指示同名交易品种已经存在的标志。

//+------------------------------------------------------------------+
//| Return the flag                                                  |
//| indicating that a symbol with this name exists                   |
//+------------------------------------------------------------------+
string SymbolExists(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Exists:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,(bool)SymbolInfoInteger(symbol,SYMBOL_EXIST) ? "Yes" : "No");
   /* Sample output:
   Exists: Yes
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the flag                                                 |
//| indicating that a symbol with this name exists                   |
//+------------------------------------------------------------------+
void SymbolExistsPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolExists(symbol,header_width,indent));
  }


在市场报价中被选中 (SYMBOL_SELECT)

用于指示交易品种在市场报价中被选中的标志

//+------------------------------------------------------------------+
//| Return the flag                                                  |
//| indicating that the symbol is selected in Market Watch           |
//+------------------------------------------------------------------+
string SymbolSelected(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Selected:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,(bool)SymbolInfoInteger(symbol,SYMBOL_SELECT) ? "Yes" : "No");
   /* Sample output:
   Selected: Yes
   */
  }

显示日志中第一个函数的返回值:

//+--------------------------------------------------------------------------------+
//| Display the flag, that the symbol is selected in Market Watch, in the journal  |
//+--------------------------------------------------------------------------------+
void SymbolSelectedPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSelected(symbol,header_width,indent));
  }


在市场报价中显示 (SYMBOL_VISIBLE)

用于指示交易品种显示在市场报价中的标志。
一些交易品种(通常是交叉汇率,这是计算保证金要求和存款货币利润所必需的)会自动选择,但可能不会显示在市场报价中。应明确选择要显示的此类交易品种。

//+------------------------------------------------------------------+
//| Return the flag                                                  |
//| indicating that the symbol is visible in Market Watch            |
//+------------------------------------------------------------------+
string SymbolVisible(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Visible:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,(bool)SymbolInfoInteger(symbol,SYMBOL_VISIBLE) ? "Yes" : "No");
   /* Sample output:
   Visible: Yes
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the flag                                                 |
//| indicating that the symbol is visible in Market Watch            |
//+------------------------------------------------------------------+
void SymbolVisiblePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolVisible(symbol,header_width,indent));
  }


当前时期的交易数量 (SYMBOL_SESSION_DEALS)

//+------------------------------------------------------------------+
//| Return the number of deals in the current session as a string    |
//+------------------------------------------------------------------+
string SymbolSessionDeals(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Session deals:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-llu",indent,"",w,header,SymbolInfoInteger(symbol,SYMBOL_SESSION_DEALS));
   /* Sample output:
      Session deals: 0
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the number of deals in the current session in the journal|
//+------------------------------------------------------------------+
void SymbolSessionDealsPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSessionDeals(symbol,header_width,indent));
  }


买入订单数 (SYMBOL_SESSION_BUY_ORDERS)

当时的买入订单总数。

//+------------------------------------------------------------------+
//| Return the total number                                          |
//| of current buy orders as a string                                |
//+------------------------------------------------------------------+
string SymbolSessionBuyOrders(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Session Buy orders:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-llu",indent,"",w,header,SymbolInfoInteger(symbol,SYMBOL_SESSION_BUY_ORDERS));
   /* Sample output:
      Session Buy orders: 0
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the total number of Buy orders at the moment             |
//+------------------------------------------------------------------+
void SymbolSessionBuyOrdersPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSessionBuyOrders(symbol,header_width,indent));
  }


卖出订单数 (SYMBOL_SESSION_SELL_ORDERS)

当时的卖出订单总数。

//+------------------------------------------------------------------+
//| Return the total number                                          |
//| of current sell orders as a string                               |
//+------------------------------------------------------------------+
string SymbolSessionSellOrders(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Session Sell orders:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-llu",indent,"",w,header,SymbolInfoInteger(symbol,SYMBOL_SESSION_BUY_ORDERS));
   /* Sample output:
      Session Sell orders: 0
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the total number of Sell orders at the moment            |
//+------------------------------------------------------------------+
void SymbolSessionSellOrdersPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSessionSellOrders(symbol,header_width,indent));
  }


最后交易的交易量 (SYMBOL_VOLUME)

交易量 - 最后交易的交易量。

//+------------------------------------------------------------------+
//| Return the last trade volume as a string                         |
//+------------------------------------------------------------------+
string SymbolVolume(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Volume:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-llu",indent,"",w,header,SymbolInfoInteger(symbol,SYMBOL_VOLUME));
   /* Sample output:
      Volume: 0
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the last trade volume in the journal                     |
//+------------------------------------------------------------------+
void SymbolVolumePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolVolume(symbol,header_width,indent));
  }


一天的最大交易量 (SYMBOL_VOLUMEHIGH)

//+------------------------------------------------------------------+
//| Return the maximum volume per day as a string                    |
//+------------------------------------------------------------------+
string SymbolVolumeHigh(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Volume high:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-llu",indent,"",w,header,SymbolInfoInteger(symbol,SYMBOL_VOLUMEHIGH));
   /* Sample output:
      Volume high: 0
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the maximum volume per day in the journal                |
//+------------------------------------------------------------------+
void SymbolVolumeHighPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolVolumeHigh(symbol,header_width,indent));
  }


一天最小交易量 (SYMBOL_VOLUMELOW)

//+------------------------------------------------------------------+
//| Return the minimum volume per day as a string                    |
//+------------------------------------------------------------------+
string SymbolVolumeLow(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Volume low:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-llu",indent,"",w,header,SymbolInfoInteger(symbol,SYMBOL_VOLUMELOW));
   /* Sample output:
      Volume low: 0
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the minimum volume per day in the journal                |
//+------------------------------------------------------------------+
void SymbolVolumeLowPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolVolumeLow(symbol,header_width,indent));
  }


最后报价时间 (SYMBOL_TIME)

//+------------------------------------------------------------------+
//| Return the last quote time as a string                           |
//+------------------------------------------------------------------+
string SymbolTime(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Time:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,(string)(datetime)SymbolInfoInteger(symbol,SYMBOL_TIME));
   /* Sample output:
      Time: 2023.07.13 21:05:12
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the last quote time in the journal                       |
//+------------------------------------------------------------------+
void SymbolTimePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolTime(symbol,header_width,indent));
  }


以毫秒计算的最后报价时间 (SYMBOL_TIME_MSC)

从1970.01.01开始计算的最后报价毫秒数。

//+------------------------------------------------------------------+
//| Return the last quote time as a string in milliseconds           |
//+------------------------------------------------------------------+
string SymbolTimeMSC(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Time msc:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,TimeMSC(SymbolInfoInteger(symbol,SYMBOL_TIME_MSC)));
   /* Sample output:
      Time msc: 2023.07.13 21:09:24.327
   */
  }

在这里,我们使用TimeMSC()函数在开始时设置来获取一个以毫秒为单位的日期-时间字符串。

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the last quote time in milliseconds in the journal       |
//+------------------------------------------------------------------+
void SymbolTimeMSCPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolTimeMSC(symbol,header_width,indent));
  }


位数 (SYMBOL_DIGITS)

小数点后的位数。

//+------------------------------------------------------------------+
//| Return the number of decimal places as a string                  |
//+------------------------------------------------------------------+
string SymbolDigits(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Digits:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-lu",indent,"",w,header,SymbolInfoInteger(symbol,SYMBOL_DIGITS));
   /* Sample output:
      Digits: 5
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the number of decimal places in the journal              |
//+------------------------------------------------------------------+
void SymbolDigitsPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolDigits(symbol,header_width,indent));
  }


点差 (SYMBOL_SPREAD)

以点数计算的点差值。

//+------------------------------------------------------------------+
//| Return the spread size in points as a string                     |
//+------------------------------------------------------------------+
string SymbolSpread(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Spread:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-lu",indent,"",w,header,SymbolInfoInteger(symbol,SYMBOL_SPREAD));
   /* Sample output:
      Spread: 7
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the spread size in points in the journal                 |
//+------------------------------------------------------------------+
void SymbolSpreadPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSpread(symbol,header_width,indent));
  }


浮动点差 (SYMBOL_SPREAD_FLOAT)

浮动点差的指示

//+------------------------------------------------------------------+
//| Return the floating spread flag as a string                      |
//+------------------------------------------------------------------+
string SymbolSpreadFloat(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Floating Spread:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,(bool)SymbolInfoInteger(symbol,SYMBOL_SPREAD_FLOAT) ? "Yes" : "No");
   /* Sample output:
   Spread float: Yes
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the floating spread flag in the journal                  |
//+------------------------------------------------------------------+
void SymbolSpreadFloatPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSpreadFloat(symbol,header_width,indent));
  }


市场深度中的请求次数 (SYMBOL_TICKS_BOOKDEPTH)

在市场深度中显示的最大请求数。对于没有请求队列的资产,该值为0。

//+------------------------------------------------------------------+
//| Return the maximum number of                                     |
//| displayed market depth requests in the journal                   |
//+------------------------------------------------------------------+
string SymbolTicksBookDepth(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Ticks book depth:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-lu",indent,"",w,header,SymbolInfoInteger(symbol,SYMBOL_TICKS_BOOKDEPTH));
   /* Sample output:
      Ticks book depth: 10
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the maximum number of                                    |
//| displayed market depth requests in the journal                   |
//+------------------------------------------------------------------+
void SymbolTicksBookDepthPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolTicksBookDepth(symbol,header_width,indent));
  }


合约价格计算模式 (SYMBOL_TRADE_CALC_MODE)

合约价格计算模式.

//+------------------------------------------------------------------+
//| Return the contract price calculation mode as a string           |
//+------------------------------------------------------------------+
string SymbolTradeCalcMode(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Get the contract price calculation mode value
   ENUM_SYMBOL_CALC_MODE symbol_trade_calc_mode=(ENUM_SYMBOL_CALC_MODE)SymbolInfoInteger(symbol,SYMBOL_TRADE_CALC_MODE);
//--- "Cut out" the contract price calculation mode from the string obtained from enum
   string trade_calc_mode=StringSubstr(EnumToString(symbol_trade_calc_mode),17);
//--- Convert all obtained symbols to lower case and replace the first letter from small to capital
   if(trade_calc_mode.Lower())
      trade_calc_mode.SetChar(0,ushort(trade_calc_mode.GetChar(0)-0x20));
//--- Replace all underscore characters with space in the resulting line
   StringReplace(trade_calc_mode,"_"," ");
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Trade calculation mode:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,trade_calc_mode);
   /* Sample output:
      Trade calculation mode: Forex
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the contract price calculation mode in the journal       |
//+------------------------------------------------------------------+
void SymbolTradeCalcModePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolTradeCalcMode(symbol,header_width,indent));
  }


订单执行类型 (SYMBOL_TRADE_MODE)

订单执行类型.

//+------------------------------------------------------------------+
//| Return the order execution type as a string                      |
//+------------------------------------------------------------------+
string SymbolTradeMode(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Get the contract price calculation mode value
   ENUM_SYMBOL_TRADE_MODE symbol_trade_mode=(ENUM_SYMBOL_TRADE_MODE)SymbolInfoInteger(symbol,SYMBOL_TRADE_MODE);
//--- "Cut out" the contract price calculation mode from the string obtained from enum
   string trade_mode=StringSubstr(EnumToString(symbol_trade_mode),18);
//--- Convert all obtained symbols to lower case and replace the first letter from small to capital
   if(trade_mode.Lower())
      trade_mode.SetChar(0,ushort(trade_mode.GetChar(0)-0x20));
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Trade mode:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,trade_mode);
   /* Sample output:
      Trade mode: Full
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the order execution type in the journal                  |
//+------------------------------------------------------------------+
void SymbolTradeModePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolTradeMode(symbol,header_width,indent));
  }


交易起始日期 (SYMBOL_START_TIME)

交易品种的交易起始日期(通常用于期货)。

//+------------------------------------------------------------------+
//| Return the trading start date for an instrument as a string      |
//+------------------------------------------------------------------+
string SymbolStartTime(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Start time:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the property value and define its description
   long time=SymbolInfoInteger(symbol,SYMBOL_START_TIME);
   string descr=(time==0 ? " (Not used)" : "");
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s%s",indent,"",w,header,(string)(datetime)time,descr);
   /* Sample output:
      Start time: 1970.01.01 00:00:00 (Not used)
   */
  }

如果值没有指定(等于0),则显示为日期 1970.01.01. 00:00:00. 这可能有点困扰,所以,在这种情况下在日期和时间后显示“未使用(Not used)”。

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the trading start date for an instrument in the journal  |
//+------------------------------------------------------------------+
void SymbolSymbolStartTimePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolStartTime(symbol,header_width,indent));
  }


交易结束日期

交易品种的交易结束日期(通常用于期货)。

//+------------------------------------------------------------------+
//| Return the trading end date for an instrument as a string        |
//+------------------------------------------------------------------+
string SymbolExpirationTime(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Expiration time:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the property value and define its description
   long time=SymbolInfoInteger(symbol,SYMBOL_EXPIRATION_TIME);
   string descr=(time==0 ? " (Not used)" : "");
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s%s",indent,"",w,header,(string)(datetime)time,descr);
   /* Sample output:
      Expiration time: 1970.01.01 00:00:00 (Not used)
   */
  }

如果该数值未指定(等于0),则在这种情况下在日期和时间之后显示“未使用(Not used)”。

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the trading end date for an instrument in the journal    |
//+------------------------------------------------------------------+
void SymbolSymbolExpirationTimePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolExpirationTime(symbol,header_width,indent));
  }


止损水平(SYMBOL_TRADE_STOPS_LEVEL)

根据当前收盘价设置止损订单的最小距离点数。

//+-------------------------------------------------------------------------+
//| Return the minimum indentation                                          |
//| from the current close price in points to place Stop orders as a string |
//+-------------------------------------------------------------------------+
string SymbolTradeStopsLevel(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Stops level:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the property value and define its description
   int stops_level=(int)SymbolInfoInteger(symbol,SYMBOL_TRADE_STOPS_LEVEL);
   string descr=(stops_level==0 ? " (By Spread)" : "");
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-lu%s",indent,"",w,header,stops_level,descr);
   /* Sample output:
      Stops level: 0 (By Spread)
   */
  }

如果该值为0,这不表示设置止损单的水平为0或者不存在,这表示止损水平依赖于点差的值,通常是2倍点差。所以这种情况下会显示“根据点差 (By Spread)”。

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the minimum indentation in points from the previous      |
//| close price for setting Stop orders in the journal               |
//+------------------------------------------------------------------+
void SymbolTradeStopsLevelPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolTradeStopsLevel(symbol,header_width,indent));
  }


冻结水平 (SYMBOL_TRADE_FREEZE_LEVEL)

冻结交易操作的距离点数。

//+------------------------------------------------------------------+
//| Return the distance of freezing                                  |
//| trading operations in points as a string                         |
//+------------------------------------------------------------------+
string SymbolTradeFreezeLevel(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Freeze level:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the property value and define its description
   int freeze_level=(int)SymbolInfoInteger(symbol,SYMBOL_TRADE_FREEZE_LEVEL);
   string descr=(freeze_level==0 ? " (Not used)" : "");
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-lu%s",indent,"",w,header,freeze_level,descr);
   /* Sample output:
      Freeze level: 0 (Not used)
   */
  }

如果该值为零,则表示未使用“冻结水平”,这就是显示“未使用(Not used)”文本的原因。

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------------------+
//| Display the distance of freezing trading operations in points in the journal |
//+------------------------------------------------------------------------------+
void SymbolTradeFreezeLevelPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolTradeFreezeLevel(symbol,header_width,indent));
  }


交易执行模式 (SYMBOL_TRADE_EXEMODE)

交易执行模式

//+------------------------------------------------------------------+
//| Return the trade execution mode as a string                      |
//+------------------------------------------------------------------+
string SymbolTradeExeMode(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Get the contract price calculation mode value
   ENUM_SYMBOL_TRADE_EXECUTION symbol_trade_exemode=(ENUM_SYMBOL_TRADE_EXECUTION)SymbolInfoInteger(symbol,SYMBOL_TRADE_EXEMODE);
//--- "Cut out" the contract price calculation mode from the string obtained from enum
   string trade_exemode=StringSubstr(EnumToString(symbol_trade_exemode),23);
//--- Convert all obtained symbols to lower case and replace the first letter from small to capital
   if(trade_exemode.Lower())
      trade_exemode.SetChar(0,ushort(trade_exemode.GetChar(0)-0x20));
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Trade Execution mode:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,trade_exemode);
   /* Sample output:
      Trade Execution mode: Instant
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the trade execution mode in the journal                  |
//+------------------------------------------------------------------+
void SymbolTradeExeModePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolTradeExeMode(symbol,header_width,indent));
  }


隔夜息计算模式 (SYMBOL_SWAP_MODE)

隔夜息计算模式

//+------------------------------------------------------------------+
//| Return the swap calculation model as a string                    |
//+------------------------------------------------------------------+
string SymbolSwapMode(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Get the value of the swap calculation model
   ENUM_SYMBOL_SWAP_MODE symbol_swap_mode=(ENUM_SYMBOL_SWAP_MODE)SymbolInfoInteger(symbol,SYMBOL_SWAP_MODE);
//--- "Cut out" the swap calculation model from the string obtained from enum
   string swap_mode=StringSubstr(EnumToString(symbol_swap_mode),17);
//--- Convert all obtained symbols to lower case and replace the first letter from small to capital
   if(swap_mode.Lower())
      swap_mode.SetChar(0,ushort(swap_mode.GetChar(0)-0x20));
//--- Replace all underscore characters with space in the resulting line
   StringReplace(swap_mode,"_"," ");
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Swap mode:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,swap_mode);
   /* Sample output:
      Swap mode: Points
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the swap calculation model to the journal                |
//+------------------------------------------------------------------+
void SymbolSwapModePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSwapMode(symbol,header_width,indent));
  }


三倍隔夜息应收日 (SYMBOL_SWAP_ROLLOVER3DAYS)

用来收取三倍隔夜息的一周中的那一天

//+--------------------------------------------------------------------+
//| Return the day of the week for calculating triple swap as a string |
//+--------------------------------------------------------------------+
string SymbolSwapRollover3Days(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Get the value of the swap calculation model
   ENUM_DAY_OF_WEEK symbol_swap_rollover3days=(ENUM_DAY_OF_WEEK)SymbolInfoInteger(symbol,SYMBOL_SWAP_ROLLOVER3DAYS);
//--- Convert enum into a string with the name of the day
   string swap_rollover3days=EnumToString(symbol_swap_rollover3days);
//--- Convert all obtained symbols to lower case and replace the first letter from small to capital
   if(swap_rollover3days.Lower())
      swap_rollover3days.SetChar(0,ushort(swap_rollover3days.GetChar(0)-0x20));
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Swap Rollover 3 days:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,swap_rollover3days);
   /* Sample output:
      Swap Rollover 3 days: Wednesday
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------------+
//| Display the day of the week for calculating triple swap in the journal |
//+------------------------------------------------------------------------+
void SymbolSwapRollover3DaysPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSwapRollover3Days(symbol,header_width,indent));
  }


锁仓预付款计算模式 (SYMBOL_MARGIN_HEDGED_USE_LEG)

使用较大仓位(买入或者卖出)来计算锁仓预付款。

//+------------------------------------------------------------------+
//| Return the calculation mode                                      |
//| of hedged margin using the larger leg as a string                |
//+------------------------------------------------------------------+
string SymbolMarginHedgedUseLeg(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Margin hedged use leg:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,(bool)SymbolInfoInteger(symbol,SYMBOL_MARGIN_HEDGED_USE_LEG) ? "Yes" : "No");
   /* Sample output:
   Margin hedged use leg: No
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the mode for calculating the hedged                      |
//| margin using the larger leg in the journal                       |
//+------------------------------------------------------------------+
void SymbolMarginHedgedUseLegPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolMarginHedgedUseLeg(symbol,header_width,indent));
  }


订单到期模式标志 (SYMBOL_EXPIRATION_MODE)

对于每种金融资产,可以指定挂单的几种有效期(到期)模式。每个模式都与标志相关联。可以使用OR(|)逻辑运算组合标志,例如SYMBOL_EXPIRATION_GTC|SYMBOL_EXPIRATION_SPECIFIED。要检查资产是否启用了特定模式,应将逻辑AND(&)的结果与模式标志进行比较。

如果为符号指定了SYMBOL_EXPIRATION_SPECIFIED标志,则在发送挂单时,您可以明确指示该挂单的有效期。

//+------------------------------------------------------------------+
//| Return the flags of allowed order expiration modes as a string   |
//+------------------------------------------------------------------+
string SymbolExpirationMode(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Get order expiration modes
   int exp_mode=(int)SymbolInfoInteger(symbol,SYMBOL_EXPIRATION_MODE);
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Expiration mode:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);

//--- Parse mode flags into components
   string flags="";
   if((exp_mode&SYMBOL_EXPIRATION_GTC)==SYMBOL_EXPIRATION_GTC)
      flags+=(flags.Length()>0 ? "|" : "")+"GTC";
   if((exp_mode&SYMBOL_EXPIRATION_DAY)==SYMBOL_EXPIRATION_DAY)
      flags+=(flags.Length()>0 ? "|" : "")+"DAY";
   if((exp_mode&SYMBOL_EXPIRATION_SPECIFIED)==SYMBOL_EXPIRATION_SPECIFIED)
      flags+=(flags.Length()>0 ? "|" : "")+"SPECIFIED";
   if((exp_mode&SYMBOL_EXPIRATION_SPECIFIED_DAY)==SYMBOL_EXPIRATION_SPECIFIED_DAY)
      flags+=(flags.Length()>0 ? "|" : "")+"SPECIFIED_DAY";

//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,flags);
   /* Sample output:
   Expiration mode: GTC|DAY|SPECIFIED
   */
  }

显示日志中第一个函数的返回值:

//+--------------------------------------------------------------------+
//| Display the flags of allowed order expiration modes in the journal |
//+--------------------------------------------------------------------+
void SymbolExpirationModePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolExpirationMode(symbol,header_width,indent));
  }


订单填写模式标志 (SYMBOL_FILLING_MODE)

允许的订单填写模式的标志。

发送订单时,我们可以指定订单的填充策略。可以通过标志组合为每个资产设置几种模式。标志的组合由逻辑或(|)运算表示,例如SYMBOL_FILLING_FOK|SYMBOL_FILLING_IOC。ORDER_FILLING_RETURN填充类型在任何执行模式中启用,“市场执行(SYMBOL_TRADE_EXECUTION_MARKET)”除外。
//+------------------------------------------------------------------+
//| Return the flags of allowed order filling modes as a string      |
//+------------------------------------------------------------------+
string SymbolFillingMode(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Get order filling modes
   int fill_mode=(int)SymbolInfoInteger(symbol,SYMBOL_FILLING_MODE);
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Filling mode:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);

//--- Parse mode flags into components
   string flags="";
   if((fill_mode&ORDER_FILLING_FOK)==ORDER_FILLING_FOK)
      flags+=(flags.Length()>0 ? "|" : "")+"FOK";
   if((fill_mode&ORDER_FILLING_IOC)==ORDER_FILLING_IOC)
      flags+=(flags.Length()>0 ? "|" : "")+"IOC";
   if((fill_mode&ORDER_FILLING_BOC)==ORDER_FILLING_BOC)
      flags+=(flags.Length()>0 ? "|" : "")+"BOC";
   if(SymbolInfoInteger(symbol,SYMBOL_TRADE_EXEMODE)!=SYMBOL_TRADE_EXECUTION_MARKET)
      flags+=(flags.Length()>0 ? "|" : "")+"RETURN";

//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,flags);
   /* Sample output:
   Filling mode: FOK|IOC|RETURN
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the flags of allowed order filling modes in the journal  |
//+------------------------------------------------------------------+
void SymbolFillingModePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolFillingMode(symbol,header_width,indent));
  }


允许订单类型的标志 (SYMBOL_ORDER_MODE)

//+------------------------------------------------------------------+
//| Return flags of allowed order types as a string                  |
//+------------------------------------------------------------------+
string SymbolOrderMode(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Get order types
   int order_mode=(int)SymbolInfoInteger(symbol,SYMBOL_ORDER_MODE);
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Order mode:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);

//--- Parse type flags into components
   string flags="";
   if((order_mode&SYMBOL_ORDER_MARKET)==SYMBOL_ORDER_MARKET)
      flags+=(flags.Length()>0 ? "|" : "")+"MARKET";
   if((order_mode&SYMBOL_ORDER_LIMIT)==SYMBOL_ORDER_LIMIT)
      flags+=(flags.Length()>0 ? "|" : "")+"LIMIT";
   if((order_mode&SYMBOL_ORDER_STOP)==SYMBOL_ORDER_STOP)
      flags+=(flags.Length()>0 ? "|" : "")+"STOP";
   if((order_mode&SYMBOL_ORDER_STOP_LIMIT )==SYMBOL_ORDER_STOP_LIMIT )
      flags+=(flags.Length()>0 ? "|" : "")+"STOP_LIMIT";
   if((order_mode&SYMBOL_ORDER_SL)==SYMBOL_ORDER_SL)
      flags+=(flags.Length()>0 ? "|" : "")+"SL";
   if((order_mode&SYMBOL_ORDER_TP)==SYMBOL_ORDER_TP)
      flags+=(flags.Length()>0 ? "|" : "")+"TP";
   if((order_mode&SYMBOL_ORDER_CLOSEBY)==SYMBOL_ORDER_CLOSEBY)
      flags+=(flags.Length()>0 ? "|" : "")+"CLOSEBY";

//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,flags);
   /* Sample output:
   Order mode: MARKET|LIMIT|STOP|STOP_LIMIT|SL|TP|CLOSEBY
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the flags of allowed order types in the journal          |
//+------------------------------------------------------------------+
void SymbolOrderModePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolOrderMode(symbol,header_width,indent));
  }


订单止损和获利的有效期 (SYMBOL_ORDER_GTC_MODE)

如果SYMBOL_EXPIRATION_MODE=SYMBOL_EXPIREATION_GTC(有效直至取消),则止损和获利订单有到期时间

//+------------------------------------------------------------------+
//| Return StopLoss and TakeProfit validity periods as a string      |
//+------------------------------------------------------------------+
string SymbolOrderGTCMode(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Get the value of the validity period of pending, StopLoss and TakeProfit orders
   ENUM_SYMBOL_ORDER_GTC_MODE symbol_order_gtc_mode=(ENUM_SYMBOL_ORDER_GTC_MODE)SymbolInfoInteger(symbol,SYMBOL_ORDER_GTC_MODE);
//--- Set the validity period description as 'GTC'
   string gtc_mode="GTC";
//--- If the validity period is not GTC
   if(symbol_order_gtc_mode!=SYMBOL_ORDERS_GTC)
     {
      //--- "Cut out" pending, StopLoss and TakeProfit order validity periods from the string obtained from enum
      StringSubstr(EnumToString(symbol_order_gtc_mode),14);
      //--- Convert all obtained symbols to lower case and replace the first letter from small to capital
      if(gtc_mode.Lower())
         gtc_mode.SetChar(0,ushort(gtc_mode.GetChar(0)-0x20));
      //--- Replace all underscore characters with space in the resulting line
      StringReplace(gtc_mode,"_"," ");
     }
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Order GTC mode:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,gtc_mode);
   /* Sample output:
      Order GTC mode: GTC
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display StopLoss and TakeProfit validity periods in the journal  |
//+------------------------------------------------------------------+
void SymbolOrderGTCModePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolOrderGTCMode(symbol,header_width,indent));
  }


期权类型 (SYMBOL_OPTION_MODE)

期权类型

//+------------------------------------------------------------------+
//| Return option type as a string                                   |
//+------------------------------------------------------------------+
string SymbolOptionMode(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Get the value of the option type model
   ENUM_SYMBOL_OPTION_MODE symbol_option_mode=(ENUM_SYMBOL_OPTION_MODE)SymbolInfoInteger(symbol,SYMBOL_OPTION_MODE);
//--- "Cut out" the option type from the string obtained from enum
   string option_mode=StringSubstr(EnumToString(symbol_option_mode),19);
//--- Convert all obtained symbols to lower case and replace the first letter from small to capital
   if(option_mode.Lower())
      option_mode.SetChar(0,ushort(option_mode.GetChar(0)-0x20));
//--- Replace all underscore characters with space in the resulting line
   StringReplace(option_mode,"_"," ");
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Option mode:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,option_mode);
   /* Sample output:
      Option mode: European
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the option type in the journal                           |
//+------------------------------------------------------------------+
void SymbolOptionModePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolOptionMode(symbol,header_width,indent));
  }


期权权限 (SYMBOL_OPTION_RIGHT)

期权权限 (看涨/看跌).

//+------------------------------------------------------------------+
//| Return the option right as a string                              |
//+------------------------------------------------------------------+
string SymbolOptionRight(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Get the option right value
   ENUM_SYMBOL_OPTION_RIGHT symbol_option_right=(ENUM_SYMBOL_OPTION_RIGHT)SymbolInfoInteger(symbol,SYMBOL_OPTION_RIGHT);
//--- "Cut out" the option right from the string obtained from enum
   string option_right=StringSubstr(EnumToString(symbol_option_right),20);
//--- Convert all obtained symbols to lower case and replace the first letter from small to capital
   if(option_right.Lower())
      option_right.SetChar(0,ushort(option_right.GetChar(0)-0x20));
//--- Replace all underscore characters with space in the resulting line
   StringReplace(option_right,"_"," ");
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Option right:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-s",indent,"",w,header,option_right);
   /* Sample output:
      Option right: Call
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the option right in the journal                          |
//+------------------------------------------------------------------+
void SymbolOptionRightPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolOptionRight(symbol,header_width,indent));
  }


读取和显示交易品种的实数属性 ENUM_SYMBOL_INFO_DOUBLE

买价 (SYMBOL_BID)

买价 - 资产的最佳卖出价格。

//+------------------------------------------------------------------+
//| Return the Bid price as a string                                 |
//+------------------------------------------------------------------+
string SymbolBid(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Bid:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_BID));
   /* Sample output:
   Bid: 1.31017
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the Bid price in the journal                             |
//+------------------------------------------------------------------+
void SymbolBidPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolBid(symbol,header_width,indent));
  }


当日最高买价 (SYMBOL_BIDHIGH)

//+------------------------------------------------------------------+
//| Return the maximum Bid per day as a string                       |
//+------------------------------------------------------------------+
string SymbolBidHigh(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Bid High:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_BIDHIGH));
   /* Sample output:
   Bid High: 1.31422
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the maximum Bid per day in the journal                   |
//+------------------------------------------------------------------+
void SymbolBidHighPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolBidHigh(symbol,header_width,indent));
  }


当日的最低买价 (SYMBOL_BIDLOW)

//+------------------------------------------------------------------+
//| Return the minimum Bid per day as a string                       |
//+------------------------------------------------------------------+
string SymbolBidLow(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Bid Low:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_BIDLOW));
   /* Sample output:
   Bid Low: 1.30934
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the minimum Bid per day in the journal                   |
//+------------------------------------------------------------------+
void SymbolBidLowPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolBidLow(symbol,header_width,indent));
  }


卖价 (SYMBOL_ASK)

卖价 - 买入资产的最佳报价

//+------------------------------------------------------------------+
//| Return the Ask price as a string                                 |
//+------------------------------------------------------------------+
string SymbolAsk(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Ask:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_ASK));
   /* Sample output:
   Ask: 1.31060
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the Ask price in the journal                             |
//+------------------------------------------------------------------+
void SymbolAskPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolAsk(symbol,header_width,indent));
  }


当日的最高卖价 (SYMBOL_ASKHIGH)

//+------------------------------------------------------------------+
//| Return the maximum Ask per day as a string                       |
//+------------------------------------------------------------------+
string SymbolAskHigh(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Ask High:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_ASKHIGH));
   /* Sample output:
   Ask High: 1.31427
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the maximum Ask per day in the journal                   |
//+------------------------------------------------------------------+
void SymbolAskHighPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolAskHigh(symbol,header_width,indent));
  }


当日的最低卖价 (SYMBOL_ASKLOW)

//+------------------------------------------------------------------+
//| Return the minimum Ask per day as a string                       |
//+------------------------------------------------------------------+
string SymbolAskLow(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Ask Low:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_ASKLOW));
   /* Sample output:
   Ask Low: 1.30938
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the minimum Ask per day in the journal                   |
//+------------------------------------------------------------------+
void SymbolAskLowPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolAskLow(symbol,header_width,indent));
  }


最后价格 (SYMBOL_LAST)

最后交易执行的价格。

//+------------------------------------------------------------------+
//| Return the Last price as a string                                |
//+------------------------------------------------------------------+
string SymbolLast(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Last:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_LAST));
   /* Sample output:
   Last: 0.00000
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the Last price in the journal                            |
//+------------------------------------------------------------------+
void SymbolLastPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolLast(symbol,header_width,indent));
  }


当日的最高最后价格 (SYMBOL_LASTHIGH)

//+------------------------------------------------------------------+
//| Return the maximum Last per day as a string                      |
//+------------------------------------------------------------------+
string SymbolLastHigh(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Last High:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_LASTHIGH));
   /* Sample output:
   Last High: 0.00000
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the maximum Last per day in the journal                  |
//+------------------------------------------------------------------+
void SymbolLastHighPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolLastHigh(symbol,header_width,indent));
  }


当日的最低最后价格(SYMBOL_LASTLOW)

//+------------------------------------------------------------------+
//| Return the minimum Last per day as a string                      |
//+------------------------------------------------------------------+
string SymbolLastLow(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Last Low:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_LASTLOW));
   /* Sample output:
   Last Low: 0.00000
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the minimum Last per day in the journal                  |
//+------------------------------------------------------------------+
void SymbolLastLowPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolLastLow(symbol,header_width,indent));
  }


最后交易的交易量 (SYMBOL_VOLUME_REAL)

最后执行交易的交易量

//+------------------------------------------------------------------+
//| Return the last executed trade volume as a string                |
//+------------------------------------------------------------------+
string SymbolVolumeReal(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Volume real:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.2f",indent,"",w,header,SymbolInfoDouble(symbol,SYMBOL_VOLUME_REAL));
   /* Sample output:
   Volume real: 0.00
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the last executed trade volume in the journal            |
//+------------------------------------------------------------------+
void SymbolVolumeRealPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolVolumeReal(symbol,header_width,indent));
  }


当天的最大交易量 (SYMBOL_VOLUMEHIGH_REAL)

//+------------------------------------------------------------------+
//| Return the maximum volume per day as a string                    |
//+------------------------------------------------------------------+
string SymbolVolumeHighReal(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Volume High real:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.2f",indent,"",w,header,SymbolInfoDouble(symbol,SYMBOL_VOLUMEHIGH_REAL));
   /* Sample output:
   Volume High real: 0.00
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the maximum volume per day in the journal                |
//+------------------------------------------------------------------+
void SymbolVolumeHighRealPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolVolumeHighReal(symbol,header_width,indent));
  }


当天的最小交易量 (SYMBOL_VOLUMELOW_REAL)

//+------------------------------------------------------------------+
//| Return the minimum volume per day as a string                    |
//+------------------------------------------------------------------+
string SymbolVolumeLowReal(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Volume Low real:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.2f",indent,"",w,header,SymbolInfoDouble(symbol,SYMBOL_VOLUMELOW_REAL));
   /* Sample output:
   Volume Low real: 0.00
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the minimum volume per day in the journal                |
//+------------------------------------------------------------------+
void SymbolVolumeLowRealPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolVolumeLowReal(symbol,header_width,indent));
  }


期权执行价格 (SYMBOL_OPTION_STRIKE)

期权执行价格。这是期权的买方可以购买(看涨期权)或出售(看跌期权)标的资产的价格,而相应地,期权卖方有义务出售或购买相应金额的标的资产。

//+------------------------------------------------------------------+
//| Return the strike price as a string                              |
//+------------------------------------------------------------------+
string SymbolOptionStrike(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Option strike:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_OPTION_STRIKE));
   /* Sample output:
   Option strike: 0.00000
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the option strike price in the journal                   |
//+------------------------------------------------------------------+
void SymbolOptionStrikePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolOptionStrike(symbol,header_width,indent));
  }


点 (SYMBOL_POINT)

点值

//+------------------------------------------------------------------+
//| Return the point value as a string                               |
//+------------------------------------------------------------------+
string SymbolPoint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Point:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_POINT));
   /* Sample output:
   Point: 0.00001
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the point value in the journal                           |
//+------------------------------------------------------------------+
void SymbolPointPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolPoint(symbol,header_width,indent));
  }


分时价格 (SYMBOL_TRADE_TICK_VALUE)

SYMBOL_TRADE_TICK_VALUE_PROFIT — 盈利仓位的计算分时值。

//+------------------------------------------------------------------+
//| Return the tick price as a string                                |
//+------------------------------------------------------------------+
string SymbolTradeTickValue(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Tick value:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_TRADE_TICK_VALUE));
   /* Sample output:
   Tick value: 1.00000
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the tick price in the journal                            |
//+------------------------------------------------------------------+
void SymbolTradeTickValuePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolTradeTickValue(symbol,header_width,indent));
  }


盈利仓位的分时价格(SYMBOL_TRADE_TICK_VALUE_PROFIT)

计算得到的盈利仓位的分时价格。

//+------------------------------------------------------------------+
//| Return the calculated tick price as a string                     |
//| for a profitable position                                        |
//+------------------------------------------------------------------+
string SymbolTradeTickValueProfit(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Tick value profit:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_TRADE_TICK_VALUE_PROFIT));
   /* Sample output:
   Tick value profit: 1.00000
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the calculated tick price in the journal                 |
//| for a profitable position                                        |
//+------------------------------------------------------------------+
void SymbolTradeTickValueProfitPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolTradeTickValueProfit(symbol,header_width,indent));
  }


亏损仓位的分时价格 (SYMBOL_TRADE_TICK_VALUE_LOSS)

计算的亏损仓位的分时价格。

//+------------------------------------------------------------------+
//| Return the calculated tick price as a string                     |
//| for a losing position                                            |
//+------------------------------------------------------------------+
string SymbolTradeTickValueLoss(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Tick value loss:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_TRADE_TICK_VALUE_LOSS));
   /* Sample output:
   Tick value loss: 1.00000
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the calculated tick price in the journal                 |
//| for a losing position                                            |
//+------------------------------------------------------------------+
void SymbolTradeTickValueLossPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolTradeTickValueLoss(symbol,header_width,indent));
  }


最小价格变化幅度 (SYMBOL_TRADE_TICK_SIZE)

//+------------------------------------------------------------------+
//| Return the minimum price change as a string                      |
//+------------------------------------------------------------------+
string SymbolTradeTickSize(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Tick size:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_TRADE_TICK_SIZE));
   /* Sample output:
   Tick size: 0.00001
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the minimum price change in the journal                  |
//+------------------------------------------------------------------+
void SymbolTradeTickSizePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolTradeTickSize(symbol,header_width,indent));
  }


交易合约大小 (SYMBOL_TRADE_CONTRACT_SIZE)

//+------------------------------------------------------------------+
//| Return the trading contract size as a string                     |
//+------------------------------------------------------------------+
string SymbolTradeContractSize(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Contract size:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.2f %s",indent,"",w,header,SymbolInfoDouble(symbol,SYMBOL_TRADE_CONTRACT_SIZE),SymbolInfoString(symbol,SYMBOL_CURRENCY_BASE));
   /* Sample output:
   Contract size: 100000.00 GBP
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the trading contract size in the journal                 |
//+------------------------------------------------------------------+
void SymbolTradeContractSizePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolTradeContractSize(symbol,header_width,indent));
  }


应计利息 (SYMBOL_TRADE_ACCRUED_INTEREST)

应计利息 —累计票面利息(按照票面债券发行或最后一次支付票面利息后的天数按比例计算的部分票面利息)。

//+------------------------------------------------------------------+
//| Return accrued interest as a string                              |
//+------------------------------------------------------------------+
string SymbolTradeAccruedInterest(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Accrued interest:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.2f",indent,"",w,header,SymbolInfoDouble(symbol,SYMBOL_TRADE_ACCRUED_INTEREST));
   /* Sample output:
   Accrued interest: 0.00
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display accrued interest in the journal                          |
//+------------------------------------------------------------------+
void SymbolTradeAccruedInterestPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolTradeAccruedInterest(symbol,header_width,indent));
  }


面值 (SYMBOL_TRADE_FACE_VALUE)

面值——发行人设定的债券初始价值。

//+------------------------------------------------------------------+
//| Return the face value as a string                                |
//+------------------------------------------------------------------+
string SymbolTradeFaceValue(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Face value:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.2f",indent,"",w,header,SymbolInfoDouble(symbol,SYMBOL_TRADE_FACE_VALUE));
   /* Sample output:
   Face value: 0.00
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the face value in the journal                            |
//+------------------------------------------------------------------+
void SymbolTradeFaceValuePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolTradeFaceValue(symbol,header_width,indent));
  }


流动性比率 (SYMBOL_TRADE_LIQUIDITY_RATE)

流动性比率是指可用于保证金的资产份额。

//+------------------------------------------------------------------+
//| Return the liquidity rate as a string                            |
//+------------------------------------------------------------------+
string SymbolTradeLiquidityRate(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Liquidity rate:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.2f",indent,"",w,header,SymbolInfoDouble(symbol,SYMBOL_TRADE_LIQUIDITY_RATE));
   /* Sample output:
   Liquidity rate: 0.00
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the rate liquidity in the journal                        |
//+------------------------------------------------------------------+
void SymbolTradeLiquidityRatePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolTradeLiquidityRate(symbol,header_width,indent));
  }


最小交易量 (SYMBOL_VOLUME_MIN)

交易执行的最小交易量。

//+------------------------------------------------------------------+
//| Return the minimum volume as a string                            |
//+------------------------------------------------------------------+
string SymbolVolumeMin(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Volume min:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places in the lot value
   int dg=(int)ceil(fabs(log10(SymbolInfoDouble(symbol,SYMBOL_VOLUME_STEP))));
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_VOLUME_MIN));
   /* Sample output:
   Volume min: 0.01
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the minimum volume in the journal                        |
//+------------------------------------------------------------------+
void SymbolVolumeMinPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolVolumeMin(symbol,header_width,indent));
  }


最大交易量 (SYMBOL_VOLUME_MAX)

交易执行的最大交易量。

//+------------------------------------------------------------------+
//| Return the maximum volume as a string                            |
//+------------------------------------------------------------------+
string SymbolVolumeMax(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Volume max:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places in the lot value
   int dg=(int)ceil(fabs(log10(SymbolInfoDouble(symbol,SYMBOL_VOLUME_STEP))));
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_VOLUME_MAX));
   /* Sample output:
   Volume max: 500.00
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the maximum volume in the journal                        |
//+------------------------------------------------------------------+
void SymbolVolumeMaxPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolVolumeMax(symbol,header_width,indent));
  }


交易量变化步长(SYMBOL_VOLUME_STEP)

交易执行的最小交易量变化步长。

//+------------------------------------------------------------------+
//| Return the minimum volume change step as a string                |
//+------------------------------------------------------------------+
string SymbolVolumeStep(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Volume step:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places in the lot value
   int dg=(int)ceil(fabs(log10(SymbolInfoDouble(symbol,SYMBOL_VOLUME_STEP))));
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_VOLUME_STEP));
   /* Sample output:
   Volume step: 0.01
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the minimum volume change step in the journal            |
//+------------------------------------------------------------------+
void SymbolVolumeStepPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolVolumeStep(symbol,header_width,indent));
  }


一个方向上的最大仓位和订单交易量(SYMBOL_VOLUME_LIMIT)

此交易品种在一个方向(买入或卖出)上的未平仓合约和挂单的最大允许总量。例如,如果限制是5手,您可能有5手的未平仓头寸,并下5手的限价订单。但在这种情况下,您不能下一个买入限价订单(因为一个方向的总成交量将超过限额)或下一个超过5手的卖出限价订单。

//+----------------------------------------------------------------------------+
//| Return the maximum acceptable                                              |
//| total volume of open position and pending orders for a symbol as a string  |
//+----------------------------------------------------------------------------+
string SymbolVolumeLimit(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Volume limit:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places in the lot value
   int dg=(int)ceil(fabs(log10(SymbolInfoDouble(symbol,SYMBOL_VOLUME_STEP))));
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_VOLUME_LIMIT));
   /* Sample output:
   Volume limit: 0.00
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------------------+
//| Display the maximum acceptable                                               |
//| total volume of open position and pending orders for a symbol in the journal |
//+------------------------------------------------------------------------------+
void SymbolVolumeLimitPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolVolumeLimit(symbol,header_width,indent));
  }


买入隔夜息 (SYMBOL_SWAP_LONG)

//+------------------------------------------------------------------+
//| Return the Buy swap value as a string                            |
//+------------------------------------------------------------------+
string SymbolSwapLong(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Swap long:";
   uint w=(header_width==0 ? header.Length()+1 : header_width-1);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%- .2f",indent,"",w,header,SymbolInfoDouble(symbol,SYMBOL_SWAP_LONG));
   /* Sample output:
   Swap long: -0.20
   */
  }

由于属性的值可以是负数,因此有必要将负数属性值向左移动一个字符,以便减号位于列表中剩余属性值列的左侧。为了实现这一点,将传递的字段宽度减少1,并且在格式说明符中放置一个空格,这将字符串向右移动一个字符(对于非负值)。因此,我们将字段宽度减少1,同时为一个非负值添加一个空格,使字段宽度减少一个字符。

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the Buy swap value in the journal                        |
//+------------------------------------------------------------------+
void SymbolSwapLongPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSwapLong(symbol,header_width,indent));
  }


卖出隔夜息 (SYMBOL_SWAP_SHORT)

//+------------------------------------------------------------------+
//| Return the Sell swap value as a string                           |
//+------------------------------------------------------------------+
string SymbolSwapShort(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Swap short:";
   uint w=(header_width==0 ? header.Length()+1 : header_width-1);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%- .2f",indent,"",w,header,SymbolInfoDouble(symbol,SYMBOL_SWAP_SHORT));
   /* Sample output:
   Swap short: -2.20
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the Sell swap value in the journal                       |
//+------------------------------------------------------------------+
void SymbolSwapShortPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSwapShort(symbol,header_width,indent));
  }


隔夜息应计比率 (SYMBOL_SWAP_SUNDAY)

从周日滚动到次日的隔夜头寸的隔夜息计算比率(SYMBOL_SWAP_LONG或SYMBOL_SWAP_SHORT)。支持以下值:

    0 – 不收隔夜息
    1 – 单倍隔夜息
    3 – 三倍隔夜息

//+------------------------------------------------------------------+
//| Return the swap accrual ratio as a string                        |
//| when swapping a position from Sunday to Monday                   |
//+------------------------------------------------------------------+
string SymbolSwapSunday(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Swap sunday:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the ratio and define its description string
   double swap_coeff=SymbolInfoDouble(symbol,SYMBOL_SWAP_SUNDAY);
   string coeff_descr=(swap_coeff==1 ? "single swap" : swap_coeff==3 ? "triple swap" : "no swap is charged");
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%.0f (%s)",indent,"",w,header,swap_coeff,coeff_descr);
   /* Sample output:
   Swap sunday: 0 (no swap is charged)
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the swap accrual ratio in the journal                    |
//| when swapping a position from Sunday to Monday                   |
//+------------------------------------------------------------------+
void SymbolSwapSundayPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSwapSunday(symbol,header_width,indent));
  }


周一至周二的应计隔夜息 (SYMBOL_SWAP_MONDAY)

周一至周二隔夜头寸的隔夜息计算比率(SYMBOL_SWAP_LONG 或 SYMBOL_SWAP_SHORT)。

//+------------------------------------------------------------------+
//| Return the swap accrual ratio as a string                        |
//| when swapping a position from Monday to Tuesday                  |
//+------------------------------------------------------------------+
string SymbolSwapMonday(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Swap monday:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the ratio and define its description string
   double swap_coeff=SymbolInfoDouble(symbol,SYMBOL_SWAP_MONDAY);
   string coeff_descr=(swap_coeff==1 ? "single swap" : swap_coeff==3 ? "triple swap" : "no swap is charged");
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%.0f (%s)",indent,"",w,header,swap_coeff,coeff_descr);
   /* Sample output:
   Swap monday: 1 (single swap)
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the swap accrual ratio in the journal                    |
//| when swapping a position from Monday to Tuesday                  |
//+------------------------------------------------------------------+
void SymbolSwapMondayPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSwapMonday(symbol,header_width,indent));
  }


周二至周三的应计隔夜息 (SYMBOL_SWAP_TUESDAY)

周二至周三隔夜头寸的隔夜息计算比率(SYMBOL_SWAP_LONG 或 SYMBOL_SWAP_SHORT)。

//+------------------------------------------------------------------+
//| Return the swap accrual ratio as a string                        |
//| when swapping a position from Tuesday to Wednesday               |
//+------------------------------------------------------------------+
string SymbolSwapTuesday(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Swap Tuesday:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the ratio and define its description string
   double swap_coeff=SymbolInfoDouble(symbol,SYMBOL_SWAP_TUESDAY);
   string coeff_descr=(swap_coeff==1 ? "single swap" : swap_coeff==3 ? "triple swap" : "no swap is charged");
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%.0f (%s)",indent,"",w,header,swap_coeff,coeff_descr);
   /* Sample output:
   Swap Tuesday: 1 (single swap)
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the swap accrual ratio in the journal                    |
//| when swapping a position from Tuesday to Wednesday               |
//+------------------------------------------------------------------+
void SymbolSwapTuesdayPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSwapTuesday(symbol,header_width,indent));
  }


周三至周四的隔夜息应计比率 (SYMBOL_SWAP_WEDNESDAY)

周三至周四隔夜头寸的隔夜息计算比率(SYMBOL_SWAP_LONG 或 SYMBOL_SWAP_SHORT)。

//+------------------------------------------------------------------+
//| Return the swap accrual ratio as a string                        |
//| when swapping a position from Wednesday to Thursday              |
//+------------------------------------------------------------------+
string SymbolSwapWednesday(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Swap Wednesday:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the ratio and define its description string
   double swap_coeff=SymbolInfoDouble(symbol,SYMBOL_SWAP_WEDNESDAY);
   string coeff_descr=(swap_coeff==1 ? "single swap" : swap_coeff==3 ? "triple swap" : "no swap is charged");
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%.0f (%s)",indent,"",w,header,swap_coeff,coeff_descr);
   /* Sample output:
      Swap Wednesday: 3 (triple swap)
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the swap accrual ratio in the journal                    |
//| when swapping a position from Wednesday to Thursday              |
//+------------------------------------------------------------------+
void SymbolSwapWednesdayPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSwapWednesday(symbol,header_width,indent));
  }


周四至周五的隔夜息应计比率 (SYMBOL_SWAP_THURSDAY)

周四至周五隔夜头寸的隔夜息计算比率(SYMBOL_SWAP_LONG 或 SYMBOL_SWAP_SHORT)。

//+------------------------------------------------------------------+
//| Return the swap accrual ratio as a string                        |
//| when swapping a position from Thursday to Friday                 |
//+------------------------------------------------------------------+
string SymbolSwapThursday(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Swap Thursday:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the ratio and define its description string
   double swap_coeff=SymbolInfoDouble(symbol,SYMBOL_SWAP_THURSDAY);
   string coeff_descr=(swap_coeff==1 ? "single swap" : swap_coeff==3 ? "triple swap" : "no swap is charged");
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%.0f (%s)",indent,"",w,header,swap_coeff,coeff_descr);
   /* Sample output:
      Swap Thursday: 1 (single swap)
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the swap accrual ratio in the journal                    |
//| when swapping a position from Thursday to Friday                 |
//+------------------------------------------------------------------+
void SymbolSwapThursdayPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSwapThursday(symbol,header_width,indent));
  }


周五至周六的隔夜息应计比率 (SYMBOL_SWAP_FRIDAY)

周五至周六隔夜头寸的隔夜息计算比率(SYMBOL_SWAP_LONG 或 SYMBOL_SWAP_SHORT)。

//+------------------------------------------------------------------+
//| Return the swap accrual ratio as a string                        |
//| when swapping a position from Friday to Saturday                 |
//+------------------------------------------------------------------+
string SymbolSwapFriday(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Swap Friday:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the ratio and define its description string
   double swap_coeff=SymbolInfoDouble(symbol,SYMBOL_SWAP_FRIDAY);
   string coeff_descr=(swap_coeff==1 ? "single swap" : swap_coeff==3 ? "triple swap" : "no swap is charged");
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%.0f (%s)",indent,"",w,header,swap_coeff,coeff_descr);
   /* Sample output:
      Swap Friday: 1 (single swap)
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the swap accrual ratio in the journal                    |
//| when swapping a position from Friday to Saturday                 |
//+------------------------------------------------------------------+
void SymbolSwapFridayPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSwapFriday(symbol,header_width,indent));
  }


周六至周日的隔夜息应计比率 (SYMBOL_SWAP_SATURDAY)

周六至周日隔夜头寸的隔夜息计算比率(SYMBOL_SWAP_LONG 或 SYMBOL_SWAP_SHORT)。

//+------------------------------------------------------------------+
//| Return the swap accrual ratio as a string                        |
//| when swapping a position from Saturday to Sunday                 |
//+------------------------------------------------------------------+
string SymbolSwapSaturday(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Swap Saturday:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the ratio and define its description string
   double swap_coeff=SymbolInfoDouble(symbol,SYMBOL_SWAP_SATURDAY);
   string coeff_descr=(swap_coeff==1 ? "single swap" : swap_coeff==3 ? "triple swap" : "no swap is charged");
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%.0f (%s)",indent,"",w,header,swap_coeff,coeff_descr);
   /* Sample output:
      Swap Saturday: 0 (no swap is charged)
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the swap accrual ratio in the journal                    |
//| when swapping a position from Saturday to Sunday                 |
//+------------------------------------------------------------------+
void SymbolSwapSaturdayPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSwapSaturday(symbol,header_width,indent));
  }

总的来说,我们最终使用了7*2个函数来显示一周中每一天的隔夜息应计系数。但是,我们可以制作一个通用函数,返回一个描述一周中指定日期隔夜息比率的字符串,并制作一个函数,将第一个函数返回的结果打印到日志中。让我们加上:

//+------------------------------------------------------------------+
//| Return the swap accrual ratio as a string                        |
//| for a specified day of the week                                  |
//+------------------------------------------------------------------+
string SymbolSwapByDay(const string symbol,const ENUM_DAY_OF_WEEK day_week,const uint header_width=0,const uint indent=0)
  {
//--- Get a text description of a day of the week
   string day=EnumToString(day_week);
//--- Convert all obtained symbols to lower case and replace the first letter from small to capital
   if(day.Lower())
      day.SetChar(0,ushort(day.GetChar(0)-0x20));
//--- Create the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header=StringFormat("Swap %s:",day);
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Declare the property that needs to be requested in SymbolInfoDouble()
   int prop=SYMBOL_SWAP_SUNDAY;
//--- Depending on the day of the week, indicate the requested property
   switch(day_week)
     {
      case MONDAY       : prop=SYMBOL_SWAP_MONDAY;    break;
      case TUESDAY      : prop=SYMBOL_SWAP_TUESDAY;   break;
      case WEDNESDAY    : prop=SYMBOL_SWAP_WEDNESDAY; break;
      case THURSDAY     : prop=SYMBOL_SWAP_THURSDAY;  break;
      case FRIDAY       : prop=SYMBOL_SWAP_FRIDAY;    break;
      case SATURDAY     : prop=SYMBOL_SWAP_SATURDAY;  break;
      default/*SUNDAY*/ : prop=SYMBOL_SWAP_SUNDAY;    break;
     }
//--- Get the ratio by a selected property and define its description string
   double swap_coeff=SymbolInfoDouble(symbol,(ENUM_SYMBOL_INFO_DOUBLE)prop);
   string coeff_descr=(swap_coeff==1 ? "single swap" : swap_coeff==3 ? "triple swap" : "no swap is charged");
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%.0f (%s)",indent,"",w,header,swap_coeff,coeff_descr);
   /* Sample output:
      Swap Sunday: 0 (no swap is charged)
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the swap accrual ratio in the journal                    |
//| for a specified day of the week                                  |
//+------------------------------------------------------------------+
void SymbolSwapByDayPrint(const string symbol,const ENUM_DAY_OF_WEEK day_week,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSwapByDay(symbol,day_week,header_width,indent));
  }


初始保证金(SYMBOL_MARGIN_INITIAL)

初始保证金 - 开仓所需的保证金货币金额(1手)。它用于在市场进入期间检查客户资金。SymbolInfoMarginRate()函数用于根据订单类型和方向获取有关收取的保证金金额的信息。

//+------------------------------------------------------------------+
//| Return the initial margin as a string                            |
//+------------------------------------------------------------------+
string SymbolMarginInitial(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Margin initial:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.2f %s",indent,"",w,header,SymbolInfoDouble(symbol,SYMBOL_MARGIN_INITIAL),SymbolInfoString(symbol,SYMBOL_CURRENCY_MARGIN));
   /* Sample output:
      Margin initial: 0.00 GBP
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the initial margin in the journal                        |
//+------------------------------------------------------------------+
void SymbolMarginInitialPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolMarginInitial(symbol,header_width,indent));
  }


维护保证金 (SYMBOL_MARGIN_MAINTENANCE)

资产的维护保证金。如果指定,则表示从一手以资产保证金货币表示的保证金大小。当检查客户的账户状态变化时,它用于检查客户资金。如果维护保证金为0,则使用初始保证金。SymbolInfoMarginRate()函数用于根据订单类型和方向获取有关收取的保证金金额的信息。

//+------------------------------------------------------------------+
//| Return the maintenance margin for an instrument as a string      |
//+------------------------------------------------------------------+
string SymbolMarginMaintenance(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Margin maintenance:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.2f %s",indent,"",w,header,SymbolInfoDouble(symbol,SYMBOL_MARGIN_MAINTENANCE),SymbolInfoString(symbol,SYMBOL_CURRENCY_MARGIN));
   /* Sample output:
      Margin maintenance: 0.00 GBP
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the maintenance margin for an instrument in the journal  |
//+------------------------------------------------------------------+
void SymbolMarginMaintenancePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolMarginMaintenance(symbol,header_width,indent));
  }


当前交易量(SYMBOL_SESSION_VOLUME)

当前交易的总交易量。

//+------------------------------------------------------------------------+
//| Returns the total volume of trades in the current session as a string  |
//+------------------------------------------------------------------------+
string SymbolSessionVolume(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Session volume:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.2f",indent,"",w,header,SymbolInfoDouble(symbol,SYMBOL_SESSION_VOLUME));
   /* Sample output:
      Session volume: 0.00
   */
  }

显示日志中第一个函数的返回值:

//+---------------------------------------------------------------------------+
//| Display the total volume of trades in the current session in the journal  |
//+---------------------------------------------------------------------------+
void SymbolSessionVolumePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSessionVolume(symbol,header_width,indent));
  }


当前流通量 (SYMBOL_SESSION_TURNOVER)

当前的总流通量。

//+------------------------------------------------------------------+
//| Return the total turnover in the current session as a string     |
//+------------------------------------------------------------------+
string SymbolSessionTurnover(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Session turnover:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.2f",indent,"",w,header,SymbolInfoDouble(symbol,SYMBOL_SESSION_TURNOVER));
   /* Sample output:
      Session turnover: 0.00
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------------+
//| Displays the total turnover during the current session in the journal  |
//+------------------------------------------------------------------------+
void SymbolSessionTurnoverPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSessionTurnover(symbol,header_width,indent));
  }


持仓量(SYMBOL_SESSION_INTEREST)

持仓的总交易量。

//+------------------------------------------------------------------+
//| Return the total volume of open positions as a string            |
//+------------------------------------------------------------------+
string SymbolSessionInterest(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Session interest:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.2f",indent,"",w,header,SymbolInfoDouble(symbol,SYMBOL_SESSION_INTEREST));
   /* Sample output:
      Session interest: 0.00
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the total volume of open positions in the journal        |
//+------------------------------------------------------------------+
void SymbolSessionInterestPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSessionInterest(symbol,header_width,indent));
  }


买入订单交易量 (SYMBOL_SESSION_BUY_ORDERS_VOLUME)

当前买入订单的总交易量。

//+------------------------------------------------------------------+
//| Return the current total volume of buy orders                    |
//| as a string                                                      |
//+------------------------------------------------------------------+
string SymbolSessionBuyOrdersVolume(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Session Buy orders volume:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.2f",indent,"",w,header,SymbolInfoDouble(symbol,SYMBOL_SESSION_BUY_ORDERS_VOLUME));
   /* Sample output:
      Session Buy orders volume: 0.00
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the total volume of Buy orders at the moment             |
//+------------------------------------------------------------------+
void SymbolSessionBuyOrdersVolumePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSessionBuyOrdersVolume(symbol,header_width,indent));
  }


卖出订单交易量 (SYMBOL_SESSION_SELL_ORDERS_VOLUME)

当前卖出订单的总交易量。

//+------------------------------------------------------------------+
//| Return the current total volume of sell orders                   |
//| as a string                                                      |
//+------------------------------------------------------------------+
string SymbolSessionSellOrdersVolume(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Session Sell orders volume:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.2f",indent,"",w,header,SymbolInfoDouble(symbol,SYMBOL_SESSION_SELL_ORDERS_VOLUME));
   /* Sample output:
      Session Sell orders volume: 0.00
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the total volume of Sell orders at the moment            |
//+------------------------------------------------------------------+
void SymbolSessionSellOrdersVolumePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSessionSellOrdersVolume(symbol,header_width,indent));
  }


当前持仓价格 (SYMBOL_SESSION_OPEN)

//+------------------------------------------------------------------+
//| Return the session open price as a string                        |
//+------------------------------------------------------------------+
string SymbolSessionOpen(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Session Open:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_SESSION_OPEN));
   /* Sample output:
      Session Open: 1.31314
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the session open price in the journal                    |
//+------------------------------------------------------------------+
void SymbolSessionOpenPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSessionOpen(symbol,header_width,indent));
  }


当前持仓价格 (SYMBOL_SESSION_CLOSE)

//+------------------------------------------------------------------+
//| Return the session close price as a string                       |
//+------------------------------------------------------------------+
string SymbolSessionClose(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Session Close:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_SESSION_CLOSE));
   /* Sample output:
      Session Close: 1.31349
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the session close price in the journal                   |
//+------------------------------------------------------------------+
void SymbolSessionClosePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSessionClose(symbol,header_width,indent));
  }


当前持仓加权平均价格(SYMBOL_SESSION_AW)

//+------------------------------------------------------------------+
//| Return the session average weighted price as a string            |
//+------------------------------------------------------------------+
string SymbolSessionAW(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Session AW:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_SESSION_AW));
   /* Sample output:
      Session AW: 0.00000
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the weighted average session price in the journal        |
//+------------------------------------------------------------------+
void SymbolSessionAWPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSessionAW(symbol,header_width,indent));
  }


当前结算价格(SYMBOL_SESSION_PRICE_SETTLEMENT)

//+------------------------------------------------------------------+
//| Return the settlement price of the current session as a string   |
//+------------------------------------------------------------------+
string SymbolSessionPriceSettlement(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Session price settlement:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_SESSION_PRICE_SETTLEMENT));
   /* Sample output:
      Session price settlement: 0.00000
   */
  }

显示日志中第一个函数的返回值:

//+--------------------------------------------------------------------+
//| Display the settlement price of the current session in the journal |
//+--------------------------------------------------------------------+
void SymbolSessionPriceSettlementPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSessionPriceSettlement(symbol,header_width,indent));
  }


当前最低价格 (SYMBOL_SESSION_PRICE_LIMIT_MIN)

当前允许的最低价格值。

//+------------------------------------------------------------------+
//| Return the minimum acceptable                                    |
//| price value per session as a string                              |
//+------------------------------------------------------------------+
string SymbolSessionPriceLimitMin(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Session price limit min:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_SESSION_PRICE_LIMIT_MIN));
   /* Sample output:
      Session price limit min: 0.00000
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Displays the minimum acceptable                                  |
//| price value per session in the journal                           |
//+------------------------------------------------------------------+
void SymbolSessionPriceLimitMinPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSessionPriceLimitMin(symbol,header_width,indent));
  }


当前最高价格 (SYMBOL_SESSION_PRICE_LIMIT_MAX)

当前允许的最高价格值。

//+------------------------------------------------------------------+
//| Return the maximum acceptable                                    |
//| price value per session as a string                              |
//+------------------------------------------------------------------+
string SymbolSessionPriceLimitMax(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Session price limit max:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_SESSION_PRICE_LIMIT_MAX));
   /* Sample output:
      Session price limit max: 0.00000
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the maximum acceptable                                   |
//| price value per session in the journal                           |
//+------------------------------------------------------------------+
void SymbolSessionPriceLimitMaxPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSessionPriceLimitMax(symbol,header_width,indent));
  }


一手锁仓的合约大小(SYMBOL_MARGIN_HEDGED)

一手锁仓的合约或保证金的大小(一个交易品种上的反向头寸)。锁仓头寸可采用两种保证金计算方法,计算方法由经纪商决定
 
基础计算:

  • 如果为某个交易品种指定了初始保证金(SYMBOL_MARGIN_INITIAL),则对冲保证金被指定为绝对值(以货币形式表示)。
  • 如果未设置初始保证金(等于0),则在SYMBOL_MARGIN_HEDGED中指定保证金计算中使用的合约大小。保证金使用与交易品种类型(SYMBOL_TRADE_CALC_MODE)相对应的公式计算。

按最大持仓计算:

  • SYMBOL_MARGIN_HEDGED 值被忽略,
  • 计算交易品种的所有空头和所有多头持仓的交易量。
  • 对于每个方向,计算加权平均开仓价格和向存款货币的加权平均转换率。
  • 接下来,使用与交易品种类型(SYMBOL_TRADE_CALC_MODE)相对应的公式来计算空头和多头的保证金。
  • 最大的那个值用来做最终值。
//+------------------------------------------------------------------+
//| Return the contract or margin size as a string                   |
//| for a single lot of covered positions                            |
//+------------------------------------------------------------------+
string SymbolMarginHedged(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Margin hedged:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.2f",indent,"",w,header,SymbolInfoDouble(symbol,SYMBOL_MARGIN_HEDGED));
   /* Sample output:
      Margin hedged: 100000.00
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the contract or margin size in the journal               |
//| for a single lot of covered positions                            |
//+------------------------------------------------------------------+
void SymbolMarginHedgedPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolMarginHedged(symbol,header_width,indent));
  }


当前价格的变化百分比(SYMBOL_PRICE_CHANGE)

当前价格相对于前一交易日结束时的变化(%)。

//+------------------------------------------------------------------+
//| Return the change of the current price relative to               |
//| the end of the previous trading day in percentage as a string    |
//+------------------------------------------------------------------+
string SymbolPriceChange(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Price change:";
   uint w=(header_width==0 ? header.Length()+1 : header_width-1);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%- .2f %%",indent,"",w,header,SymbolInfoDouble(symbol,SYMBOL_PRICE_CHANGE));
   /* Sample output:
      Price change: -0.28 %
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display in the journal                                           |
//| the end of the previous trading day in percentage as a string    |
//+------------------------------------------------------------------+
void SymbolPriceChangePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolPriceChange(symbol,header_width,indent));
  }


价格波动率百分比 (SYMBOL_PRICE_VOLATILITY)

//+------------------------------------------------------------------+
//| Return the price volatility in percentage as a string            |
//+------------------------------------------------------------------+
string SymbolPriceVolatility(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Price volatility:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.2f %%",indent,"",w,header,SymbolInfoDouble(symbol,SYMBOL_PRICE_VOLATILITY));
   /* Sample output:
      Price volatility: 0.00 %
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the price volatility in percentage in the journal        |
//+------------------------------------------------------------------+
void SymbolPriceVolatilityPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolPriceVolatility(symbol,header_width,indent));
  }


理论期权价格 (SYMBOL_PRICE_THEORETICAL)

//+------------------------------------------------------------------+
//| Return the theoretical price of an option as a string            |
//+------------------------------------------------------------------+
string SymbolPriceTheoretical(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Price theoretical:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_PRICE_THEORETICAL));
   /* Sample output:
      Price theoretical: 0.00000
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the theoretical price of an option in the journal        |
//+------------------------------------------------------------------+
void SymbolPriceTheoreticalPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolPriceTheoretical(symbol,header_width,indent));
  }


期权/权证delta

期权/权证delta显示当基础资产价格变化1时,期权价格变化的值。

//+------------------------------------------------------------------+
//| Return as the option/warrant delta as a string                   |
//+------------------------------------------------------------------+
string SymbolPriceDelta(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Price delta:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_PRICE_DELTA));
   /* Sample output:
      Price delta: 0.00000
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the option/warrant delta in the journal                  |
//+------------------------------------------------------------------+
void SymbolPriceDeltaPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolPriceDelta(symbol,header_width,indent));
  }


期权/权证theta (SYMBOL_PRICE_THETA)

期权/权证theta. 期权价格每天因临时停止而损失的点数,即到期日临近时。

//+------------------------------------------------------------------+
//| Return as the option/warrant theta as a string                   |
//+------------------------------------------------------------------+
string SymbolPriceTheta(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Price theta:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_PRICE_THETA));
   /* Sample output:
      Price theta: 0.00000
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the option/warrant theta in the journal                  |
//+------------------------------------------------------------------+
void SymbolPriceThetaPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolPriceTheta(symbol,header_width,indent));
  }


期权/权证gamma (SYMBOL_PRICE_GAMMA)

期权/权证 gamma. SYMBOL_PRICE_GAMMA — 期权/权证 gamma.

//+------------------------------------------------------------------+
//| Return as the option/warrant gamma as a string                   |
//+------------------------------------------------------------------+
string SymbolPriceGamma(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Price gamma:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_PRICE_GAMMA));
   /* Sample output:
      Price gamma: 0.00000
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the option/warrant gamma in the journal                  |
//+------------------------------------------------------------------+
void SymbolPriceGammaPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolPriceGamma(symbol,header_width,indent));
  }


期权/权证 vega (SYMBOL_PRICE_VEGA)

期权/权证 vega。显示当波动率变化1%时,期权价格变化的点数。

//+------------------------------------------------------------------+
//| Return as the option/warrant vega as a string                    |
//+------------------------------------------------------------------+
string SymbolPriceVega(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Price vega:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_PRICE_VEGA));
   /* Sample output:
      Price vega: 0.00000
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the option/warrant vega in the journal                   |
//+------------------------------------------------------------------+
void SymbolPriceVegaPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolPriceVega(symbol,header_width,indent));
  }


期权/权证 rho (SYMBOL_PRICE_RHO)

期权/权证 rho. 反映了理论期权价格对利率变化1%的敏感性。

//+------------------------------------------------------------------+
//| Return as the option/warrant rho as a string                     |
//+------------------------------------------------------------------+
string SymbolPriceRho(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Price rho:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_PRICE_RHO));
   /* Sample output:
      Price rho: 0.00000
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the option/warrant rho in the journal                    |
//+------------------------------------------------------------------+
void SymbolPriceRhoPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolPriceRho(symbol,header_width,indent));
  }


期权/权证 omega (SYMBOL_PRICE_OMEGA)

期权/权证 omega. 期权弹性——期权价格相对于基础资产价格的百分比变化的相对百分比变化。

//+------------------------------------------------------------------+
//| Return as the option/warrant omega as a string                   |
//+------------------------------------------------------------------+
string SymbolPriceOmega(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Price omega:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_PRICE_OMEGA));
   /* Sample output:
      Price omega: 0.00000
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the option/warrant omega in the journal                  |
//+------------------------------------------------------------------+
void SymbolPriceOmegaPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolPriceOmega(symbol,header_width,indent));
  }


期权/权证敏感度 (SYMBOL_PRICE_SENSITIVITY)

期权/权证敏感性。显示期权基础资产的价格应更改多少点,从而使期权的价格更改一点。

//+------------------------------------------------------------------+
//| Return the option/warrant sensitivity as a string                |
//+------------------------------------------------------------------+
string SymbolPriceSensitivity(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Price sensitivity:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the number of decimal places
   int dg=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s%-.*f",indent,"",w,header,dg,SymbolInfoDouble(symbol,SYMBOL_PRICE_SENSITIVITY));
   /* Sample output:
      Price sensitivity: 0.00000
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the option/warrant sensitivity in the journal            |
//+------------------------------------------------------------------+
void SymbolPriceSensitivityPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolPriceSensitivity(symbol,header_width,indent));
  }


读取和显示交易品种的字符串型属性

标的资产名称 (SYMBOL_BASIS)

衍生交易品种的参考基础资产的名称。

//+------------------------------------------------------------------+
//| Return the base asset name for a derivative instrument           |
//+------------------------------------------------------------------+
string SymbolBasis(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Basis:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the string parameter value
   string param=SymbolInfoString(symbol,SYMBOL_BASIS);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s'%-s'%-s",indent,"",w,header,param,param=="" ? " (Not specified)" : "");
   /* Sample output:
      Basis: '' (Not specified)
   */
  }

如果未指定参数并返回空字符串,在空参数旁边添加“未指定(Not specified)”文本

显示日志中第一个函数的返回值:

//+----------------------------------------------------------------------+
//| Return the base asset name for a derivative instrument in the journal|
//+----------------------------------------------------------------------+
void SymbolBasisPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolBasis(symbol,header_width,indent));
  }


资产类别或行业(SYMBOL_CATEGORY)

金融工具所属类别或行业的名称。

//+------------------------------------------------------------------+
//| Return the name of the financial instrument category or sector   |
//+------------------------------------------------------------------+
string SymbolCategory(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Category:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the string parameter value
   string param=SymbolInfoString(symbol,SYMBOL_CATEGORY);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s'%-s'%-s",indent,"",w,header,param,param=="" ? " (Not specified)" : "");
   /* Sample output:
      Category: '' (Not specified)
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the name of the financial instrument category or sector  |
//| in the journal                                                   |
//+------------------------------------------------------------------+
void SymbolCategoryPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolCategory(symbol,header_width,indent));
  }


金融资产国家(SYMBOL_COUNTRY)

交易资产所属的国家/地区。

//+------------------------------------------------------------------+
//| Return the country the trading instrument belongs to             |
//+------------------------------------------------------------------+
string SymbolCountry(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Country:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the string parameter value
   string param=SymbolInfoString(symbol,SYMBOL_COUNTRY);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s'%-s'%-s",indent,"",w,header,param,param=="" ? " (Not specified)" : "");
   /* Sample output:
      Country: '' (Not specified)
   */
  }

显示日志中第一个函数的返回值:

//+----------------------------------------------------------------------+
//| Display the country the trading instrument belongs to in the journal |
//+----------------------------------------------------------------------+
void SymbolCountryPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolCountry(symbol,header_width,indent));
  }


经济部门(SYMBOL_SECTOR_NAME)

交易资产所属的经济部门。

//+------------------------------------------------------------------+
//| Return the economic sector                                       |
//| the financial instrument belongs to                              |
//+------------------------------------------------------------------+
string SymbolSectorName(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Sector name:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the string parameter value
   string param=SymbolInfoString(symbol,SYMBOL_SECTOR_NAME);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s'%-s'%-s",indent,"",w,header,param,param=="" ? " (Not specified)" : "");
   /* Sample output:
      Sector name: 'Currency'
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display in the journal the economic sector                       |
//| the financial instrument belongs to                              |
//+------------------------------------------------------------------+
void SymbolSectorNamePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolSectorName(symbol,header_width,indent));
  }


经济分支(SYMBOL_INDUSTRY_NAME)

金融资产所属的行业分支或行业。

//+------------------------------------------------------------------+
//| Return the economy or industry branch                            |
//| the financial instrument belongs to                              |
//+------------------------------------------------------------------+
string SymbolIndustryName(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Industry name:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the string parameter value
   string param=SymbolInfoString(symbol,SYMBOL_INDUSTRY_NAME);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s'%-s'%-s",indent,"",w,header,param,param=="" ? " (Not specified)" : "");
   /* Sample output:
      Industry name: 'Undefined'
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display in the journal the economy or industry branch            |
//| the financial instrument belongs to                              |
//+------------------------------------------------------------------+
void SymbolIndustryNamePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolIndustryName(symbol,header_width,indent));
  }


基础货币 (SYMBOL_CURRENCY_BASE)

资产基础货币。

//+------------------------------------------------------------------+
//| Return the instrument base currency                              |
//+------------------------------------------------------------------+
string SymbolCurrencyBase(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Currency base:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the string parameter value
   string param=SymbolInfoString(symbol,SYMBOL_CURRENCY_BASE);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s'%-s'%-s",indent,"",w,header,param,param=="" ? " (Not specified)" : "");
   /* Sample output:
      Currency base: 'GBP'
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the instrument base currency in the journal              |
//+------------------------------------------------------------------+
void SymbolCurrencyBasePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolCurrencyBase(symbol,header_width,indent));
  }


利润货币(SYMBOL_CURRENCY_PROFIT)

//+------------------------------------------------------------------+
//| Return the profit currency                                       |
//+------------------------------------------------------------------+
string SymbolCurrencyProfit(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Currency profit:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the string parameter value
   string param=SymbolInfoString(symbol,SYMBOL_CURRENCY_PROFIT);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s'%-s'%-s",indent,"",w,header,param,param=="" ? " (Not specified)" : "");
   /* Sample output:
      Currency profit: 'USD'
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the profit currency in the journal                       |
//+------------------------------------------------------------------+
void SymbolCurrencyProfitPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolCurrencyProfit(symbol,header_width,indent));
  }


抵押货币(SYMBOL_CURRENCY_MARGIN)

保证金货币。

//+------------------------------------------------------------------+
//| Return margin currency                                           |
//+------------------------------------------------------------------+
string SymbolCurrencyMargin(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Currency margin:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the string parameter value
   string param=SymbolInfoString(symbol,SYMBOL_CURRENCY_MARGIN);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s'%-s'%-s",indent,"",w,header,param,param=="" ? " (Not specified)" : "");
   /* Sample output:
      Currency margin: 'GBP'
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the margin currency in the journal                       |
//+------------------------------------------------------------------+
void SymbolCurrencyMarginPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolCurrencyMargin(symbol,header_width,indent));
  }


报价来源 (SYMBOL_BANK)

当前报价的来源。

//+------------------------------------------------------------------+
//| Return the current quote source                                  |
//+------------------------------------------------------------------+
string SymbolBank(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Bank:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the string parameter value
   string param=SymbolInfoString(symbol,SYMBOL_BANK);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s'%-s'%-s",indent,"",w,header,param,param=="" ? " (Not specified)" : "");
   /* Sample output:
      Bank: '' (Not specified)
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the current quote source in the journal                  |
//+------------------------------------------------------------------+
void SymbolBankPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolBank(symbol,header_width,indent));
  }


交易品种描述 (SYMBOL_DESCRIPTION)

交易品种的字符串描述。

//+------------------------------------------------------------------+
//| Return the symbol string description                             |
//+------------------------------------------------------------------+
string SymbolDescription(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Description:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the string parameter value
   string param=SymbolInfoString(symbol,SYMBOL_DESCRIPTION);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s'%-s'%-s",indent,"",w,header,param,param=="" ? " (Not specified)" : "");
   /* Sample output:
      Description: 'Pound Sterling vs US Dollar'
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the symbol string description in the journal             |
//+------------------------------------------------------------------+
void SymbolDescriptionPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolDescription(symbol,header_width,indent));
  }


交易所名称 (SYMBOL_EXCHANGE)

交易资产所在交易所的名称。

//+------------------------------------------------------------------+
//| Return the name of an exchange                                   |
//| a symbol is traded on                                            |
//+------------------------------------------------------------------+
string SymbolExchange(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Exchange:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the string parameter value
   string param=SymbolInfoString(symbol,SYMBOL_EXCHANGE);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s'%-s'%-s",indent,"",w,header,param,param=="" ? " (Not specified)" : "");
   /* Sample output:
      Exchange: '' (Not specified)
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display in the journal the name of an exchange                   |
//| a symbol is traded on                                            |
//+------------------------------------------------------------------+
void SymbolExchangePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolExchange(symbol,header_width,indent));
  }


自定义交易品种公式(SYMBOL_FORMULA)

用于自定义交易品种定价的公式。如果等式中包含的金融工具名称以数字开头或包含特殊字符(“”、“.”、“-”、“&”、“#”等),则该名称应用引号括起来。

  • 合成交易品种:“@ESU19”/EURCAD
  • 日历排列:“Si-9.13”-“Si-6.13”
  • 欧元指数:34.38805726 * pow(EURUSD,0.3155) * pow(EURGBP,0.3056) * pow(EURJPY,0.1891) * pow(EURCHF,0.1113) * pow(EURSEK,0.0785)
//+------------------------------------------------------------------+
//| Return a formula for constructing a custom symbol price          |
//+------------------------------------------------------------------+
string SymbolFormula(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Formula:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the string parameter value
   string param=SymbolInfoString(symbol,SYMBOL_FORMULA);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s'%-s'%-s",indent,"",w,header,param,param=="" ? " (Not specified)" : "");
   /* Sample output:
      Formula: '' (Not specified)
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the equation for constructing                            |
//| the custom symbol price in the journal                           |
//+------------------------------------------------------------------+
void SymbolFormulaPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolFormula(symbol,header_width,indent));
  }


ISIN 系统名称 (SYMBOL_ISIN)

国际证券识别号系统(ISIN)中交易品种的名称。国际安全识别码是一个12位字母数字代码,用于唯一识别安全。此交易品种属性的可用性在交易服务器端定义。

//+------------------------------------------------------------------+
//| Return the trading symbol name in the                            |
//| ISIN system                                                      |
//+------------------------------------------------------------------+
string SymbolISIN(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="ISIN:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the string parameter value
   string param=SymbolInfoString(symbol,SYMBOL_ISIN);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s'%-s'%-s",indent,"",w,header,param,param=="" ? " (Not specified)" : "");
   /* Sample output:
      ISIN: '' (Not specified)
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display in the journal the trading symbol name in the            |
//| ISIN system                                                      |
//+------------------------------------------------------------------+
void SymbolISINPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolISIN(symbol,header_width,indent));
  }


网页地址(SYMBOL_PAGE)

包含交易品种信息的网页的地址。在终端中查看交易品种属性时,此地址将显示为链接。

//+------------------------------------------------------------------+
//| Return the address of a web page with a symbol data              |
//+------------------------------------------------------------------+
string SymbolPage(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Page:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the string parameter value
   string param=SymbolInfoString(symbol,SYMBOL_PAGE);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s'%-s'%-s",indent,"",w,header,param,param=="" ? " (Not specified)" : "");
   /* Sample output:
      Page: 'https://www.mql5.com/en/quotes/currencies/gbpusd'
   */
  }

显示日志中第一个函数的返回值:

//+--------------------------------------------------------------------+
//| Display the address of a web page with a symbol data in the journal|
//+--------------------------------------------------------------------+
void SymbolPagePrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolPage(symbol,header_width,indent));
  }


交易品种树中的通路(SYMBOL_PATH)

//+------------------------------------------------------------------+
//| Return the path in the symbol tree                               |
//+------------------------------------------------------------------+
string SymbolPath(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Define the header text and the width of the header field
//--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
   string header="Path:";
   uint w=(header_width==0 ? header.Length()+1 : header_width);
//--- Get the string parameter value
   string param=SymbolInfoString(symbol,SYMBOL_PATH);
//--- Return the property value with a header having the required width and indentation
   return StringFormat("%*s%-*s'%-s'%-s",indent,"",w,header,param,param=="" ? " (Not specified)" : "");
   /* Sample output:
      Path: 'Forex\GBPUSD'
   */
  }

显示日志中第一个函数的返回值:

//+------------------------------------------------------------------+
//| Display the path in the symbol tree in the journal               |
//+------------------------------------------------------------------+
void SymbolPathPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Print the property value in the log with a header with the required width and indentation
   Print(SymbolPath(symbol,header_width,indent));
  }

上述函数在逻辑上彼此相同。它们中的每一个都可以“原样”用于输出到日志,或者以字符串的形式获得所需的符号属性。默认情况下,字符串缩进为零,标题字段的宽度等于标题文本的宽度,即属性描述文本中没有缩进或对齐。如果需要显示一组交易品种属性以对齐日记账中的数据字段,则需要它们。让我们实现这样一个函数,


在日志中打印所有交易品种数据的函数

基于创建的函数,我们将创建一个函数,按照交易品种在ENUM_symbol_INFO_INTEGERENUM_SEYMBOL_INFO_DOUBLE

ENUM_SYMBOL_INFO_STRING 枚举中的顺序记录下这些属性。

//+------------------------------------------------------------------+
//| Send all symbol properties to the journal                        |
//+------------------------------------------------------------------+
void SymbolInfoPrint(const string symbol,const uint header_width=0,const uint indent=0)
  {
//--- Display descriptions of integer properties according to their location in ENUM_SYMBOL_INFO_INTEGER
   Print("SymbolInfoInteger properties:");
   SymbolSubscriptionDelayPrint(symbol,header_width,indent);
   SymbolSectorPrint(symbol,header_width,indent);
   SymbolIndustryPrint(symbol,header_width,indent);
   SymbolCustomPrint(symbol,header_width,indent);
   SymbolBackgroundColorPrint(symbol,header_width,indent);
   SymbolChartModePrint(symbol,header_width,indent);
   SymbolExistsPrint(symbol,header_width,indent);
   SymbolSelectedPrint(symbol,header_width,indent);
   SymbolVisiblePrint(symbol,header_width,indent);
   SymbolSessionDealsPrint(symbol,header_width,indent);
   SymbolSessionBuyOrdersPrint(symbol,header_width,indent);
   SymbolSessionSellOrdersPrint(symbol,header_width,indent);
   SymbolVolumePrint(symbol,header_width,indent);
   SymbolVolumeHighPrint(symbol,header_width,indent);
   SymbolVolumeLowPrint(symbol,header_width,indent);
   SymbolTimePrint(symbol,header_width,indent);
   SymbolTimeMSCPrint(symbol,header_width,indent);
   SymbolDigitsPrint(symbol,header_width,indent);
   SymbolSpreadPrint(symbol,header_width,indent);
   SymbolSpreadFloatPrint(symbol,header_width,indent);
   SymbolTicksBookDepthPrint(symbol,header_width,indent);
   SymbolTradeCalcModePrint(symbol,header_width,indent);
   SymbolTradeModePrint(symbol,header_width,indent);
   SymbolSymbolStartTimePrint(symbol,header_width,indent);
   SymbolSymbolExpirationTimePrint(symbol,header_width,indent);
   SymbolTradeStopsLevelPrint(symbol,header_width,indent);
   SymbolTradeFreezeLevelPrint(symbol,header_width,indent);
   SymbolTradeExeModePrint(symbol,header_width,indent);
   SymbolSwapModePrint(symbol,header_width,indent);
   SymbolSwapRollover3DaysPrint(symbol,header_width,indent);
   SymbolMarginHedgedUseLegPrint(symbol,header_width,indent);
   SymbolExpirationModePrint(symbol,header_width,indent);
   SymbolFillingModePrint(symbol,header_width,indent);
   SymbolOrderModePrint(symbol,header_width,indent);
   SymbolOrderGTCModePrint(symbol,header_width,indent);
   SymbolOptionModePrint(symbol,header_width,indent);
   SymbolOptionRightPrint(symbol,header_width,indent);

//--- Display descriptions of real properties according to their location in ENUM_SYMBOL_INFO_DOUBLE
   Print("SymbolInfoDouble properties:");
   SymbolBidPrint(symbol,header_width,indent);
   SymbolBidHighPrint(symbol,header_width,indent);
   SymbolBidLowPrint(symbol,header_width,indent);
   SymbolAskPrint(symbol,header_width,indent);
   SymbolAskHighPrint(symbol,header_width,indent);
   SymbolAskLowPrint(symbol,header_width,indent);
   SymbolLastPrint(symbol,header_width,indent);
   SymbolLastHighPrint(symbol,header_width,indent);
   SymbolLastLowPrint(symbol,header_width,indent);
   SymbolVolumeRealPrint(symbol,header_width,indent);
   SymbolVolumeHighRealPrint(symbol,header_width,indent);
   SymbolVolumeLowRealPrint(symbol,header_width,indent);
   SymbolOptionStrikePrint(symbol,header_width,indent);
   SymbolPointPrint(symbol,header_width,indent);
   SymbolTradeTickValuePrint(symbol,header_width,indent);
   SymbolTradeTickValueProfitPrint(symbol,header_width,indent);
   SymbolTradeTickValueLossPrint(symbol,header_width,indent);
   SymbolTradeTickSizePrint(symbol,header_width,indent);
   SymbolTradeContractSizePrint(symbol,header_width,indent);
   SymbolTradeAccruedInterestPrint(symbol,header_width,indent);
   SymbolTradeFaceValuePrint(symbol,header_width,indent);
   SymbolTradeLiquidityRatePrint(symbol,header_width,indent);
   SymbolVolumeMinPrint(symbol,header_width,indent);
   SymbolVolumeMaxPrint(symbol,header_width,indent);
   SymbolVolumeStepPrint(symbol,header_width,indent);
   SymbolVolumeLimitPrint(symbol,header_width,indent);
   SymbolSwapLongPrint(symbol,header_width,indent);
   SymbolSwapShortPrint(symbol,header_width,indent);
   SymbolSwapByDayPrint(symbol,SUNDAY,header_width,indent);
   SymbolSwapByDayPrint(symbol,MONDAY,header_width,indent);
   SymbolSwapByDayPrint(symbol,TUESDAY,header_width,indent);
   SymbolSwapByDayPrint(symbol,WEDNESDAY,header_width,indent);
   SymbolSwapByDayPrint(symbol,THURSDAY,header_width,indent);
   SymbolSwapByDayPrint(symbol,FRIDAY,header_width,indent);
   SymbolSwapByDayPrint(symbol,SATURDAY,header_width,indent);
   SymbolMarginInitialPrint(symbol,header_width,indent);
   SymbolMarginMaintenancePrint(symbol,header_width,indent);
   SymbolSessionVolumePrint(symbol,header_width,indent);
   SymbolSessionTurnoverPrint(symbol,header_width,indent);
   SymbolSessionInterestPrint(symbol,header_width,indent);
   SymbolSessionBuyOrdersVolumePrint(symbol,header_width,indent);
   SymbolSessionSellOrdersVolumePrint(symbol,header_width,indent);
   SymbolSessionOpenPrint(symbol,header_width,indent);
   SymbolSessionClosePrint(symbol,header_width,indent);
   SymbolSessionAWPrint(symbol,header_width,indent);
   SymbolSessionPriceSettlementPrint(symbol,header_width,indent);
   SymbolSessionPriceLimitMinPrint(symbol,header_width,indent);
   SymbolSessionPriceLimitMaxPrint(symbol,header_width,indent);
   SymbolMarginHedgedPrint(symbol,header_width,indent);
   SymbolPriceChangePrint(symbol,header_width,indent);
   SymbolPriceVolatilityPrint(symbol,header_width,indent);
   SymbolPriceTheoreticalPrint(symbol,header_width,indent);
   SymbolPriceDeltaPrint(symbol,header_width,indent);
   SymbolPriceThetaPrint(symbol,header_width,indent);
   SymbolPriceGammaPrint(symbol,header_width,indent);
   SymbolPriceVegaPrint(symbol,header_width,indent);
   SymbolPriceRhoPrint(symbol,header_width,indent);
   SymbolPriceOmegaPrint(symbol,header_width,indent);
   SymbolPriceSensitivityPrint(symbol,header_width,indent);
   
//--- Display descriptions of string properties according to their location in ENUM_SYMBOL_INFO_STRING
   Print("SymbolInfoString properties:");
   SymbolBasisPrint(symbol,header_width,indent);
   SymbolCategoryPrint(symbol,header_width,indent);
   SymbolCountryPrint(symbol,header_width,indent);
   SymbolSectorNamePrint(symbol,header_width,indent);
   SymbolIndustryNamePrint(symbol,header_width,indent);
   SymbolCurrencyBasePrint(symbol,header_width,indent);
   SymbolCurrencyProfitPrint(symbol,header_width,indent);
   SymbolCurrencyMarginPrint(symbol,header_width,indent);
   SymbolBankPrint(symbol,header_width,indent);
   SymbolDescriptionPrint(symbol,header_width,indent);
   SymbolExchangePrint(symbol,header_width,indent);
   SymbolFormulaPrint(symbol,header_width,indent);
   SymbolISINPrint(symbol,header_width,indent);
   SymbolPagePrint(symbol,header_width,indent);
   SymbolPathPrint(symbol,header_width,indent);
  }
//+------------------------------------------------------------------+

在这里,所有的交易品种属性都被简单地打印在日志中的一行中。属性类型前面有指示类型的标头:整数型、实数型和字符串型。

从标题字段宽度为28个字符、缩进为2个字符的脚本调用函数的结果:

void OnStart()
  {
//---
   SymbolInfoPrint(Symbol(),28,2);
   /* Sample output:
      SymbolInfoInteger properties:
        Subscription Delay:         No
        Sector:                     Currency
        Industry:                   Undefined
        Custom symbol:              No
        Background color:           Default
        Chart mode:                 Bid
        Exists:                     Yes
        Selected:                   Yes
        Visible:                    Yes
        Session deals:              0
        Session Buy orders:         0
        Session Sell orders:        0
        Volume:                     0
        Volume high:                0
        Volume low:                 0
        Time:                       2023.07.14 22:07:01
        Time msc:                   2023.07.14 22:07:01.706
        Digits:                     5
        Spread:                     5
        Spread float:               Yes
        Ticks book depth:           10
        Trade calculation mode:     Forex
        Trade mode:                 Full
        Start time:                 1970.01.01 00:00:00 (Not used)
        Expiration time:            1970.01.01 00:00:00 (Not used)
        Stops level:                0 (By Spread)
        Freeze level:               0 (Not used)
        Trade Execution mode:       Instant
        Swap mode:                  Points
        Swap Rollover 3 days:       Wednesday
        Margin hedged use leg:      No
        Expiration mode:            GTC|DAY|SPECIFIED
        Filling mode:               FOK|IOC|RETURN
        Order mode:                 MARKET|LIMIT|STOP|STOP_LIMIT|SL|TP|CLOSEBY
        Order GTC mode:             GTC
        Option mode:                European
        Option right:               Call
      SymbolInfoDouble properties:
        Bid:                        1.30979
        Bid High:                   1.31422
        Bid Low:                    1.30934
        Ask:                        1.30984
        Ask High:                   1.31427
        Ask Low:                    1.30938
        Last:                       0.00000
        Last High:                  0.00000
        Last Low:                   0.00000
        Volume real:                0.00
        Volume High real:           0.00
        Volume Low real:            0.00
        Option strike:              0.00000
        Point:                      0.00001
        Tick value:                 1.00000
        Tick value profit:          1.00000
        Tick value loss:            1.00000
        Tick size:                  0.00001
        Contract size:              100000.00 GBP
        Accrued interest:           0.00
        Face value:                 0.00
        Liquidity rate:             0.00
        Volume min:                 0.01
        Volume max:                 500.00
        Volume step:                0.01
        Volume limit:               0.00
        Swap long:                 -0.20
        Swap short:                -2.20
        Swap Sunday:                0 (no swap is charged)
        Swap Monday:                1 (single swap)
        Swap Tuesday:               1 (single swap)
        Swap Wednesday:             3 (triple swap)
        Swap Thursday:              1 (single swap)
        Swap Friday:                1 (single swap)
        Swap Saturday:              0 (no swap is charged)
        Margin initial:             0.00 GBP
        Margin maintenance:         0.00 GBP
        Session volume:             0.00
        Session turnover:           0.00
        Session interest:           0.00
        Session Buy orders volume:  0.00
        Session Sell orders volume: 0.00
        Session Open:               1.31314
        Session Close:              1.31349
        Session AW:                 0.00000
        Session price settlement:   0.00000
        Session price limit min:    0.00000
        Session price limit max:    0.00000
        Margin hedged:              100000.00
        Price change:              -0.28 %
        Price volatility:           0.00 %
        Price theoretical:          0.00000
        Price delta:                0.00000
        Price theta:                0.00000
        Price gamma:                0.00000
        Price vega:                 0.00000
        Price rho:                  0.00000
        Price omega:                0.00000
        Price sensitivity:          0.00000
      SymbolInfoString properties:
        Basis:                      '' (Not specified)
        Category:                   '' (Not specified)
        Country:                    '' (Not specified)
        Sector name:                'Currency'
        Industry name:              'Undefined'
        Currency base:              'GBP'
        Currency profit:            'USD'
        Currency margin:            'GBP'
        Bank:                       '' (Not specified)
        Description:                'Pound Sterling vs US Dollar'
        Exchange:                   '' (Not specified)
        Formula:                    '' (Not specified)
        ISIN:                       '' (Not specified)
        Page:                       'https://www.mql5.com/en/quotes/currencies/gbpusd'
        Path:                       'Forex\GBPUSD'
   */
  }

正如我们所看到的,所有的数据都以表格的形式排列整齐。负值由于向左移动而不会从整体画面中突出。

这只是如何使用上述函数的一个示例。您可以在程序中“按原样”使用它们,显示一些交易品种属性组或修改它们以满足您的视觉和需求。


结论

我们已经探讨了使用格式化字符串显示交易品种和帐户属性的功能。下一步是记录MQL5中实现的一些结构。


本文由MetaQuotes Ltd译自俄文
原文地址: https://www.mql5.com/ru/articles/12953

通过应用程序了解MQL5中的函数 通过应用程序了解MQL5中的函数
函数在任何编程语言中都是至关重要的东西,它有助于开发人员应用(DRY)的概念,这意味着不要重复自己,还有许多其他好处。在本文中,您将找到更多关于函数的信息,以及我们如何使用简单的应用程序在MQL5中创建自己的函数,这些应用程序可以在任何系统中使用或调用。您必须在不使事情复杂化的情况下丰富您的交易系统。
了解 MQL5 面向对象编程(OOP) 了解 MQL5 面向对象编程(OOP)
作为开发人员,我们需要学习如何在创建和开发软件时,无需重复代码做到可重用、且灵活,尤其是当我们拥有不同行为的不同对象时。这可以利用面向对象的编程技术和原则来顺滑地达到。在本文中,我们将介绍 MQL5 面向对象编程的基础知识,以便了解如何在我们的软件中利用这一关键主题的原则和实践。
离散哈特莱变换 离散哈特莱变换
在本文中,我们将探讨频谱分析和信号处理的方法之一——离散哈特莱变换(discrete Hartley transform,DHT)。它可以过滤信号,分析它们的频谱等等。DHT的性能不亚于离散傅立叶变换(discrete Fourier transform,DFT)。然而,与DFT不同的是,DHT只使用实数,这使得它在实践中更方便实现,并且它的应用结果更直观。
DoEasy. 控件 (第 32 部分): 水平滚动条,鼠标轮滚动 DoEasy. 控件 (第 32 部分): 水平滚动条,鼠标轮滚动
在本文中,我们将完成水平滚动条对象功能的开发。我们还将令移动滚动条滑块和旋转鼠标滚轮来滚动容器的内容成为可能,以及考虑到 MQL5 中的新订单执行策略,和新的运行时错误代码,在函数库里相应添加。