当前位置:网站首页>Mt4/mql4 getting started to mastering EA tutorial lesson 4 - common functions of MQL language (IV) - common functions of K-line value
Mt4/mql4 getting started to mastering EA tutorial lesson 4 - common functions of MQL language (IV) - common functions of K-line value
2022-06-22 08:01:00 【EA development - green shirt code customer】
MQL There is a group of “ function ”, They look different from other functions , Is a different function , These are the following powerful “ function ”
Open[]、Close[]、High[]、Low[]、Time[]、Volume[]
General function names are followed by (), This alternative “ function ” After the name is [].
double Open[]
Function has only one integer argument , The function is to return one of the current chart transaction varieties K Linear Opening price
double Close[]
Function has only one integer argument , The function is to return one of the current chart transaction varieties K Linear Closing price
double High[]
Function has only one integer argument , The function is to return one of the current chart transaction varieties K Linear Highest price
double Low[]
Function has only one integer argument , The function is to return one of the current chart transaction varieties K Linear The lowest price
long Volume[]
Function has only one integer argument , The function is to return one of the current chart transaction varieties K Linear volume
datetime Time[]
Function has only one integer argument , The function is to return one of the current chart transaction varieties K Linear Time
The script instance
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
datetime time= Time[0];
double open = Open[0];
double high = High[0];
double low = Low[0];
double close = Close[0];
long volume = Volume[0];
Print("Current bar time: ",time);
Print("Current bar open: ",open);
Print("Current bar high: ",high);
Print("Current bar low: ",low);
Print("Current bar close: ",close);
Print("Current bar volume: ",volume);
}
Instance running results 
Verify the next data window 
There are several different data , Because what is read is the current K Line column data , At present K The string column is still fluctuating , So the lowest price 、 Highest price 、 Closing price 、 Trading volume is variable .
Next, read the previous one K Line post , See if the data is consistent
Change the parameter to 1.
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
datetime time= Time[1];
double open = Open[1];
double high = High[1];
double low = Low[1];
double close = Close[1];
long volume = Volume[1];
Print("Current bar time: ",time);
Print("Current bar open: ",open);
Print("Current bar high: ",high);
Print("Current bar low: ",low);
Print("Current bar close: ",close);
Print("Current bar volume: ",volume);
}


The printout results are consistent .
A good workman does his work well , You must sharpen your tools first , The most important thing in trading is to follow the rules , Strictly carry out . Official account , Study MQL Beginner to master EA course , Learn more EA Programming , Write your own EA, Forge your own magic weapon .
边栏推荐
- Some suggestions on Oracle SQL query return optimization
- Orientdb batch execute SQL
- Model electricity experiment -- Experiment 2 JFET common source amplifier circuit
- SVN 提交子文件夹问题
- Charles uses
- Template code overview
- Target detection series -- detailed explanation of RCNN principle
- Example of using listagg in Oracle 11g (splicing the values of a field into a line, separated by commas)
- The difference between get and post requests
- 【Oracle 數據庫】奶媽式教程 day13 日期函數
猜你喜欢

Website sharing of program ape -- continuous update

Relative positioning, absolute positioning, fixed positioning

ES6 set data type de duplication of array, intersection, union and difference

How Navicat queries the password information of the connected database

mysql查询group by 1055 问题完美解决,最简单最便捷的方法

Energy and interference of waves

模电实验——实验二 JFET共源极放大电路

QT QtableView的使用示例

Use js to download the current image

XMIND 2022 mind map active resources?
随机推荐
The difference between get and post requests
Qt 错误提示1: invalid use of incomplete type ‘***‘
Symbolic processing of crash log
Excellent cases of data visualization
【Oracle 数据库】奶妈式教程 day12 字符函数
QT 自定义组合控件(类提升功能)
Canvastotempfilepath of wechat
力扣(LeetCode)172. 阶乘后的零(2022.06.21)
LNMP environment setup
Applet /vant UI to upload files
ExcelToJson
OSI and tcp/ip
MySQL transactions
UI draw line
An example shows the difference between let and VaR
KVO summary
0基础自学stm32(野火)——什么是寄存器?
Windchill - how to start workflow through API
CollectionViewCell
navicat如何查询已连接的数据库密码信息