1 Star 1 Fork 1

chizhijing / MT4

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
czj_ea4.mq4 4.56 KB
一键复制 编辑 原始数据 按行查看 历史
chizhijing 提交于 2016-10-10 18:34 . MQL4 INIT
//+------------------------------------------------------------------+
//| czj_ea4.mq4 |
//| Copyright 2016, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
extern double N=20;
extern double TakeProfit=50;//止盈点数
extern double StopLoss=20;//止损点数
extern double Lots=0.1;//交易手数
extern double Poin;//平台最小报价
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
//int rand1,rand2;
//rand1=MathRand();
//rand2=MathRand();
double rand1,rand2;
rand1=iClose(NULL,0,0);
rand2=iOpen(NULL,0,0);
if(rand1>rand2*1.05)
{
if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES) && OrderType()==OP_SELL)
OrderClose(OrderTicket(),OrderLots(),Ask,3,CLR_NONE);
if(OrdersTotal()==0)
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Poin,Ask+TakeProfit*Poin,"TFO_1",0,Green);
}
if(rand1<rand2*0.95)
{
if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES) && OrderType()==OP_BUY)
OrderClose(OrderTicket(),OrderLots(),Bid,3,CLR_NONE);
if(OrdersTotal()==0)
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+StopLoss*Poin,Bid-TakeProfit*Poin,"TFO_1",0,Red);
}
}
//+------------------------------------------------------------------+
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chizhijing/MT4.git
git@gitee.com:chizhijing/MT4.git
chizhijing
MT4
MT4
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891