Time: 2015-06-22 | Download file:ForexReplicatorEA_EURUSD.mq4
/* Generated by EX4-TO-MQ4 decompiler V4.0.416.1b [-] Website: https://purebeam.biz E-mail : purebeam@gmail.com */ #property copyright "Copyright © 2012, Forex Replicator. http://forexreplicator.com" #property link "http://forexreplicator.com" #import "ForexReplicator_EURUSD.dll" int listen_market(double& a0[], int a1, double& a2[], int a3, double& a4[], int a5, double& a6[], int a7, double& a8[], int a9, double& a10[], int a11, int a12, int a13, int a14, int a15, int a16, string a17); double gdaa(); #import double gda_76[][6]; double gda_80[][6]; double gda_84[][6]; double gda_88[][6]; double gda_92[][6]; double gda_96[][6]; int gi_104; int gi_108; int gi_112; int gi_116; int gi_120; int gi_124; extern string CommentOrder = "rep"; extern int ChartLength = 50; extern int Forecast = 10; extern int SearchLength = 3000; extern string RiskLevel = "Low(1),High(2)"; extern int Risk = 1; extern double AccuracyLevel = 85.0; extern bool ManageOrders = TRUE; extern bool TraillingOption = TRUE; extern int TrailingStop = 10; extern bool AutoSLTPModify = TRUE; extern int StopLoss = 30; extern int TakeProfit = 20; extern bool SendEmail = TRUE; extern string EmailSubject = "ForexReplicator Signal Notification"; double gd_204 = 0.0; double gd_212 = 0.0; double gda_220[]; double gda_224[]; int g_y_228 = 270; extern color color_disply = White; string gs_236 = ""; double gd_244 = 0.0; double gd_252 = 0.0; int gi_260 = 0; int gi_264 = 0; double gd_268; double gd_276 = 20.0; double gd_284 = 10.0; double gd_292 = 0.0; double gd_300 = 0.0; int init() { return (0); } int deinit() { return (0); } int start() { int li_12; double ld_40; double ld_48; double price_56; double price_64; if (Digits == 3) gd_268 = 10; if (Digits == 2) gd_268 = 1; if (Digits == 5) gd_268 = 10; if (Digits == 4) gd_268 = 1; string str_concat_4 = ""; gi_104 = ArrayCopyRates(gda_76, Symbol(), PERIOD_H4); gi_108 = ArrayCopyRates(gda_80, Symbol(), PERIOD_H1); gi_112 = ArrayCopyRates(gda_84, Symbol(), PERIOD_M30); gi_116 = ArrayCopyRates(gda_88, Symbol(), PERIOD_M15); gi_120 = ArrayCopyRates(gda_92, Symbol(), PERIOD_M5); gi_124 = ArrayCopyRates(gda_96, Symbol(), PERIOD_M1); if (Period() == PERIOD_H4) li_12 = 240; if (Period() == PERIOD_H1) li_12 = 60; if (Period() == PERIOD_M30) li_12 = 30; if (Period() == PERIOD_M15) li_12 = 15; if (Period() == PERIOD_M5) li_12 = 5; if (Period() == PERIOD_M1) li_12 = 1; bool li_16 = FALSE; int li_20 = listen_market(gda_76, gi_104, gda_80, gi_108, gda_84, gi_112, gda_88, gi_116, gda_92, gi_120, gda_96, gi_124, li_16, ChartLength, SearchLength, li_12, Forecast, Symbol()); int li_24 = f0_1(li_20); f0_0(); int li_28 = li_20 - Forecast; for (int count_32 = 0; count_32 < ChartLength; count_32++) f0_2(li_28, count_32 + li_28, Symbol(), Period(), ChartLength, -li_28); if (li_24 == 1) gs_236 = "Long(Buy)"; if (li_24 == 2) gs_236 = "Short(Sell)"; if (li_24 == 0) gs_236 = "Range(No Signal)"; if (li_24 == 1 && gi_260 == FALSE) { str_concat_4 = StringConcatenate(Symbol(), " ", "Long(Buy)"); Alert(str_concat_4); gi_260 = TRUE; } if (li_24 == 2 && gi_260 == FALSE) { str_concat_4 = StringConcatenate(Symbol(), " ", "Short(Sell)"); Alert(str_concat_4); gi_260 = TRUE; } if (li_24 == 0) gi_260 = FALSE; if (li_24 == 1) gd_244 = High[0] * (f0_3(li_20, 1) + 1.0); if (li_24 == 1) gd_252 = Low[0] * (1 - f0_3(li_20, 2)); if (li_24 == 2) gd_244 = Low[0] * (1 - f0_3(li_20, 1)); if (li_24 == 2) gd_252 = High[0] * (f0_3(li_20, 2) + 1.0); if (li_24 == 0) gd_244 = 0; if (li_24 == 0) gd_252 = 0; if (ManageOrders) { for (int pos_36 = 0; pos_36 < OrdersTotal(); pos_36++) { ld_40 = 0; ld_48 = 0; ld_40 = StopLoss * gd_268 * Point; ld_48 = TakeProfit * gd_268 * Point; OrderSelect(pos_36, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() == Symbol() && OrderComment() == CommentOrder) { if (!AutoSLTPModify) { if (OrderType() == OP_BUY && OrderStopLoss() == 0.0) OrderModify(OrderTicket(), OrderOpenPrice(), Bid - ld_40, Ask + ld_48, 0, Blue); if (OrderType() == OP_SELL && OrderStopLoss() == 0.0) OrderModify(OrderTicket(), OrderOpenPrice(), Ask + ld_40, Bid - ld_48, 0, Blue); gd_300 = Bid - ld_40; gd_292 = Ask + ld_48; gd_212 = Ask + ld_40; gd_204 = Bid - ld_48; continue; } price_56 = 0; price_64 = 0; gd_276 = gd_276 * gd_268 * Point; gd_284 = gd_284 * gd_268 * Point; if (OrderType() == OP_BUY) { price_56 = Low[0] * (1 - f0_3(li_20, 2)); price_64 = High[0] * (f0_3(li_20, 1) + 1.0); if (Bid - gd_276 < price_56) price_56 = Bid - gd_276; if (Ask + gd_284 > price_64) price_64 = Ask + gd_284; gd_300 = gd_276; gd_292 = gd_284; } if (OrderType() == OP_SELL) { price_56 = Low[0] * (f0_3(li_20, 1) + 1.0); price_64 = High[0] * (1 - f0_3(li_20, 2)); if (Ask + ld_40 > gd_276) price_56 = Ask + ld_40; if (Bid - ld_48 < gd_284) price_64 = Bid - ld_48; gd_212 = gd_276; gd_204 = gd_284; } if (OrderStopLoss() == 0.0) OrderModify(OrderTicket(), OrderOpenPrice(), price_56, price_64, 0, Blue); } } for (pos_36 = 0; pos_36 < OrdersTotal(); pos_36++) { OrderSelect(pos_36, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() == Symbol() && TraillingOption && OrderComment() == CommentOrder) { if (OrderType() == OP_BUY && Bid - OrderOpenPrice() > TrailingStop * gd_268 * Point && OrderStopLoss() < Bid - Point * TrailingStop * gd_268) OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop * gd_268, OrderTakeProfit(), 0, Blue); if (OrderType() == OP_SELL && OrderOpenPrice() - Ask > TrailingStop * gd_268 * Point && OrderStopLoss() > Ask + Point * TrailingStop * gd_268) OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * TrailingStop * gd_268, OrderTakeProfit(), 0, Blue); } } } ArrayResize(gda_220, Forecast + 10); ArrayResize(gda_224, Forecast + 10); int li_unused_72 = Forecast; string str_concat_76 = ""; if (li_24 == 1 && gi_264 == FALSE && SendEmail) { str_concat_76 = StringConcatenate("ReplicatorForex Signal Information\nCurrency Pair: ", StringSubstr(Symbol(), 0, 6), "\nTime: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS), "\nOrder Type: ", "Long(Buy)", "\nPrice: ", DoubleToStr(Bid, Digits), "\nAccurency Signal: ", DoubleToStr(100.0 * gdaa(), 2), "\nTakeProfit: ", gd_292, "\nStopLoss: ", gd_300, "\nEvent: Ready To Open Trade", "\n\nCurrent Balance: ", DoubleToStr(AccountBalance(), 2), " ", AccountCurrency(), "\nCurrent Equity: ", DoubleToStr(AccountEquity(), 2), " ", AccountCurrency()); SendMail(EmailSubject, str_concat_76); gi_264 = TRUE; } if (li_24 == 2 && gi_264 == FALSE && SendEmail) { str_concat_76 = StringConcatenate("ReplicatorForex Signal Information\nCurrency Pair: ", StringSubstr(Symbol(), 0, 6), "\nTime: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS), "\nOrder Type: ", "Short(Sell)", "\nPrice: ", DoubleToStr(Bid, Digits), "\nAccurency Signal: ", DoubleToStr(100.0 * gdaa(), 2), "\nTakeProfit: ", gd_204, "\nStopLoss: ", gd_212, "\nEvent: Ready To Open Trade", "\n\nCurrent Balance: ", DoubleToStr(AccountBalance(), 2), " ", AccountCurrency(), "\nCurrent Equity: ", DoubleToStr(AccountEquity(), 2), " ", AccountCurrency()); SendMail(EmailSubject, str_concat_76); gi_264 = TRUE; } return (0); } void f0_2(int ai_unused_0, int ai_4, string a_symbol_8, int a_timeframe_16, int ai_20, int ai_24) { double ihigh_68 = iHigh(a_symbol_8, a_timeframe_16, ai_4); double ilow_76 = iLow(a_symbol_8, a_timeframe_16, ai_4); ai_4++; ai_24 += 2; if ((ai_4 + ai_24) % (ai_20 + 3) < Forecast + 1) { gda_220[ai_4 + ai_24] = ihigh_68; gda_224[ai_4 + ai_24] = ilow_76; return; } gda_220[ai_4 + ai_24] = ihigh_68; gda_224[ai_4 + ai_24] = ilow_76; } double f0_3(int ai_0, int ai_4) { double ld_ret_8 = 0.0; int li_16 = f0_1(ai_0); int li_20 = Forecast; double ld_24 = gda_224[li_20 + 1]; double ld_unused_32 = gda_220[li_20]; double ld_unused_40 = gda_220[li_20 - 1]; double ld_48 = gda_220[li_20 - 2]; double ld_unused_56 = gda_220[li_20 - 3]; double ld_unused_64 = gda_220[li_20 - 4]; double ld_72 = gda_224[li_20 + 1]; double ld_unused_80 = gda_224[li_20]; double ld_unused_88 = gda_224[li_20 - 1]; double ld_96 = gda_224[li_20 - 2]; double ld_unused_104 = gda_224[li_20 - 3]; double ld_unused_112 = gda_224[li_20 - 4]; if (li_16 == 1 && ai_4 == 1) ld_ret_8 = MathAbs(ld_24 - ld_48) / ld_24; if (li_16 == 1 && ai_4 == 2) ld_ret_8 = MathAbs(ld_72 - ld_96) / ld_72; if (li_16 == 2 && ai_4 == 1) ld_ret_8 = MathAbs(ld_72 - ld_96) / ld_72; if (li_16 == 2 && ai_4 == 2) ld_ret_8 = MathAbs(ld_24 - ld_48) / ld_24; return (ld_ret_8); } int f0_1(int ai_unused_0) { int li_ret_4 = 0; int li_8 = Forecast; double ld_12 = (gda_220[li_8 + 1] + (gda_224[li_8 + 1])) / 2.0; double ld_20 = (gda_220[li_8] + gda_224[li_8]) / 2.0; double ld_28 = (gda_220[li_8 - 1] + (gda_224[li_8 - 1])) / 2.0; double ld_36 = (gda_220[li_8 - 2] + (gda_224[li_8 - 2])) / 2.0; double ld_44 = (High[li_8] + Low[li_8] + Close[li_8] + Open[li_8]) / 4.0; double ld_52 = (High[li_8 - 1] + (Low[li_8 - 1]) + (Close[li_8 - 1]) + (Open[li_8 - 1])) / 4.0; double ld_60 = (High[li_8 - 2] + (Low[li_8 - 2]) + (Close[li_8 - 2]) + (Open[li_8 - 2])) / 4.0; double ld_68 = (High[li_8 - 3] + (Low[li_8 - 3]) + (Close[li_8 - 3]) + (Open[li_8 - 3])) / 4.0; if (100.0 * gdaa() > AccuracyLevel) { if (Risk == 2) { if (ld_12 < ld_20 && ld_20 < ld_28) li_ret_4 = 1; if (ld_12 > ld_20 && ld_20 > ld_28) li_ret_4 = 2; } if (Risk == 1) { if (ld_12 < ld_20 && ld_20 < ld_28 && ld_28 < ld_36) li_ret_4 = 1; if (ld_12 > ld_20 && ld_20 > ld_28 && ld_28 > ld_36) li_ret_4 = 2; } } return (li_ret_4); } void f0_0() { ObjectCreate("Info_1.1", OBJ_LABEL, 0, 0, 0); ObjectSetText("Info_1.1", "ForexReplicator ", 10, "Courier New Bold", color_disply); ObjectSet("Info_1.1", OBJPROP_CORNER, 2); ObjectSet("Info_1.1", OBJPROP_XDISTANCE, 20); ObjectSet("Info_1.1", OBJPROP_YDISTANCE, g_y_228); ObjectCreate("Info_2", OBJ_LABEL, 0, 0, 0); ObjectSetText("Info_2", "------------------------------------ ", 10, "Courier New Bold", color_disply); ObjectSet("Info_2", OBJPROP_CORNER, 2); ObjectSet("Info_2", OBJPROP_XDISTANCE, 20); ObjectSet("Info_2", OBJPROP_YDISTANCE, g_y_228 - 10); ObjectCreate("Info_3", OBJ_LABEL, 0, 0, 0); ObjectSetText("Info_3", "Broker: " + AccountCompany(), 10, "Courier New Bold", color_disply); ObjectSet("Info_3", OBJPROP_CORNER, 2); ObjectSet("Info_3", OBJPROP_XDISTANCE, 20); ObjectSet("Info_3", OBJPROP_YDISTANCE, g_y_228 - 20); ObjectCreate("Info_4", OBJ_LABEL, 0, 0, 0); ObjectSetText("Info_4", "Broker Time: " + Hour() + ":" + Minute(), 10, "Courier New Bold", color_disply); ObjectSet("Info_4", OBJPROP_CORNER, 2); ObjectSet("Info_4", OBJPROP_XDISTANCE, 20); ObjectSet("Info_4", OBJPROP_YDISTANCE, g_y_228 - 35); ObjectCreate("Info_5", OBJ_LABEL, 0, 0, 0); ObjectSetText("Info_5", "TradingLot = ", 10, "Courier New Bold", color_disply); ObjectSet("Info_5", OBJPROP_CORNER, 2); ObjectSet("Info_5", OBJPROP_XDISTANCE, 20); ObjectSet("Info_5", OBJPROP_YDISTANCE, g_y_228 - 50); ObjectCreate("Info_6", OBJ_LABEL, 0, 0, 0); ObjectSetText("Info_6", "Your Risk = ", 10, "Courier New Bold", color_disply); ObjectSet("Info_6", OBJPROP_CORNER, 2); ObjectSet("Info_6", OBJPROP_XDISTANCE, 20); ObjectSet("Info_6", OBJPROP_YDISTANCE, g_y_228 - 65); ObjectCreate("Info_7", OBJ_LABEL, 0, 0, 0); ObjectSetText("Info_7", "------------------------------------ ", 10, "Courier New Bold", color_disply); ObjectSet("Info_7", OBJPROP_CORNER, 2); ObjectSet("Info_7", OBJPROP_XDISTANCE, 20); ObjectSet("Info_7", OBJPROP_YDISTANCE, g_y_228 - 75); ObjectCreate("Info_8", OBJ_LABEL, 0, 0, 0); ObjectSetText("Info_8", "ACCOUNT INFORMATIONS:", 10, "Courier New Bold", color_disply); ObjectSet("Info_8", OBJPROP_CORNER, 2); ObjectSet("Info_8", OBJPROP_XDISTANCE, 20); ObjectSet("Info_8", OBJPROP_YDISTANCE, g_y_228 - 85); ObjectCreate("Info_9", OBJ_LABEL, 0, 0, 0); ObjectSetText("Info_9", "Account Name: " + AccountName(), 10, "Courier New Bold", color_disply); ObjectSet("Info_9", OBJPROP_CORNER, 2); ObjectSet("Info_9", OBJPROP_XDISTANCE, 20); ObjectSet("Info_9", OBJPROP_YDISTANCE, g_y_228 - 100); ObjectCreate("Info_10", OBJ_LABEL, 0, 0, 0); ObjectSetText("Info_10", "Account number: " + AccountNumber(), 10, "Courier New Bold", color_disply); ObjectSet("Info_10", OBJPROP_CORNER, 2); ObjectSet("Info_10", OBJPROP_XDISTANCE, 20); ObjectSet("Info_10", OBJPROP_YDISTANCE, g_y_228 - 115); ObjectCreate("Info_11", OBJ_LABEL, 0, 0, 0); ObjectSetText("Info_11", "Account leverage: " + DoubleToStr(AccountLeverage(), 0), 10, "Courier New Bold", color_disply); ObjectSet("Info_11", OBJPROP_CORNER, 2); ObjectSet("Info_11", OBJPROP_XDISTANCE, 20); ObjectSet("Info_11", OBJPROP_YDISTANCE, g_y_228 - 130); ObjectCreate("Info_12", OBJ_LABEL, 0, 0, 0); ObjectSetText("Info_12", "Account balance: " + DoubleToStr(AccountBalance(), 2), 10, "Courier New Bold", color_disply); ObjectSet("Info_12", OBJPROP_CORNER, 2); ObjectSet("Info_12", OBJPROP_XDISTANCE, 20); ObjectSet("Info_12", OBJPROP_YDISTANCE, g_y_228 - 145); ObjectCreate("Info_13", OBJ_LABEL, 0, 0, 0); ObjectSetText("Info_13", "Account equity: " + DoubleToStr(AccountEquity(), 2), 10, "Courier New Bold", color_disply); ObjectSet("Info_13", OBJPROP_CORNER, 2); ObjectSet("Info_13", OBJPROP_XDISTANCE, 20); ObjectSet("Info_13", OBJPROP_YDISTANCE, g_y_228 - 160); ObjectCreate("Info_14", OBJ_LABEL, 0, 0, 0); ObjectSetText("Info_14", "Account margin: " + DoubleToStr(AccountMargin(), 2), 10, "Courier New Bold", color_disply); ObjectSet("Info_14", OBJPROP_CORNER, 2); ObjectSet("Info_14", OBJPROP_XDISTANCE, 20); ObjectSet("Info_14", OBJPROP_YDISTANCE, g_y_228 - 175); ObjectCreate("Info_15", OBJ_LABEL, 0, 0, 0); ObjectSetText("Info_15", "Signal Status: " + gs_236, 10, "Courier New Bold", color_disply); ObjectSet("Info_15", OBJPROP_CORNER, 3); ObjectSet("Info_15", OBJPROP_XDISTANCE, 160); ObjectSet("Info_15", OBJPROP_YDISTANCE, g_y_228); ObjectCreate("Info_16", OBJ_LABEL, 0, 0, 0); ObjectSetText("Info_16", "TakeProfit= " + DoubleToStr(gd_244, 5), 10, "Courier New Bold", color_disply); ObjectSet("Info_16", OBJPROP_CORNER, 3); ObjectSet("Info_16", OBJPROP_XDISTANCE, 200); ObjectSet("Info_16", OBJPROP_YDISTANCE, g_y_228 - 13); ObjectCreate("Info_16", OBJ_LABEL, 0, 0, 0); ObjectSetText("Info_17", "StopLoss= " + DoubleToStr(gd_252, 5), 10, "Courier New Bold", color_disply); ObjectSet("Info_17", OBJPROP_CORNER, 3); ObjectSet("Info_17", OBJPROP_XDISTANCE, 200); ObjectSet("Info_17", OBJPROP_YDISTANCE, g_y_228 - 30); ObjectCreate("Info_17", OBJ_LABEL, 0, 0, 0); }