顺水外汇EA交易网MT4
标题:
有请高手帮忙改进kdj逆加仓EA ,加双周期共振开仓
[打印本页]
作者:
dreamkid
时间:
2016-12-17 09:14
看看,学习一下。。。。
作者:
yxmh163
时间:
2016-12-17 15:15
标题:
有请高手帮忙改进kdj逆加仓EA ,加双周期共振开仓
//+------------------------------------------------------------------+
//| kdj逆加仓多单EA.mq4 |
//| Copyright 2013, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
string b;
string buy;
extern int shijian=5;
extern int k=8;
extern int d=5;
extern double buylots=0.01;
extern bool buydan=true;
int init()
{
return(0);
}
int deinit()
{
return(0);
}
int start()
{
double ma200=iMA(NULL,PERIOD_D1,10,0,MODE_SMA,PRICE_CLOSE,0);
double kdj2man=iStochastic(Symbol(),shijian,k,d,d,MODE_SMA,0,1,1);
double kdj2man0=iStochastic(Symbol(),shijian,k,d,d,MODE_SMA,0,1,0);
double kdjkuai=iStochastic(Symbol(),shijian,k,d,d,MODE_SMA,0,0,1);
double kdjkuai0=iStochastic(Symbol(),shijian,k,d,d,MODE_SMA,0,0,0);
double kdjdayman0=iStochastic(Symbol(),PERIOD_D1,k,d,d,MODE_SMA,0,1,0);
double kdjdaykuai0=iStochastic(Symbol(),PERIOD_D1,k,d,d,MODE_SMA,0,0,0);
double shang=iBands(Symbol(),PERIOD_M5,20,2,0,PRICE_CLOSE,MODE_UPPER,0);
double xai=iBands(Symbol(),PERIOD_M5,20,2,0,PRICE_CLOSE,MODE_LOWER,0);
int bukang=(shang-xai)/Point;
double close=iClose(Symbol(),15,0);
if(kdj2man0100&&buy!=Symbol()&&buydan==true)
{
if(kdjkuai0>kdj2man0&&kdjkuaikdj2man0&&kdjkuai100)
{
if(buy(buylots,0,0,Symbol()+"buy"+buylots,333)>0)
{
buy=Symbol();
buylots=0;
b=Symbol();
}
}
}
}
if(kdj2man0>40&&kdjkuai0>40)
{
if(kdjkuai0kdj2man)
{
buy=Symbol()+1;
}
}
if(lastbuyying()>0)
{
buylots=0.01;
}
double lastlots=buylotss();
if(danbuyying()0)
{
if(kdj2man0>80&&kdjkuai0>80)
{
if(kdjkuai0kdj2man)
{
b=Symbol()+1;
}
}
}
if(b==Symbol()+1)
{
for (int i1=0;i1=total-50;i--)
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==true)
{
if(OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY)
{
if(OrderMagicNumber()==333)
{
int a=OrderTicket();
if(tikit0)
{
if(OrderSelect(ticket, SELECT_BY_TICKET)==true)
{
if((sun!=0)&&(ying!=0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-sun*MarketInfo(Symbol(),MODE_POINT),OrderOpenPrice()+ying*MarketInfo(Symbol(),MODE_POINT),0,Red);
}
if((sun==0)&&(ying!=0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),0,OrderOpenPrice()+ying*MarketInfo(Symbol(),MODE_POINT),0,Red);
}
if((sun!=0)&&(ying==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-sun*MarketInfo(Symbol(),MODE_POINT),0,0,Red);
}
}
}
return(ticket);
}
else
{
return(0);
}
}
int sell(double Lots,double sun,double ying,string comment,int magic)
{
int kaiguan=0;
for(int i=0;i0)
{
if(OrderSelect(ticket, SELECT_BY_TICKET)==true)
{
if((sun!=0)&&(ying!=0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+sun*MarketInfo(Symbol(),MODE_POINT),OrderOpenPrice()-ying*MarketInfo(Symbol(),MODE_POINT),0,Red);
}
if((sun==0)&&(ying!=0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),0,OrderOpenPrice()-ying*MarketInfo(Symbol(),MODE_POINT),0,Red);
}
if((sun!=0)&&(ying==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+sun*MarketInfo(Symbol(),MODE_POINT),0,0,Red);
}
}
}
return(ticket);
}
else
{
return(0);
}
改进一下就更好了,就是首单开仓条件为大小两个周期同时kdj金叉开仓。小周期逆加仓,平仓条件不变。
以上代码帮我解释一下,拜托
作者:
suolande
时间:
2016-12-17 16:08
看看,学习一下。
作者:
bluef
时间:
2016-12-17 23:06
没有看懂
作者:
jiangrpeng
时间:
2017-1-15 19:46
学习一下,没有看懂
作者:
selimary168
时间:
2017-3-10 10:41
其实这是个不错的策略
作者:
飘梦
时间:
2017-4-24 12:00
谢谢分享!!!
欢迎光临 顺水外汇EA交易网MT4 (http://waterforex.com/)
Powered by Discuz! X3.2