下载MetaTrader 5
要添加评论,请登录注册
如何发布您的交易信号并成为供应商
t
7
t 2012.03.28 16:32 

求编个简单的EA, 昨天收盘价+100点挂空单,-100点挂多单, 第二天没挂到的单子取消,重新计算收盘价挂单.

好心人帮帮忙,菜鸟,想获得思路,拜托了

t
7
t 2012.03.29 05:51  
求各位大虾指点下
chenweiguo
7
chenweiguo 2012.04.17 06:21  
t46278989:

求编个简单的EA, 昨天收盘价+100点挂空单,-100点挂多单, 第二天没挂到的单子取消,重新计算收盘价挂单.

好心人帮帮忙,菜鸟,想获得思路,拜托了


//+------------------------------------------------------------------+
//| 100点挂单.mq4 |
//| calvinfx |
//| |
//+------------------------------------------------------------------+
/*
周期:DAILY
策略:昨天收盘价+100点挂空单,-100点挂多单, 第二天没挂到的单子取消,重新计算收盘价挂单
*/

#property copyright "calvinfx"
#property link ""
extern double zisun=500; //止损
extern double ziyin=500; //止盈
extern double mylots=0.1; //仓位


int init()
{
return(0);
}
int deinit()
{
return(0);
}
int start()
{
double close=iClose(Symbol(),PERIOD_D1,1);
double zisun_buy=close-1000*Point-zisun*Point;
double ziyin_buy=close-1000*Point+ziyin*Point;
double zisun_sell=close+1000*Point+zisun*Point;
double ziyin_sell=close+1000*Point-ziyin*Point;
if(Hour()==0&&Minute()==0&&Seconds()==0)
{
if(OrdersTotal()==0)
{
OrderSend(Symbol(),OP_BUYLIMIT,mylots,close-1000*Point,30,zisun_buy,ziyin_buy,"buy limit",0,0,Blue);
OrderSend(Symbol(),OP_SELLLIMIT,mylots,close+1000*Point,30,zisun_sell,ziyin_sell,"sell limit",0,0,Red);
}
}
for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderType()==OP_BUYLIMIT||OrderType()==OP_SELLLIMIT)
{
if(OrderOpenTime()==iTime(Symbol(),PERIOD_D1,1))
{
OrderDelete(OrderTicket());
}
}
}
}
return(0);
}

/
要添加评论,请登录注册