2 Star 5 Fork 4

航耍耍/mql4

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
.大摩跟投终极武器-27货币版源码-加货币选择(1).mq4 138.21 KB
一键复制 编辑 原始数据 按行查看 历史
航耍耍 提交于 2021-11-09 08:24 . 123123123123
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651
//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
//--------------------- ----------------------------------------
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/hangyejiadao_581/mql4.git
git@gitee.com:hangyejiadao_581/mql4.git
hangyejiadao_581
mql4
mql4
master

搜索帮助