当前位置:网站首页>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,锻造属于自己的神兵利器.

边栏推荐
- The server quit without updating PID file (/usr/local/mysql/data/localhost.pid).
- [深入研究4G/5G/6G专题-55]: L3信令控制-4-软件功能与流程的切分-CU网元的信令
- MT4/MQL4入门到精通EA教程第一课-MQL语言常用函数(一)OrderSend()函数
- 力扣刷题记录10.1-----19. 删除链表的倒数第 N 个结点
- Introduction to LVGL (based on v8.1-8.2)
- 虹科技术|如何阻止供应链攻击?
- D. Tournament Countdown
- 面试秘籍 | 软件测试必备的mysql数据库技术
- The 7 taboos of time management summarized by the postgraduate students, how many have you won?
- [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
猜你喜欢
![[C language brush questions] Application of fast and slow pointers in linked lists](/img/de/907192f705d9b2dc1628d480c4d7d9.png)
[C language brush questions] Application of fast and slow pointers in linked lists

如何在EasyDSS中使用ffmpeg实现点播视频的拼接与合成?

『Another Redis DeskTop Manager』用了这款Redis可视化工具,分析效率提升12倍

MT4/MQL4 entry to proficient foreign exchange EA tutorial Lesson 1 Getting to know MetaEditor

eladmin容器部署超详细过程

力扣刷题记录8.1-----206. 反转链表

JDBC技术(一)——一个简单的JDBC测试

JDBC technology (1) - a simple JDBC test

虹科技术|如何阻止供应链攻击?

全文翻译:EDPB 基于设计和默认的数据保护指南
随机推荐
德语翻译-德语在线批量翻译软件
makefile file compilation
TP测试查询数据库字段为null或空的字段
MT4/MQL4入门到精通外汇EA教程第一课 认识MetaEditor
面试秘籍 | 软件测试必备的mysql数据库技术
Proe/Creo智能硬件产品结构设计要点「干货分享」
Go-12-Structure
JDBC technology (1) - a simple JDBC test
基于机器学习之模型树短期负荷预测(Matlab代码实现)
配置文件的读取-TOML
数字孪生+燃气管理,开启智慧燃气管理新模式
[Cellular Automata] Simulation of emergency evacuation of disaster personnel under social force factors based on cellular automata with matlab code attached
d初化模板构造器
MAYA发动机建模
Data recovery software EasyRecovery supports recovery of all types of files
Go-8-Gin framework
解决有路由策略的情况下域内NAT不通的问题
『Another Redis DeskTop Manager』用了这款Redis可视化工具,分析效率提升12倍
Z-Game on grid(牛客多校赛)
日文翻译-在线免费日文翻译软件