当前位置:网站首页>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 .
边栏推荐
- 计算水费问题
- The applet uses the step bar vant steps in vant
- Relative positioning, absolute positioning, fixed positioning
- Kotlin a simple Android program
- Stored procedures and functions of MySQL
- (7)双向链表
- Scrollrect rewrite recycle
- Wechat applets will directly open the parent element when the child element of flex:1 is too long (the text is too long)
- C语言双向链表实现图书管理系统 可读写文件
- PostgreSQL common commands and SQL -- continuous update
猜你喜欢

MySQL master-slave replication

Node red sends wechat official account message (template message)

lr 2022超详细安装教程「最新」

MySQL view

Use js to download the current image

代码覆盖率测试对编程小白的意义及其使用方法

Problems caused by canvas palette width and height and canvas width and height
![[Oracle database] mammy tutorial day13 date function](/img/ca/90aaa682ec393b1531060377276ca6.png)
[Oracle database] mammy tutorial day13 date function

QT combox的使用示例

【宋红康 MySQL数据库 】【高级篇】【06】MySQL的逻辑架构
随机推荐
先锋期货安全么?期货开户都是哪些流程?期货手续费怎么降低?
Qt 错误提示1: invalid use of incomplete type ‘***‘
Design skills of common table structure in database design
Unity AssetBundle load
Applet /vant UI to upload files
MySQL query group by 1055 is the simplest and most convenient way to solve the problem perfectly
Query where uiwebview is used in the project
How to create an index
Upload your own library to pod
LNMP environment setup
【Oracle 数据库】奶妈式教程 day11 数值函数
Cocoapods problem record
Why redis is so fast:
【Oracle 数据库】奶妈式教程 day13 日期函数
An example shows the difference between let and VaR
[Oracle database] wet nurse tutorial day15 DDL, DML, index, view, sequence and deadlock are enough
【Oracle 数据库】奶妈式教程day15 DDL、DML、索引、视图、序列、死锁这一篇就够了
MySQL query database capacity
MySQL avoids the method of repeatedly inserting records (ignore, replace, on duplicate key update)
Target detection series -- detailed explanation of RCNN principle