2 Star 5 Fork 4

航耍耍/mql4

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
黄金甲5B_~.mq4 17.49 KB
一键复制 编辑 原始数据 按行查看 历史
航耍耍 提交于 2021-11-09 08:24 . 123123123123
/*
Generated by EX4-TO-MQ4 decompiler V4.0.401.1j [-]
Website: https://purebeam.biz
E-mail : purebeam@gmail.com
*/
#property copyright "ƽ5B"
#property link "www.xxx.com"
extern bool OrderValue = FALSE;
extern string Main = "EURUSD";
string gs_88 = "0:Trend ; 1:Buy ; 2:Sell";
extern int MainDirection = 0;
extern string Correlation1 = "USDJPY";
extern string Correlation2 = "EURJPY";
extern string Correlation3 = "AUDUSD";
extern string Correlation4 = "NZDUSD";
bool gi_132 = FALSE;
bool gi_136 = FALSE;
bool gi_140 = FALSE;
bool gi_144 = FALSE;
string gs_148 = "True:By G-MA ; False:No";
extern bool CheckOrder = FALSE;
extern int WinPoint = 8;
extern double TakeProfit = 150.0;
extern double StopLoss = 10000.0;
string gs_180 = "True:Reverse ; False:By Trend";
extern bool TwoWay = FALSE;
extern double MaxLots = 3.0;
extern int Magic = 55555;
extern int TimeFrame = 15;
extern int TimeFrame2 = 60;
extern int TimeFrame3 = 240;
extern int TimeFrame4 = 1440;
extern int BreakEvenLevel = 8;
extern bool LastTradeStop = FALSE;
extern double LotNo1 = 0.02;
extern double LotNo2 = 0.03;
extern double LotNo3 = 0.04;
extern double LotNo4 = 0.05;
extern double LotNo5 = 0.06;
extern double LotNo6 = 0.07;
extern double LotNo7 = 0.08;
extern double LotNo8 = 0.09;
extern double LotNo9 = 0.1;
extern double LotNo10 = 0.11;
extern double LotNo11 = 0.12;
extern double LotNo12 = 0.13;
extern double LotNo13 = 0.14;
extern double LotNo14 = 0.15;
extern double LotNo15 = 0.16;
extern double LotNo16 = 0.17;
extern double LotNo17 = 0.18;
extern double LotNo18 = 0.19;
extern double LotNo19 = 0.2;
extern double LotNo20 = 0.3;
extern int LossPoint1 = 8;
extern int LossPoint2 = 12;
extern int LossPoint3 = 16;
extern int LossPoint4 = 20;
extern int LossPoint5 = 25;
extern int LossPoint6 = 30;
extern int LossPoint7 = 40;
extern int LossPoint8 = 50;
extern int LossPoint9 = 60;
extern int LossPoint10 = 70;
extern int LossPoint11 = 80;
extern int LossPoint12 = 90;
extern int LossPoint13 = 100;
extern int LossPoint14 = 110;
extern int LossPoint15 = 120;
extern int LossPoint16 = 130;
extern int LossPoint17 = 140;
extern int LossPoint18 = 150;
extern int LossPoint19 = 160;
extern int LossPoint20 = 170;
string gs_468 = "alert2.wav";
string gs_476 = "";
string gs_484 = "";
string gs_492 = "";
double gd_500 = 0.0;
double gd_508 = 0.0;
double gd_516 = 0.0;
int gi_524 = -1;
int gi_528 = 0;
int gi_532 = 0;
int gia_536[5];
int gi_540 = 0;
int gia_544[8] = {8941301, 127, 11, 127, 15, 62, 953701};
int gi_548 = 0;
int gia_560[210];
int gia_564[5];
int gi_568;
string gs_576 = "0123456789098765432123456789098765432123456789098765432123456789005385389485";
string gs_584 = "abcdefguijklmnopqrstuvwxyz1234567898abcdefguijklmnopqrstuvwxywwwzlocksoftcom";
int init() {
gi_568 = -8;
if (StringGetChar(gs_576, 0) != '+') return (-1);
if (StringGetChar(gs_576, 1) != 'E') return (-1);
if (StringGetChar(gs_576, 2) != '>') return (-1);
if (StringGetChar(gs_576, 3) != 'N') return (-1);
if (StringGetChar(gs_576, 4) != '/') return (-1);
if (StringGetChar(gs_576, 5) != 24) return (-1);
if (StringGetChar(gs_576, 6) != ',') return (-1);
if (StringGetChar(gs_576, 7) != 27) return (-1);
if (StringGetChar(gs_576, 8) != 'O') return (-1);
if (StringGetChar(gs_576, 9) != '1') return (-1);
if (StringGetChar(gs_576, StringGetChar(gs_576, 17) + 18) != StringGetChar(gs_576, StringGetChar(gs_576, 17) + 20) + StringGetChar(gs_576, StringGetChar(gs_576, 17) +
22)) return (-1);
if (StringGetChar(gs_576, 16) != TimeDay(TimeLocal()) + 7) return (-1);
ObjectsDeleteAll(0, OBJ_LABEL);
Comment("");
gs_476 = "_CloseAllOrder_";
gs_492 = "_CloseMagic_" + Magic + "_";
gs_484 = "_OpenRev_" + Magic + "_";
if (!GlobalVariableCheck(gs_476)) f0_5(gs_476, 0);
if (!GlobalVariableCheck(gs_492)) f0_5(gs_492, 0);
if (IsDemo()) start();
return (0);
}
int deinit() {
ObjectsDeleteAll(0, OBJ_LABEL);
return (0);
}
int start() {
f0_0();
f0_0();
f0_0();
f0_12();
return (0);
}
void f0_0() {
double ld_0;
int li_8;
if (AccountProfit() < (-1.0 * StopLoss) || f0_6(gs_476) == 1) {
Alert("Stop Loss ,Close ALL !!");
f0_5(gs_476, 1);
if (TwoWay) f0_5(gs_484, 1);
f0_8();
f0_8();
f0_7();
if (gi_528 == 0) f0_5(gs_476, 0);
} else {
if (AccountProfit() > TakeProfit || f0_6(gs_476) == 1) {
Alert("Take Profit, Close ALL !!");
f0_5(gs_476, 1);
if (TwoWay) f0_5(gs_484, 1);
f0_8();
f0_8();
f0_7();
if (gi_528 == 0) f0_5(gs_476, 0);
} else {
f0_7();
if ((gd_516 >= 10.0 * gd_500 * WinPoint && gd_500 > 0.0) || f0_6(gs_492) == 1) {
Alert("Win Point ,Close ! Magic:" + Magic);
f0_5(gs_492, 1);
if (TwoWay) f0_5(gs_484, 1);
f0_9();
f0_9();
f0_7();
if (gi_532 + gi_540 == 0) f0_5(gs_492, 0);
} else {
f0_7();
if ((gi_532 >= BreakEvenLevel && gd_516 > 0.0) || f0_6(gs_492) == 1) {
Alert("Arrival Break-Even Close All! Magic:" + Magic);
f0_5(gs_492, 1);
if (TwoWay) f0_5(gs_484, 1);
f0_9();
f0_9();
f0_7();
if (gi_532 + gi_540 == 0) f0_5(gs_492, 0);
} else {
f0_7();
if (gi_532 + gi_540 == 0) {
if (LastTradeStop) return;
ld_0 = f0_6(gs_484);
if (ld_0 != 1.0) {
if (f0_4() > 0) OrderSend(Main, OP_BUY, f0_10(f0_14(0, Main)), MarketInfo(Main, MODE_ASK), 3, 0, 0, "[" + Magic + "]ƽ5B ;N." + ((gi_532 + 1)), Magic, 0, Lime);
else
if (f0_4() < 0) OrderSend(Main, OP_SELL, f0_10(f0_14(0, Main)), MarketInfo(Main, MODE_BID), 3, 0, 0, "[" + Magic + "]ƽ5B ;N." + ((gi_532 + 1)), Magic, 0, Red);
} else {
li_8 = f0_15();
if (li_8 == 1) OrderSend(Main, OP_BUY, f0_10(f0_14(0, Main)), MarketInfo(Main, MODE_ASK), 3, 0, 0, "[" + Magic + "]ƽ5B ;N." + ((gi_532 + 1)), Magic, 0, Lime);
else
if (li_8 == 0) OrderSend(Main, OP_SELL, f0_10(f0_14(0, Main)), MarketInfo(Main, MODE_BID), 3, 0, 0, "[" + Magic + "]ƽ5B ;N." + ((gi_532 + 1)), Magic, 0, Red);
}
} else f0_5(gs_484, 0);
f0_1(gi_132, Correlation1, gia_536[1]);
f0_1(gi_136, Correlation2, gia_536[2]);
f0_1(gi_140, Correlation3, gia_536[3]);
f0_1(gi_144, Correlation4, gia_536[4]);
}
}
}
}
}
void f0_1(bool ai_0, string as_4, int ai_12) {
double ld_16;
f0_7();
if (ai_12 < gi_532) {
if (ai_0) {
if (gi_524 == OP_BUY) OrderSend(as_4, OP_BUY, f0_10(f0_14(ai_12, as_4)), MarketInfo(as_4, MODE_ASK), 3, 0, 0, "[" + Magic + "]ƽ5B ;N." + gi_532, Magic, 0, Lime);
else
if (gi_524 == OP_SELL) OrderSend(as_4, OP_SELL, f0_10(f0_14(ai_12, as_4)), MarketInfo(as_4, MODE_BID), 3, 0, 0, "[" + Magic + "]ƽ5B ;N." + gi_532, Magic, 0, Red);
} else {
if (gi_524 == OP_SELL) OrderSend(as_4, OP_BUY, f0_10(f0_14(ai_12, as_4)), MarketInfo(as_4, MODE_ASK), 3, 0, 0, "[" + Magic + "]ƽ5B ;N." + gi_532, Magic, 0, Lime);
else
if (gi_524 == OP_BUY) OrderSend(as_4, OP_SELL, f0_10(f0_14(ai_12, as_4)), MarketInfo(as_4, MODE_BID), 3, 0, 0, "[" + Magic + "]ƽ5B ;N." + gi_532, Magic, 0, Red);
}
} else {
if (f0_2() && gi_532 > 0) {
if (gd_516 <= 10.0 * (-gd_500) * f0_13(gi_532)) {
ld_16 = f0_10(f0_14(gi_532, Main));
if (gd_500 < MaxLots) {
if (CheckOrder) {
if (gi_524 == OP_BUY && f0_3() > 0) OrderSend(Main, OP_BUY, ld_16, MarketInfo(Main, MODE_ASK), 3, 0, 0, "[" + Magic + "]ƽ5B ;N." + ((gi_532 + 1)), Magic, 0, Lime);
else
if (gi_524 == OP_SELL && f0_3() < 0) OrderSend(Main, OP_SELL, ld_16, MarketInfo(Main, MODE_BID), 3, 0, 0, "[" + Magic + "]ƽ5B ;N." + ((gi_532 + 1)), Magic, 0, Red);
} else {
if (gi_524 == OP_BUY) OrderSend(Main, OP_BUY, ld_16, MarketInfo(Main, MODE_ASK), 3, 0, 0, "[" + Magic + "]ƽ5B ;N." + ((gi_532 + 1)), Magic, 0, Lime);
else
if (gi_524 == OP_SELL) OrderSend(Main, OP_SELL, ld_16, MarketInfo(Main, MODE_BID), 3, 0, 0, "[" + Magic + "]ƽ5B ;N." + ((gi_532 + 1)), Magic, 0, Red);
}
}
}
}
}
}
int f0_2() {
bool li_0 = TRUE;
for (int li_4 = 1; li_4 < ArraySize(gia_536); li_4++) {
if (gia_536[li_4] != gi_532) {
li_0 = FALSE;
break;
}
}
return (li_0);
}
int f0_3() {
int li_0 = 0;
double ld_4 = iMA(Symbol(), TimeFrame, 5, 0, MODE_LWMA, PRICE_CLOSE, li_0);
double ld_12 = iMA(Symbol(), TimeFrame, 5, 0, MODE_LWMA, PRICE_CLOSE, li_0 + 1);
double ld_20 = iMA(Symbol(), TimeFrame, 10, 0, MODE_LWMA, PRICE_CLOSE, li_0);
double ld_28 = iMA(Symbol(), TimeFrame, 10, 0, MODE_LWMA, PRICE_CLOSE, li_0 + 1);
double ld_36 = iMA(Symbol(), TimeFrame, 20, 0, MODE_LWMA, PRICE_CLOSE, li_0);
double ld_44 = iMA(Symbol(), TimeFrame, 20, 0, MODE_LWMA, PRICE_CLOSE, li_0 + 1);
if (ld_4 > ld_12 && ld_20 > ld_28 && ld_36 > ld_44) return (1);
if (ld_4 < ld_12 && ld_20 < ld_28 && ld_36 < ld_44) return (-1);
return (0);
}
int f0_4() {
if (MainDirection == 1) return (1);
if (MainDirection == 2) return (-1);
int li_0 = 0;
double ld_4 = iMA(Symbol(), TimeFrame2, 5, 0, MODE_LWMA, PRICE_CLOSE, li_0);
double ld_12 = iMA(Symbol(), TimeFrame2, 5, 0, MODE_LWMA, PRICE_CLOSE, li_0 + 1);
double ld_20 = iMA(Symbol(), TimeFrame2, 10, 0, MODE_LWMA, PRICE_CLOSE, li_0);
double ld_28 = iMA(Symbol(), TimeFrame2, 10, 0, MODE_LWMA, PRICE_CLOSE, li_0 + 1);
double ld_36 = iMA(Symbol(), TimeFrame2, 20, 0, MODE_LWMA, PRICE_CLOSE, li_0);
double ld_44 = iMA(Symbol(), TimeFrame2, 20, 0, MODE_LWMA, PRICE_CLOSE, li_0 + 1);
if (ld_4 > ld_12 && ld_20 > ld_28 && ld_36 > ld_44) return (1);
if (ld_4 < ld_12 && ld_20 < ld_28 && ld_36 < ld_44) return (-1);
return (0);
}
int f0_5(string as_0, double ad_8) {
GlobalVariableSet(as_0, ad_8);
if (GlobalVariableGet(as_0) != ad_8) Alert("EAClose Error ! Reason=" + DoubleToStr(ad_8, 0));
return (GlobalVariableGet(as_0));
}
int f0_6(string as_0) {
int li_8 = GlobalVariableGet(as_0);
return (li_8);
}
void f0_7() {
gd_500 = 0;
gd_508 = 0;
gd_516 = 0;
gi_528 = 0;
gi_532 = 0;
gi_540 = 0;
for (int li_0 = 0; li_0 < ArraySize(gia_536); li_0++) gia_536[li_0] = 0;
gi_524 = -1;
int li_4 = 0;
for (li_0 = 0; li_0 < OrdersTotal(); li_0++) {
if (OrderSelect(li_0, SELECT_BY_POS, MODE_TRADES) != FALSE) {
gi_528++;
if (OrderMagicNumber() == Magic) {
if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
gd_500 += OrderLots();
gd_516 += OrderProfit();
if (OrderSymbol() == Main) gi_532++;
if (OrderSymbol() == Correlation1) {
gia_536[1]++;
gi_540++;
}
if (OrderSymbol() == Correlation2) {
gia_536[2]++;
gi_540++;
}
if (OrderSymbol() == Correlation3) {
gia_536[3]++;
gi_540++;
}
if (OrderSymbol() == Correlation4) {
gia_536[4]++;
gi_540++;
}
if (OrderTicket() > li_4 && OrderSymbol() == Main) {
li_4 = OrderTicket();
gd_508 = OrderLots();
gi_524 = OrderType();
}
}
}
}
}
}
void f0_8() {
bool li_0;
bool li_4;
for (int li_8 = 0; li_8 < OrdersTotal(); li_8++) {
RefreshRates();
li_0 = OrderSelect(li_8, SELECT_BY_POS, MODE_TRADES);
if (li_0) {
if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
li_4 = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Blue);
if (li_4) PlaySound(gs_468);
}
}
}
}
void f0_9() {
bool li_0;
bool li_4;
for (int li_8 = 0; li_8 < OrdersTotal(); li_8++) {
RefreshRates();
li_0 = OrderSelect(li_8, SELECT_BY_POS, MODE_TRADES);
if (li_0) {
if (OrderMagicNumber() == Magic) {
if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
li_4 = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Blue);
if (li_4) PlaySound(gs_468);
}
}
}
}
}
double f0_10(double ad_0) {
double ld_8 = 0;
ld_8 = NormalizeDouble(ad_0 / MarketInfo(Main, MODE_LOTSTEP), 0);
ld_8 *= MarketInfo(Main, MODE_LOTSTEP);
ld_8 = MathMax(ld_8, MarketInfo(Symbol(), MODE_MINLOT));
return (ld_8);
}
void f0_11(string as_0, string as_8, int ai_16, color ai_20) {
if (ObjectFind(as_0) != 0) {
ObjectDelete(as_0);
ObjectCreate(as_0, OBJ_LABEL, 0, 0, 0);
ObjectSet(as_0, OBJPROP_CORNER, 0);
ObjectSet(as_0, OBJPROP_XDISTANCE, 2);
ObjectSet(as_0, OBJPROP_YDISTANCE, ai_16);
}
ObjectSetText(as_0, as_8, 9, "Arial", ai_20);
}
void f0_12() {
f0_7();
int li_0 = 20;
int li_4 = 15;
string ls_8 = "Lable_Name1";
string ls_16 = "Current Profit: " + DoubleToStr(gd_516, 2);
if (gd_516 > 0.0) f0_11(ls_8, ls_16, li_0, Red);
else f0_11(ls_8, ls_16, li_0, Lime);
li_0 += li_4;
ls_8 = "Lable_Name2";
ls_16 = "WinPoint Price: " + DoubleToStr(10.0 * gd_500 * WinPoint, 2);
f0_11(ls_8, ls_16, li_0, DeepPink);
li_0 += li_4;
ls_8 = "Lable_Name3";
ls_16 = "TakeProfit: " + DoubleToStr(TakeProfit, 2);
f0_11(ls_8, ls_16, li_0, DeepPink);
li_0 += li_4;
ls_8 = "Lable_Name4";
ls_16 = "StopLoss: " + DoubleToStr(StopLoss, 2);
f0_11(ls_8, ls_16, li_0, Lime);
li_0 += li_4;
ls_8 = "Lable_Name5";
ls_16 = "NowLot: " + DoubleToStr(gd_500, 2);
f0_11(ls_8, ls_16, li_0, DeepPink);
li_0 += li_4;
ls_8 = "Lable_Name6";
ls_16 = "MaxLots: " + DoubleToStr(MaxLots, 2);
f0_11(ls_8, ls_16, li_0, DeepPink);
li_0 += li_4;
ls_8 = "Lable_Name7";
ls_16 = "Level: " + DoubleToStr(gi_532, 0);
f0_11(ls_8, ls_16, li_0, DeepPink);
li_0 += li_4;
ls_8 = "Lable_Name8";
ls_16 = "LossPoint : " + DoubleToStr(f0_13(gi_532), 0);
f0_11(ls_8, ls_16, li_0, DeepPink);
li_0 += li_4;
ls_8 = "Lable_Name9";
if (TwoWay) ls_16 = "TwoWay : True";
else ls_16 = "TwoWay : False";
f0_11(ls_8, ls_16, li_0, DeepPink);
li_0 += li_4;
ls_8 = "Lable_Name11";
ls_16 = "NextOrderPrice : " + DoubleToStr(10.0 * (gd_500 * f0_13(gi_532)), 2);
f0_11(ls_8, ls_16, li_0, Lime);
li_0 += li_4;
ls_8 = "Lable_Name12";
ls_16 = "Magic : " + Magic;
f0_11(ls_8, ls_16, li_0, DeepPink);
li_0 += li_4;
if (gd_500 >= MaxLots) {
ls_8 = "Lable_NameAlert";
ls_16 = "Alert: Maxlots ! Maxlots !!";
if (ObjectFind(ls_8) < 0) Alert(ls_16);
f0_11(ls_8, ls_16, li_0, Red);
li_0 += li_4;
return;
}
ObjectDelete("Lable_NameAlert");
}
double f0_13(int ai_0) {
int li_4 = ai_0;
if (li_4 == 0) return (99999999);
if (li_4 == 1) return (LossPoint1);
if (li_4 == 2) return (LossPoint2);
if (li_4 == 3) return (LossPoint3);
if (li_4 == 4) return (LossPoint4);
if (li_4 == 5) return (LossPoint5);
if (li_4 == 6) return (LossPoint6);
if (li_4 == 7) return (LossPoint7);
if (li_4 == 8) return (LossPoint8);
if (li_4 == 9) return (LossPoint9);
if (li_4 == 10) return (LossPoint10);
if (li_4 == 11) return (LossPoint11);
if (li_4 == 12) return (LossPoint12);
if (li_4 == 13) return (LossPoint13);
if (li_4 == 14) return (LossPoint14);
if (li_4 == 15) return (LossPoint15);
if (li_4 == 16) return (LossPoint16);
if (li_4 == 17) return (LossPoint17);
if (li_4 == 18) return (LossPoint18);
if (li_4 == 19) return (LossPoint19);
if (li_4 == 20) return (LossPoint20);
return (LossPoint20);
}
double f0_14(int ai_0, string as_4) {
double ld_12;
double ld_20 = LotNo20;
int li_28 = ai_0 + 1;
if (li_28 == 1) ld_20 = LotNo1;
if (li_28 == 2) ld_20 = LotNo2;
if (li_28 == 3) ld_20 = LotNo3;
if (li_28 == 4) ld_20 = LotNo4;
if (li_28 == 5) ld_20 = LotNo5;
if (li_28 == 6) ld_20 = LotNo6;
if (li_28 == 7) ld_20 = LotNo7;
if (li_28 == 8) ld_20 = LotNo8;
if (li_28 == 9) ld_20 = LotNo9;
if (li_28 == 10) ld_20 = LotNo10;
if (li_28 == 11) ld_20 = LotNo11;
if (li_28 == 12) ld_20 = LotNo12;
if (li_28 == 13) ld_20 = LotNo13;
if (li_28 == 14) ld_20 = LotNo14;
if (li_28 == 15) ld_20 = LotNo15;
if (li_28 == 16) ld_20 = LotNo16;
if (li_28 == 17) ld_20 = LotNo17;
if (li_28 == 18) ld_20 = LotNo18;
if (li_28 == 19) ld_20 = LotNo19;
if (li_28 == 20) ld_20 = LotNo20;
if (OrderValue) {
ld_12 = MarketInfo(as_4, MODE_BID);
if (ld_12 > 0.0) {
if (ld_12 < 10.0) ld_20 = 1 / ld_12 * ld_20;
else ld_20 = 100 / ld_12 * ld_20;
}
}
return (ld_20);
}
int f0_15() {
int li_0 = 0;
int li_4 = -1;
for (int li_8 = 0; li_8 < OrdersHistoryTotal(); li_8++) {
if (OrderSelect(li_8, SELECT_BY_POS, MODE_HISTORY) != FALSE) {
if (OrderMagicNumber() == Magic) {
if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
if (li_0 < OrderTicket() && OrderSymbol() == Main) {
li_0 = OrderTicket();
li_4 = OrderType();
}
}
}
}
}
return (li_4);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/hangyejiadao_581/mql4.git
git@gitee.com:hangyejiadao_581/mql4.git
hangyejiadao_581
mql4
mql4
master

搜索帮助