//+------------------------------------------------------------------+ //| GOLDEX | //| Copyright 2021, LSTECH INDUSTRIES | //| http://www.lstechindustries.co.uk | //+------------------------------------------------------------------+ #property copyright "Copyright 2021 LSTECH INDUSTRIES"; #property link " www.lstechindustries.co.uk"; #property version ""; #property strict #property description "GOLDEX"; extern string LicenseKey; extern int MagicNumber = 20230104; extern double Lots = 0.1; extern int TakeProfit = 3; extern int StopLoss = 300; extern int Slippage = 3; extern bool OpenOnNewCandle = true; extern bool PipSet = true; extern bool PendingOrders = true; extern bool Averaging = true; extern int AveragingStep = 3; extern int TrailingStop; extern bool MM; extern double Risk = 0.1; extern bool UseZigZag = true; extern int ExtDepth = 30; extern int ExtDeviation = 10; extern int ExtBackstep = 7; extern bool UseIINWMARROWS; extern int FasterMA = 5; extern int SlowerMA = 8; extern string note1 = "Faster/Slower Mode Option"; extern string note2 = "0=sma, 1=ema, 2=smma, 3=lwma"; extern int FasterMode = 1; // 0=sma, 1=ema, 2=smma, 3=lwma extern int SlowerMode = 1; // 0=sma, 1=ema, 2=smma, 3=lwma extern string note3 = "Your Alert Options"; extern string note4 = "true using your wav file"; extern string note5 = "false using default alert"; extern bool YourAlert; extern bool TradingTime; extern int StartTime_Hour; extern int StartTime_Minute; extern int EndTime_Hour; extern int EndTime_Minute; struct IINWMARROWS { public: datetime m_16; double m_24[]; double m_76[]; int m_128; int m_132; int m_136; int m_140; bool m_144; int m_145; int func_1024() { int Li_FFF4; int Li_FFF0; int Li_FFEC; int Li_FFE8; double Ld_FFE0; double Ld_FFD8; double Ld_FFD0; double Ld_FFC8; double Ld_FFC0; double Ld_FFB8; double Ld_FFB0; double Ld_FFA8; int Li_FFF8; Gi_0000 = Bars; if (ArraySize(this.m_24) < Gi_0000) { ArraySetAsSeries(this.m_24, false); ArrayResize(this.m_24, Bars, 0); ArraySetAsSeries(this.m_24, true); } if (ArraySize(this.m_76) < Gi_0000) { ArraySetAsSeries(this.m_76, false); ArrayResize(this.m_76, Gi_0000, 0); ArraySetAsSeries(this.m_76, true); } Li_FFF4 = 0; Li_FFF0 = 0; Li_FFEC = 0; Li_FFE8 = 9; Ld_FFE0 = 0; Ld_FFD8 = 0; Ld_FFD0 = 0; Ld_FFC8 = 0; Ld_FFC0 = 0; Ld_FFB8 = 0; Ld_FFB0 = 0; Ld_FFA8 = 0; if (this.m_145 < 0) { Li_FFF8 = -1; return Li_FFF8; } if (this.m_145 > 0) { this.m_145 = this.m_145 - 1; } Li_FFF4 = Bars - this.m_145; Li_FFF0 = 0; if (Li_FFF4 >= 0 && Bars > 0) { do { Li_FFEC = Li_FFF0; Ld_FFB0 = 0; Ld_FFA8 = 0; Li_FFEC = Li_FFF0; Gi_0001 = Li_FFF0 + Li_FFE8; if (Li_FFF0 <= Gi_0001 && Li_FFF0 < Bars) { do { Gd_0001 = fabs((High[Li_FFEC] - Low[Li_FFEC])); Ld_FFA8 = (Ld_FFA8 + Gd_0001); Li_FFEC = Li_FFEC + 1; Gi_0001 = Li_FFF0 + Li_FFE8; if (Li_FFEC > Gi_0001) break; } while (Li_FFEC < Bars); } Ld_FFB0 = (Ld_FFA8 / 10); Ld_FFE0 = iMA(NULL, 0, this.m_128, 0, this.m_136, 0, Li_FFF0); Gi_0001 = Li_FFF0 + 1; Ld_FFD0 = iMA(NULL, 0, this.m_128, 0, this.m_136, 0, Gi_0001); Gi_0004 = Li_FFF0 - 1; Ld_FFC0 = iMA(NULL, 0, this.m_128, 0, this.m_136, 0, Gi_0004); Ld_FFD8 = iMA(NULL, 0, this.m_132, 0, this.m_140, 1, Li_FFF0); Ld_FFC8 = iMA(NULL, 0, this.m_132, 0, this.m_140, 1, Gi_0001); returned_double = iMA(NULL, 0, this.m_132, 0, this.m_140, 1, Gi_0004); Ld_FFB8 = returned_double; if (Ld_FFE0 > Ld_FFD8 && Ld_FFD0 < Ld_FFC8 && Ld_FFC0 > returned_double) { Gd_0001 = (Ld_FFB0 * 0.5); Gd_0001 = (Low[Li_FFF0] - Gd_0001); this.m_24[Li_FFF0] = Gd_0001; if (this.m_16 != Time[0]) { if (this.m_144 == 0) { Alert(_Symbol, " M", _Period, " IINWMARROWS BUY"); } else { PlaySound("alert1.wav"); } } this.m_16 = Time[0]; } else { this.m_24[Li_FFF0] = 0; if (Ld_FFE0 < Ld_FFD8 && Ld_FFD0 > Ld_FFC8 && Ld_FFC0 < Ld_FFB8) { Gd_0001 = ((Ld_FFB0 * 0.5) + High[Li_FFF0]); this.m_76[Li_FFF0] = Gd_0001; if (this.m_16 != Time[0]) { if (this.m_144 == 0) { Alert(_Symbol, " M", _Period, " IINWMARROWS SELL"); } else { PlaySound("alert2.wav"); } } this.m_16 = Time[0]; } else { this.m_76[Li_FFF0] = 0; } } Li_FFF0 = Li_FFF0 + 1; if (Li_FFF0 > Li_FFF4) break; } while (Li_FFF0 < Bars); } this.m_145 = Bars; Li_FFF8 = 0; return Li_FFF8; } private: }; int Ii_0000; long Gl_0000; long returned_l; long Gl_0001; int Gi_0000; int returned_i; int Gi_0001; bool returned_b; double Gd_0002; double Gd_0003; int Gi_0004; int Ii_007C; int Gi_0005; int Gi_0006; int Gi_0007; int Gi_0008; int Gi_0009; double Gd_0007; double Gd_0008; long Gl_0002; long Gl_0003; bool Gb_0004; long Il_0008; long Il_0010; long Gl_0006; double Id_0018; double Id_0020; int Ii_0028; int Ii_002C; double Id_0030; double Id_0038; double Id_0040; double Gd_0000; double Ind_000; double Gd_0001; double Ind_003; int Gi_0003; double Gd_0005; double Gd_0006; int Gi_0002; int Gi_000A; int Gi_000F; int Gi_0010; int Gi_0011; int Gi_0012; int Gi_0013; int Gi_0014; bool Gb_0012; double Gd_0015; int Gi_0015; int Gi_0016; int Gi_0017; int Gi_0018; double Gd_0019; double Gd_001A; double Gd_0016; int Gi_001B; double Gd_001B; int Gi_001C; int Gi_001D; int Gi_001E; int Gi_001F; double Gd_0020; double Gd_0021; double Gd_001D; double Gd_0022; int Gi_0023; int Gi_0024; int Gi_0029; int Gi_002A; int Gi_002B; int Gi_002C; int Gi_002D; int Gi_002E; bool Gb_002C; double Gd_002F; int Gi_002F; int Gi_0030; int Gi_0031; int Gi_0032; double Gd_0033; double Gd_0034; double Gd_0030; int Gi_0035; int Gi_0025; int Gi_0026; double Gd_0027; double Gd_0028; int Gi_000B; int Gi_000C; double Gd_000D; double Gd_000E; double Gd_0004; string Gs_0002; string Gs_0003; string Gs_0004; string Gs_0005; string Gs_0006; string Gs_0007; string Gs_0008; string Gs_0009; string Gs_000A; string Gs_000B; string Gs_000C; double Ind_002; string Gs_000D; string Gs_000E; string Gs_000F; string Gs_0010; string Gs_0011; string Gs_0012; string Gs_0013; string Gs_0015; string Gs_0016; long Gl_0005; long Gl_0007; double Gd_0009; double Gd_000B; long Gl_000A; long Gl_000C; int Ii_0048[]; int Ii_0080[]; double Id_00B4[]; double Id_00E8[]; double returned_double; IINWMARROWS Input_IINWMARROWS; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { string Gs_51; string Gs_62; int Li_4; int Gi_1; int Gl_2; bool Gb_0; int Gl_0; int Li_2; int Li_3; Gs_51 = LicenseKey; Gl_0 = StringToInteger(Gs_51); Gi_1 = AccountNumber() + 8922; Gi_1 = Gi_1 * 2; Gi_1 = Gi_1 + 19950809; Gi_1 = fabs(Gi_1); Gl_2 = Gi_1; if(Gl_0 == Gl_2) // Goto_00000006 { Gb_0 = true; } // Goto_00000005 else // Label 00000006 { Gb_0 = false; } // Label 00000005 if(Gb_0 != true) // Goto_00000003 { Alert("You are not allowed to run ea on this account, contact vendor to buy valid license.\nPlease contact me www.lstechindustries.co.uk"); ExpertRemove(); Li_4 = 0; return Li_4; } // Label 00000003 if (TimeCurrent() > StrToTime("2024.01.01")) { Alert("Expired!, Please contact me www.lstechindustries.co.uk"); ExpertRemove(); return INIT_FAILED; } Ii_0000 = 0; Il_0008 = 0; Il_0010 = 0; Id_0018 = 0; Id_0020 = 0; Ii_0028 = 0; Ii_002C = 0; Id_0030 = 0; Id_0038 = 0; Id_0040 = 0; Ii_007C = 0; Input_IINWMARROWS.m_128 = FasterMA; Input_IINWMARROWS.m_132 = SlowerMA; Input_IINWMARROWS.m_136 = FasterMode; Input_IINWMARROWS.m_140 = SlowerMode; Input_IINWMARROWS.m_144 = YourAlert; Input_IINWMARROWS.m_145 = 0; int Li_FFFC; int Li_FFF8; Gi_0000 = OrdersTotal(); Gi_0001 = 0; if (Gi_0000 > 0) { do { if (!OrderSelect(Gi_0001, 0, 0)) break; if (OrderSymbol() == _Symbol && OrderMagicNumber() == MagicNumber) { Gd_0002 = OrderTakeProfit(); Gd_0003 = OrderStopLoss(); Gi_0004 = OrderTicket(); Ii_007C = Ii_007C + 1; Gi_0005 = Ii_007C; ArrayResize(Ii_0080, Ii_007C, 0); Gi_0006 = Ii_007C - 1; Ii_0080[Gi_0006] = Gi_0004; ArrayResize(Id_00B4, Gi_0005, 0); Gi_0007 = Gi_0005 - 1; Gi_0008 = Gi_0007; Id_00B4[Gi_0007] = Gd_0002; ArrayResize(Id_00E8, Gi_0005, 0); Gi_0009 = Gi_0008; Id_00E8[Gi_0008] = Gd_0003; } Gi_0001 = Gi_0001 + 1; } while (Gi_0001 < Gi_0000); } Li_FFF8 = (int)MarketInfo(_Symbol, MODE_SPREAD); if ((_Digits != 3 && _Digits != 5 && StopLoss < Li_FFF8) || StopLoss * 10 < Li_FFF8) { Print("StopLoss less than spread."); Li_FFFC = 32767; return Li_FFFC; } if (_Digits == 3 || _Digits == 5) { TakeProfit = TakeProfit * 10; StopLoss = StopLoss * 10; Slippage = Slippage * 10; AveragingStep = AveragingStep * 10; TrailingStop = TrailingStop * 10; } Input_IINWMARROWS.m_128 = FasterMA; Input_IINWMARROWS.m_132 = SlowerMA; Input_IINWMARROWS.m_136 = FasterMode; Input_IINWMARROWS.m_140 = SlowerMode; Input_IINWMARROWS.m_144 = YourAlert; Input_IINWMARROWS.m_145 = 0; Input_IINWMARROWS.func_1024(); Li_FFFC = 0; return Li_FFFC; } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void OnTick() { MqlDateTime Local_Struct_FFFFFFE0; if (TradingTime == true) { Gl_0000 = Time[0]; Local_Struct_FFFFFFE0.day = TimeDay(Gl_0000); Local_Struct_FFFFFFE0.mon = TimeMonth(Gl_0000); Local_Struct_FFFFFFE0.year = TimeYear(Gl_0000); Local_Struct_FFFFFFE0.sec = 0; Local_Struct_FFFFFFE0.hour = StartTime_Hour; Local_Struct_FFFFFFE0.min = StartTime_Minute; Gl_0002 = StructToTime(Local_Struct_FFFFFFE0); Local_Struct_FFFFFFE0.hour = EndTime_Hour; Local_Struct_FFFFFFE0.min = EndTime_Minute; Gl_0003 = StructToTime(Local_Struct_FFFFFFE0); if (Gl_0000 >= Gl_0002 && Gl_0000 < Gl_0003) { Gb_0004 = true; } else { Gb_0004 = false; } } else { Gb_0004 = true; } if (Gb_0004 == false) return; if (Il_0008 == 0 || Il_0008 < TimeGMT()) { if (Il_0010 == 0 || Il_0010 > TimeGMT()) { func_1005(); if ((!OpenOnNewCandle && PipSet == false) || Volume[0] == 1) { func_1013(); } func_1019(); return ; } } Alert("Time trial version has expired."); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int func_1003(double Fa_d_00, double Fa_d_01, int Fa_i_02, bool FuncArg_Boolean_00000003) { int Li_FFFC; double Ld_FFF0; double Ld_FFE8; double Ld_FFE0; int Li_FFDC; if (Fa_i_02 != 0 && Fa_i_02 != 2 && Fa_i_02 != 4) { Li_FFFC = 0; return Li_FFFC; } if (MM) { Gd_0000 = Lots; HistoryTotal(); Gd_0000 = NormalizeDouble(((AccountFreeMargin() * Risk) / 1000), 1); if (Gd_0000 < 0.1) { Gd_0000 = 0.1; } Lots = Gd_0000; } if (Fa_d_00 == 0) { Fa_d_00 = Ask; } if (Fa_d_01 == 0) { Fa_d_01 = Lots; } returned_double = MarketInfo(_Symbol, MODE_STOPLEVEL); Ld_FFF0 = returned_double; if (StopLoss <= Ld_FFF0) { Gd_0001 = returned_double; } else { Gd_0001 = StopLoss; } Gd_0001 = (Gd_0001 * _Point); Ld_FFE8 = NormalizeDouble((Fa_d_00 - Gd_0001), _Digits); if (TakeProfit <= Ld_FFF0) { Gd_0001 = Ld_FFF0; } else { Gd_0001 = TakeProfit; } returned_double = NormalizeDouble(((Gd_0001 * _Point) + Fa_d_00), _Digits); Ld_FFE0 = returned_double; Li_FFDC = OrderSend(_Symbol, Fa_i_02, Fa_d_01, Fa_d_00, Slippage, Ld_FFE8, returned_double, "GOLDEX", MagicNumber, 0, 32768); if (Li_FFDC > 0) { if (OrderSelect(Li_FFDC, 1, 0)) { Gd_0001 = NormalizeDouble(((TakeProfit * _Point) + Fa_d_00), _Digits); Gd_0002 = (StopLoss * _Point); Gd_0002 = NormalizeDouble((Fa_d_00 - Gd_0002), _Digits); Ii_007C = Ii_007C + 1; Gi_0003 = Ii_007C; ArrayResize(Ii_0080, Ii_007C, 0); Gi_0004 = Ii_007C - 1; Ii_0080[Gi_0004] = Li_FFDC; ArrayResize(Id_00B4, Gi_0003, 0); Gi_0005 = Gi_0003 - 1; Gi_0006 = Gi_0005; Id_00B4[Gi_0005] = Gd_0001; ArrayResize(Id_00E8, Gi_0003, 0); Gi_0007 = Gi_0006; Id_00E8[Gi_0006] = Gd_0002; Print("BUY order opened : ", OrderOpenPrice()); } if (FuncArg_Boolean_00000003 != true) { Gi_0007 = ArraySize(Ii_0048); ArrayResize(Ii_0048, (ArraySize(Ii_0048) + 1), 0); Ii_0048[Gi_0007] = Li_FFDC; } func_1018(0); return Li_FFDC; } Print("Error opening BUY order : ", GetLastError()); Li_FFFC = Li_FFDC; return Li_FFFC; } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int func_1004(double Fa_d_00, double Fa_d_01, int Fa_i_02, bool FuncArg_Boolean_00000003) { int Li_FFFC; double Ld_FFF0; double Ld_FFE8; double Ld_FFE0; int Li_FFDC; if (Fa_i_02 != 1 && Fa_i_02 != 3 && Fa_i_02 != 5) { Li_FFFC = 0; return Li_FFFC; } if (MM) { Gd_0000 = Lots; HistoryTotal(); Gd_0000 = NormalizeDouble(((AccountFreeMargin() * Risk) / 1000), 1); if (Gd_0000 < 0.1) { Gd_0000 = 0.1; } Lots = Gd_0000; } if (Fa_d_00 == 0) { Fa_d_00 = Bid; } if (Fa_d_01 == 0) { Fa_d_01 = Lots; } returned_double = MarketInfo(_Symbol, MODE_STOPLEVEL); Ld_FFF0 = returned_double; if (StopLoss <= Ld_FFF0) { Gd_0001 = returned_double; } else { Gd_0001 = StopLoss; } Ld_FFE8 = NormalizeDouble(((Gd_0001 * _Point) + Fa_d_00), _Digits); if (TakeProfit <= Ld_FFF0) { Gd_0001 = Ld_FFF0; } else { Gd_0001 = TakeProfit; } Gd_0001 = (Gd_0001 * _Point); returned_double = NormalizeDouble((Fa_d_00 - Gd_0001), _Digits); Ld_FFE0 = returned_double; Li_FFDC = OrderSend(_Symbol, Fa_i_02, Fa_d_01, Fa_d_00, Slippage, Ld_FFE8, returned_double, "GOLDEX", MagicNumber, 0, 255); if (Li_FFDC > 0) { if (OrderSelect(Li_FFDC, 1, 0)) { Gd_0001 = (TakeProfit * _Point); Gd_0001 = NormalizeDouble((Fa_d_00 - Gd_0001), _Digits); Gd_0002 = NormalizeDouble(((StopLoss * _Point) + Fa_d_00), _Digits); Ii_007C = Ii_007C + 1; Gi_0003 = Ii_007C; ArrayResize(Ii_0080, Ii_007C, 0); Gi_0004 = Ii_007C - 1; Ii_0080[Gi_0004] = Li_FFDC; ArrayResize(Id_00B4, Gi_0003, 0); Gi_0005 = Gi_0003 - 1; Gi_0006 = Gi_0005; Id_00B4[Gi_0005] = Gd_0001; ArrayResize(Id_00E8, Gi_0003, 0); Gi_0007 = Gi_0006; Id_00E8[Gi_0006] = Gd_0002; Print("SELL order opened : ", OrderOpenPrice()); } if (FuncArg_Boolean_00000003 != true) { Gi_0007 = ArraySize(Ii_0048); ArrayResize(Ii_0048, (ArraySize(Ii_0048) + 1), 0); Ii_0048[Gi_0007] = Li_FFDC; } func_1018(1); return Li_FFDC; } Print("Error opening SELL order : ", GetLastError()); Li_FFFC = Li_FFDC; return Li_FFFC; } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void func_1005() { int Li_FFFC; int Li_FFF8; double Ld_FFF0; double Ld_FFE8; double Ld_FFE0; double Ld_FFD8; Ii_0028 = 0; Ii_002C = 0; Id_0030 = 0; Id_0038 = 0; Li_FFFC = OrdersTotal(); Li_FFF8 = 0; if (Li_FFFC <= 0) return; do { if (!OrderSelect(Li_FFF8, 0, 0)) return; if (OrderSymbol() == _Symbol && OrderMagicNumber() == MagicNumber) { if (OrderType() == OP_BUY) { if (TrailingStop > 0) { Gd_0000 = (Bid - OrderOpenPrice()); if (Gd_0000 > (_Point * TrailingStop)) { Gd_0000 = 0; Gd_0001 = 0; Gi_0002 = OrderTicket(); Gi_0003 = Ii_007C - 1; Gi_0004 = Gi_0003; if (Gi_0003 >= 0) { do { if (Ii_0080[Gi_0004] == Gi_0002) { Gd_0001 = Id_00B4[Gi_0004]; Gd_0000 = Id_00E8[Gi_0004]; break; } Gi_0004 = Gi_0004 - 1; } while (Gi_0004 >= 0); } if (OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(((_Point * TrailingStop) + Gd_0000), _Digits), Gd_0001, 0, 16711680) != true) { Print("Error modifying orders. Error code=", GetLastError()); } else { Gd_0003 = OrderTakeProfit(); Gd_0008 = OrderStopLoss(); Gi_0009 = OrderTicket(); Gi_000A = Ii_007C - 1; Gi_000B = Gi_000A; if (Gi_000A >= 0) { do { if (Ii_0080[Gi_000B] == Gi_0009) { Id_00B4[Gi_000B] = Gd_0003; Id_00E8[Gi_000B] = Gd_0008; break; } Gi_000B = Gi_000B - 1; } while (Gi_000B >= 0); } Print("Price Stop Loss order successfully modified."); } } } Gi_000A = 0; if (Averaging) { Gi_000F = OrderTicket(); Gi_0010 = ArraySize(Ii_0048); Gi_0011 = 0; Gb_0012 = false; if (ArraySize(Ii_0048) > 0) { do { if (Ii_0048[Gi_0011] == Gi_000F) { Ii_0048[Gi_0011] = 0; Gb_0012 = true; break; } Gi_0011 = Gi_0011 + 1; } while (Gi_0011 < Gi_0010); } else Gb_0012 = false; if (Gb_0012) { Gd_0015 = (OrderOpenPrice() - Bid); if ((Gi_000A == 0 && Gd_0015 > (_Point * AveragingStep)) || (Gi_000A == 1 && (Ask - OrderOpenPrice()) > (_Point * AveragingStep))) { if (Gi_000A == 0) { func_1003(0, Lots, 0, true); } if (Gi_000A == 1) { func_1004(0, Lots, 1, true); } } } } Ld_FFF0 = 0; Ld_FFE8 = 0; Gi_0015 = OrderTicket(); Gi_0016 = Ii_007C - 1; Gi_0017 = Gi_0016; if (Gi_0016 >= 0) { do { if (Ii_0080[Gi_0017] == Gi_0015) { Ld_FFE8 = Id_00B4[Gi_0017]; Ld_FFF0 = Id_00E8[Gi_0017]; break; } Gi_0017 = Gi_0017 - 1; } while (Gi_0017 >= 0); } if (Ld_FFE8 <= Bid || Ld_FFF0 >= Bid) { if (!OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, 255)) { Print("Error close BUY order : ", GetLastError()); } } else { Ii_0028 = Ii_0028 + 1; } Id_0030 = (Id_0030 + OrderLots()); } if (OrderType() == OP_SELL) { if (TrailingStop > 0) { Gd_0016 = (OrderOpenPrice() - Ask); if (Gd_0016 > (_Point * TrailingStop)) { Gd_0016 = 0; Gd_001B = 0; Gi_001C = OrderTicket(); Gi_001D = Ii_007C - 1; Gi_001E = Gi_001D; if (Gi_001D >= 0) { do { if (Ii_0080[Gi_001E] == Gi_001C) { Gd_001B = Id_00B4[Gi_001E]; Gd_0016 = Id_00E8[Gi_001E]; break; } Gi_001E = Gi_001E - 1; } while (Gi_001E >= 0); } Gd_001D = (_Point * TrailingStop); if (OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble((Gd_0016 - Gd_001D), _Digits), Gd_001B, 0, 16711680) != true) { Print("Error modifying orders. Error code=", GetLastError()); } else { Print("Price Stop Loss order successfully modified."); Gd_001D = OrderTakeProfit(); Gd_0022 = OrderStopLoss(); Gi_0023 = OrderTicket(); Gi_0024 = Ii_007C - 1; Gi_0025 = Gi_0024; if (Gi_0024 >= 0) { do { if (Ii_0080[Gi_0025] == Gi_0023) { Id_00B4[Gi_0025] = Gd_001D; Id_00E8[Gi_0025] = Gd_0022; break; } Gi_0025 = Gi_0025 - 1; } while (Gi_0025 >= 0); } } } } Gi_0024 = 1; if (Averaging) { Gi_0029 = OrderTicket(); Gi_002A = ArraySize(Ii_0048); Gi_002B = 0; Gb_002C = false; if (ArraySize(Ii_0048) > 0) { do { if (Ii_0048[Gi_002B] == Gi_0029) { Ii_0048[Gi_002B] = 0; Gb_002C = true; break; } Gi_002B = Gi_002B + 1; } while (Gi_002B < Gi_002A); } else Gb_002C = false; if (Gb_002C) { if ((Gi_0024 == 0 && OrderOpenPrice() - Bid > (_Point * AveragingStep)) || (Gi_0024 == 1 && (Ask - OrderOpenPrice() > _Point * AveragingStep))) { if (Gi_0024 == 0) { func_1003(0, Lots, 0, true); } if (Gi_0024 == 1) { Print("######### "); func_1004(0, Lots, 1, true); } } } } Ld_FFE0 = 0; Ld_FFD8 = 0; Gi_002F = OrderTicket(); Gi_0030 = Ii_007C - 1; Gi_0031 = Gi_0030; if (Gi_0030 >= 0) { do { if (Ii_0080[Gi_0031] == Gi_002F) { Ld_FFD8 = Id_00B4[Gi_0031]; Ld_FFE0 = Id_00E8[Gi_0031]; break; } Gi_0031 = Gi_0031 - 1; } while (Gi_0031 >= 0); } if (Ld_FFD8 >= Ask || Ld_FFE0 <= Ask) { if (!OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, 255)) { Print("Error close SELL order : ", GetLastError()); } } else { Ii_002C = Ii_002C + 1; } Id_0038 = (Id_0038 + OrderLots()); } } Li_FFF8 = Li_FFF8 + 1; } while (Li_FFF8 < Li_FFFC); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void func_1013() { double Ld_FFF8; double Ld_FFF0; int Li_FFEC; double Ld_FFE0; double Ld_FFD8; double Ld_FFD0; double Ld_FFC8; if (UseZigZag) { Ld_FFF8 = 0; Ld_FFF0 = 0; Li_FFEC = 0; if (iCustom(NULL, 0, "ZigZag", ExtDepth, ExtDeviation, ExtBackstep, 0, 0) == 0) { do { Li_FFEC = Li_FFEC + 1; } while (iCustom(NULL, 0, "ZigZag", ExtDepth, ExtDeviation, ExtBackstep, 0, Li_FFEC) == 0); } Ld_FFF8 = iCustom(NULL, 0, "ZigZag", ExtDepth, ExtDeviation, ExtBackstep, 0, Li_FFEC); Li_FFEC = Li_FFEC + 1; if (iCustom(NULL, 0, "ZigZag", ExtDepth, ExtDeviation, ExtBackstep, 0, Li_FFEC) == 0) { do { Li_FFEC = Li_FFEC + 1; } while (iCustom(NULL, 0, "ZigZag", ExtDepth, ExtDeviation, ExtBackstep, 0, Li_FFEC) == 0); } returned_double = iCustom(NULL, 0, "ZigZag", ExtDepth, ExtDeviation, ExtBackstep, 0, Li_FFEC); Ld_FFF0 = returned_double; if (PipSet) { if (returned_double > Ld_FFF8) { func_1003(0, 0, 0, false); } else { func_1004(0, 0, 1, false); } } if (Id_0018 != Ld_FFF8) { if (Id_0018 != 0 && Id_0020 != 0) { if (Ld_FFF0 > Ld_FFF8) { if (PipSet != true) { if (OpenOnNewCandle || Ii_0028 == 0) { func_1003(0, 0, 0, false); } } Ld_FFE0 = (Ld_FFF0 + _Point); if (PendingOrders && Ld_FFE0 != Id_0040) { Gi_0000 = 0; if (OrdersTotal() > 0) { do { if (!OrderSelect(Gi_0000, 0, 0)) break; if (OrderSymbol() == _Symbol && OrderMagicNumber() == MagicNumber) { if (OrderType() == OP_BUYSTOP || OrderType() == OP_SELLSTOP || OrderType() == OP_BUYLIMIT || OrderType() == OP_SELLLIMIT) { if (OrderDelete(OrderTicket(), 255) != true) { Print("Error delete pending order : ", GetLastError()); } } } Gi_0000 = Gi_0000 + 1; } while (Gi_0000 < OrdersTotal()); } func_1003(Ld_FFE0, 0, 4, false); func_1004(Ld_FFE0, 0, 3, false); Id_0040 = Ld_FFE0; } } if (Ld_FFF0 < Ld_FFF8) { if (PipSet != true) { if (OpenOnNewCandle || Ii_002C == 0) { func_1004(0, 0, 1, false); } } Ld_FFD8 = (Ld_FFF0 - _Point); if (PendingOrders && Ld_FFD8 != Id_0040) { Gi_0001 = 0; if (OrdersTotal() > 0) { do { if (!OrderSelect(Gi_0001, 0, 0)) break; if (OrderSymbol() == _Symbol && OrderMagicNumber() == MagicNumber) { if (OrderType() == OP_BUYSTOP || OrderType() == OP_SELLSTOP || OrderType() == OP_BUYLIMIT || OrderType() == OP_SELLLIMIT) { if (OrderDelete(OrderTicket(), 255) != true) { Print("Error delete pending order : ", GetLastError()); } } } Gi_0001 = Gi_0001 + 1; } while (Gi_0001 < OrdersTotal()); } func_1004(Ld_FFD8, 0, 5, false); func_1003(Ld_FFD8, 0, 2, false); Id_0040 = Ld_FFD8; } } } Id_0018 = Ld_FFF8; Id_0020 = Ld_FFF0; } } if (UseIINWMARROWS == false) return; Input_IINWMARROWS.func_1024(); Ld_FFD0 = Input_IINWMARROWS.m_24[1]; Ld_FFC8 = Input_IINWMARROWS.m_76[1]; if (OpenOnNewCandle || Ii_0028 == 0) { if (Ld_FFD0 > 0) { func_1003(0, 0, 0, false); } } if (OpenOnNewCandle || Ii_002C == 0) { if (Ld_FFC8 <= 0) return; func_1004(0, 0, 1, false); } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void func_1018(int Fa_i_00) { bool Lb_FFFF; int Li_FFF8; double Ld_FFF0; int Li_FFEC; int Li_FFE8; double Ld_FFE0; double Ld_FFD8; double Ld_FFD0; if (Averaging == false) return; Lb_FFFF = false; Li_FFF8 = 0; Ld_FFF0 = 0; Li_FFEC = 0; Li_FFE8 = OrdersTotal(); Li_FFF8 = 0; if (Li_FFE8 > 0) { do { if (!OrderSelect(Li_FFF8, 0, 0)) break; if (OrderSymbol() == _Symbol && OrderMagicNumber() == MagicNumber && OrderType() == Fa_i_00) { Ld_FFF0 = (Ld_FFF0 + OrderOpenPrice()); Li_FFEC = Li_FFEC + 1; } Li_FFF8 = Li_FFF8 + 1; } while (Li_FFF8 < Li_FFE8); } if (Li_FFEC != 0) { Ld_FFF0 = (Ld_FFF0 / Li_FFEC); } Ld_FFE0 = 0; Ld_FFD8 = 0; Ld_FFD0 = 0; returned_double = MarketInfo(_Symbol, MODE_STOPLEVEL); Ld_FFE0 = returned_double; if (Fa_i_00 == 0) { if (StopLoss <= returned_double) { Gd_0000 = returned_double; } else { Gd_0000 = StopLoss; } Gd_0000 = (Gd_0000 * _Point); Ld_FFD8 = NormalizeDouble((Ld_FFF0 - Gd_0000), _Digits); if (TakeProfit <= Ld_FFE0) { Gd_0000 = Ld_FFE0; } else { Gd_0000 = TakeProfit; } Ld_FFD0 = NormalizeDouble(((Gd_0000 * _Point) + Ld_FFF0), _Digits); } if (Fa_i_00 == 1) { if (StopLoss <= Ld_FFE0) { Gd_0000 = Ld_FFE0; } else { Gd_0000 = StopLoss; } Ld_FFD8 = NormalizeDouble(((Gd_0000 * _Point) + Ld_FFF0), _Digits); if (TakeProfit <= Ld_FFE0) { Gd_0000 = Ld_FFE0; } else { Gd_0000 = TakeProfit; } Gd_0000 = (Gd_0000 * _Point); Ld_FFD0 = NormalizeDouble((Ld_FFF0 - Gd_0000), _Digits); } if (Li_FFEC <= 1) return; Li_FFF8 = 0; if (Li_FFE8 <= 0) return; do { if (!OrderSelect(Li_FFF8, 0, 0)) return; if (OrderSymbol() == _Symbol && OrderMagicNumber() == MagicNumber && OrderType() == Fa_i_00) { Lb_FFFF = OrderModify(OrderTicket(), Ld_FFF0, Ld_FFD8, Ld_FFD0, 0, 16711680); if (Lb_FFFF != true) { Print("Error modifying orders. Error code=", GetLastError()); } else { if (Fa_i_00 == 0) { Gd_0000 = NormalizeDouble(((TakeProfit * _Point) + Ld_FFF0), _Digits); Gd_0001 = (StopLoss * _Point); Gd_0001 = NormalizeDouble((Ld_FFF0 - Gd_0001), _Digits); Gi_0002 = OrderTicket(); Gi_0003 = Ii_007C - 1; Gi_0004 = Gi_0003; if (Gi_0003 >= 0) { do { if (Ii_0080[Gi_0004] == Gi_0002) { Id_00B4[Gi_0004] = Gd_0000; Id_00E8[Gi_0004] = Gd_0001; break; } Gi_0004 = Gi_0004 - 1; } while (Gi_0004 >= 0); } } if (Fa_i_00 == 1) { Gd_0003 = (TakeProfit * _Point); Gd_0003 = NormalizeDouble((Ld_FFF0 - Gd_0003), _Digits); Gd_0008 = NormalizeDouble(((StopLoss * _Point) + Ld_FFF0), _Digits); Gi_0009 = OrderTicket(); Gi_000A = Ii_007C - 1; Gi_000B = Gi_000A; if (Gi_000A >= 0) { do { if (Ii_0080[Gi_000B] == Gi_0009) { Id_00B4[Gi_000B] = Gd_0003; Id_00E8[Gi_000B] = Gd_0008; break; } Gi_000B = Gi_000B - 1; } while (Gi_000B >= 0); } } } } Li_FFF8 = Li_FFF8 + 1; } while (Li_FFF8 < Li_FFE8); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void func_1019() { string tmp_str0000; string tmp_str0001; string tmp_str0002; string tmp_str0003; string tmp_str0004; string Ls_FFF0; int Li_FFEC; int Li_FF80; int Li_FF7C; int Li_FF78; int Li_FF74; int Li_FF70; Ls_FFF0 = "Info_"; Li_FFEC = 9; string Ls_FFB8[]; string Ls_FF84[]; ArrayResize(Ls_FFB8, 9, 0); ArrayResize(Ls_FF84, 9, 0); Li_FF80 = 15; Li_FF7C = 20; Li_FF78 = 0; if (IsTesting() != true) { tmp_str0000 = "Info_"; Gi_0000 = ObjectsTotal(-1) - 1; Gi_0001 = Gi_0000; if (Gi_0000 >= 0) { do { tmp_str0001 = ObjectName(Gi_0001); if (StringFind(tmp_str0001, tmp_str0000, 0) > -1) { ObjectDelete(tmp_str0001); } Gi_0001 = Gi_0001 - 1; } while (Gi_0001 >= 0); } } Li_FF74 = 1; tmp_str0002 = Ls_FFF0 + "A/C name"; Ls_FFB8[0] = tmp_str0002; tmp_str0002 = "A/C name: " + AccountInfoString(1); Ls_FF84[0] = tmp_str0002; tmp_str0002 = Ls_FFF0 + "A/C no"; Ls_FFB8[1] = tmp_str0002; tmp_str0002 = (string)AccountInfoInteger(ACCOUNT_LOGIN); tmp_str0003 = "A/C no: " + tmp_str0002; Ls_FF84[1] = tmp_str0003; tmp_str0002 = Ls_FFF0 + "Balance"; Ls_FFB8[2] = tmp_str0002; tmp_str0002 = "Balance: " + DoubleToString(AccountBalance(), Li_FF74); Ls_FF84[2] = tmp_str0002; tmp_str0002 = Ls_FFF0 + "Equity"; Ls_FFB8[3] = tmp_str0002; tmp_str0002 = "Eqity: " + DoubleToString(AccountInfoDouble(ACCOUNT_EQUITY), Li_FF74); Ls_FF84[3] = tmp_str0002; tmp_str0002 = Ls_FFF0 + "Profit/Loss: usd"; Ls_FFB8[4] = tmp_str0002; tmp_str0002 = "Profit/Loss: " + DoubleToString(AccountInfoDouble(ACCOUNT_PROFIT), Li_FF74); tmp_str0002 = tmp_str0002 + " usd: "; Ls_FF84[4] = tmp_str0002; tmp_str0002 = Ls_FFF0 + "Profit/Loss : %"; Ls_FFB8[5] = tmp_str0002; Gd_0000 = AccountInfoDouble(ACCOUNT_PROFIT); tmp_str0002 = "Profit/Loss: " + DoubleToString(((Gd_0000 / AccountInfoDouble(ACCOUNT_BALANCE)) * 100), Li_FF74); tmp_str0002 = tmp_str0002 + "%"; Ls_FF84[5] = tmp_str0002; tmp_str0002 = Ls_FFF0 + "Open sell ordertotal lot"; Ls_FFB8[6] = tmp_str0002; tmp_str0002 = "Open sell ordertotal lot: " + DoubleToString(Id_0038, Li_FF74); Ls_FF84[6] = tmp_str0002; tmp_str0002 = Ls_FFF0 + "Open buy order total lot"; Ls_FFB8[7] = tmp_str0002; tmp_str0002 = "Open buy order total lot: " + DoubleToString(Id_0030, Li_FF74); Ls_FF84[7] = tmp_str0002; tmp_str0002 = Ls_FFF0 + "Spread"; Ls_FFB8[8] = tmp_str0002; tmp_str0002 = "Spread: " + DoubleToString(MarketInfo(_Symbol, MODE_SPREAD), Li_FF74); Ls_FF84[8] = tmp_str0002; Li_FF78 = Li_FF7C; Li_FF70 = 0; if (Li_FFEC > 0) { do { Gi_0000 = 15453831; tmp_str0002 = Ls_FF84[Li_FF70]; tmp_str0003 = Ls_FFB8[Li_FF70]; if (ObjectFind(tmp_str0003) == -1) { ObjectCreate(0, tmp_str0003, OBJ_LABEL, 0, 0, 0, 0, 0, 0, 0); ObjectSet(tmp_str0003, OBJPROP_CORNER, 0); ObjectSet(tmp_str0003, OBJPROP_XDISTANCE, 10); ObjectSet(tmp_str0003, OBJPROP_YDISTANCE, Li_FF78); } tmp_str0004 = "" + tmp_str0002; ObjectSetText(tmp_str0003, tmp_str0004, 10, "Tahoma", Gi_0000); Li_FF78 = Li_FF78 + Li_FF80; Li_FF70 = Li_FF70 + 1; } while (Li_FF70 < Li_FFEC); } ArrayFree(Ls_FF84); ArrayFree(Ls_FFB8); } //+------------------------------------------------------------------+