代码拉取完成,页面将自动刷新
//EA交易 => ...\MT4\MQL4\Experts
#property copyright "大摩跟投QQ:3229685 "
#property link "大摩跟投QQ:3229685 "
//enum ENUM_TIMEFRAMES {PERIOD_CURRENT = 0, PERIOD_M1 = 1, PERIOD_M2 = 2, PERIOD_M3 = 3, PERIOD_M4 = 4, PERIOD_M5 = 5, PERIOD_M6 = 6, PERIOD_M10 = 10, PERIOD_M12 = 12, PERIOD_M15 = 15, PERIOD_M20 = 20, PERIOD_M30 = 30, PERIOD_H1 = 60, PERIOD_H2 = 120, PERIOD_H3 = 180, PERIOD_H4 = 240, PERIOD_H6 = 360, PERIOD_H8 = 480, PERIOD_H12 = 720, PERIOD_D1 = 1440, PERIOD_W1 = 10080, PERIOD_MN1 = 43200, };
//enum ENUM_APPLIED_PRICE {PRICE_CLOSE = 0, PRICE_OPEN = 1, PRICE_HIGH = 2, PRICE_LOW = 3, PRICE_MEDIAN = 4, PRICE_TYPICAL = 5, PRICE_WEIGHTED = 6, };
enum 时间 {
平台时间 = 1,
电脑时间 = 2,
};
extern string 本ea使用说明:="****************************" ;
extern string 本ea只需要加载到1个货币任意1个周期="就可以开启27个货币交易" ;
extern string 开户即可永久免费使用本ea="可联系ea开发者qq3229685" ;
extern string 本ea起始资金最低5000美金,建议1万美金="开2-3个货币" ;
extern string 本ea有强平风控,可自行设置最大止损金额="有保护,不怕任何行情" ;
extern string 以下为ea参数设置:="****************************" ;
extern double 在此填写本金=10000 ;
extern string 激进策略:ea加载后立即开多空2单="****************************" ;
extern bool 激进策略=false ;
extern string RSI策略:当指标超买或者超卖,反向开单="****************************" ;
extern bool RSI策略=true ;
extern string 通道策略:当碰上轨或者下轨,反向开单="****************************" ;
extern bool 通道策略=false ;
extern int 魔术号=888 ;
extern double 起始手数=0.01 ;
extern double 最大开单手数=4 ;
extern int 开单次数=20 ;
extern string 可以设置开单货币品种的多少的限制="设置几就只开几种货币" ;
extern string 建议稳健的每1万美金开1个货币="按次比例增加货币数量" ;
extern int 开启货币品种数量限制=5 ;
extern int 开仓间隔秒数=0 ;
extern string 全仓风控设置="****************************" ;
extern bool 全仓金额止损=false ;
extern double 止损金额=5000 ;
extern string 开启时间控制,只在此时间段开单="超过的不再开新单,未止盈的加码仍继续" ;
extern bool 是否启用时间控制=false ;
extern 时间 时间选择=2 ;
extern string 时间段始="23:30" ;
extern string 时间段终="15:00" ;
extern string 如货币有后缀,请在参数“货币后缀”添加="*******************" ;
extern string 货币后缀="" ;
int 总_in_1 = 5;
int 总_in_2 = 14;
int 总_in_3 = 35;
int 总_in_4 = 65;
int 总_in_5 = 100;
int 总_in_6 = 5;
int 总_in_7 = 200;
string 总_st_8 = "间隔系数越大越安全,范围在0.1-1之间调整";
double 总_do_9 = 0.0;
int 总_in_10 = 5;
int 总_in_11 = 20;
int 总_in_12 = 0;
double 总_do_13 = 2.0;
int 总_in_14 = 0;
string 总_st_15 = "当2根均线回调才加仓,趋势继续则不加仓";
int 总_in_16 = 10;
int 总_in_17 = 150;
int 总_in_18 = 2;
int 总_in_19 = 4;
int 总_in_20 = 5;
string 总_st_21 = "回调保护";
double 总_do_22 = 10.0;
bool 总_bo_23 = true;
string 总_st_24 = "****************************";
double 总_do_25 = 1.0;
double 总_do_26 = 2.0;
double 总_do_27 = 1.5;
double 总_do_28 = 1.5;
double 总_do_29 = 1.5;
double 总_do_30 = 1.5;
double 总_do_31 = 1.5;
double 总_do_32 = 1.5;
double 总_do_33 = 1.5;
double 总_do_34 = 1.5;
double 总_do_35 = 1.5;
double 总_do_36 = 1.5;
double 总_do_37 = 1.5;
double 总_do_38 = 1.5;
double 总_do_39 = 1.5;
double 总_do_40 = 1.5;
double 总_do_41 = 1.5;
double 总_do_42 = 1.5;
double 总_do_43 = 1.5;
double 总_do_44 = 1.5;
double 总_do_45 = 1.5;
double 总_do_46 = 1.5;
double 总_do_47 = 1.5;
double 总_do_48 = 1.5;
double 总_do_49 = 1.5;
double 总_do_50 = 1.5;
double 总_do_51 = 1.5;
double 总_do_52 = 1.5;
double 总_do_53 = 1.5;
double 总_do_54 = 1.5;
double 总_do_55 = 1.5;
double 总_do_56 = 1.5;
double 总_do_57 = 1.5;
double 总_do_58 = 1.5;
double 总_do_59 = 1.5;
double 总_do_60 = 1.5;
double 总_do_61 = 1.5;
double 总_do_62 = 1.5;
double 总_do_63 = 1.5;
double 总_do_64 = 1.5;
double 总_do_65 = 1.5;
double 总_do_66 = 1.5;
double 总_do_67 = 1.5;
double 总_do_68 = 1.5;
double 总_do_69 = 1.5;
double 总_do_70 = 1.5;
double 总_do_71 = 1.5;
double 总_do_72 = 1.5;
double 总_do_73 = 1.5;
double 总_do_74 = 1.5;
bool 总_bo_75 = true;
bool 总_bo_76 = true;
string 总_st_77 = "****************************";
double 总_do_78 = 50.0;
double 总_do_79 = 1.0;
double 总_do_80 = 10.0;
double 总_do_81 = 0.0;
double 总_do_82 = 0.0;
string 总_st_83 = "可以在指定某一单加大加仓间隔,形成断层";
double 总_do_84 = 50.0;
int 总_in_85 = 1;
double 总_do_86 = 50.0;
int 总_in_87 = 12;
string 总_st_88 = "****************************";
bool 总_bo_89 = true;
double 总_do_90 = 50.0;
double 总_do_91 = 2.0;
double 总_do_92 = 20.0;
bool 总_bo_93 = false;
double 总_do_94 = 10.0;
bool 总_bo_95 = false;
double 总_do_96 = 50.0;
bool 总_bo_97 = false;
int 总_in_98 = 1;
int 总_in_99 = 2;
int 总_in_100 = 5;
bool 总_bo_101 = false;
bool 总_bo_102 = false;
int 总_in_103 = 200;
int 总_in_104 = 1;
bool 总_bo_105 = false;
bool 总_bo_106 = false;
bool 总_bo_107 = false;
double 总_do_108 = 100.0;
int 总_in_109 = 60;
string 总_st_110 = "ok.wav";
string 总_st_111 = "终极武器27货币";
string 总_st_112 = "终极武器27货币";
string 总_st_113 = "锁单 QQ3229685";
double 总_do_114 = 0.0;
double 总_do_115 = 0.0;
double 总_do_116 = 300.0;
int 总_in_117 = 0;
datetime 总_da_118 = 0;
double 总_do_119 = 0.0;
double 总_do_120 = 0.0;
int 总_in_121 = 2;
datetime 总_da_122 = D'3018.02.06';
int 总_in_123 = 123456;
int 总_in_124 = 0;
datetime 总_da_125 = 0;
double 总_do_126 = 0.0;
double 总_do_127 = 0.0;
double 总_do_128 = 0.0;
double 总_do_129 = 0.0;
extern string 货币1 = "EURUSD";
extern bool 货币1允许交易=TRUE;
extern string 货币2 = "GBPUSD";
extern bool 货币2允许交易=TRUE;
extern string 货币3 = "NZDUSD";
extern bool 货币3允许交易=TRUE;
extern string 货币4 = "USDCHF";
extern bool 货币4允许交易=TRUE;
extern string 货币5 = "USDCAD";
extern bool 货币5允许交易=TRUE;
extern string 货币6 = "USDJPY";
extern bool 货币6允许交易=TRUE;
extern string 货币7 = "EURGBP";
extern bool 货币7允许交易=TRUE;
extern string 货币8 = "EURCHF";
extern bool 货币8允许交易=TRUE;
extern string 货币9 = "EURAUD";
extern bool 货币9允许交易=TRUE;
extern string 货币10 = "EURNZD";
extern bool 货币10允许交易=TRUE;
extern string 货币11 = "EURCAD";
extern bool 货币11允许交易=TRUE;
extern string 货币12 = "EURJPY";
extern bool 货币12允许交易=TRUE;
extern string 货币13 = "GBPCHF";
extern bool 货币13允许交易=TRUE;
extern string 货币14 = "GBPAUD";
extern bool 货币14允许交易=TRUE;
extern string 货币15 = "GBPNZD";
extern bool 货币15允许交易=TRUE;
extern string 货币16 = "GBPJPY";
extern bool 货币16允许交易=TRUE;
extern string 货币17 = "GBPCAD";
extern bool 货币17允许交易=TRUE;
extern string 货币18 = "AUDCHF";
extern bool 货币18允许交易=TRUE;
extern string 货币19 = "AUDNZD";
extern bool 货币19允许交易=TRUE;
extern string 货币20 = "AUDCAD";
extern bool 货币20允许交易=TRUE;
extern string 货币21 = "AUDJPY";
extern bool 货币21允许交易=TRUE;
extern string 货币22 = "NZDCHF";
extern bool 货币22允许交易=TRUE;
extern string 货币23 = "NZDCAD";
extern bool 货币23允许交易=TRUE;
extern string 货币24 = "NZDJPY";
extern bool 货币24允许交易=TRUE;
extern string 货币25 = "CADJPY";
extern bool 货币25允许交易=TRUE;
extern string 货币26 = "CHFJPY";
extern bool 货币26允许交易=TRUE;
extern string 货币27 = "AUDUSD";
extern bool 货币27允许交易=TRUE;
string 总_st_157[400];
int 总_in_158[400];
string Current_Symbol="EURUSD";
int OnInit ()
{
//----------------------------
}
//OnInit
//--------------------- ----------------------------------------
void OnTick ()
{
int 子_in_1;
int 子_in_2;
int 子_in_3;
double 子_do_4;
int 子_in_5;
//----------------------------
uint 临_ui_2;
uint 临_ui_1;
string 临_st_293;
string 临_st_294;
uint 临_ui_5;
uint 临_ui_4;
string 临_st_297;
string 临_st_298;
if ( TimeCurrent() > 总_da_122 )
{
// Alert("软件过期!请联系大摩QQ:3229685");
// return;
}
子_in_1 = 0 ;
临_ui_2 = Lime;
临_ui_1 = Gray;
临_st_293 = "正在执行";
临_st_294 = "全部平仓";
if ( ObjectFind(0,"CCCCCC0") == -1 )
{
ObjectCreate(0,"CCCCCC0",OBJ_BUTTON,0,0,0.0);
ObjectSetInteger(0,"CCCCCC0",OBJPROP_XDISTANCE,70);
ObjectSetInteger(0,"CCCCCC0",OBJPROP_YDISTANCE,25);
ObjectSetInteger(0,"CCCCCC0",OBJPROP_XSIZE,65);
ObjectSetInteger(0,"CCCCCC0",OBJPROP_YSIZE,20);
ObjectSetInteger(0,"CCCCCC0",OBJPROP_CORNER,3);
ObjectSetString(0,"CCCCCC0",OBJPROP_FONT,"微软雅黑");
ObjectSetInteger(0,"CCCCCC0",OBJPROP_FONTSIZE,11);
ObjectSetInteger(0,"CCCCCC0",OBJPROP_BORDER_COLOR,65535);
}
if ( ObjectGetInteger(0,"CCCCCC0",1018,0) == 1 )
{
ObjectSetInteger(0,"CCCCCC0",OBJPROP_COLOR,临_ui_1);
ObjectSetInteger(0,"CCCCCC0",OBJPROP_BGCOLOR,临_ui_2);
ObjectSetString(0,"CCCCCC0",OBJPROP_TEXT,临_st_293);
}
else
{
ObjectSetInteger(0,"CCCCCC0",OBJPROP_COLOR,临_ui_2);
ObjectSetInteger(0,"CCCCCC0",OBJPROP_BGCOLOR,临_ui_1);
ObjectSetString(0,"CCCCCC0",OBJPROP_TEXT,临_st_294);
}
if ( ObjectGetInteger(0,"CCCCCC0",1018,0) == 1 )
{
全部平仓 ( );
ObjectSetInteger(0,"CCCCCC0",OBJPROP_STATE,0);
}
临_ui_5 = Lime;
临_ui_4 = Gray;
临_st_297 = "正在执行";
临_st_298 = "本屏平仓";
if ( ObjectFind(0,"CCCCCC1") == -1 )
{
ObjectCreate(0,"CCCCCC1",OBJ_BUTTON,0,0,0.0);
ObjectSetInteger(0,"CCCCCC1",OBJPROP_XDISTANCE,70);
ObjectSetInteger(0,"CCCCCC1",OBJPROP_YDISTANCE,50);
ObjectSetInteger(0,"CCCCCC1",OBJPROP_XSIZE,65);
ObjectSetInteger(0,"CCCCCC1",OBJPROP_YSIZE,20);
ObjectSetInteger(0,"CCCCCC1",OBJPROP_CORNER,3);
ObjectSetString(0,"CCCCCC1",OBJPROP_FONT,"微软雅黑");
ObjectSetInteger(0,"CCCCCC1",OBJPROP_FONTSIZE,11);
ObjectSetInteger(0,"CCCCCC1",OBJPROP_BORDER_COLOR,65535);
}
if ( ObjectGetInteger(0,"CCCCCC1",1018,0) == 1 )
{
ObjectSetInteger(0,"CCCCCC1",OBJPROP_COLOR,临_ui_4);
ObjectSetInteger(0,"CCCCCC1",OBJPROP_BGCOLOR,临_ui_5);
ObjectSetString(0,"CCCCCC1",OBJPROP_TEXT,临_st_297);
}
else
{
ObjectSetInteger(0,"CCCCCC1",OBJPROP_COLOR,临_ui_5);
ObjectSetInteger(0,"CCCCCC1",OBJPROP_BGCOLOR,临_ui_4);
ObjectSetString(0,"CCCCCC1",OBJPROP_TEXT,临_st_298);
}
if ( ObjectGetInteger(0,"CCCCCC1",1018,0) == 1 )
{
全部清仓 ( Symbol());
ObjectSetInteger(0,"CCCCCC1",OBJPROP_STATE,0);
}
for (子_in_2 = 1 ; 子_in_2 < 28 ; 子_in_2 = 子_in_2 + 1)
{
if ( 子_in_2 == 1 && 货币1允许交易==TRUE )
{
Current_Symbol=货币1 + 货币后缀;
}
if ( 子_in_2 == 2 && 货币2允许交易==TRUE )
{
Current_Symbol=货币2 + 货币后缀;
}
if ( 子_in_2 == 3 && 货币3允许交易==TRUE )
{
Current_Symbol=货币3 + 货币后缀;
}
if ( 子_in_2 == 4 && 货币4允许交易==TRUE )
{
Current_Symbol=货币4 + 货币后缀;
}
if ( 子_in_2 == 5 && 货币5允许交易==TRUE )
{
Current_Symbol=货币5 + 货币后缀;
}
if ( 子_in_2 == 6 && 货币6允许交易==TRUE )
{
Current_Symbol=货币6 + 货币后缀;
}
if ( 子_in_2 == 7 && 货币7允许交易==TRUE )
{
Current_Symbol=货币7 + 货币后缀;
}
if ( 子_in_2 == 8 && 货币8允许交易==TRUE )
{
Current_Symbol=货币8 + 货币后缀;
}
if ( 子_in_2 == 9 && 货币9允许交易==TRUE )
{
Current_Symbol=货币9 + 货币后缀;
}
if ( 子_in_2 == 10 && 货币10允许交易==TRUE )
{
Current_Symbol=货币10 + 货币后缀;
}
if ( 子_in_2 == 11 && 货币11允许交易==TRUE )
{
Current_Symbol=货币11 + 货币后缀;
}
if ( 子_in_2 == 12 && 货币12允许交易==TRUE )
{
Current_Symbol=货币12 + 货币后缀;
}
if ( 子_in_2 == 13 && 货币13允许交易==TRUE )
{
Current_Symbol=货币13 + 货币后缀;
}
if ( 子_in_2 == 14 && 货币14允许交易==TRUE )
{
Current_Symbol=货币14 + 货币后缀;
}
if ( 子_in_2 == 15 && 货币15允许交易==TRUE )
{
Current_Symbol=货币15 + 货币后缀;
}
if ( 子_in_2 == 16 && 货币16允许交易==TRUE )
{
Current_Symbol=货币16 + 货币后缀;
}
if ( 子_in_2 == 17 && 货币17允许交易==TRUE )
{
Current_Symbol=货币17 + 货币后缀;
}
if ( 子_in_2 == 18 && 货币18允许交易==TRUE )
{
Current_Symbol=货币18 + 货币后缀;
}
if ( 子_in_2 == 19 && 货币19允许交易==TRUE )
{
Current_Symbol=货币19 + 货币后缀;
}
if ( 子_in_2 == 20 && 货币20允许交易==TRUE )
{
Current_Symbol=货币20 + 货币后缀;
}
if ( 子_in_2 == 21 && 货币21允许交易==TRUE )
{
Current_Symbol=货币21 + 货币后缀;
}
if ( 子_in_2 == 22 && 货币22允许交易==TRUE )
{
Current_Symbol=货币22 + 货币后缀;
}
if ( 子_in_2 == 23 && 货币23允许交易==TRUE )
{
Current_Symbol=货币23 + 货币后缀;
}
if ( 子_in_2 == 24 && 货币24允许交易==TRUE )
{
Current_Symbol=货币24 + 货币后缀;
}
if ( 子_in_2 == 25 && 货币25允许交易==TRUE )
{
Current_Symbol=货币25 + 货币后缀;
}
if ( 子_in_2 == 26 && 货币26允许交易==TRUE )
{
Current_Symbol=货币26 + 货币后缀;
}
if ( 子_in_2 == 27 && 货币27允许交易==TRUE )
{
Current_Symbol=货币27 + 货币后缀;
}
for (子_in_3 = 0 ; 子_in_3 < 200 ; 子_in_3 = 子_in_3 + 1)
{
if ( !(Open_Symbol(总_st_157[子_in_3],魔术号)) ) return;
}
ObjectCreate("guoq1",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSetText("guoq1","*大摩EA量化交易研发机构:**大摩27货币EA**",10,"微软雅黑",Magenta);
ObjectSet("guoq1",OBJPROP_CORNER,2.0);
ObjectSet("guoq1",OBJPROP_XDISTANCE,6.0);
ObjectSet("guoq1",OBJPROP_YDISTANCE,268.0);
ObjectCreate("guoq2",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSetText("guoq2","QQ:3229685**开户即可免费使用本EA**欢迎个人及平台方咨询合作",10,"微软雅黑",Magenta);
ObjectSet("guoq2",OBJPROP_CORNER,2.0);
ObjectSet("guoq2",OBJPROP_XDISTANCE,6.0);
ObjectSet("guoq2",OBJPROP_YDISTANCE,238.0);
ObjectCreate("guoq3",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSetText("guoq3","使用方法:任意加载到一个货币的任意周期,就可以自动交易27个货币**",10,"微软雅黑",Magenta);
ObjectSet("guoq3",OBJPROP_CORNER,2.0);
ObjectSet("guoq3",OBJPROP_XDISTANCE,6.0);
ObjectSet("guoq3",OBJPROP_YDISTANCE,208.0);
ObjectCreate("guoq4",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSetText("guoq4","*使用有效期:" + TimeToString(总_da_122,TIME_DATE),10,"微软雅黑",Magenta);
ObjectSet("guoq4",OBJPROP_CORNER,2.0);
ObjectSet("guoq4",OBJPROP_XDISTANCE,6.0);
ObjectSet("guoq4",OBJPROP_YDISTANCE,168.0);
ObjectCreate("guoq5",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSetText("guoq5","当前日期: " + string(Month()) + "月" + string(Day()),10,"微软雅黑",Red);
ObjectSet("guoq5",OBJPROP_CORNER,3.0);
ObjectSet("guoq5",OBJPROP_XDISTANCE,6.0);
ObjectSet("guoq5",OBJPROP_YDISTANCE,168.0);
iDisplayInfo ( "guoq6","历史交易量:" + string(CountOrdersLots ( )),3,56,148,10,"微软雅黑",Red);
iDisplayInfo ( "guoq7","订单数量:" + string(OrdersTotal()) + " 订单手数:" + string(持仓手数 ( Current_Symbol,0) + 持仓手数 ( Current_Symbol,1)),3,6,128,10,"微软雅黑",Red);
ObjectCreate("guoq8",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSetText("guoq8","账户余额: " + string(MathFloor(AccountBalance())),10,"微软雅黑",Red);
ObjectSet("guoq8",OBJPROP_CORNER,3.0);
ObjectSet("guoq8",OBJPROP_XDISTANCE,6.0);
ObjectSet("guoq8",OBJPROP_YDISTANCE,108.0);
ObjectCreate("guoq9",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSetText("guoq9","账户净值:" + string(MathFloor(AccountEquity())),10,"微软雅黑",Red);
ObjectSet("guoq9",OBJPROP_CORNER,3.0);
ObjectSet("guoq9",OBJPROP_XDISTANCE,6.0);
ObjectSet("guoq9",OBJPROP_YDISTANCE,88.0);
ObjectCreate("guoq10",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSetText("guoq10","持仓利润:" + string(MathFloor(AccountProfit())),10,"微软雅黑",Red);
ObjectSet("guoq10",OBJPROP_CORNER,3.0);
ObjectSet("guoq10",OBJPROP_XDISTANCE,56.0);
ObjectSet("guoq10",OBJPROP_YDISTANCE,228.0);
ObjectCreate("guoq11",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSetText("guoq11","利润比例:" + string(MathFloor(AccountProfit() / AccountBalance() * 1000.0) / 10.0) + "%",10,"微软雅黑",Red);
ObjectSet("guoq11",OBJPROP_CORNER,3.0);
ObjectSet("guoq11",OBJPROP_XDISTANCE,56.0);
ObjectSet("guoq11",OBJPROP_YDISTANCE,208.0);
ObjectCreate("guoq12",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSetText("guoq12"," 累计盈利:" + string((MathFloor(((AccountEquity() - 在此填写本金) / 在此填写本金) * 1000.0)) / 10.0) + "%",10,"微软雅黑",Red);
ObjectSet("guoq12",OBJPROP_CORNER,3.0);
ObjectSet("guoq12",OBJPROP_XDISTANCE,56.0);
ObjectSet("guoq12",OBJPROP_YDISTANCE,188.0);
if ( TimeCurrent() > 总_da_122 )
{
// Alert("软件过期!请联系QQ:3229685");
// return;
}
if ( 总_bo_101 == true )
{
if ( 均线开空 ( ) && 持仓数量 ( Current_Symbol,1) == 0 && 时间限制 ( ) )
{
RefreshRates();
子_in_1 = OrderSend(Current_Symbol,OP_SELL,起始手数,MarketInfo(Current_Symbol,9),总_do_116,0.0,0.0,总_st_112 + "1",魔术号,0,Blue) ;
if ( 子_in_1 < 0 )
{
Print("空单入场失败" + string(GetLastError()));
}
if ( 子_in_1 > 0 )
{
Print(Symbol() + "空单入场成功!!");
}}
if ( 均线开多 ( ) && 持仓数量 ( Current_Symbol,0) == 0 && 时间限制 ( ) )
{
RefreshRates();
子_in_1 = OrderSend(Current_Symbol,OP_BUY,起始手数,MarketInfo(Current_Symbol,10),总_do_116,0.0,0.0,总_st_111 + "1",魔术号,0,Red) ;
if ( 子_in_1 < 0 )
{
Print("多单入场失败" + string(GetLastError()));
}
if ( 子_in_1 > 0 )
{
Print(Symbol() + "多单入场成功!!");
}}}
if ( 总_bo_107 == true )
{
if ( K线开空 ( ) && 持仓数量 ( Current_Symbol,1) == 0 && 时间限制 ( ) )
{
RefreshRates();
子_in_1 = OrderSend(Current_Symbol,OP_SELL,起始手数,MarketInfo(Current_Symbol,9),总_do_116,0.0,0.0,总_st_112 + "1",魔术号,0,Blue) ;
if ( 子_in_1 < 0 )
{
Print("空单入场失败" + string(GetLastError()));
}
if ( 子_in_1 > 0 )
{
Print(Symbol() + "空单入场成功!!");
}}
if ( K线开多 ( ) && 持仓数量 ( Current_Symbol,0) == 0 && 时间限制 ( ) )
{
RefreshRates();
子_in_1 = OrderSend(Current_Symbol,OP_BUY,起始手数,MarketInfo(Current_Symbol,10),总_do_116,0.0,0.0,总_st_111 + "1",魔术号,0,Red) ;
if ( 子_in_1 < 0 )
{
Print("多单入场失败" + string(GetLastError()));
}
if ( 子_in_1 > 0 )
{
Print(Symbol() + "多单入场成功!!");
}}}
if ( RSI策略 == true )
{
if ( RSI开空 ( ) && 持仓数量 ( Current_Symbol,1) == 0 && 时间限制 ( ) )
{
RefreshRates();
子_in_1 = OrderSend(Current_Symbol,OP_SELL,起始手数,MarketInfo(Current_Symbol,9),总_do_116,0.0,0.0,总_st_112 + "1",魔术号,0,Blue) ;
if ( 子_in_1 < 0 )
{
Print("空单入场失败" + string(GetLastError()));
}
if ( 子_in_1 > 0 )
{
Print(Symbol() + "空单入场成功!!");
}}
if ( RSI开多 ( ) && 持仓数量 ( Current_Symbol,0) == 0 && 时间限制 ( ) )
{
RefreshRates();
子_in_1 = OrderSend(Current_Symbol,OP_BUY,起始手数,MarketInfo(Current_Symbol,10),总_do_116,0.0,0.0,总_st_111 + "1",魔术号,0,Red) ;
if ( 子_in_1 < 0 )
{
Print("多单入场失败" + string(GetLastError()));
}
if ( 子_in_1 > 0 )
{
Print(Symbol() + "多单入场成功!!");
}}}
if ( 通道策略 == true )
{
if ( 通道开空 ( ) && 持仓数量 ( Current_Symbol,1) == 0 && 时间限制 ( ) )
{
RefreshRates();
子_in_1 = OrderSend(Current_Symbol,OP_SELL,起始手数,MarketInfo(Current_Symbol,9),总_do_116,0.0,0.0,总_st_112 + "1",魔术号,0,Blue) ;
if ( 子_in_1 < 0 )
{
Print("空单入场失败" + string(GetLastError()));
}
if ( 子_in_1 > 0 )
{
Print(Symbol() + "空单入场成功!!");
}}
if ( 通道开多 ( ) && 持仓数量 ( Current_Symbol,0) == 0 && 时间限制 ( ) )
{
RefreshRates();
子_in_1 = OrderSend(Current_Symbol,OP_BUY,起始手数,MarketInfo(Current_Symbol,10),总_do_116,0.0,0.0,总_st_111 + "1",魔术号,0,Red) ;
if ( 子_in_1 < 0 )
{
Print("多单入场失败" + string(GetLastError()));
}
if ( 子_in_1 > 0 )
{
Print(Symbol() + "多单入场成功!!");
}}}
if ( 总_bo_102 == true )
{
if ( 通道顺势开空 ( ) && 持仓数量 ( Current_Symbol,1) == 0 && 时间限制 ( ) )
{
RefreshRates();
子_in_1 = OrderSend(Current_Symbol,OP_SELL,起始手数,MarketInfo(Current_Symbol,9),总_do_116,0.0,0.0,总_st_112 + "1",魔术号,0,Blue) ;
if ( 子_in_1 < 0 )
{
Print("空单入场失败" + string(GetLastError()));
}
if ( 子_in_1 > 0 )
{
Print(Symbol() + "空单入场成功!!");
}}
if ( 通道顺势开多 ( ) && 持仓数量 ( Current_Symbol,0) == 0 && 时间限制 ( ) )
{
RefreshRates();
子_in_1 = OrderSend(Current_Symbol,OP_BUY,起始手数,MarketInfo(Current_Symbol,10),总_do_116,0.0,0.0,总_st_111 + "1",魔术号,0,Red) ;
if ( 子_in_1 < 0 )
{
Print("多单入场失败" + string(GetLastError()));
}
if ( 子_in_1 > 0 )
{
Print(Symbol() + "多单入场成功!!");
}}}
if ( 总_bo_105 == true )
{
if ( 持仓数量 ( Current_Symbol,0) == 0 && 持仓数量 ( Current_Symbol,1) == 0 && 时间限制 ( ) )
{
RefreshRates();
子_in_1 = OrderSend(Current_Symbol,OP_BUY,起始手数,MarketInfo(Current_Symbol,10),总_do_116,0.0,0.0,总_st_111 + "1",魔术号,0,Red) ;
if ( 子_in_1 < 0 )
{
Print("多单入场失败" + string(GetLastError()));
}
if ( 子_in_1 > 0 )
{
Print(Symbol() + "多单入场成功!!");
}}
if ( 止盈开空() && 持仓数量 ( Current_Symbol,1) == 0 && 时间限制 ( ) )
{
RefreshRates();
子_in_1 = OrderSend(Current_Symbol,OP_SELL,起始手数,MarketInfo(Current_Symbol,9),总_do_116,0.0,0.0,总_st_112 + "1",魔术号,0,Blue) ;
if ( 子_in_1 < 0 )
{
Print("空单入场失败" + string(GetLastError()));
}
if ( 子_in_1 > 0 )
{
Print(Symbol() + "空单入场成功!!");
}}
if ( 止盈开多() && 持仓数量 ( Current_Symbol,0) == 0 && 时间限制 ( ) )
{
RefreshRates();
子_in_1 = OrderSend(Current_Symbol,OP_BUY,起始手数,MarketInfo(Current_Symbol,10),总_do_116,0.0,0.0,总_st_111 + "1",魔术号,0,Red) ;
if ( 子_in_1 < 0 )
{
Print("多单入场失败" + string(GetLastError()));
}
if ( 子_in_1 > 0 )
{
Print(Symbol() + "多单入场成功!!");
}}}
if ( 激进策略 == true )
{
if ( 持仓数量 ( Current_Symbol,1) == 0 && 时间限制 ( ) )
{
RefreshRates();
子_in_1 = OrderSend(Current_Symbol,OP_SELL,起始手数,MarketInfo(Current_Symbol,9),总_do_116,0.0,0.0,总_st_112 + "1",魔术号,0,Blue) ;
if ( 子_in_1 < 0 )
{
Print("空单入场失败" + string(GetLastError()));
}
if ( 子_in_1 > 0 )
{
Print(Symbol() + "空单入场成功!!");
}}
if ( 持仓数量 ( Current_Symbol,0) == 0 && 时间限制 ( ) )
{
RefreshRates();
子_in_1 = OrderSend(Current_Symbol,OP_BUY,起始手数,MarketInfo(Current_Symbol,10),总_do_116,0.0,0.0,总_st_111 + "1",魔术号,0,Red) ;
if ( 子_in_1 < 0 )
{
Print("多单入场失败" + string(GetLastError()));
}
if ( 子_in_1 > 0 )
{
Print(Symbol() + "多单入场成功!!");
}}}
if ( MarketInfo(Current_Symbol,10)<总_do_128 )
{
总_do_128 = MarketInfo(Current_Symbol,10) ;
}
if ( MarketInfo(Current_Symbol,9)>总_do_129 )
{
总_do_129 = MarketInfo(Current_Symbol,9) ;
}
if ( 总_bo_76 == true )
{
if ( 持仓数量 ( Current_Symbol,0) == 总_in_85 )
{
总_do_81 = 总_do_84 ;
}
if ( 持仓数量 ( Current_Symbol,0) > 总_in_85 )
{
总_do_81 = 总_do_78 ;
}
if ( 持仓数量 ( Current_Symbol,0) < 总_in_85 )
{
总_do_81 = 总_do_78 ;
}
if ( 持仓数量 ( Current_Symbol,0) == 总_in_87 )
{
总_do_81 = 总_do_86 ;
}
if ( 持仓数量 ( Current_Symbol,0) > 总_in_87 )
{
总_do_81 = 总_do_78 ;
}
if ( 持仓数量 ( Current_Symbol,1) == 总_in_85 )
{
总_do_82 = 总_do_84 ;
}
if ( 持仓数量 ( Current_Symbol,1) > 总_in_85 )
{
总_do_82 = 总_do_78 ;
}
if ( 持仓数量 ( Current_Symbol,1) < 总_in_85 )
{
总_do_82 = 总_do_78 ;
}
if ( 持仓数量 ( Current_Symbol,1) == 总_in_87 )
{
总_do_82 = 总_do_86 ;
}
if ( 持仓数量 ( Current_Symbol,1) > 总_in_87 )
{
总_do_82 = 总_do_78 ;
}
if ( 持仓数量 ( Current_Symbol,0) != 0 && 最新持仓单开仓价 ( Current_Symbol,0) - MarketInfo(Current_Symbol,10)>=布林间隔 ( Current_Symbol,0) * MarketInfo(Current_Symbol,11) * 总_do_9 && MarketInfo(Current_Symbol,10) - 总_do_128>=总_do_22 * MarketInfo(Current_Symbol,11) && 最新持仓单开仓价 ( Current_Symbol,0) - MarketInfo(Current_Symbol,10)>=(总_do_81 - 持仓数量 ( Current_Symbol,0) * 总_do_79) * MarketInfo(Current_Symbol,11) && 最新持仓单开仓价 ( Current_Symbol,0) - MarketInfo(Current_Symbol,10)>=总_do_80 * MarketInfo(Current_Symbol,11) && 持仓数量 ( Current_Symbol,0) < 总_in_16 && 加仓时间间隔限制 ( ) )
{
子_do_4 = NormalizeDouble(最新持仓单手数 ( Current_Symbol,0) * 多倍数计算(),总_in_121) ;
if ( 子_do_4>=最大开单手数 )
{
子_do_4 = 最大开单手数 ;
}
子_in_5 = 持仓数量 ( Current_Symbol,0) + 1;
RefreshRates();
子_in_1 = OrderSend(Current_Symbol,OP_BUY,子_do_4,MarketInfo(Current_Symbol,10),总_do_116,0.0,0.0,总_st_111 + string(子_in_5),魔术号,0,Red) ;
if ( 子_in_1 < 0 )
{
Print("多单入场失败" + string(GetLastError()));
}
if ( 子_in_1 > 0 )
{
Print(Symbol() + "多单入场成功!!");
}}
if ( 持仓数量 ( Current_Symbol,1) != 0 && MarketInfo(Current_Symbol,9) - 最新持仓单开仓价 ( Current_Symbol,1)>=布林间隔 ( Current_Symbol,0) * MarketInfo(Current_Symbol,11) * 总_do_9 && 总_do_129 - MarketInfo(Current_Symbol,9)>=总_do_22 * MarketInfo(Current_Symbol,11) && MarketInfo(Current_Symbol,9) - 最新持仓单开仓价 ( Current_Symbol,1)>=(总_do_82 - 持仓数量 ( Current_Symbol,1) * 总_do_79) * MarketInfo(Current_Symbol,11) && MarketInfo(Current_Symbol,9) - 最新持仓单开仓价 ( Current_Symbol,1)>=总_do_80 * MarketInfo(Current_Symbol,11) && 持仓数量 ( Current_Symbol,1) < 总_in_16 && 加仓时间间隔限制 ( ) )
{
子_do_4 = NormalizeDouble(最新持仓单手数 ( Current_Symbol,1) * 空倍数计算(),总_in_121) ;
if ( 子_do_4>=最大开单手数 )
{
子_do_4 = 最大开单手数 ;
}
子_in_5 = 持仓数量 ( Current_Symbol,1) + 1;
RefreshRates();
子_in_1 = OrderSend(Current_Symbol,OP_SELL,子_do_4,MarketInfo(Current_Symbol,9),总_do_116,0.0,0.0,总_st_112 + string(子_in_5),魔术号,0,Blue) ;
if ( 子_in_1 < 0 )
{
Print("空单入场失败" + string(GetLastError()));
}
if ( 子_in_1 > 0 )
{
Print(Current_Symbol + "空单入场成功!!");
}}
if ( 持仓数量 ( Current_Symbol,0) != 0 && 最新持仓单开仓价 ( Current_Symbol,0) - MarketInfo(Current_Symbol,10)>=布林间隔 ( Current_Symbol,0) * MarketInfo(Current_Symbol,11) * 总_do_9 && 最新持仓单开仓价 ( Current_Symbol,0) - MarketInfo(Current_Symbol,10)>=(总_do_81 - 持仓数量 ( Current_Symbol,0) * 总_do_79) * MarketInfo(Current_Symbol,11) && 最新持仓单开仓价 ( Current_Symbol,0) - MarketInfo(Current_Symbol,10)>=总_in_17 * MarketInfo(Current_Symbol,11) && 持仓数量 ( Current_Symbol,0) >= 总_in_16 && 持仓数量 ( Current_Symbol,0) < 开单次数 && 加仓时间间隔限制 ( ) && MA1 ( Current_Symbol,0)>MA2 ( Current_Symbol,0) )
{
子_do_4 = NormalizeDouble(最新持仓单手数 ( Current_Symbol,0) * 多倍数计算(),总_in_121) ;
if ( 子_do_4>=最大开单手数 )
{
子_do_4 = 最大开单手数 ;
}
子_in_5 = 持仓数量 ( Current_Symbol,0) + 1;
RefreshRates();
子_in_1 = OrderSend(Current_Symbol,OP_BUY,子_do_4,MarketInfo(Current_Symbol,10),总_do_116,0.0,0.0,总_st_111 + string(子_in_5),魔术号,0,Red) ;
if ( 子_in_1 < 0 )
{
Print("多单入场失败" + string(GetLastError()));
}
if ( 子_in_1 > 0 )
{
Print(Symbol() + "多单入场成功!!");
}}
if ( 持仓数量 ( Current_Symbol,1) != 0 && MarketInfo(Current_Symbol,9) - 最新持仓单开仓价 ( Current_Symbol,1)>=布林间隔 ( Current_Symbol,0) * MarketInfo(Current_Symbol,11) * 总_do_9 && MarketInfo(Current_Symbol,9) - 最新持仓单开仓价 ( Current_Symbol,1)>=(总_do_82 - 持仓数量 ( Current_Symbol,1) * 总_do_79) * MarketInfo(Current_Symbol,11) && MarketInfo(Current_Symbol,9) - 最新持仓单开仓价 ( Current_Symbol,1)>=总_in_17 * MarketInfo(Current_Symbol,11) && 持仓数量 ( Current_Symbol,1) >= 总_in_16 && 持仓数量 ( Current_Symbol,1) < 开单次数 && 加仓时间间隔限制 ( ) && MA1 ( Current_Symbol,0)<MA2 ( Current_Symbol,0) )
{
子_do_4 = NormalizeDouble(最新持仓单手数 ( Current_Symbol,1) * 空倍数计算(),总_in_121) ;
if ( 子_do_4>=最大开单手数 )
{
子_do_4 = 最大开单手数 ;
}
子_in_5 = 持仓数量 ( Current_Symbol,1) + 1;
RefreshRates();
子_in_1 = OrderSend(Current_Symbol,OP_SELL,子_do_4,MarketInfo(Current_Symbol,9),总_do_116,0.0,0.0,总_st_112 + string(子_in_5),魔术号,0,Blue) ;
if ( 子_in_1 < 0 )
{
Print("空单入场失败" + string(GetLastError()));
}
if ( 子_in_1 > 0 )
{
Print(Current_Symbol + "空单入场成功!!");
}}}
if ( 总_bo_89 == true )
{
修改止盈止损();
}
if ( 总_bo_93 == true && 盈亏统计 ( 0) + 盈亏统计 ( 1)>=(持仓手数 ( Current_Symbol,0) + 持仓手数 ( Current_Symbol,1)) * 总_do_94 )
{
全部清仓 ( );
}
if ( 总_bo_95 == true && 盈亏统计 ( 0) + 盈亏统计 ( 1)>=总_do_96 )
{
全部清仓 ( );
}
if ( 全仓金额止损 == true && 盈亏统计 ( 0) + 盈亏统计 ( 1)<= -(止损金额) )
{
全部清仓 ( );
}
if ( 总_bo_97 == true )
{
均线止盈();
if ( 总_do_114==0.0 )
{
if ( ObjectFind("BuyAveragePrice") != -1 )
{
ObjectDelete("BuyAveragePrice");
}}
else
{
if ( ObjectFind("BuyAveragePrice") == -1 )
{
ObjectCreate("BuyAveragePrice",OBJ_HLINE,0,0,总_do_114,0,0.0,0,0.0);
ObjectSet("BuyAveragePrice",OBJPROP_COLOR,16711680.0);
ObjectSet("BuyAveragePrice",OBJPROP_STYLE,0.0);
}
else
{
ObjectSet("BuyAveragePrice",OBJPROP_PRICE1,总_do_114);
}}
if ( 总_do_115==0.0 )
{
if ( ObjectFind("SellAveragePrice") != -1 )
{
ObjectDelete("SellAveragePrice");
}}
else
{
if ( ObjectFind("SellAveragePrice") == -1 )
{
ObjectCreate("SellAveragePrice",OBJ_HLINE,0,0,总_do_115,0,0.0,0,0.0);
ObjectSet("SellAveragePrice",OBJPROP_COLOR,255.0);
ObjectSet("SellAveragePrice",OBJPROP_STYLE,0.0);
}
else
{
ObjectSet("SellAveragePrice",OBJPROP_PRICE1,总_do_115);
}}}
}
}
//OnTick
//--------------------- ----------------------------------------
void OnDeinit (const int 木_0)
{
//----------------------------
}
//OnDeinit
//--------------------- ----------------------------------------
double 盈亏统计 (int 木_0)
{
double 子_do_1;
int 子_in_2;
//----------------------------
for ( ; 子_in_2 < OrdersTotal() ; 子_in_2 = 子_in_2 + 1)
{
if ( OrderSelect(子_in_2,SELECT_BY_POS,MODE_TRADES) == true && OrderType() == 木_0 )
{
子_do_1 = 子_do_1 + OrderProfit() + OrderCommission() + OrderSwap() ;
}
}
return(子_do_1);
}
//盈亏统计
//--------------------- ----------------------------------------
void 全部清仓 ()
{
int 子_in_1;
//----------------------------
for (子_in_1 = OrdersTotal() - 1 ; 子_in_1 >= 0 ; 子_in_1 = 子_in_1 - 1)
{
if ( OrderSelect(子_in_1,SELECT_BY_POS,MODE_TRADES) && OrderType() < 2 )
{
繁忙等待组件 ( );
if ( OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),总_do_116,0xFFFFFFFF) == false )
{
报错组件("");
}}
}
for (子_in_1 = OrdersTotal() - 1 ; 子_in_1 >= 0 ; 子_in_1 = 子_in_1 - 1)
{
if ( OrderSelect(子_in_1,SELECT_BY_POS,MODE_TRADES) && OrderType() > 1 )
{
繁忙等待组件 ( );
if ( OrderDelete(OrderTicket(),0xFFFFFFFF) == false )
{
报错组件("");
}}
}
}
//全部清仓
//--------------------- ----------------------------------------
int 已开单货币数量 (string 木_0)
{
int 子_in_1;
int 子_in_2;
//----------------------------
for (子_in_2 = OrdersTotal() - 1 ; 子_in_2 >= 0 ; 子_in_2 = 子_in_2 - 1)
{
if ( OrderSelect(子_in_2,SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == 木_0 && OrderMagicNumber() == 魔术号 && OrderComment() != 总_st_113 )
{
子_in_1 = 子_in_1 + 1;
}
}
return(子_in_1);
}
//已开单货币数量
//--------------------- ----------------------------------------
int 持仓数量 (string 木_0, int 木_1)
{
int 子_in_1;
int 子_in_2;
//----------------------------
for (子_in_2 = OrdersTotal() - 1 ; 子_in_2 >= 0 ; 子_in_2 = 子_in_2 - 1)
{
if ( OrderSelect(子_in_2,SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == 木_0 && OrderType() == 木_1 && OrderMagicNumber() == 魔术号 && OrderComment() != 总_st_113 )
{
子_in_1 = 子_in_1 + 1;
}
}
return(子_in_1);
}
//持仓数量
//--------------------- ----------------------------------------
int 锁单数量 (string 木_0, int 木_1)
{
int 子_in_1;
int 子_in_2;
//----------------------------
for (子_in_2 = OrdersTotal() - 1 ; 子_in_2 >= 0 ; 子_in_2 = 子_in_2 - 1)
{
if ( OrderSelect(子_in_2,SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == 木_0 && OrderType() == 木_1 && OrderMagicNumber() == 魔术号 && OrderComment() == 总_st_113 )
{
子_in_1 = 子_in_1 + 1;
}
}
return(子_in_1);
}
//锁单数量
//--------------------- ----------------------------------------
double 多开仓价 (string 木_0)
{
double 子_do_1;
int 子_in_2;
//----------------------------
for (子_in_2 = OrdersTotal() - 1 ; 子_in_2 >= 0 ; 子_in_2 = 子_in_2 - 1)
{
if ( OrderSelect(子_in_2,SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == 木_0 && OrderType() == 0 && OrderMagicNumber() == 魔术号 && OrderComment() != 总_st_113 )
{
子_do_1 = OrderOpenPrice() * OrderLots() + 子_do_1 ;
}
}
return(子_do_1);
}
//多开仓价
//--------------------- ----------------------------------------
double 空开仓价 (string 木_0)
{
double 子_do_1;
int 子_in_2;
//----------------------------
for (子_in_2 = OrdersTotal() - 1 ; 子_in_2 >= 0 ; 子_in_2 = 子_in_2 - 1)
{
if ( OrderSelect(子_in_2,SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == 木_0 && OrderType() == 1 && OrderMagicNumber() == 魔术号 && OrderComment() != 总_st_113 )
{
子_do_1 = OrderOpenPrice() * OrderLots() + 子_do_1 ;
}
}
return(子_do_1);
}
//空开仓价
//--------------------- ----------------------------------------
double 持仓手数 (string 木_0, int 木_1)
{
double 子_do_1;
int 子_in_2;
//----------------------------
for (子_in_2 = OrdersTotal() - 1 ; 子_in_2 >= 0 ; 子_in_2 = 子_in_2 - 1)
{
if ( OrderSelect(子_in_2,SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == 木_0 && OrderType() == 木_1 && OrderMagicNumber() == 魔术号 && OrderComment() != 总_st_113 )
{
子_do_1 = 子_do_1 + OrderLots() ;
}
}
return(子_do_1);
}
//持仓手数
//--------------------- ----------------------------------------
double 最新持仓单开仓价 (string 木_0, int 木_1)
{
int 子_in_1;
//----------------------------
for (子_in_1 = OrdersTotal() - 1 ; 子_in_1 >= 0 ; 子_in_1 = 子_in_1 - 1)
{
if ( OrderSelect(子_in_1,SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == 木_0 && OrderType() == 木_1 && OrderMagicNumber() == 魔术号 && OrderComment() != 总_st_113 )
{
return(OrderOpenPrice());
}
}
return(0.0);
}
//最新持仓单开仓价
//--------------------- ----------------------------------------
datetime 最新持仓单开仓时间 (string 木_0)
{
int 子_in_1;
//----------------------------
for (子_in_1 = OrdersTotal() - 1 ; 子_in_1 >= 0 ; 子_in_1 = 子_in_1 - 1)
{
if ( OrderSelect(子_in_1,SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == 木_0 && OrderMagicNumber() == 魔术号 )
{
return(OrderOpenTime());
}
}
return(0);
}
//最新持仓单开仓时间
//--------------------- ----------------------------------------
double 最新持仓单手数 (string 木_0, int 木_1)
{
int 子_in_1;
//----------------------------
for (子_in_1 = OrdersTotal() - 1 ; 子_in_1 >= 0 ; 子_in_1 = 子_in_1 - 1)
{
if ( OrderSelect(子_in_1,SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == 木_0 && OrderType() == 木_1 && OrderMagicNumber() == 魔术号 && OrderComment() != 总_st_113 )
{
return(OrderLots());
}
}
return(0.0);
}
//最新持仓单手数
//--------------------- ----------------------------------------
void 修改多止盈 (string 木_0)
{
int 子_in_1;
int 子_in_2;
bool 子_bo_3;
//----------------------------
子_in_2 = OrdersTotal() ;
for (子_in_1 = 子_in_2 - 1 ; 子_in_1 >= 0 ; 子_in_1 = 子_in_1 - 1)
{
if ( OrderSelect(子_in_1,SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == 木_0 && OrderType() == 0 && OrderTakeProfit()!=总_do_114 && 总_do_114!=0.0 && OrderMagicNumber() == 魔术号 && OrderComment() != 总_st_113 )
{
子_bo_3 = OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),总_do_114,0,Green) ;
if ( 子_bo_3 )
{
Print("单号:" + string(OrderTicket()) + "修改止盈成功");
}}
}
}
//修改多止盈
//--------------------- ----------------------------------------
void 修改空止盈 (string 木_0)
{
int 子_in_1;
int 子_in_2;
bool 子_bo_3;
//----------------------------
子_in_2 = OrdersTotal() ;
for (子_in_1 = 子_in_2 - 1 ; 子_in_1 >= 0 ; 子_in_1 = 子_in_1 - 1)
{
if ( OrderSelect(子_in_1,SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == 木_0 && OrderType() == 1 && OrderTakeProfit()!=总_do_115 && 总_do_115!=0.0 && OrderMagicNumber() == 魔术号 && OrderComment() != 总_st_113 )
{
子_bo_3 = OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),总_do_115,0,Green) ;
if ( 子_bo_3 )
{
Print("单号:" + string(OrderTicket()) + "修改止盈成功");
}}
}
}
//修改空止盈
//--------------------- ----------------------------------------
void 修改止盈止损 ()
{
//----------------------------
double 临_do_59;
double 临_do_73;
if ( 持仓数量 ( Current_Symbol,0) == 0 )
{
总_do_114 = 0.0 ;
}
if ( 持仓数量 ( Current_Symbol,0) >= 1 )
{
临_do_59 = NormalizeDouble((总_do_90 - 持仓数量 ( Current_Symbol,0) * 总_do_91) * MarketInfo(Current_Symbol,11) + 多开仓价 ( Current_Symbol) / 持仓手数 ( Current_Symbol,0),MarketInfo(Current_Symbol,12));
总_do_114 = MathMax(临_do_59,NormalizeDouble(总_do_92 * MarketInfo(Current_Symbol,11) + 多开仓价 ( Current_Symbol) / 持仓手数 ( Current_Symbol,0),MarketInfo(Current_Symbol,12))) ;
修改多止盈 ( Current_Symbol);
}
if ( 持仓数量 ( Current_Symbol,1) == 0 )
{
总_do_115 = 0.0 ;
}
if ( 持仓数量 ( Current_Symbol,1) < 1 ) return;
临_do_73 = NormalizeDouble(空开仓价 ( Current_Symbol) / 持仓手数 ( Current_Symbol,1) - (总_do_90 - 持仓数量 ( Current_Symbol,1) * 总_do_91) * MarketInfo(Current_Symbol,11),MarketInfo(Current_Symbol,12));
总_do_115 = MathMin(临_do_73,NormalizeDouble(空开仓价 ( Current_Symbol) / 持仓手数 ( Current_Symbol,1) - 总_do_92 * MarketInfo(Current_Symbol,11),MarketInfo(Current_Symbol,12))) ;
修改空止盈 ( Current_Symbol);
}
//修改止盈止损
//--------------------- ----------------------------------------
void 均线止盈 ()
{
//----------------------------
double 临_do_54;
double 临_do_68;
if ( 持仓数量 ( Current_Symbol,0) >= 1 )
{
临_do_54 = NormalizeDouble((总_do_90 - 持仓数量 ( Current_Symbol,0) * 总_do_91) * MarketInfo(Current_Symbol,11) + 多开仓价 ( Current_Symbol) / 持仓手数 ( Current_Symbol,0),MarketInfo(Current_Symbol,12));
总_do_114 = MathMax(临_do_54,NormalizeDouble(总_do_92 * MarketInfo(Current_Symbol,11) + 多开仓价 ( Current_Symbol) / 持仓手数 ( Current_Symbol,0),MarketInfo(Current_Symbol,12))) ;
if ( MarketInfo(Current_Symbol,9)>=总_do_114 )
{
平仓 ( Current_Symbol,0);
}}
if ( 持仓数量 ( Current_Symbol,1) < 1 ) return;
临_do_68 = NormalizeDouble(空开仓价 ( Current_Symbol) / 持仓手数 ( Current_Symbol,1) - (总_do_90 - 持仓数量 ( Current_Symbol,1) * 总_do_91) * MarketInfo(Current_Symbol,11),MarketInfo(Current_Symbol,12));
总_do_115 = MathMin(临_do_68,NormalizeDouble(空开仓价 ( Current_Symbol) / 持仓手数 ( Current_Symbol,1) - 总_do_92 * MarketInfo(Current_Symbol,11),MarketInfo(Current_Symbol,12))) ;
if ( !(MarketInfo(Current_Symbol,9)<=总_do_115) ) return;
平仓 ( Current_Symbol,1);
}
//均线止盈
//--------------------- ----------------------------------------
double 盈利金额 (string 木_0)
{
double 子_do_1;
int 子_in_2;
//----------------------------
for (子_in_2 = OrdersTotal() - 1 ; 子_in_2 >= 0 ; 子_in_2 = 子_in_2 - 1)
{
if ( OrderSelect(子_in_2,SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == 木_0 && OrderMagicNumber() == 魔术号 )
{
子_do_1 = OrderProfit() + OrderSwap() + OrderCommission() + 子_do_1 ;
}
}
return(子_do_1);
}
//盈利金额
//--------------------- ----------------------------------------
void 全部清仓 (string 木_0)
{
int 子_in_1;
//----------------------------
for (子_in_1 = OrdersTotal() - 1 ; 子_in_1 >= 0 ; 子_in_1 = 子_in_1 - 1)
{
if ( OrderSelect(子_in_1,SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == 木_0 && OrderMagicNumber() == 魔术号 && OrderType() < 2 )
{
繁忙等待组件 ( );
if ( OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),总_do_116,0xFFFFFFFF) == false )
{
报错组件("");
}}
}
for (子_in_1 = OrdersTotal() - 1 ; 子_in_1 >= 0 ; 子_in_1 = 子_in_1 - 1)
{
if ( OrderSelect(子_in_1,SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == 木_0 && OrderMagicNumber() == 魔术号 && OrderType() > 1 )
{
繁忙等待组件 ( );
if ( OrderDelete(OrderTicket(),0xFFFFFFFF) == false )
{
报错组件("");
}}
}
}
//全部清仓
//--------------------- ----------------------------------------
void 平仓 (string 木_0, int 木_1)
{
int 子_in_1;
//----------------------------
for (子_in_1 = OrdersTotal() - 1 ; 子_in_1 >= 0 ; 子_in_1 = 子_in_1 - 1)
{
if ( OrderSelect(子_in_1,SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == 木_0 && OrderType() == 木_1 && OrderMagicNumber() == 魔术号 && OrderType() < 2 )
{
繁忙等待组件 ( );
if ( OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),总_do_116,0xFFFFFFFF) == false )
{
报错组件("");
}}
}
for (子_in_1 = OrdersTotal() - 1 ; 子_in_1 >= 0 ; 子_in_1 = 子_in_1 - 1)
{
if ( OrderSelect(子_in_1,SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == 木_0 && OrderType() == 木_1 && OrderMagicNumber() == 魔术号 && OrderType() > 1 )
{
繁忙等待组件 ( );
if ( OrderDelete(OrderTicket(),0xFFFFFFFF) == false )
{
报错组件("");
}}
}
}
//平仓
//--------------------- ----------------------------------------
void 全部平仓 ()
{
int 子_in_1;
//----------------------------
for (子_in_1 = OrdersTotal() - 1 ; 子_in_1 >= 0 ; 子_in_1 = 子_in_1 - 1)
{
if ( OrderSelect(子_in_1,SELECT_BY_POS,MODE_TRADES) && OrderMagicNumber() == 魔术号 && OrderType() < 2 )
{
繁忙等待组件 ( );
if ( OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),总_do_116,0xFFFFFFFF) == false )
{
报错组件("");
}}
}
for (子_in_1 = OrdersTotal() - 1 ; 子_in_1 >= 0 ; 子_in_1 = 子_in_1 - 1)
{
if ( OrderSelect(子_in_1,SELECT_BY_POS,MODE_TRADES) && OrderMagicNumber() == 魔术号 && OrderType() > 1 )
{
繁忙等待组件 ( );
if ( OrderDelete(OrderTicket(),0xFFFFFFFF) == false )
{
报错组件("");
}}
}
}
//全部平仓
//--------------------- ----------------------------------------
void 当前屏清仓 ()
{
int 子_in_1;
//----------------------------
for (子_in_1 = OrdersTotal() - 1 ; 子_in_1 >= 0 ; 子_in_1 = 子_in_1 - 1)
{
if ( OrderSelect(子_in_1,SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == Symbol() && OrderMagicNumber() == 魔术号 && OrderType() < 2 )
{
繁忙等待组件 ( );
if ( OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),总_do_116,0xFFFFFFFF) == false )
{
报错组件("");
}}
}
for (子_in_1 = OrdersTotal() - 1 ; 子_in_1 >= 0 ; 子_in_1 = 子_in_1 - 1)
{
if ( OrderSelect(子_in_1,SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == Symbol() && OrderMagicNumber() == 魔术号 && OrderType() > 1 )
{
繁忙等待组件 ( );
if ( OrderDelete(OrderTicket(),0xFFFFFFFF) == false )
{
报错组件("");
}}
}
}
//当前屏清仓
//--------------------- ----------------------------------------
void 繁忙等待组件 ()
{
//----------------------------
if(!(IsTradeAllowed()) && IsTradeContextBusy()){
do
{
Sleep(100);
if ( IsTradeAllowed() ) break;
}
while(IsTradeContextBusy());
}
RefreshRates();
}
//繁忙等待组件
//--------------------- ----------------------------------------
void 报错组件 (string 木_0)
{
int 子_in_1;
string 子_st_2;
//----------------------------
子_in_1 = GetLastError() ;
if ( 子_in_1 != 0 )
{
switch(子_in_1)
{
case 0 :
子_st_2 = "错误代码:0没有错误返回" ;
break;
case 1 :
子_st_2 = "错误代码:1没有错误返回但结果不明" ;
break;
case 2 :
子_st_2 = "错误代码:2一般错误" ;
break;
case 3 :
子_st_2 = "错误代码:3无效交易参量" ;
break;
case 4 :
子_st_2 = "错误代码:4交易服务器繁忙" ;
break;
case 5 :
子_st_2 = "错误代码:5客户终端旧版本" ;
break;
case 6 :
子_st_2 = "错误代码:6没有连接服务器" ;
break;
case 7 :
子_st_2 = "错误代码:7没有权限" ;
break;
case 8 :
子_st_2 = "错误代码:8请求过于频繁" ;
break;
case 9 :
子_st_2 = "错误代码:9交易运行故障" ;
break;
case 64 :
子_st_2 = "错误代码:64账户禁止" ;
break;
case 65 :
子_st_2 = "错误代码:65无效账户" ;
break;
case 128 :
子_st_2 = "错误代码:128交易超时" ;
break;
case 129 :
子_st_2 = "错误代码:129无效价格" ;
break;
case 130 :
子_st_2 = "错误代码:130无效停止" ;
break;
case 131 :
子_st_2 = "错误代码:131无效交易量" ;
break;
case 132 :
子_st_2 = "错误代码:132市场关闭" ;
break;
case 133 :
子_st_2 = "错误代码:133交易被禁止" ;
break;
case 134 :
子_st_2 = "错误代码:134资金不足" ;
break;
case 135 :
子_st_2 = "错误代码:135价格改变" ;
break;
case 136 :
子_st_2 = "错误代码:136开价" ;
break;
case 137 :
子_st_2 = "错误代码:137经纪繁忙" ;
break;
case 138 :
子_st_2 = "错误代码:138重新开价" ;
break;
case 139 :
子_st_2 = "错误代码:139定单被锁定" ;
break;
case 140 :
子_st_2 = "错误代码:140只允许看涨仓位" ;
break;
case 141 :
子_st_2 = "错误代码:141过多请求" ;
break;
case 145 :
子_st_2 = "错误代码:145因为过于接近市场,修改否定" ;
break;
case 146 :
子_st_2 = "错误代码:146交易文本已满" ;
break;
case 147 :
子_st_2 = "错误代码:147时间周期被经纪否定" ;
break;
case 148 :
子_st_2 = "错误代码:148开单和挂单总数已被经纪限定" ;
break;
case 149 :
子_st_2 = "错误代码:149当对冲备拒绝时,打开相对于现有的一个单置" ;
break;
case 150 :
子_st_2 = "错误代码:150把为反FIFO规定的单子平掉" ;
break;
case 4000 :
子_st_2 = "错误代码:4000没有错误" ;
break;
case 4001 :
子_st_2 = "错误代码:4001错误函数指示" ;
break;
case 4002 :
子_st_2 = "错误代码:4002数组索引超出范围" ;
break;
case 4003 :
子_st_2 = "错误代码:4003对于调用堆栈储存器函数没有足够内存" ;
break;
case 4004 :
子_st_2 = "错误代码:4004循环堆栈储存器溢出" ;
break;
case 4005 :
子_st_2 = "错误代码:4005对于堆栈储存器参量没有内存" ;
break;
case 4006 :
子_st_2 = "错误代码:4006对于字行参量没有足够内存" ;
break;
case 4007 :
子_st_2 = "错误代码:4007对于字行没有足够内存" ;
break;
case 4008 :
子_st_2 = "错误代码:4008没有初始字行" ;
break;
case 4009 :
子_st_2 = "错误代码:4009在数组中没有初始字串符" ;
break;
case 4010 :
子_st_2 = "错误代码:4010对于数组没有内存" ;
break;
case 4011 :
子_st_2 = "错误代码:4011字行过长" ;
break;
case 4012 :
子_st_2 = "错误代码:4012余数划分为零" ;
break;
case 4013 :
子_st_2 = "错误代码:4013零划分" ;
break;
case 4014 :
子_st_2 = "错误代码:4014不明命令" ;
break;
case 4015 :
子_st_2 = "错误代码:4015错误转换(没有常规错误)" ;
break;
case 4016 :
子_st_2 = "错误代码:4016没有初始数组" ;
break;
case 4017 :
子_st_2 = "错误代码:4017禁止调用DLL " ;
break;
case 4018 :
子_st_2 = "错误代码:4018数据库不能下载" ;
break;
case 4019 :
子_st_2 = "错误代码:4019不能调用函数" ;
break;
case 4020 :
子_st_2 = "错误代码:4020禁止调用智能交易函数" ;
break;
case 4021 :
子_st_2 = "错误代码:4021对于来自函数的字行没有足够内存" ;
break;
case 4022 :
子_st_2 = "错误代码:4022系统繁忙 (没有常规错误)" ;
break;
case 4050 :
子_st_2 = "错误代码:4050无效计数参量函数" ;
break;
case 4051 :
子_st_2 = "错误代码:4051无效参量值函数" ;
break;
case 4052 :
子_st_2 = "错误代码:4052字行函数内部错误" ;
break;
case 4053 :
子_st_2 = "错误代码:4053一些数组错误" ;
break;
case 4054 :
子_st_2 = "错误代码:4054应用不正确数组" ;
break;
case 4055 :
子_st_2 = "错误代码:4055自定义指标错误" ;
break;
case 4056 :
子_st_2 = "错误代码:4056不协调数组" ;
break;
case 4057 :
子_st_2 = "错误代码:4057整体变量过程错误" ;
break;
case 4058 :
子_st_2 = "错误代码:4058整体变量未找到" ;
break;
case 4059 :
子_st_2 = "错误代码:4059测试模式函数禁止" ;
break;
case 4060 :
子_st_2 = "错误代码:4060没有确认函数" ;
break;
case 4061 :
子_st_2 = "错误代码:4061发送邮件错误" ;
break;
case 4062 :
子_st_2 = "错误代码:4062字行预计参量" ;
break;
case 4063 :
子_st_2 = "错误代码:4063整数预计参量" ;
break;
case 4064 :
子_st_2 = "错误代码:4064双预计参量" ;
break;
case 4065 :
子_st_2 = "错误代码:4065数组作为预计参量" ;
break;
case 4066 :
子_st_2 = "错误代码:4066刷新状态请求历史数据" ;
break;
case 4067 :
子_st_2 = "错误代码:4067交易函数错误" ;
break;
case 4099 :
子_st_2 = "错误代码:4099文件结束" ;
break;
case 4100 :
子_st_2 = "错误代码:4100一些文件错误" ;
break;
case 4101 :
子_st_2 = "错误代码:4101错误文件名称" ;
break;
case 4102 :
子_st_2 = "错误代码:4102打开文件过多" ;
break;
case 4103 :
子_st_2 = "错误代码:4103不能打开文件" ;
break;
case 4104 :
子_st_2 = "错误代码:4104不协调文件" ;
break;
case 4105 :
子_st_2 = "错误代码:4105没有选择定单" ;
break;
case 4106 :
子_st_2 = "错误代码:4106不明货币对" ;
break;
case 4107 :
子_st_2 = "错误代码:4107无效价格" ;
break;
case 4108 :
子_st_2 = "错误代码:4108无效定单编码" ;
break;
case 4109 :
子_st_2 = "错误代码:4109不允许交易" ;
break;
case 4110 :
子_st_2 = "错误代码:4110不允许长期" ;
break;
case 4111 :
子_st_2 = "错误代码:4111不允许短期" ;
break;
case 4200 :
子_st_2 = "错误代码:4200定单已经存在" ;
break;
case 4201 :
子_st_2 = "错误代码:4201不明定单属性" ;
break;
case 4203 :
子_st_2 = "错误代码:4203不明定单类型" ;
break;
case 4204 :
子_st_2 = "错误代码:4204没有定单名称" ;
break;
case 4205 :
子_st_2 = "错误代码:4205定单坐标错误" ;
break;
case 4206 :
子_st_2 = "错误代码:4206没有指定子窗口" ;
break;
case 4207 :
子_st_2 = "错误代码:4207定单一些函数错误" ;
break;
case 4250 :
子_st_2 = "错误代码:4250错误设定发送通知到队列中" ;
break;
case 4251 :
子_st_2 = "错误代码:4251无效参量- 空字符串传递到SendNotification()函数" ;
break;
case 4252 :
子_st_2 = "错误代码:4252无效设置发送通知(未指定ID或未启用通知)" ;
break;
case 4253 :
子_st_2 = "错误代码:4253通知发送过于频繁" ;
}}
if ( 子_in_1 == 0 ) return;
Print(子_st_2);
}
//报错组件
//--------------------- ----------------------------------------
void iDisplayInfo (string 木_0, string 木_1, int 木_2, int 木_3, int 木_4, int 木_5, string 木_6, color 木_7)
{
//----------------------------
ObjectCreate(木_0,OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSetText(木_0,木_1,木_5,木_6,木_7);
ObjectSet(木_0,OBJPROP_CORNER,木_2);
ObjectSet(木_0,OBJPROP_XDISTANCE,木_3);
ObjectSet(木_0,OBJPROP_YDISTANCE,木_4);
}
//iDisplayInfo
//--------------------- ----------------------------------------
void close (string 木_0, int 木_1)
{
int 子_in_1;
//----------------------------
for (子_in_1 = OrdersTotal() - 1 ; 子_in_1 >= 0 ; 子_in_1 = 子_in_1 - 1)
{
if ( OrderSelect(子_in_1,SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == 木_0 && OrderMagicNumber() == 魔术号 && OrderType() == 木_1 )
{
OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),10,Blue);
}
}
}
//close
//--------------------- ----------------------------------------
double 多倍数计算 ()
{
//----------------------------
if ( 总_bo_23 == true )
{
if ( 持仓数量 ( Current_Symbol,0) == 1 )
{
return(总_do_25);
}
if ( 持仓数量 ( Current_Symbol,0) == 2 )
{
return(总_do_26);
}
if ( 持仓数量 ( Current_Symbol,0) == 3 )
{
return(总_do_27);
}
if ( 持仓数量 ( Current_Symbol,0) == 4 )
{
return(总_do_28);
}
if ( 持仓数量 ( Current_Symbol,0) == 5 )
{
return(总_do_29);
}
if ( 持仓数量 ( Current_Symbol,0) == 6 )
{
return(总_do_30);
}
if ( 持仓数量 ( Current_Symbol,0) == 7 )
{
return(总_do_31);
}
if ( 持仓数量 ( Current_Symbol,0) == 8 )
{
return(总_do_32);
}
if ( 持仓数量 ( Current_Symbol,0) == 9 )
{
return(总_do_33);
}
if ( 持仓数量 ( Current_Symbol,0) == 10 )
{
return(总_do_34);
}
if ( 持仓数量 ( Current_Symbol,0) == 11 )
{
return(总_do_35);
}
if ( 持仓数量 ( Current_Symbol,0) == 12 )
{
return(总_do_36);
}
if ( 持仓数量 ( Current_Symbol,0) == 13 )
{
return(总_do_37);
}
if ( 持仓数量 ( Current_Symbol,0) == 14 )
{
return(总_do_38);
}
if ( 持仓数量 ( Current_Symbol,0) == 15 )
{
return(总_do_39);
}
if ( 持仓数量 ( Current_Symbol,0) == 16 )
{
return(总_do_40);
}
if ( 持仓数量 ( Current_Symbol,0) == 17 )
{
return(总_do_41);
}
if ( 持仓数量 ( Current_Symbol,0) == 18 )
{
return(总_do_42);
}
if ( 持仓数量 ( Current_Symbol,0) == 19 )
{
return(总_do_43);
}
if ( 持仓数量 ( Current_Symbol,0) == 20 )
{
return(总_do_44);
}
if ( 持仓数量 ( Current_Symbol,0) == 21 )
{
return(总_do_45);
}
if ( 持仓数量 ( Current_Symbol,0) == 22 )
{
return(总_do_46);
}
if ( 持仓数量 ( Current_Symbol,0) == 23 )
{
return(总_do_47);
}
if ( 持仓数量 ( Current_Symbol,0) == 24 )
{
return(总_do_48);
}
if ( 持仓数量 ( Current_Symbol,0) == 25 )
{
return(总_do_49);
}
if ( 持仓数量 ( Current_Symbol,0) == 26 )
{
return(总_do_50);
}
if ( 持仓数量 ( Current_Symbol,0) == 27 )
{
return(总_do_51);
}
if ( 持仓数量 ( Current_Symbol,0) == 28 )
{
return(总_do_52);
}
if ( 持仓数量 ( Current_Symbol,0) == 29 )
{
return(总_do_53);
}
if ( 持仓数量 ( Current_Symbol,0) == 30 )
{
return(总_do_54);
}
if ( 持仓数量 ( Current_Symbol,0) == 31 )
{
return(总_do_55);
}
if ( 持仓数量 ( Current_Symbol,0) == 32 )
{
return(总_do_56);
}
if ( 持仓数量 ( Current_Symbol,0) == 33 )
{
return(总_do_57);
}
if ( 持仓数量 ( Current_Symbol,0) == 34 )
{
return(总_do_58);
}
if ( 持仓数量 ( Current_Symbol,0) == 35 )
{
return(总_do_59);
}
if ( 持仓数量 ( Current_Symbol,0) == 36 )
{
return(总_do_60);
}
if ( 持仓数量 ( Current_Symbol,0) == 37 )
{
return(总_do_61);
}
if ( 持仓数量 ( Current_Symbol,0) == 38 )
{
return(总_do_62);
}
if ( 持仓数量 ( Current_Symbol,0) == 39 )
{
return(总_do_63);
}
if ( 持仓数量 ( Current_Symbol,0) == 40 )
{
return(总_do_64);
}
if ( 持仓数量 ( Current_Symbol,0) == 41 )
{
return(总_do_65);
}
if ( 持仓数量 ( Current_Symbol,0) == 42 )
{
return(总_do_66);
}
if ( 持仓数量 ( Current_Symbol,0) == 43 )
{
return(总_do_67);
}
if ( 持仓数量 ( Current_Symbol,0) == 44 )
{
return(总_do_68);
}
if ( 持仓数量 ( Current_Symbol,0) == 45 )
{
return(总_do_69);
}
if ( 持仓数量 ( Current_Symbol,0) == 46 )
{
return(总_do_70);
}
if ( 持仓数量 ( Current_Symbol,0) == 47 )
{
return(总_do_71);
}
if ( 持仓数量 ( Current_Symbol,0) == 48 )
{
return(总_do_72);
}
if ( 持仓数量 ( Current_Symbol,0) == 49 )
{
return(总_do_73);
}
if ( 持仓数量 ( Current_Symbol,0) == 50 )
{
return(总_do_74);
}}
else
{
return(0.0);
}
return(0.0);
}
//多倍数计算
//--------------------- ----------------------------------------
double 空倍数计算 ()
{
//----------------------------
if ( 总_bo_23 == true )
{
if ( 持仓数量 ( Current_Symbol,1) == 1 )
{
return(总_do_25);
}
if ( 持仓数量 ( Current_Symbol,1) == 2 )
{
return(总_do_26);
}
if ( 持仓数量 ( Current_Symbol,1) == 3 )
{
return(总_do_27);
}
if ( 持仓数量 ( Current_Symbol,1) == 4 )
{
return(总_do_28);
}
if ( 持仓数量 ( Current_Symbol,1) == 5 )
{
return(总_do_29);
}
if ( 持仓数量 ( Current_Symbol,1) == 6 )
{
return(总_do_30);
}
if ( 持仓数量 ( Current_Symbol,1) == 7 )
{
return(总_do_31);
}
if ( 持仓数量 ( Current_Symbol,1) == 8 )
{
return(总_do_32);
}
if ( 持仓数量 ( Current_Symbol,1) == 9 )
{
return(总_do_33);
}
if ( 持仓数量 ( Current_Symbol,1) == 10 )
{
return(总_do_34);
}
if ( 持仓数量 ( Current_Symbol,1) == 11 )
{
return(总_do_35);
}
if ( 持仓数量 ( Current_Symbol,1) == 12 )
{
return(总_do_36);
}
if ( 持仓数量 ( Current_Symbol,1) == 13 )
{
return(总_do_37);
}
if ( 持仓数量 ( Current_Symbol,1) == 14 )
{
return(总_do_38);
}
if ( 持仓数量 ( Current_Symbol,1) == 15 )
{
return(总_do_39);
}
if ( 持仓数量 ( Current_Symbol,1) == 16 )
{
return(总_do_40);
}
if ( 持仓数量 ( Current_Symbol,1) == 17 )
{
return(总_do_41);
}
if ( 持仓数量 ( Current_Symbol,1) == 18 )
{
return(总_do_42);
}
if ( 持仓数量 ( Current_Symbol,1) == 19 )
{
return(总_do_43);
}
if ( 持仓数量 ( Current_Symbol,1) == 20 )
{
return(总_do_44);
}
if ( 持仓数量 ( Current_Symbol,1) == 21 )
{
return(总_do_45);
}
if ( 持仓数量 ( Current_Symbol,1) == 22 )
{
return(总_do_46);
}
if ( 持仓数量 ( Current_Symbol,1) == 23 )
{
return(总_do_47);
}
if ( 持仓数量 ( Current_Symbol,1) == 24 )
{
return(总_do_48);
}
if ( 持仓数量 ( Current_Symbol,1) == 25 )
{
return(总_do_49);
}
if ( 持仓数量 ( Current_Symbol,1) == 26 )
{
return(总_do_50);
}
if ( 持仓数量 ( Current_Symbol,1) == 27 )
{
return(总_do_51);
}
if ( 持仓数量 ( Current_Symbol,1) == 28 )
{
return(总_do_52);
}
if ( 持仓数量 ( Current_Symbol,1) == 29 )
{
return(总_do_53);
}
if ( 持仓数量 ( Current_Symbol,1) == 30 )
{
return(总_do_54);
}
if ( 持仓数量 ( Current_Symbol,1) == 31 )
{
return(总_do_55);
}
if ( 持仓数量 ( Current_Symbol,1) == 32 )
{
return(总_do_56);
}
if ( 持仓数量 ( Current_Symbol,1) == 33 )
{
return(总_do_57);
}
if ( 持仓数量 ( Current_Symbol,1) == 34 )
{
return(总_do_58);
}
if ( 持仓数量 ( Current_Symbol,1) == 35 )
{
return(总_do_59);
}
if ( 持仓数量 ( Current_Symbol,1) == 36 )
{
return(总_do_60);
}
if ( 持仓数量 ( Current_Symbol,1) == 37 )
{
return(总_do_61);
}
if ( 持仓数量 ( Current_Symbol,1) == 38 )
{
return(总_do_62);
}
if ( 持仓数量 ( Current_Symbol,1) == 39 )
{
return(总_do_63);
}
if ( 持仓数量 ( Current_Symbol,1) == 40 )
{
return(总_do_64);
}
if ( 持仓数量 ( Current_Symbol,1) == 41 )
{
return(总_do_65);
}
if ( 持仓数量 ( Current_Symbol,1) == 42 )
{
return(总_do_66);
}
if ( 持仓数量 ( Current_Symbol,1) == 43 )
{
return(总_do_67);
}
if ( 持仓数量 ( Current_Symbol,1) == 44 )
{
return(总_do_68);
}
if ( 持仓数量 ( Current_Symbol,1) == 45 )
{
return(总_do_69);
}
if ( 持仓数量 ( Current_Symbol,1) == 46 )
{
return(总_do_70);
}
if ( 持仓数量 ( Current_Symbol,1) == 47 )
{
return(总_do_71);
}
if ( 持仓数量 ( Current_Symbol,1) == 48 )
{
return(总_do_72);
}
if ( 持仓数量 ( Current_Symbol,1) == 49 )
{
return(总_do_73);
}
if ( 持仓数量 ( Current_Symbol,1) == 50 )
{
return(总_do_74);
}}
else
{
return(0.0);
}
return(0.0);
}
//空倍数计算
//--------------------- ----------------------------------------
double 布林间隔 (string 木_0, int 木_1)
{
double 子_do_1;
double 子_do_2;
double 子_do_3;
//----------------------------
子_do_1 = iBands(木_0,总_in_10,总_in_11,总_do_13,总_in_12,总_in_14,1,木_1) ;
子_do_2 = iBands(木_0,总_in_10,总_in_11,总_do_13,总_in_12,总_in_14,2,木_1) ;
子_do_3 = (子_do_1 - 子_do_2) / MarketInfo(木_0,11) ;
return(子_do_3);
}
//布林间隔
//--------------------- ----------------------------------------
double MA1 (string 木_0, int 木_1)
{
double 子_do_1;
//----------------------------
子_do_1 = iMA(木_0,总_in_20,总_in_18,0,MODE_EMA,PRICE_CLOSE,木_1) ;
return(子_do_1);
}
//MA1
//--------------------- ----------------------------------------
double MA2 (string 木_0, int 木_1)
{
double 子_do_1;
//----------------------------
子_do_1 = iMA(木_0,总_in_20,总_in_19,0,MODE_EMA,PRICE_CLOSE,木_1) ;
return(子_do_1);
}
//MA2
//--------------------- ----------------------------------------
double 止盈MA1 (string 木_0, int 木_1)
{
double 子_do_1;
//----------------------------
子_do_1 = iMA(木_0,总_in_100,总_in_98,0,MODE_EMA,PRICE_CLOSE,木_1) ;
return(子_do_1);
}
//止盈MA1
//--------------------- ----------------------------------------
double 止盈MA2 (string 木_0, int 木_1)
{
double 子_do_1;
//----------------------------
子_do_1 = iMA(木_0,总_in_100,总_in_99,0,MODE_EMA,PRICE_CLOSE,木_1) ;
return(子_do_1);
}
//止盈MA2
//--------------------- ----------------------------------------
bool 均线开多 ()
{
//----------------------------
if ( MA1 ( Current_Symbol,0)>MA2 ( Current_Symbol,0) )
{
return(true);
}
return(false);
}
//均线开多
//--------------------- ----------------------------------------
bool 均线开空 ()
{
//----------------------------
if ( MA1 ( Current_Symbol,0)<MA2 ( Current_Symbol,0) )
{
return(true);
}
return(false);
}
//均线开空
//--------------------- ----------------------------------------
double K1 (string 木_0, int 木_1)
{
double 子_do_1;
//----------------------------
子_do_1 = iMA(木_0,总_in_109,1,0,MODE_EMA,PRICE_CLOSE,木_1) ;
return(子_do_1);
}
//K1
//--------------------- ----------------------------------------
double K2 (string 木_0, int 木_1)
{
double 子_do_1;
//----------------------------
子_do_1 = iMA(木_0,总_in_109,1,0,MODE_EMA,PRICE_OPEN,木_1) ;
return(子_do_1);
}
//K2
//--------------------- ----------------------------------------
bool K线开多 ()
{
//----------------------------
if ( K1 ( Current_Symbol,1)>K2 ( Current_Symbol,1) && K1 ( Current_Symbol,1) - K2 ( Current_Symbol,1)>=总_do_108 * MarketInfo(Current_Symbol,11) )
{
return(true);
}
return(false);
}
//K线开多
//--------------------- ----------------------------------------
bool K线开空 ()
{
//----------------------------
if ( K1 ( Current_Symbol,1)<K2 ( Current_Symbol,1) && K2 ( Current_Symbol,1) - K1 ( Current_Symbol,1)>=总_do_108 * MarketInfo(Current_Symbol,11) )
{
return(true);
}
return(false);
}
//K线开空
//--------------------- ----------------------------------------
double MA0 (string 木_0, int 木_1)
{
double 子_do_1;
//----------------------------
子_do_1 = iMA(木_0,总_in_20,总_in_104,0,MODE_EMA,PRICE_CLOSE,木_1) ;
return(子_do_1);
}
//MA0
//--------------------- ----------------------------------------
double 通道MA (string 木_0, int 木_1)
{
double 子_do_1;
//----------------------------
子_do_1 = iMA(木_0,总_in_6,总_in_5,0,MODE_EMA,PRICE_CLOSE,木_1) ;
return(子_do_1);
}
//通道MA
//--------------------- ----------------------------------------
bool 通道开多 ()
{
//----------------------------
if ( MarketInfo(Current_Symbol,10)<通道MA ( Current_Symbol,0) - 总_in_7 * MarketInfo(Current_Symbol,11) )
{
return(true);
}
return(false);
}
//通道开多
//--------------------- ----------------------------------------
bool 通道开空 ()
{
//----------------------------
if ( MarketInfo(Current_Symbol,10)>总_in_7 * MarketInfo(Current_Symbol,11) + 通道MA ( Current_Symbol,0) )
{
return(true);
}
return(false);
}
//通道开空
//--------------------- ----------------------------------------
bool 通道顺势开空 ()
{
//----------------------------
if ( MA0 ( Current_Symbol,0)<通道MA ( Current_Symbol,0) - 总_in_103 * MarketInfo(Current_Symbol,11) )
{
return(true);
}
return(false);
}
//通道顺势开空
//--------------------- ----------------------------------------
bool 通道顺势开多 ()
{
//----------------------------
if ( MA0 ( Current_Symbol,0)>总_in_103 * MarketInfo(Current_Symbol,11) + 通道MA ( Current_Symbol,0) )
{
return(true);
}
return(false);
}
//通道顺势开多
//--------------------- ----------------------------------------
double RSI指标 (string 木_0, int 木_1)
{
double 子_do_1;
//----------------------------
子_do_1 = iRSI(木_0,总_in_1,总_in_2,0,木_1) ;
return(子_do_1);
}
//RSI指标
//--------------------- ----------------------------------------
bool RSI开多 ()
{
//----------------------------
if ( RSI指标 ( Current_Symbol,0)<总_in_3 )
{
return(true);
}
return(false);
}
//RSI开多
//--------------------- ----------------------------------------
bool RSI开空 ()
{
//----------------------------
if ( RSI指标 ( Current_Symbol,0)>总_in_4 )
{
return(true);
}
return(false);
}
//RSI开空
//--------------------- ----------------------------------------
void ButtonCreate (string 木_0, string 木_1, string 木_2, int 木_3, int 木_4, int 木_5, int 木_6, int 木_7, color 木_8, color 木_9)
{
//----------------------------
if ( ObjectFind(0,木_0) == -1 )
{
ObjectCreate(0,木_0,OBJ_BUTTON,0,0,0.0);
ObjectSetInteger(0,木_0,OBJPROP_XDISTANCE,木_3);
ObjectSetInteger(0,木_0,OBJPROP_YDISTANCE,木_4);
ObjectSetInteger(0,木_0,OBJPROP_XSIZE,木_5);
ObjectSetInteger(0,木_0,OBJPROP_YSIZE,木_6);
ObjectSetInteger(0,木_0,OBJPROP_CORNER,木_7);
ObjectSetString(0,木_0,OBJPROP_FONT,"微软雅黑");
ObjectSetInteger(0,木_0,OBJPROP_FONTSIZE,11);
ObjectSetInteger(0,木_0,OBJPROP_BORDER_COLOR,65535);
}
if ( ObjectGetInteger(0,木_0,1018,0) == 1 )
{
ObjectSetInteger(0,木_0,OBJPROP_COLOR,木_8);
ObjectSetInteger(0,木_0,OBJPROP_BGCOLOR,木_9);
ObjectSetString(0,木_0,OBJPROP_TEXT,木_2);
return;
}
ObjectSetInteger(0,木_0,OBJPROP_COLOR,木_9);
ObjectSetInteger(0,木_0,OBJPROP_BGCOLOR,木_8);
ObjectSetString(0,木_0,OBJPROP_TEXT,木_1);
}
//ButtonCreate
//--------------------- ----------------------------------------
bool 止盈开多 ()
{
//----------------------------
if ( 最新出场单止盈 ( Current_Symbol) && 最新出场单类型 ( Current_Symbol) == 1 && 持仓数量 ( Current_Symbol,0) == 0 )
{
return(true);
}
return(false);
}
//止盈开多
//--------------------- ----------------------------------------
bool 止盈开空 ()
{
//----------------------------
if ( 最新出场单止盈 ( Current_Symbol) && 最新出场单类型 ( Current_Symbol) == 0 && 持仓数量 ( Current_Symbol,1) == 0 )
{
return(true);
}
return(false);
}
//止盈开空
//--------------------- ----------------------------------------
bool 最新出场单止盈 (string 木_0)
{
int 子_in_1;
//----------------------------
for (子_in_1 = OrdersHistoryTotal() - 1 ; 子_in_1 >= 0 ; 子_in_1 = 子_in_1 - 1)
{
if ( OrderSelect(子_in_1,SELECT_BY_POS,MODE_HISTORY) && OrderSymbol() == 木_0 && OrderCloseTime() >= 总_da_125 && OrderMagicNumber() == 魔术号 )
{
if ( StringFind(OrderComment(),"tp",0) != -1 )
{
return(true);
}
return(false);
}
}
return(false);
}
//最新出场单止盈
//--------------------- ----------------------------------------
int 最新出场单类型 (string 木_0)
{
int 子_in_1;
//----------------------------
for (子_in_1 = OrdersHistoryTotal() - 1 ; 子_in_1 >= 0 ; 子_in_1 = 子_in_1 - 1)
{
if ( OrderSelect(子_in_1,SELECT_BY_POS,MODE_HISTORY) && OrderSymbol() == 木_0 && OrderCloseTime() >= 总_da_125 && OrderMagicNumber() == 魔术号 )
{
return(OrderType());
}
}
return(888);
}
//最新出场单类型
//--------------------- ----------------------------------------
datetime 最新持仓单开仓时间 ()
{
int 子_in_1;
//----------------------------
for (子_in_1 = OrdersTotal() - 1 ; 子_in_1 >= 0 ; 子_in_1 = 子_in_1 - 1)
{
if ( OrderSelect(子_in_1,SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == Current_Symbol && OrderMagicNumber() == 魔术号 )
{
return(OrderOpenTime());
}
}
return(0);
}
//最新持仓单开仓时间
//--------------------- ----------------------------------------
bool 时间限制 ()
{
//----------------------------
if ( 是否启用时间控制 && 开仓时间() == false )
{
return(false);
}
return(true);
}
//时间限制
//--------------------- ----------------------------------------
bool 加仓时间间隔限制 ()
{
//----------------------------
if ( 总_bo_75 && TimeCurrent() - 最新持仓单开仓时间 ( Current_Symbol) < 开仓间隔秒数 )
{
return(false);
}
return(true);
}
//加仓时间间隔限制
//--------------------- ----------------------------------------
bool 开仓时间 ()
{
//----------------------------
if ( 时间选择 == 1 && StringToTime(TimeToString(TimeCurrent(),TIME_DATE) + " " + 时间段始) < StringToTime(TimeToString(TimeCurrent(),TIME_DATE) + " " + 时间段终) && TimeCurrent() >= StringToTime(TimeToString(TimeCurrent(),TIME_DATE) + " " + 时间段始) && TimeCurrent() < StringToTime(TimeToString(TimeCurrent(),TIME_DATE) + " " + 时间段终) )
{
return(true);
}
if ( 时间选择 == 1 && StringToTime(TimeToString(TimeCurrent(),TIME_DATE) + " " + 时间段始) > StringToTime(TimeToString(TimeCurrent(),TIME_DATE) + " " + 时间段终) && ( TimeCurrent() >= StringToTime(TimeToString(TimeCurrent(),TIME_DATE) + " " + 时间段始) || TimeCurrent() < StringToTime(TimeToString(TimeCurrent(),TIME_DATE) + " " + 时间段终) ) )
{
return(true);
}
if ( 时间选择 == 2 && StringToTime(TimeToString(TimeLocal(),TIME_DATE) + " " + 时间段始) < StringToTime(TimeToString(TimeLocal(),TIME_DATE) + " " + 时间段终) && TimeLocal() >= StringToTime(TimeToString(TimeLocal(),TIME_DATE) + " " + 时间段始) && TimeLocal() < StringToTime(TimeToString(TimeLocal(),TIME_DATE) + " " + 时间段终) )
{
return(true);
}
if ( 时间选择 == 2 && StringToTime(TimeToString(TimeLocal(),TIME_DATE) + " " + 时间段始) > StringToTime(TimeToString(TimeLocal(),TIME_DATE) + " " + 时间段终) && ( TimeLocal() >= StringToTime(TimeToString(TimeLocal(),TIME_DATE) + " " + 时间段始) || TimeLocal() < StringToTime(TimeToString(TimeLocal(),TIME_DATE) + " " + 时间段终) ) )
{
return(true);
}
return(false);
}
//开仓时间
//--------------------- ----------------------------------------
bool Open_Symbol (string 木_0, int 木_1)
{
bool 子_bo_1;
int 子_in_2;
string 子_st_3[];
int 子_in_4;
int 子_in_5;
//----------------------------
bool 临_bo_9;
if ( ( 木_0 == "" || 木_0 == " " ) )
{
return(false);
}
子_in_2 = OrdersTotal() ;
ArrayResize(子_st_3,开启货币品种数量限制,0);
子_in_4 = 0 ;
for (子_in_5 = 子_in_2 - 1 ; 子_in_5 >= 0 ; 子_in_5 = 子_in_5 - 1)
{
if ( OrderSelect(子_in_5,SELECT_BY_POS,MODE_TRADES) && ( OrderMagicNumber() == 木_1 || 木_1 == -1 ) && is_sym ( OrderSymbol(),子_st_3) == false )
{
子_st_3[子_in_4] = OrderSymbol();
子_in_4 = 子_in_4 + 1;
if ( 子_in_4 == 开启货币品种数量限制 ) break;
}
}
临_bo_9 = is_sym ( 木_0,子_st_3);
子_bo_1 = is_sym ( 木_0,子_st_3) || 子_st_3[开启货币品种数量限制 - 1]==0 || OrdersTotal()==0 ;
return(子_bo_1);
}
//Open_Symbol
//--------------------- ----------------------------------------
bool is_sym (string 木_0, string &木_1[])
{
bool 子_bo_1;
int 子_in_2;
int 子_in_3;
//----------------------------
子_in_2 = ArraySize(木_1) ;
for (子_in_3 = 0 ; 子_in_3 < 子_in_2 ; 子_in_3 = 子_in_3 + 1)
{
if ( 木_0 == 木_1[子_in_3] )
{
子_bo_1 = true ;
break;
}
}
return(子_bo_1);
}
//is_sym
//--------------------- ----------------------------------------
double CountOrdersLots ()
{
int 子_in_1;
double 子_do_2;
int 子_in_3;
//----------------------------
子_in_1 = OrdersHistoryTotal() ;
子_do_2 = 0.0 ;
for (子_in_3 = 子_in_1 - 1 ; 子_in_3 >= 0 ; 子_in_3 = 子_in_3 - 1)
{
if ( OrderSelect(子_in_3,SELECT_BY_POS,MODE_HISTORY) == false )
{
Print("Error in history!");
break;
}
if ( OrderSymbol() == Symbol() && OrderType() <= 1 )
{
子_do_2 = 子_do_2 + OrderLots() ;
}
}
return(子_do_2);
}
//CountOrdersLots
//--------------------- ----------------------------------------
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。