Ava Trader MT4 Terminal 程序化交易(2)获取品种交易数据

2023-05-16

Ava Trader MT4 Terminal 程序化交易(2)获取品种交易数据

官方文档

在这里插入图片描述


Example:

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   Print("Symbol name of the current chart=",_Symbol);
   Print("Timeframe of the current chart=",_Period);
   Print("卖一价 =",Ask);
   Print("买一价=",Bid);   
   Print("Number of decimal places=",Digits);
   Print("Number of decimal places=",_Digits);
   Print("Size of the current symbol point in the quote currency=",_Point);
   Print("Size of the current symbol point in the quote currency=",Point);   
   Print("Number of bars in the current chart=",Bars);
   Print("当前 K线 开盘价=",Open[0]);
   Print("当前 K线 收盘价=",Close[0]);
   Print("当前 K线 最高价 =",High[0]);
   Print("当前 K线 最低价 =",Low[0]);
   Print("当前K线时间=",Time[0]);
   Print("Tick volume of the current bar of the current chart=",Volume[0]);
   Print("Last error code=",_LastError);
   Print("Random seed=",_RandomSeed);
   Print("Stop flag=",_StopFlag);
   Print("Uninitialization reason code=",_UninitReason);   
  }


测试

  • 新建 ea
//+------------------------------------------------------------------+
//|                                                           11.mq4 |
//|                        Copyright 2021, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+



int OnInit()
  {
//---
   MessageBox("Hello, World!","hi");
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---

 
   Print("Symbol name of the current chart=",_Symbol);
   Print("Timeframe of the current chart=",_Period);
   Print("卖一价 =",Ask);
   Print("买一价=",Bid);   
   Print("Number of decimal places=",Digits);
   Print("Number of decimal places=",_Digits);
   Print("Size of the current symbol point in the quote currency=",_Point);
   Print("Size of the current symbol point in the quote currency=",Point);   
   Print("Number of bars in the current chart=",Bars);
   Print("当前 K线 开盘价=",Open[0]);
   Print("当前 K线 收盘价=",Close[0]);
   Print("当前 K线 最高价 =",High[0]);
   Print("当前 K线 最低价 =",Low[0]);
   Print("当前K线时间=",Time[0]);
   Print("Tick volume of the current bar of the current chart=",Volume[0]);
   Print("Last error code=",_LastError);
   Print("Random seed=",_RandomSeed);
   Print("Stop flag=",_StopFlag);
   Print("Uninitialization reason code=",_UninitReason);   
 }
//+------------------------------------------------------------------+

  • 运行
    在这里插入图片描述
  • 点击确定
    在这里插入图片描述
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Ava Trader MT4 Terminal 程序化交易(2)获取品种交易数据 的相关文章

随机推荐