和讯外汇 发表于 2011-12-24 08:53:31

请版主看一下这个ea不能自动交易

这是自动生成的,但是不能自动交易啊,烦请版主改一下,万分感谢!

extern string orderManageTip = \"---------------- 订单参数设置 ----------------\";
extern bool AutoTrade = true; //是否允许自动交易
extern bool SendEmailMessage = true;   //是否发送Email提示信息
extern bool CalModel = 1;
extern intmagic= 2011388;
extern double DefaultLots = 0.1; //默认交易手数
extern bool MoneyManage = false; //资金管理
extern double Risk = 5; //最大Risk
extern int LotDigits = 1;
extern double MinLots = 0.1;
extern double MaxLots = 100;
extern double StopLoss = 50;
extern double TakeProfit = 0;
extern int TrailMode = 0;
extern int TrailStart = 50;
extern int TrailStop = 10;
extern int BreakEven = 0;
extern bool ECN = true; //是否兼容ECN
extern bool MultiOrder = false; //多订单
extern int MaxOrder = 2;
extern bool RotationOrder=false; //只有当空单之后才交易多单, 只有当多单之后才交易空单
extern bool ReverseOrder = false; //反转订单
extern double MaxSpread = 4;
extern bool InstantOrder = true;
extern bool StopOrder = false;
extern bool LimitOrder = false;
extern double Gap = 0;
extern double Expiration = 0;
extern double Slippage = 1;
extern string comment = \"Power by TradeMaster\";

extern string TimeFilterTip=\"---------------- 时间过滤设置 ----------------\";
extern string TimeFilter1Tip=\"---------------- 时间过滤器1 ----------------\";
extern bool TimeFilter1 = false; //使用时间过滤器1
extern intStartHour1 = 8;
extern intStartMinute1 = 0;
extern intEndHour1 = 21;
extern intEndMinute1 = 0;
extern string TimeFilter2Tip=\"---------------- 时间过滤器2 ----------------\";
extern bool TimeFilter2 = false; //使用时间过滤器2
extern intStartHour2 = 22;
extern intStartMinute2 = 0;
extern intEndHour2 = 8;
extern intEndMinute2 = 0;
extern string FridayFilterTip=\"---------------- 星期5过滤器 ----------------\";
extern bool FridayFilter = false; //使用星期5时间过滤
extern intFridayHour = 12;
extern intFridayMinute = 0;
extern intGmtOffset = 0;

extern string longCondionTip= \"---------------- 做多信号参数设置 ----------------\";
extern string subInd1Tip= \"---------------- 副图指标参数设置 ----------------\";
extern string subInd1Group1Tip= \"---------------- 第1组指标 ----------------\";
extern string subInd1Group1aIndTip= \"---------------- a指标:MACD ----------------\";
extern double L.sub.a.para.1.1= 0;//指标线
extern double L.sub.a.para.1.2= 12;//快EMA
extern double L.sub.a.para.1.3= 26;//慢EMA
extern double L.sub.a.para.1.4= 9;//SMA
extern double L.sub.a.para.1.5= 0;//应用于
extern double L.sub.a.para.1.6= 0;//时间架构
extern string subInd1Group1bIndTip= \"---------------- b指标:特定值 ----------------\";
extern double L.sub.b.para.1.1= 0;//数值

extern string shortCondionTip= \"---------------- 做空信号参数设置 ----------------\";
extern string subInd2Tip= \"---------------- 副图指标参数设置 ----------------\";
extern string subInd2Group1Tip= \"---------------- 第1组指标 ----------------\";
extern string subInd2Group1aIndTip= \"---------------- a指标:MACD ----------------\";
extern double S.sub.a.para.1.1= 0;//指标线
extern double S.sub.a.para.1.2= 12;//快EMA
extern double S.sub.a.para.1.3= 26;//慢EMA
extern double S.sub.a.para.1.4= 9;//SMA
extern double S.sub.a.para.1.5= 0;//应用于
extern double S.sub.a.para.1.6= 0;//时间架构
extern string subInd2Group1bIndTip= \"---------------- b指标:特定值 ----------------\";
extern double S.sub.b.para.1.1= 0;//数值

