当前位置:网站首页>MT4/MQL4 entry to proficient foreign exchange EA tutorial Lesson 1 Getting to know MetaEditor
MT4/MQL4 entry to proficient foreign exchange EA tutorial Lesson 1 Getting to know MetaEditor
2022-08-09 02:03:00 【The EA development - the blue code】
1. Open MetaEditor.Open the MT4 trading platform and click on the following figure in the navigation bar, or open it with the shortcut key on the desktop.
2. Get to know MetaEditor
Main file structure
①EA program folder, which stores mq4 files and compiled executable files ex4.
②A folder for storing arbitrary files, such as audio files, etc.
③The folder where pictures are stored.
④Function library folder, store mqh file.
⑤The indicator signal folder, which stores the mq4 file and the compiled executable file ex4.
⑥Database folder, store external program files, DLL files, etc.
⑦Script folder, store script files.
Start EA Journey - "Hello World"
1. Click Expert, right-click -> New File
Select the EA template, click Next
Fill in the EA name HelloWorld and click Next
Uncheck the option, click Next
Uncheck the option and click Next
Click Done
Recognize the code structure
Start writing code
Add printf() function inside each function.
int OnInit()
{
//—
printf("Initialization: Hello World!!!");
//—
return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason)
{
//—
printf("Deinitialization: Hello World!!!");
}
void OnTick()
{
//—
printf("Hello World!!!");
}
Click the green button in the navigation bar to compile
Click OK
MT4 platform terminal EA option to see the print result: one initialization: Hello World!!! and a series of Hello World!!!
Go back to MetaEditor, click the red button to stop debugging
Stop the test with a deinitialization: HelloWorld!!!
Function and function explanation
OnInit(): Initialization function function, which is only executed once when the EA program is loaded and running, and will not be executed after that, and returns integer data.
OnDeinit(): Deinitialization function, executed once when the EA program is unloaded, and returns an empty type.
OnTick(): EA main function program, executed once when each tick is generated, and returns an empty type.
The execution result of the above HelloWorld EA,
The EA program loads the printf() function in the OnInit() function and executes it once, so "Initialization: HelloWorld!!!" appears once.
The OnTick() function is executed multiple times because of the intensive exchange rate quotes, so there are multiple "HelloWorld!!!"
When the EA program stops debugging, OnDeinit() is executed once, so "Deinitialization: HelloWorld!!!" is printed once
If you want to do good work, you must first sharpen your tools. The most important thing in trading is to abide by the rules and strictly implement them.Pay attention to the official account, learn MQL entry to master EA tutorials, write your own EA freely, and forge your own magic weapon.
边栏推荐
猜你喜欢
随机推荐
TP测试查询数据库字段为null或空的字段
LeetCode每日一题:搜索插入位置 (均1200道)方法:二分查找
力扣刷题记录1.5-----367. 有效的完全平方数
右键新建缺少word、excel选项问题处理
Loadrunner结合Fiddler实现脚本的录制
《LC刷题总结》——贪心
软件测试的调用接口怎么调用,逻辑是什么?
【Fiddler】Fiddler实现mock测试(模拟接口数据)
Observer pattern
qps tps rps 区别
KQL和Lucene的区别
在实际工作中如何开展性能测试?
低代码开发创新企业应用构建模式
力扣刷题记录2.1-----27. 移除元素
深度学习模型的两种部署:ONNX与Caffe
Go - 9 - data type - function
eladmin容器部署超详细过程
Latex示例参考
Grid布局介绍
Go-12-Structure