2 Star 5 Fork 4

航耍耍/mql4

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
神猴刷单EA (1) (1).mq4 43.76 KB
一键复制 编辑 原始数据 按行查看 历史
航耍耍 提交于 2021-11-09 08:24 . 123123123123
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634

int 帐号限制 = 0;//只修改等号右边的数字 标点符号不要动 0=不限制帐号
datetime 时间限制 = D'2030.12.9';
string 作者QQ = "000";
extern string 加载货币M15 = "AUDUSD NZDUSD GBPUSD USDJPY EURGBP GBPJPY AUDJPY CHFJPY";
enum BuyOrSell0 {只做多 = 0,只做空 = 1,多空都做 = 2};
input BuyOrSell0 多空方向 = 2;
extern bool 显示图表信息 = false;//在图表上显示持仓订单信息
extern bool 显示止盈价格 = true;//在订单上显示止盈价格
extern bool 启用虚拟下单 = false;//前几单可以不直接下在持仓订单里
extern int 显示浮亏单数 = 7;//达到设定单数开始记录此轮加码最大浮亏金额并且显示在图表上
extern int 虚拟下单单数 = 10;//第一单开始多少单以内虚拟下单
extern int 单向最大单数 = 15;
extern double 单笔最大下单量 = 5;
extern string 下单量参数说明0 = "按1000本金下0.0005起步,内部自动启用";
extern string 下单量参数说明1 = "虚拟下单注意中途不能重启平台或者重";
extern string 下单量参数说明2 = "新加载EA或者切换图表周期,否则需要平";
extern string 下单量参数说明3 = "仓所有定单再重新加载EA才能正常运行";
extern double 起始下单量 = 0.005;//小资金可设置低于平台最小下单量,比如1000本金下0.0005起步,内部自动启用虚拟下单
extern double 翻倍 = 1.6;
extern int 七单以下间隔点数 = 20;
extern int 七单以上间隔点数 = 30;
extern int 总体盈利点数 = 10;
extern double 总亏损平仓 = 0.0;//当前货币当前EA下的单子总亏损金额平仓
extern double 总盈利平仓 = 0.0;
extern int 滑点 = 3;
extern int 定单识别码 = 10533;
extern string 定单注释 = "Norns";
int Gi_144 = 0;
int Gi_148 = 0;
double G_order_open_price_150;
double G_order_open_price_158;
double Gd_168;
double Gd_176;
double Gd_184;
double Gd_192;
double Gd_200;
double Gd_208;
double Gd_216;
double Gd_217;
double Gd_218;
double Gd_219;
double G_price_232;
bool Gi_256;
bool TrackZoer0 = true;
bool TrackZoer1 = true;
bool TrackZoerXuNi0;
bool TrackZoerXuNi1;
int G_pos_260;
int G_ticket_264;
int Gi_260;
int Gi_261;
int Gi_268;
int Gi_269;
int Gi_272;
int Time0 = 1;
int Gi_276 = 1;
int Gi_280;
double Gd_284;
double G_lots_290 = 0.02;
double G_lots_292 = 0.02;
double Gd_300 = 1.5;
int Gi_306 = 7;
int Gi_307 = 4;
int Gi_308 = 20;
int Gi_310 = 7;
int Gi_311 = 7;
int Gi_312 = 7;
bool Gi_315;
double Gi_316 = 2;
double NewOpenPrice;
double STOPLEVEL;
double Gd_320 = 0.0;
double Gd_328 = 0.0;
int Day0 = -1;
int Gi_336 = 3;
int G_magic_340 = 10533;
string G_comment_300 = "";
string G_comment_344 = "";
string Gsa_720[14];
bool Use_Msg;
bool BoolClose;
int l_pod_110;
double LotsAll;
double Lots0;
double LotsC0;
double MinLot;
double MaxLot;
double Gd_720[30];
double Gd_730[30];
double Gd_721[30];
double Gd_731[30];
int Gi_720 = 0;
int Gi_721 = 0;
int Gi_309 = 0;
bool TrackXuNi;
int Gi_323 = 0;
int Gi_324 = 0;
int init() {
ArrayInitialize(Gd_720,0);
ArrayInitialize(Gd_721,0);
ArrayInitialize(Gd_730,0);
ArrayInitialize(Gd_731,0);
TrackXuNi = 启用虚拟下单;
Gi_269 = 多空方向;
Use_Msg = 显示图表信息;
G_lots_290 = 单笔最大下单量;
G_lots_292 = 起始下单量;
Gd_300 = 翻倍;
Gi_306 = 显示浮亏单数;
Gi_309 = 虚拟下单单数;
Gi_308 = 单向最大单数;
Gi_311 = 七单以下间隔点数;
Gi_312 = 七单以上间隔点数;
Gi_316 = 总体盈利点数;
Gi_315 = 显示止盈价格;
Gd_320 = 总亏损平仓;
Gd_328 = 总盈利平仓;
Gi_336 = 滑点;
G_magic_340 = 定单识别码;
G_comment_344 = 定单注释;
if(StringFind(G_comment_344,"_",0) >= 0) {
Alert("禁止注释带_符号");
ExpertRemove();
return(0);
}
G_comment_344 = G_comment_344 + "_";
Gd_284 = MathPow(0.1, Digits);
if (Digits == 5 || Digits == 3) Gi_276 = 10;
if (StringFind(Symbol(), "XAU", 0) >= 0 || StringFind(Symbol(), "GOLD", 0) >= 0) {
if (Digits == 2) Gi_276 = 10;
if (Digits == 3) Gi_276 = 100;
}
STOPLEVEL = MarketInfo(Symbol(),MODE_STOPLEVEL);
MinLot = MarketInfo(Symbol(),MODE_MINLOT);
MaxLot = MarketInfo(Symbol(),MODE_MAXLOT);
Gi_280 = MathRound((-MathLog(MarketInfo(Symbol(), MODE_LOTSTEP))) / 2.302585093);
return (0);
}
int deinit() {
Comment("");
EventKillTimer();
if(!IsTesting()) ObjectsDeleteAll();
return (0);
}
int start() {
if(帐号限制 != 0 && AccountNumber() != 帐号限制) {
Alert("此帐号未注册,联系作者QQ:",作者QQ);//请不要在这块修改限制
ExpertRemove();
return(0);
}
if(TimeCurrent() > 时间限制) {//请不要在这块修改限制
Alert("使用时间过期,联系作者QQ:",作者QQ);
ExpertRemove();
return(0);
}
ButtonCreate("CCCCCC0","全部平仓","正在执行",70,25,65,20,CORNER_RIGHT_LOWER,clrGray,clrLime);
if(ObjectGetInteger(0,"CCCCCC0",OBJPROP_STATE)==1) {
CloseOrders(OP_BUY);
CloseOrders(OP_SELL);
ObjectSetInteger(0,"CCCCCC0",OBJPROP_STATE,0);
}
ButtonCreate("CCCCCC1","空单平仓","正在执行",70,50,65,20,CORNER_RIGHT_LOWER,clrGray,clrLime);
if(ObjectGetInteger(0,"CCCCCC1",OBJPROP_STATE)==1) {
CloseOrders(OP_SELL);
ObjectSetInteger(0,"CCCCCC1",OBJPROP_STATE,0);
}
ButtonCreate("CCCCCC2","多单平仓","正在执行",70,75,65,20,CORNER_RIGHT_LOWER,clrGray,clrLime);
if(ObjectGetInteger(0,"CCCCCC2",OBJPROP_STATE)==1) {
CloseOrders(OP_BUY);
ObjectSetInteger(0,"CCCCCC2",OBJPROP_STATE,0);
}
if(!IsTesting() && MathAbs(Day() - Day0) > 5) {
ObjectsDeleteAll();
Day0 = Day();
}
CountOrders();
if(Use_Msg) CommentMsg();
if(Gi_268 != Gi_144) {
Gi_144 = Gi_268;
if(Gi_315) O_Modify(0);
else {
if(Gi_268 > 0) ObjectCreat1("xxxxx1",Gd_168 + Gi_316 * Gi_276 * Gd_284,Blue);
else if(ObjectFind("xxxxx1") >= 0) ObjectDelete("xxxxx1");
}
}
if(Gi_272 != Gi_148) {
Gi_148 = Gi_272;
if(Gi_315) O_Modify(1);
else {
if (Gi_272 > 0) ObjectCreat1("xxxxx2",Gd_176 - Gi_316 * Gi_276 * Gd_284,Red);
else if(ObjectFind("xxxxx2") >= 0) ObjectDelete("xxxxx2");
}
}
BoolClose = false;
if ((Gd_328 > 0.0 && Gd_216 >= Gd_328) || (Gd_320 > 0.0 && Gd_216 <= (-Gd_320))) CloseOrders(OP_BUY);
if ((Gd_328 > 0.0 && Gd_218 >= Gd_328) || (Gd_320 > 0.0 && Gd_218 <= (-Gd_320))) CloseOrders(OP_SELL);
if (Gi_268 > 0 && Bid > Gd_168 + Gi_316 * Gi_276 * Gd_284) CloseOrders(OP_BUY);
if (Gi_272 > 0 && Ask < Gd_176 - Gi_316 * Gi_276 * Gd_284) CloseOrders(OP_SELL);
if (BoolClose) return(0);
if (Time0 != iTime(NULL, PERIOD_M1, 0)) {
Time0 = iTime(NULL, PERIOD_M1, 0);
if (Gi_268 == 0 && (Gi_269 == 0 || Gi_269 == 2)) {
if((TrackXuNi && Gi_720 < Gi_309) || G_lots_292 < MinLot) {
Gi_323++;
ObjectCreat3("xxxxxxx0" + IntegerToString(Gi_720),Ask,clrLime);
ObjectCreat4("xxxxxxx2" + IntegerToString(Gi_720),"#" + IntegerToString(Gi_720) + " buy " + DoubleToStr(G_lots_292,4),Time[0],2*Ask - Bid,clrWhite);
ShowArrow0(0,Gi_720);
Gd_720[Gi_720] = G_lots_292;
Gd_730[Gi_720] = Ask;
Gi_720++;
}
else G_ticket_264 = OrderSend(Symbol(), OP_BUY, G_lots_292, Ask, Gi_336 * Gi_276, 0, 0, G_comment_344 + DoubleToStr(Gi_268,0), G_magic_340, 0, Blue);
return(0);
}
if (Gi_272 == 0 && (Gi_269 == 1 || Gi_269 == 2)) {
if((TrackXuNi && Gi_721 < Gi_309) || G_lots_292 < MinLot) {
Gi_324++;
ObjectCreat3("xxxxxxx1" + IntegerToString(Gi_721),Bid,clrLime);
ObjectCreat4("xxxxxxx3" + IntegerToString(Gi_721),"#" + IntegerToString(Gi_721) + " sell " + DoubleToStr(G_lots_292,4),Time[0],Ask,clrWhite);
ShowArrow0(1,Gi_721);
Gd_721[Gi_721] = G_lots_292;
Gd_731[Gi_721] = Bid;
Gi_721++;
}
else G_ticket_264 = OrderSend(Symbol(), OP_SELL, G_lots_292, Bid, Gi_336 * Gi_276, 0, 0, G_comment_344 + DoubleToStr(Gi_272,0), G_magic_340, 0, Red);
return(0);
}
Gi_310 = GetGi_310(Gi_268);
if (Gi_268 > 0 && (Gi_269 == 0 || Gi_269 == 2) && iClose(NULL, PERIOD_M15, 1) >= iOpen(NULL, PERIOD_M15, 1) && Gi_268 < Gi_308 && G_order_open_price_150 - Ask >= Gi_310 * Gi_276 * Gd_284) {
LotsC0 = 0;
l_pod_110 = 0;
LotsAll = MathMin(G_lots_290,NormalizeDouble(G_lots_292 * MathPow(Gd_300, Gi_268), 4));
if((TrackXuNi && Gi_720 < Gi_309) || LotsAll < MinLot) {
Gi_323++;
ObjectCreat3("xxxxxxx0" + IntegerToString(Gi_720),Ask,clrLime);
ObjectCreat4("xxxxxxx2" + IntegerToString(Gi_720),"#" + IntegerToString(Gi_720) + " buy " + DoubleToStr(LotsAll,4),Time[0],2*Ask - Bid,clrWhite);
ShowArrow0(0,Gi_720);
Gd_720[Gi_720] = LotsAll;
Gd_730[Gi_720] = Ask;
Gi_720++;
}
else {
LotsAll = NormalizeDouble(LotsAll, Gi_280);
while(LotsC0 < LotsAll && l_pod_110 < 10) {
RefreshRates();
Lots0 = MathMin(LotsAll - LotsC0,MaxLot);
G_ticket_264 = OrderSend(Symbol(), OP_BUY, Lots0, Ask, Gi_336 * Gi_276, 0, 0, G_comment_344 + DoubleToStr(Gi_268,0), G_magic_340, 0, Blue);
if(G_ticket_264 >= 0) {
LotsC0 += Lots0;
}
else {
l_pod_110++;
Print("下单错误 = ",GetLastError());
}
}
}
return(0);
}
Gi_310 = GetGi_310(Gi_272);
if (Gi_272 > 0 && (Gi_269 == 1 || Gi_269 == 2) && iClose(NULL, PERIOD_M15, 1) <= iOpen(NULL, PERIOD_M15, 1) && Gi_272 < Gi_308 && Bid - G_order_open_price_158 >= Gi_310 * Gi_276 * Gd_284) {
LotsC0 = 0;
l_pod_110 = 0;
LotsAll = MathMin(G_lots_290,NormalizeDouble(G_lots_292 * MathPow(Gd_300, Gi_272), 4));
if((TrackXuNi && Gi_721 < Gi_309) || LotsAll < MinLot) {
Gi_324++;
ObjectCreat3("xxxxxxx1" + IntegerToString(Gi_721),Bid,clrLime);
ObjectCreat4("xxxxxxx3" + IntegerToString(Gi_721),"#" + IntegerToString(Gi_721) + " sell " + DoubleToStr(LotsAll,4),Time[0],Ask,clrWhite);
ShowArrow0(1,Gi_721);
Gd_721[Gi_721] = LotsAll;
Gd_731[Gi_721] = Bid;
Gi_721++;
}
else {
LotsAll = NormalizeDouble(LotsAll, Gi_280);
while(LotsC0 < LotsAll && l_pod_110 < 10) {
RefreshRates();
Lots0 = MathMin(LotsAll - LotsC0,MaxLot);
G_ticket_264 = OrderSend(Symbol(), OP_SELL, Lots0, Bid, Gi_336 * Gi_276, 0, 0, G_comment_344 + DoubleToStr(Gi_272,0), G_magic_340, 0, Red);
if(G_ticket_264 >= 0) {
LotsC0 += Lots0;
}
else {
l_pod_110++;
Print("下单错误 = ",GetLastError());
}
}
}
return(0);
}
}
return (0);
}
int GetGi_310(int Ai_0) {
int li_8 = Gi_311;;
if (Ai_0 >= 7 && Ai_0 <= 10) li_8 = Gi_312;
if (Ai_0 >= 11 && Ai_0 <= 12) li_8 = Gi_312 * 10 / 6;
if (Ai_0 == 13) li_8 = Gi_312 * 10 / 4;
return(li_8);
}
void O_Modify(int Ai_0) {
if (Ai_0 == 0) {
G_price_232 = Gd_168 + Gi_316 * Gi_276 * Gd_284;
if (G_price_232 - Bid <= STOPLEVEL * Point) return;
for (G_pos_260 = OrdersTotal() - 1; G_pos_260 >= 0; G_pos_260--) {
if (OrderSelect(G_pos_260, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol() == Symbol() && OrderMagicNumber() == G_magic_340)
if (OrderType() == OP_BUY) Gi_256 = OrderModify(OrderTicket(), OrderOpenPrice(), 0, G_price_232, 0, Blue);
}
}
}
if (Ai_0 == 1) {
G_price_232 = Gd_176 - Gi_316 * Gi_276 * Gd_284;
if (Ask - G_price_232 <= STOPLEVEL * Point) return;
for (G_pos_260 = OrdersTotal() - 1; G_pos_260 >= 0; G_pos_260--) {
if (OrderSelect(G_pos_260, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol() == Symbol() && OrderMagicNumber() == G_magic_340)
if (OrderType() == OP_SELL) Gi_256 = OrderModify(OrderTicket(), OrderOpenPrice(), 0, G_price_232, 0, Red);
}
}
}
}
void ShowArrow0(int A_cmd_0,int A_count_0) {
string name;
string Type;
int Gi_325;
int Arrow;
color Color;
double OpenPrice;
double OrderLots0 = MathMin(G_lots_290,NormalizeDouble(G_lots_292 * MathPow(Gd_300, A_count_0), 4));
if(A_cmd_0 == 0) {
Arrow = 1;
Color = Blue;
Type = "buy";
OpenPrice = Ask;
Gi_325 = Gi_323;
}
if(A_cmd_0 == 1) {
Arrow = 2;
Color = Red;
Type = "sell";
OpenPrice = Bid;
Gi_325 = Gi_324;
}
name = "#" + Gi_325 + " " + Type + " " + DoubleToStr(OrderLots0, 4) + " " + Symbol() + " at " + DoubleToStr(OpenPrice, Digits);
ObjectCreate(name, OBJ_ARROW, 0, TimeCurrent(), OpenPrice);
ObjectSet(name, OBJPROP_ARROWCODE, Arrow);
ObjectSet(name, OBJPROP_COLOR, Color);
}
void ShowArrow1(int A_cmd_0,int A_count_0,int OpenTime) {
string name;
string Type;
int Arrow;
int Gi_325;
color Color;
double OpenPrice;
double ClosePrice;
double OrderLots0 = MathMin(G_lots_290,NormalizeDouble(G_lots_292 * MathPow(Gd_300, A_count_0), 4));
if(A_cmd_0 == 0) {
Arrow = 1;
Color = Blue;
Type = "buy";
OpenPrice = Gd_730[A_count_0];
ClosePrice = Bid;
Gi_325 = Gi_323;
}
if(A_cmd_0 == 1) {
Arrow = 2;
Color = Red;
Type = "sell";
OpenPrice = Gd_731[A_count_0];
ClosePrice = Ask;
Gi_325 = Gi_324;
}
name = "#" + IntegerToString(Gi_325 - A_count_0) + " " + Type + " " + DoubleToStr(OrderLots0, 4) + " " + Symbol() + " at " + DoubleToStr(OpenPrice, Digits) + " close at " + DoubleToStr(ClosePrice,Digits);
ObjectCreate(name, OBJ_ARROW, 0, TimeCurrent(), ClosePrice);
ObjectSet(name, OBJPROP_ARROWCODE, 3);
ObjectSet(name, OBJPROP_COLOR, Goldenrod);
name = "#" + IntegerToString(Gi_325 - A_count_0) + " " + Type + " " + DoubleToStr(OpenPrice,Digits) + " -> " + DoubleToStr(ClosePrice,Digits) + " Lots = " + DoubleToStr(OrderLots0, 4);
ObjectCreate(name, OBJ_TREND, 0, OpenTime, OpenPrice, TimeCurrent(), ClosePrice);
ObjectSet(name, OBJPROP_STYLE, STYLE_DOT);
ObjectSet(name, OBJPROP_WIDTH, 1);
ObjectSet(name, OBJPROP_RAY, false);
ObjectSet(name, OBJPROP_COLOR, Color);
}
void CloseOrders(int A_cmd_0) {
string NameObject;
if(A_cmd_0 == 0) {
Gi_720 = 0;
for(int i = 0;i < ObjectsTotal();i++) {
NameObject = ObjectName(i);
if(StringFind(NameObject,"xxxxxxx0",0) >= 0) {
ShowArrow1(0,StringSubstr(NameObject,8,StringLen(NameObject) - 8),ObjectGet(NameObject,OBJPROP_TIME1));
}
}
ArrayInitialize(Gd_720,0);
ArrayInitialize(Gd_730,0);
ObjectsDeleteAll(0,"xxxxxxx0",0,OBJ_HLINE);
ObjectsDeleteAll(0,"xxxxxxx2",0,OBJ_TEXT);
}
if(A_cmd_0 == 1) {
Gi_721 = 0;
for(i = 0;i < ObjectsTotal();i++) {
NameObject = ObjectName(i);
if(StringFind(NameObject,"xxxxxxx1",0) >= 0) {
ShowArrow1(1,StringSubstr(NameObject,8,StringLen(NameObject) - 8),ObjectGet(NameObject,OBJPROP_TIME1));
}
}
ArrayInitialize(Gd_721,0);
ArrayInitialize(Gd_731,0);
ObjectsDeleteAll(0,"xxxxxxx1",0,OBJ_HLINE);
ObjectsDeleteAll(0,"xxxxxxx3",0,OBJ_TEXT);
}
BoolClose = true;
for (int pos_4 = OrdersTotal() - 1; pos_4 >= 0; pos_4--) {
if (OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol() == Symbol() && OrderMagicNumber() == G_magic_340)
if (OrderType() == A_cmd_0) Gi_256 = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), Gi_336 * Gi_276, Yellow);
}
}
}
double CountL(int A_cmd_0) {
double awefwpijo = 0;
if(A_cmd_0 == 0) {
for(int i = 0;i <= 30;i++) {
if(Gd_720[i] == 0) break;
awefwpijo += Gd_720[i];
}
}
if(A_cmd_0 == 1) {
for(i = 0;i <= 30;i++) {
if(Gd_721[i] == 0) break;
awefwpijo += Gd_721[i];
}
}
return(awefwpijo);
}
double CountLP(int A_cmd_0) {
double awefwpijo = 0;
if(A_cmd_0 == 0) {
for(int i = 0;i <= 30;i++) {
if(Gd_720[i] == 0) break;
awefwpijo += Gd_720[i] * Gd_730[i];
}
}
if(A_cmd_0 == 1) {
for(i = 0;i <= 30;i++) {
if(Gd_721[i] == 0) break;
awefwpijo += Gd_721[i] * Gd_731[i];
}
}
return(awefwpijo);
}
void CountOrders() {
Gi_268 = Gi_720;
Gi_272 = Gi_721;
Gd_184 = CountL(0);
Gd_192 = CountL(1);
Gd_200 = CountLP(0);
Gd_208 = CountLP(1);
Gi_260 = 0;
Gi_261 = 0;
Gd_216 = 0;
Gd_218 = 0;
if(Gd_184 > 0) Gd_216 = Gd_184 * (Bid - (Gd_200 / Gd_184)) * MarketInfo(Symbol(),MODE_TICKVALUE);
if(Gd_192 > 0) Gd_218 = Gd_192 * ((Gd_208 / Gd_192) - Ask) * MarketInfo(Symbol(),MODE_TICKVALUE);
if(Gi_720 > 0) G_order_open_price_150 = Gd_730[Gi_720-1];
if(Gi_721 > 0) G_order_open_price_158 = Gd_731[Gi_721-1];
Gd_168 = 0;
Gd_176 = 0;
for (G_pos_260 = 0; G_pos_260 < OrdersTotal(); G_pos_260++) {
if (OrderSelect(G_pos_260, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol() == Symbol() && OrderMagicNumber() == G_magic_340) {
G_comment_300 = OrderComment();
if(StringFind(G_comment_300,"_",0) < 0) {
Alert("定单注释异常 = ",G_comment_300);
ExpertRemove();
break;
}
if (OrderType() == OP_BUY) {
Gi_268 = StrToInteger(StringSubstr(G_comment_300,StringFind(G_comment_300,"_",0)+1,StringLen(G_comment_300)-StringFind(G_comment_300,"_",0)-1))+1;
Gi_260++;
Gd_184 += OrderLots();
Gd_200 += OrderOpenPrice() * OrderLots();
Gd_216 += OrderProfit() + OrderSwap() + OrderCommission();
G_order_open_price_150 = OrderOpenPrice();
}
if (OrderType() == OP_SELL) {
Gi_272 = StrToInteger(StringSubstr(G_comment_300,StringFind(G_comment_300,"_",0)+1,StringLen(G_comment_300)-StringFind(G_comment_300,"_",0)-1))+1;
Gi_261++;
Gd_192 += OrderLots();
Gd_208 += OrderOpenPrice() * OrderLots();
Gd_218 += OrderProfit() + OrderSwap() + OrderCommission();
G_order_open_price_158 = OrderOpenPrice();
}
}
}
}
if (Gi_268 == 0 && TrackZoer0) {
TrackZoer0 = false;
if(Gd_217 < -1) {
ObjectCreat2("xxxxx" + DoubleToStr(TimeCurrent(),0), DoubleToStr(Gd_217,0), High[0] + 50*Point, Yellow);
Gd_217 = 0;
}
}
if (Gi_272 == 0 && TrackZoer1) {
TrackZoer1 = false;
if(Gd_219 < -1) {
ObjectCreat2("xxxxx" + DoubleToStr(TimeCurrent(),0), DoubleToStr(Gd_219,0), Low[0] - 50*Point, Yellow);
Gd_219 = 0;
}
}
if (Gi_260 > 0) TrackZoerXuNi0 = true;
if (Gi_261 > 0) TrackZoerXuNi1 = true;
if (Gi_260 == 0 && TrackZoerXuNi0) {
CloseOrders(OP_BUY);
TrackZoerXuNi0 = false;
}
if (Gi_261 == 0 && TrackZoerXuNi1) {
CloseOrders(OP_SELL);
TrackZoerXuNi1 = false;
}
if (Gi_268 > 0) TrackZoer0 = true;
if (Gi_272 > 0) TrackZoer1 = true;
if (Gi_268 >= Gi_306 && Gd_216 < Gd_217) Gd_217 = Gd_216;
if (Gi_272 >= Gi_306 && Gd_218 < Gd_219) Gd_219 = Gd_218;
if (Gd_184 > 0.0) Gd_168 = NormalizeDouble(Gd_200 / Gd_184, Digits);
if (Gd_192 > 0.0) Gd_176 = NormalizeDouble(Gd_208 / Gd_192, Digits);
}
void CommentMsg() {
Gsa_720[0] = "平台杠杆:1:" + DoubleToStr(AccountLeverage(), 0) + " 过期时间:" + TimeToStr(时间限制,TIME_DATE);
Gsa_720[1] = "强平比例:" + DoubleToStr(AccountStopoutLevel(), 0) + "%";
Gsa_720[2] = "--------------";
Gsa_720[3] = "多单单数:" + Gi_268;
Gsa_720[4] = "多单手数:" + DoubleToStr(Gd_184, 2);
Gsa_720[5] = "多单盈亏:" + DoubleToStr(Gd_216, 2);
Gsa_720[6] = "--------------";
Gsa_720[7] = "空单单数:" + Gi_272;
Gsa_720[8] = "空单手数:" + DoubleToStr(Gd_192, 2);
Gsa_720[9] = "空单盈亏:" + DoubleToStr(Gd_218, 2);
Gsa_720[10] = "--------------";
Gsa_720[11] = "净下单量:" + DoubleToStr(Gd_184 - Gd_192, 2);
Gsa_720[12] = "浮动盈亏:" + DoubleToStr(Gd_216 + Gd_218, 2);
Gsa_720[13] = "--------------";
for (int index_0 = 0; index_0 < 14; index_0++) ObjectCreat0("xxxxxx" + index_0, Gsa_720[index_0], 10, 15 + 19 * index_0, Yellow);
}
void ObjectCreat0(string A_name_0, string A_text_8, double A_x_16, double A_y_24, color A_color_32) {
if (ObjectFind(A_name_0) >= 0) {
ObjectSetText(A_name_0, A_text_8, 14, "微软雅黑", A_color_32);
return;
}
ObjectCreate(A_name_0, OBJ_LABEL, 0, 0, 0);
ObjectSet(A_name_0, OBJPROP_XDISTANCE, A_x_16);
ObjectSet(A_name_0, OBJPROP_YDISTANCE, A_y_24);
ObjectSet(A_name_0, OBJPROP_COLOR, A_color_32);
ObjectSetText(A_name_0, A_text_8, 14, "微软雅黑", A_color_32);
}
void ObjectCreat1(string Name,double Price0,color COLOR) {
if(ObjectFind(Name) >= 0) ObjectSet(Name, OBJPROP_PRICE1, Price0);
else {
ObjectCreate(Name, OBJ_HLINE, 0, 0, Price0);
ObjectSet(Name, OBJPROP_WIDTH, 1);
ObjectSet(Name, OBJPROP_COLOR, COLOR);
}
}
void ObjectCreat2(string A_name_0, string A_text_8, double A_x_16, color A_color_32) {
if (ObjectFind(A_name_0) >= 0) {
ObjectSetText(A_name_0, A_text_8, 25, "微软雅黑", A_color_32);
return;
}
ObjectCreate(A_name_0, OBJ_TEXT, 0, Time[10], A_x_16);
ObjectSet(A_name_0, OBJPROP_COLOR, A_color_32);
ObjectSetText(A_name_0, A_text_8, 25, "微软雅黑", A_color_32);
}
void ObjectCreat3(string Name,double OBJPrice1,color COLOR) {
if(ObjectFind(Name) >= 0) ObjectSet(Name, OBJPROP_PRICE1, OBJPrice1);
else {
ObjectCreate(Name, OBJ_HLINE, 0, TimeCurrent(), OBJPrice1);
ObjectSet(Name, OBJPROP_WIDTH, 1);
ObjectSet(Name, OBJPROP_STYLE, STYLE_DASHDOT);
ObjectSet(Name, OBJPROP_COLOR, COLOR);
}
}
void ObjectCreat4(string Name,string Text,int OBJTime1,double OBJPrice1,color COLOR) {
if(ObjectFind(Name) >= 0) ObjectSetText(Name, Text, 7, "Microsoft Sans", COLOR);
else {
ObjectCreate(Name, OBJ_TEXT, 0, OBJTime1, OBJPrice1);
ObjectSet(Name, OBJPROP_COLOR, COLOR);
ObjectSetText(Name, Text, 7, "Microsoft Sans", COLOR);
}
}
void ButtonCreate(string Name,string txt1,string txt2,int XX,int YX,int XL,int YL,int WZ,color A,color B) {
if(ObjectFind(0,Name)==-1) {
ObjectCreate(0,Name,OBJ_BUTTON,0,0,0);
ObjectSetInteger(0,Name,OBJPROP_XDISTANCE,XX);
ObjectSetInteger(0,Name,OBJPROP_YDISTANCE,YX);
ObjectSetInteger(0,Name,OBJPROP_XSIZE,XL);
ObjectSetInteger(0,Name,OBJPROP_YSIZE,YL);
ObjectSetInteger(0,Name,OBJPROP_CORNER,WZ);
ObjectSetString(0,Name,OBJPROP_FONT,"微软雅黑");
ObjectSetInteger(0,Name,OBJPROP_FONTSIZE,11);
ObjectSetInteger(0,Name,OBJPROP_BORDER_COLOR,clrYellow);
}
if(ObjectGetInteger(0,Name,OBJPROP_STATE)==1) {
ObjectSetInteger(0,Name,OBJPROP_COLOR,A);
ObjectSetInteger(0,Name,OBJPROP_BGCOLOR,B);
ObjectSetString(0,Name,OBJPROP_TEXT,txt2);
}
else {
ObjectSetInteger(0,Name,OBJPROP_COLOR,B);
ObjectSetInteger(0,Name,OBJPROP_BGCOLOR,A);
ObjectSetString(0,Name,OBJPROP_TEXT,txt1);
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/hangyejiadao_581/mql4.git
git@gitee.com:hangyejiadao_581/mql4.git
hangyejiadao_581
mql4
mql4
master

搜索帮助