deadsoul
Местный житель
can any one reverse this expert advisor
Может ли один обратный этого эксперта
i use google translation so sorry if its not right
Может ли один обратный этого эксперта
i use google translation so sorry if its not right
Код:
/*
Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
Website: http://purebeam.biz
E-mail : [email protected]
*/
#property copyright "Copyright © 2008, Leurn"
#property link "[email protected]"
extern string FridayTimeToSet = "22:50";
extern bool WaitNewBarAtStart = TRUE;
extern double Lots = 1.0;
extern int TakeProfit = 150;
extern int StopLoss = 5;
extern int TrailStop = 20;
extern int TrailStep = 5;
extern string OrdersComment = "Cerpiy";
int g_pos_120;
int g_magic_124;
int g_stoplevel_128;
int g_spread_132;
double g_lots_136;
double g_price_144;
double g_price_152;
double g_maxlot_160;
double g_minlot_168;
double g_lotstep_176;
double g_price_184;
double g_price_192;
string g_comment_200;
bool gi_208;
bool gi_212;
bool gi_216;
bool gi_220;
bool gi_224;
bool gi_228;
int g_datetime_232;
int g_str2time_236;
int init() {
g_magic_124 = StringGetChar(Symbol(), 0) + 61008 + StringGetChar(Symbol(), 1) * 2 + 3 * StringGetChar(Symbol(), 3) + StringGetChar(Symbol(), 4) << 2;
g_maxlot_160 = MarketInfo(Symbol(), MODE_MAXLOT);
g_minlot_168 = MarketInfo(Symbol(), MODE_MINLOT);
g_lotstep_176 = MarketInfo(Symbol(), MODE_LOTSTEP);
g_lots_136 = GlobalVariableGet("SHI_Lots");
if (g_lots_136 <= 0.0) g_lots_136 = Lots;
if (g_lots_136 < g_minlot_168) g_lots_136 = g_minlot_168;
else {
if (g_lots_136 > g_maxlot_160) g_lots_136 = g_maxlot_160;
else g_lots_136 = NormalizeDouble(g_lots_136 / g_lotstep_176, 0) * g_lotstep_176;
}
gi_212 = FALSE;
g_datetime_232 = 0;
g_price_184 = 0;
g_price_192 = 0;
g_comment_200 = OrdersComment + " Magic#=" + g_magic_124;
return (0);
}
int start() {
if (!IsTesting()) {
if (!IsExpertEnabled()) {
Comment("آ ٍîًمîâîى ٍهًىèيàëه çàïًهù¸ي çàïٌَê êٌïهًٍîâ.");
return (0);
}
if (!IsTradeAllowed()) {
Comment("زîًمîâëے çàïًهùهيà èëè ٍîًمîâûé ïîٍîê çàيےٍ.");
return (0);
}
Comment("");
}
g_stoplevel_128 = MarketInfo(Symbol(), MODE_STOPLEVEL);
g_spread_132 = MarketInfo(Symbol(), MODE_SPREAD);
g_str2time_236 = StrToTime(FridayTimeToSet);
if (!WaitNewBarAtStart) gi_208 = TRUE;
else {
if (DayOfWeek() == 5) {
if (g_datetime_232 == 0) g_datetime_232 = iTime(NULL, PERIOD_D1, 0);
if (g_datetime_232 < iTime(NULL, PERIOD_D1, 0)) gi_208 = TRUE;
else {
if (g_datetime_232 == iTime(NULL, PERIOD_D1, 0) && TimeCurrent() >= g_str2time_236) gi_208 = TRUE;
else gi_208 = FALSE;
}
} else {
if (g_datetime_232 == 0) g_datetime_232 = iTime(NULL, PERIOD_D1, 0);
if (g_datetime_232 < iTime(NULL, PERIOD_D1, 0)) gi_208 = TRUE;
else gi_208 = FALSE;
}
}
if (gi_208 && !gi_212 && g_price_184 == 0.0 && g_price_192 == 0.0) {
if (DayOfWeek() == 5 && TimeCurrent() >= g_str2time_236) {
g_price_184 = NormalizeDouble(iHigh(NULL, PERIOD_D1, 0) + g_spread_132 * Point, Digits);
g_price_192 = NormalizeDouble(iLow(NULL, PERIOD_D1, 0), Digits);
} else {
g_price_184 = NormalizeDouble(iHigh(NULL, PERIOD_D1, 1) + g_spread_132 * Point, Digits);
g_price_192 = NormalizeDouble(iLow(NULL, PERIOD_D1, 1), Digits);
}
}
if (!gi_212 && Ask + g_stoplevel_128 * Point > g_price_184 && g_price_184 > 0.0) {
Comment("سذخآإحـ خذؤإذہ BUYSTOP - ", DoubleToStr(g_price_184, Digits), " رثبطتخج ءثباخت ت زإتسظإة ضإحإ!!!");
return (0);
}
if (!gi_212 && Bid - g_stoplevel_128 * Point < g_price_192 && g_price_192 > 0.0) {
Comment("سذخآإحـ خذؤإذہ SELLSTOP - ", DoubleToStr(g_price_192, Digits), " رثبطتخج ءثباخت ت زإتسظإة ضإحإ!!!");
return (0);
}
Comment("");
gi_216 = FALSE;
gi_220 = FALSE;
for (g_pos_120 = OrdersTotal() - 1; g_pos_120 >= 0; g_pos_120--) {
OrderSelect(g_pos_120, SELECT_BY_POS);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != g_magic_124 || OrderType() > OP_SELL) continue;
if (OrderType() == OP_SELL) {
gi_220 = TRUE;
if (TrailStop >= g_stoplevel_128) {
if (OrderOpenPrice() - Ask > TrailStop * Point && OrderStopLoss() > OrderOpenPrice() || OrderStopLoss() == 0.0) OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice(), OrderTakeProfit(), 0, CLR_NONE);
else
if (OrderOpenPrice() - Ask > TrailStop * Point && OrderStopLoss() > Ask + (TrailStop + TrailStep) * Point && OrderStopLoss() <= OrderOpenPrice()) OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(Ask + TrailStop * Point, Digits), OrderTakeProfit(), 0, CLR_NONE);
}
} else {
if (OrderType() == OP_BUY) {
gi_216 = TRUE;
if (TrailStop >= g_stoplevel_128) {
if (Bid - OrderOpenPrice() > TrailStop * Point && OrderStopLoss() < OrderOpenPrice()) OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice(), OrderTakeProfit(), 0, CLR_NONE);
else
if (Bid - OrderOpenPrice() > TrailStop * Point && OrderStopLoss() < Bid - (TrailStop + TrailStep) * Point && OrderStopLoss() >= OrderOpenPrice()) OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(Bid - TrailStop * Point, Digits), OrderTakeProfit(), 0, CLR_NONE);
}
}
}
}
gi_224 = FALSE;
gi_228 = FALSE;
for (g_pos_120 = OrdersTotal() - 1; g_pos_120 >= 0; g_pos_120--) {
OrderSelect(g_pos_120, SELECT_BY_POS);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != g_magic_124 || OrderType() <= OP_SELL) continue;
if (OrderType() == OP_SELLSTOP) {
if (gi_216) OrderDelete(OrderTicket());
else gi_228 = TRUE;
} else {
if (OrderType() == OP_BUYSTOP) {
if (gi_220) OrderDelete(OrderTicket());
else gi_224 = TRUE;
}
}
}
if (gi_228 && gi_224) {
gi_212 = TRUE;
g_datetime_232 = iTime(NULL, PERIOD_D1, 0);
}
if (gi_212 && !gi_220 && !gi_228 && !gi_216 && !gi_224) {
gi_212 = FALSE;
g_price_184 = 0;
g_price_192 = 0;
return (0);
}
RefreshRates();
if (!gi_216 && !gi_224 && gi_208 && !gi_212) {
if (StopLoss < g_stoplevel_128 + g_spread_132) g_price_144 = g_price_192;
else g_price_144 = NormalizeDouble(g_price_184 - StopLoss * Point, Digits);
if (TakeProfit < g_stoplevel_128 - g_spread_132 || TakeProfit == 0) g_price_152 = 0;
else g_price_152 = NormalizeDouble(g_price_184 + TakeProfit * Point, Digits);
OrderSend(Symbol(), OP_BUYSTOP, g_lots_136, g_price_184, 0, g_price_144, g_price_152, g_comment_200, g_magic_124, 0, Red);
}
if (!gi_220 && !gi_228 && gi_208 && !gi_212) {
if (StopLoss < g_stoplevel_128 + g_spread_132) g_price_144 = g_price_184;
else g_price_144 = NormalizeDouble(g_price_192 + StopLoss * Point, Digits);
if (TakeProfit < g_stoplevel_128 - g_spread_132 || TakeProfit == 0) g_price_152 = 0;
else g_price_152 = NormalizeDouble(g_price_192 - TakeProfit * Point, Digits);
OrderSend(Symbol(), OP_SELLSTOP, g_lots_136, g_price_192, 0, g_price_144, g_price_152, g_comment_200, g_magic_124, 0, Blue);
}
return (0);
}