extern string closelongCondionTip= \"---------------- 关闭多头信号参数设置 ----------------\";
extern string mainInd3Tip= \"---------------- 主图指标参数设置 ----------------\";
extern string mainInd3Group1Tip= \"---------------- 第1组指标 ----------------\";
extern string mainInd3Group1aIndTip= \"---------------- a指标:MA ----------------\";
extern double CL.main.a.para.1.1= 0;//类型
extern double CL.main.a.para.1.2= 20;//周期
extern double CL.main.a.para.1.3= 0;//应用于
extern double CL.main.a.para.1.4= 0;//平移
extern double CL.main.a.para.1.5= 0;//时间架构
extern string mainInd3Group1bIndTip= \"---------------- b指标:MA ----------------\";
extern double CL.main.b.para.1.1= 1;//类型
extern double CL.main.b.para.1.2= 8;//周期
extern double CL.main.b.para.1.3= 0;//应用于
extern double CL.main.b.para.1.4= 0;//平移
extern double CL.main.b.para.1.5= 0;//时间架构
extern string subInd3Tip= \"---------------- 副图指标参数设置 ----------------\";
extern string subInd3Group1Tip= \"---------------- 第1组指标 ----------------\";
extern string subInd3Group1aIndTip= \"---------------- a指标:MACD ----------------\";
extern double CL.sub.a.para.1.1= 1;//指标线
extern double CL.sub.a.para.1.2= 12;//快EMA
extern double CL.sub.a.para.1.3= 26;//慢EMA
extern double CL.sub.a.para.1.4= 9;//SMA
extern double CL.sub.a.para.1.5= 0;//应用于
extern double CL.sub.a.para.1.6= 0;//时间架构
extern string subInd3Group1bIndTip= \"---------------- b指标:特定值 ----------------\";
extern double CL.sub.b.para.1.1= 0;//数值

extern string closeshortCondionTip= \"---------------- 关闭空头信号参数设置 ----------------\";
extern string mainInd4Tip= \"---------------- 主图指标参数设置 ----------------\";
extern string mainInd4Group1Tip= \"---------------- 第1组指标 ----------------\";
extern string mainInd4Group1aIndTip= \"---------------- a指标:MA ----------------\";
extern double CS.main.a.para.1.1= 1;//类型
extern double CS.main.a.para.1.2= 8;//周期
extern double CS.main.a.para.1.3= 0;//应用于
extern double CS.main.a.para.1.4= 0;//平移
extern double CS.main.a.para.1.5= 0;//时间架构
extern string mainInd4Group1bIndTip= \"---------------- b指标:MA ----------------\";
extern double CS.main.b.para.1.1= 0;//类型
extern double CS.main.b.para.1.2= 20;//周期
extern double CS.main.b.para.1.3= 0;//应用于
extern double CS.main.b.para.1.4= 0;//平移
extern double CS.main.b.para.1.5= 0;//时间架构
extern string subInd4Tip= \"---------------- 副图指标参数设置 ----------------\";
extern string subInd4Group1Tip= \"---------------- 第1组指标 ----------------\";
extern string subInd4Group1aIndTip= \"---------------- a指标:MACD ----------------\";
extern double CS.sub.a.para.1.1= 1;//指标线
extern double CS.sub.a.para.1.2= 12;//快EMA
extern double CS.sub.a.para.1.3= 26;//慢EMA
extern double CS.sub.a.para.1.4= 9;//SMA
extern double CS.sub.a.para.1.5= 0;//应用于
extern double CS.sub.a.para.1.6= 0;//时间架构
extern string subInd4Group1bIndTip= \"---------------- b指标:特定值 ----------------\";
extern double CS.sub.b.para.1.1= 0;//数值


double L.ma.val,S.ma.val,CL.ma.val,CS.ma.val;
intL.ma.para,S.ma.para,CL.ma.para,CS.ma.para;
intL.ma.type,S.ma.type,CL.ma.type,CS.ma.type;
intL.ma.num,S.ma.num,CL.ma.num,CS.ma.num;

