这是自动生成的,但是不能自动交易啊,烦请版主改一下,万分感谢!
extern string orderManageTip = \"---------------- 订单参数设置 ----------------\";
extern bool AutoTrade = true; //是否允许自动交易
extern bool SendEmailMessage = true; //是否发送Email提示信息
extern bool CalModel = 1;
extern int magic= 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 int StartHour1 = 8;
extern int StartMinute1 = 0;
extern int EndHour1 = 21;
extern int EndMinute1 = 0;
extern string TimeFilter2Tip=\"---------------- 时间过滤器2 ----------------\";
extern bool TimeFilter2 = false; //使用时间过滤器2
extern int StartHour2 = 22;
extern int StartMinute2 = 0;
extern int EndHour2 = 8;
extern int EndMinute2 = 0;
extern string FridayFilterTip=\"---------------- 星期5过滤器 ----------------\";
extern bool FridayFilter = false; //使用星期5时间过滤
extern int FridayHour = 12;
extern int FridayMinute = 0;
extern int GmtOffset = 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[12][11][11][11],S.ma.val[12][11][11][11],CL.ma.val[12][11][11][11],CS.ma.val[12][11][11][11];
int L.ma.para[11][11][11],S.ma.para[11][11][11],CL.ma.para[11][11][11],CS.ma.para[11][11][11];
int L.ma.type[11],S.ma.type[11],CL.ma.type[11],CS.ma.type[11];
int L.ma.num[11],S.ma.num[11],CL.ma.num[11],CS.ma.num[11];
int L.main.a.id[11],L.main.b.id[11],S.main.a.id[11],S.main.b.id[11],CL.main.a.id[11],CL.main.b.id[11],CS.main.a.id[11],CS.main.b.id[11];
double L.main.a.para[11][11],L.main.b.para[11][11],S.main.a.para[11][11],S.main.b.para[11][11],CL.main.a.para[11][11],CL.main.b.para[11][11],CS.main.a.para[11][11],CS.main.b.para[11][11];
int L.main.type[11],S.main.type[11],CL.main.type[11],CS.main.type[11];
double L.main.a.val[12][11][11],L.main.b.val[12][11][11],S.main.a.val[12][11][11],S.main.b.val[12][11][11],CL.main.a.val[12][11][11],CL.main.b.val[12][11][11],CS.main.a.val[12][11][11],CS.main.b.val[12][11][11];
int L.main.num,S.main.num,CL.main.num,CS.main.num;
int L.sub.a.id[11],L.sub.b.id[11],S.sub.a.id[11],S.sub.b.id[11],CL.sub.a.id[11],CL.sub.b.id[11],CS.sub.a.id[11],CS.sub.b.id[11];
double L.sub.a.para[11][11],L.sub.b.para[11][11],S.sub.a.para[11][11],S.sub.b.para[11][11],CL.sub.a.para[11][11],CL.sub.b.para[11][11],CS.sub.a.para[11][11],CS.sub.b.para[11][11];
int L.sub.type[11],S.sub.type[11],CL.sub.type[11],CS.sub.type[11];
double L.sub.a.val[12][11][11],L.sub.b.val[12][11][11],S.sub.a.val[12][11][11],S.sub.b.val[12][11][11],CL.sub.a.val[12][11][11],CL.sub.b.val[12][11][11],CS.sub.a.val[12][11][11],CS.sub.b.val[12][11][11];
int L.sub.num,S.sub.num,CL.sub.num,CS.sub.num;
int maxtry=10;bool printLog=true;
int maxSymbol=1;
string strSymbol[1]; int tfSymbol[1];
int validBar=1;
datetime lastBarTime[1]; int longFlag,shortFlag,closeLongFlag,closeShortFlag;
bool continueLong[1],continueShort[1];
datetime msgTime[1];
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 |