当前位置:网站首页>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,锻造属于自己的神兵利器.
边栏推荐
- 力扣刷题记录1.5-----367. 有效的完全平方数
- etcd实现大规模服务治理应用实战
- JDBC technology (1) - a simple JDBC test
- MT4/MQL4入门到精通EA教程第一课-MQL语言常用函数(一)OrderSend()函数
- PostMan import certificate add certificate
- Analysis of when AuthenticationSuccessHandler is called after UsernameAuthenticationFilter is authorized successfully
- 力扣刷题记录5.1-----59. 螺旋矩阵 II
- 德语翻译器在线翻译中文
- makefile file compilation
- class path resource [bean.xml] cannot be opened because it does not 错误解决方案
猜你喜欢
mysql 5.7 入坑
torchversion.transforms的使用
企业里Foxmail邮箱问题解决方法汇总
字节输入流(InputStream)与字节输出流(OutputStream)
typescript89-展示任务列表功能
The server quit without updating PID file (/usr/local/mysql/data/localhost.pid).
Summary of Database Design
Group DETR:分组一对多匹配是加速DETR收敛的关键
LeetCode每日一题:搜索插入位置 (均1200道)方法:二分查找
2022 PMP Project Management Certification Exam Registration Guide (1)
随机推荐
2022 PMP Project Management Certification Exam Registration Guide (1)
[Signal denoising] Based on Sage-Husa adaptive Kalman filter to realize the suppression of ocean wave magnetic field noise and the generation of ocean wave magnetic field noise with matlab code
Image denoising based on edge enhancement Diffusion 】 (cEED) and Coherence Enhancing coursing together (cCED) filter to realize image denoising matlab code
How to install yii2
如何在EasyDSS中使用ffmpeg实现点播视频的拼接与合成?
composer的使用记录
The Best Open Source Web Application Firewall to Protect Your Web Applications
Z-Game on grid(牛客多校赛)
Go-8-Gin framework
How SEMRush finds keywords for advertising
Go-11 - Process Control
Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules
力扣刷题记录1.5-----367. 有效的完全平方数
Go-8-Gin框架
Observer pattern
SEMRush如何寻找关键词用于投放广告
2020.12.4 log
谷歌翻译下载-免费谷歌翻译软件下载
Dapr学习(4)之eShopOnDapr部署(Rancher2.63&k3s)
How to install ngrok in Synology system (Synology 6.X version)