int L.main.a.id,L.main.b.id,S.main.a.id,S.main.b.id,CL.main.a.id,CL.main.b.id,CS.main.a.id,CS.main.b.id;
doubleL.main.a.para,L.main.b.para,S.main.a.para,S.main.b.para,CL.main.a.para,CL.main.b.para,CS.main.a.para,CS.main.b.para;
intL.main.type,S.main.type,CL.main.type,CS.main.type;
doubleL.main.a.val,L.main.b.val,S.main.a.val,S.main.b.val,CL.main.a.val,CL.main.b.val,CS.main.a.val,CS.main.b.val;
intL.main.num,S.main.num,CL.main.num,CS.main.num;

int L.sub.a.id,L.sub.b.id,S.sub.a.id,S.sub.b.id,CL.sub.a.id,CL.sub.b.id,CS.sub.a.id,CS.sub.b.id;
doubleL.sub.a.para,L.sub.b.para,S.sub.a.para,S.sub.b.para,CL.sub.a.para,CL.sub.b.para,CS.sub.a.para,CS.sub.b.para;
int L.sub.type,S.sub.type,CL.sub.type,CS.sub.type;
doubleL.sub.a.val,L.sub.b.val,S.sub.a.val,S.sub.b.val,CL.sub.a.val,CL.sub.b.val,CS.sub.a.val,CS.sub.b.val;
intL.sub.num,S.sub.num,CL.sub.num,CS.sub.num;

int maxtry=10;bool printLog=true;

int maxSymbol=1;
string strSymbol;int tfSymbol;
int validBar=1;

datetime lastBarTime; int longFlag,shortFlag,closeLongFlag,closeShortFlag;

bool continueLong,continueShort;
datetime msgTime;
string LongMsg=\"此时满足做多条件\";
string ShortMsg=\"此时满足做空条件\";
string CLMsg=\"此时满足关闭多头条件,若无头寸可忽略此消息\";
string CSMsg=\"此时满足关闭空头条件,若无头寸可忽略此消息\";

double point;
int mt;
int totalLong=0,totalShort=0,total=0,totalbuylimit=0,totalselllimit=0,totalbuystop=0,totalsellstop=0;

//+------------------------------------------------------------------+
//| expert initialization function                                 
//+------------------------------------------------------------------+
int init(){
    if(Digits==3 || Digits==5){
      point=Point*10;
      mt=10;
    }else{
      point=Point;
      mt=1;
    }
    initParas();
}
//+------------------------------------------------------------------+
//| expert deinitialization function                              
//+------------------------------------------------------------------+
int deinit(){

}
//+------------------------------------------------------------------+
//| expert start function                                       
//+------------------------------------------------------------------+
int start(){
//+------------------------------------------------------------------+
//| Break even, trailingstop                                          
//+------------------------------------------------------------------+
    if(BreakEven>0)breakEven();
    if(TrailMode>0)trailStop();
    bool tradetime=false;
    bool tradetime1=false;
    bool tradetime2=false;
    if(TimeFilter1){if(timefilter(StartHour1,StartMinute1,EndHour1,EndMinute1))tradetime1=false; else tradetime1=true;}else{tradetime1=false;}
    if(TimeFilter2){if(timefilter(StartHour2,StartMinute2,EndHour2,EndMinute2))tradetime2=false; else tradetime2=true;}else{tradetime2=false;}
    if(tradetime1 || tradetime2) tradetime=true;
    if((!TimeFilter1)&&(!TimeFilter2)) tradetime=true;
    if(FridayFilter)if(fridayfilter())tradetime=false;

    for(int symbol=0;symbol

小明mjd 发表于 2012-11-25 16:59:05

谢谢分享

madydela07 发表于 2012-11-25 16:59:05

楼上的话等于没说~~~

q826418559 发表于 2012-11-25 18:27:51

长时间没来看了 ~~

御赐黄马甲 发表于 2012-11-25 18:27:51

ding   支持

走就走吧 发表于 2012-11-25 18:27:51

顶你一下.

iboomer 发表于 2012-11-25 18:27:51

老大,我好崇拜你哟

lili 发表于 2014-10-30 10:11:41

谢谢分享!!!!!

hhuqmxsh71 发表于 2014-11-8 01:42:21

赚钱,赚积分。顶....

gMTrLjUr 发表于 2014-11-17 05:00:51

看看什么EA,,,
页: [1] 2
查看完整版本: 请版主看一下这个ea不能自动交易