您需要 登录 才可以下载或查看,没有帐号?注册
本帖最后由 大魔王808 于 2018-12-7 22:33 编辑
我想编写一个简单的假突破挂单EA,以应对24小时的外汇交易。
//+------------------------------------------------------------------+
//| my1ea001.mq4 |
//| Copyright ?2009, metaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright Copyright ?2009, metaQuotes Software Corp.
#property link http://www.metaquotes.net
datetime z=0;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
if(High[0] 1.14124 z==0)
{
OrderSend( EURUSD ,OP_SELLSTOP,0.01,1.14120,3,1.14150,0, 假突破再买入 ,10002,0,Red);
z=1;
}
//----
return(0);
}
这是我在EA编写教程下自己在模板下改的程序,就是在EURUSD当日价格突破1.14124之后,在1.14120挂追空单,止损3个点位。已经没有程序错误,但是在运行中不起作用。不知道哪里出了问题?求大神指正。如果可以的话,附上正确的程序写法,不胜感激。
==============================
//+------------------------------------------------------------------+
//| my1ea001.mq4 |
//| Copyright ?2009, metaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright Copyright ?2009, metaQuotes Software Corp.
#property link http://www.metaquotes.net
datetime z=0;
extern double 突破點 = 1.14150;
extern double 掛單點 = 30;
extern double 止損點 = 30;//
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
if(High[0] 突破點 z==0)
{
OrderSend( EURUSD ,OP_SELLSTOP,0.01,突破點-掛單點*Point,3,突破點-掛單點*Point+止損點*Point,0, 假突破再?入 ,10002,0,Red);
z=1;
}
//----
return(0);
}
itkmantt 发表于 2018-12-8 00:38
實測OK!!
==============================
//+------------------------------------------------------- ...
昨天才注册账号,我一开始还以为只有评价功能呢,找了一才找到回复功能。这里程序的意思是追空单卖出0.01手在1.14120的价位还是在1.13850的价位啊,我不太懂这个point的作用,是说30个最小点位还是说30个点差。
本帖最后由 大魔王808 于 2018-12-11 09:07 编辑
itkmantt 发表于 2018-12-8 00:38
實測OK!!
==============================
//+------------------------------------------------------- ...
//+------------------------------------------------------------------+
//| my1ea001.mq4 |
//| Copyright ?2009, metaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright Copyright ?2009, metaQuotes Software Corp.
#property link http://www.metaquotes.net
datetime z=0;
extern double 突破點 = 2609;
extern double 掛單點 = 20;
extern double 止損點 = 50;//
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
if(Low[0] 突破點 z==0)
{
OrderSend( USA500 ,OP_BUYSTOP,0.01,突破點+掛單點*Point,3,突破點+掛單點*Point-止損點*Point,0, 假突破再?入 ,10003,0,Red);
z=1;
}
//----
return(0);
}
大神,我照着你的程序,修改了一个假突破再买入的程序,但是,昨天实测,还是失败了,没有上车。是什么原因呢?程序我改的很小心应该是没问题的呀,难道是USA500滑点太大?
OrderSend( USA500 ,OP_BUYSTOP,0.01,突破點+掛單點*Point,3,突破點+掛單點*Point-止損點*Point,0, 假突破再?入 ,10003,0,Red);
_________________________________________
改~ 任何貨幣都可以下單!!
OrderSend(Symbol(),OP_BUYSTOP,0.01,突破點+掛單點*Point,3,突破點+掛單點*Point-止損點*Point,0, 假突破再?入 ,10003,0,Red);
_________________________________________
備註: USA500 請確定MT4 卷商提供的名稱, 每家名稱標註可能不一樣,比如: #USA500 (多一個#)。
試試看吧!! (^^
itkmantt 发表于 2018-12-12 00:20
請先回測!! 沒有人拿實倉真錢~下去測試一款不穩定的EA!! (^^
嗯嗯嗯,弄好了,我这个EA策略测试不太会用,感觉适合完整策略的查看盈利状况。我注册了一个模拟账号,成功了。感激不尽。
外汇交易有很大的风险性,本站所有资源均来自网络,请选择使用,如若出现亏损,本站不承担任何责任!