当前位置:网站首页>MT4/MQL4 Getting Started to Mastering EA Tutorial Lesson 1 - MQL Language Common Functions (1) OrderSend() Function
MT4/MQL4 Getting Started to Mastering EA Tutorial Lesson 1 - MQL Language Common Functions (1) OrderSend() Function
2022-08-09 02:04:00 【EA Development - Blue Shirt Coder】
int OrderSend()
The function is used to open a new order,它有11个参数.`
int OrderSend(
string symbol, // 交易品种
int cmd, // 买单、Sell order type
double volume, // Order lot size
double price, // 开仓价格
int slippage, // 点差
double stoploss, // 止损
double takeprofit, // 止盈
string comment=NULL, // Order Notes
int magic=0, // Order magic code
datetime expiration=0, // 时限
color arrow_color=clrNONE // The open position shows the arrow color
)
;
Use script instance:
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//--- place market order to buy 1 lot
int ticket=OrderSend(Symbol(),OP_BUY,1,Ask,0,0,0,"My order",16384,0,clrGreen);
if(ticket<0)
{
Print("OrderSend failed with error #",GetLastError());
}
else
Print("OrderSend placed successfully");
//---
}
实例代码实现 Open a buy order at the current price(Buy)No take profit止损.
OrderSend(Symbol(), // 当前交易品种
OP_BUY, // 开一个多单BUY ,Corresponding to the empty ordersell的代码是OP_SELL
1, // The open lot size is1
Ask, // The opening price is the current priceAsk
0, // 点差0
0, // 不设止损
0, // No take profit
"My order",// Order Notes“My order”
16384, // 订单代码16384
0, // 不设时限,This parameter is generally set for pending orders
clrGreen // The open position chart shows a green arrow
);
Example function diagram:
工欲善其事,必先利其器,交易最重要的是遵守规则,严格执行.关注公众号,学习MQL入门到精通EA教程,学习更多EA编程,畅写属于自己的EA,锻造属于自己的神兵利器.
边栏推荐
- Latex示例参考
- JDBC technology (1) - a simple JDBC test
- Cmake 报错 Could not find a package configuration file provided by “OpenCV“
- 2022/8/8 比赛思维+状压dp
- 力扣刷题记录7.1-----707. 设计链表
- etcd实现大规模服务治理应用实战
- What is the difference between a project manager and a product manager?
- 软件测试技术之如何编写测试用例(5)
- Loadrunner结合Fiddler实现脚本的录制
- typescript91-添加任务基本实现
猜你喜欢
力扣刷题记录7.1-----707. 设计链表
力扣刷题记录9.1-----24. 两两交换链表中的节点
力扣刷题记录3.1-----977. 有序数组的平方
企业里Foxmail邮箱问题解决方法汇总
MT4/MQL4 entry to proficient foreign exchange EA tutorial Lesson 1 Getting to know MetaEditor
深度学习模型的两种部署:ONNX与Caffe
力扣刷题记录1.5-----367. 有效的完全平方数
Wireshark packet capture tool
软件测试的调用接口怎么调用,逻辑是什么?
2022 PMP Project Management Certification Exam Registration Guide (1)
随机推荐
.reduce()的简单例子
The security of the pension insurance?Reliable?
UsernameAuthenticationFilter授权成功后调用AuthenticationSuccessHandler时的解析
Significance Test--Study Notes
How to install ngrok in Synology system (Synology 6.X version)
D. Tournament Countdown
右键新建缺少word、excel选项问题处理
2022 PMP Project Management Certification Exam Registration Guide (1)
如何在群晖系统中安装cpolar(群晖6.X版)
力扣刷题记录8.1-----206. 反转链表
LeetCode每日两题01:有序数组的平方 (均1200道)方法:双指针
typescript91-添加任务基本实现
JDBC技术(一)——一个简单的JDBC测试
Go-12-Structure
JDBC技术(二)——设置通用的sql和配置文件
Go-11-流程控制
Go-11 - Process Control
LeetCode每日两题01:二分查找 (均1200道)
How to install yii2
基于机器学习之模型树短期负荷预测(Matlab代码实现)