diff --git a/!FT M-MATH v3.mq4 b/!FT M-MATH v3.mq4 new file mode 100644 index 0000000..30207a6 --- /dev/null +++ b/!FT M-MATH v3.mq4 @@ -0,0 +1,616 @@ + +// +----------------------------------------------------------------------------------------+ // +// | !FT M-MATH v3 \¦/ | // +// | Knowledge of the ancients (ò ó) | // +// |_________________________________________________o0o___(_)___o0o________________________| // +// |_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|____|_____| // +// | 2011 | // +// |----------------------------------------------------------------------------------------| // +// | Programming language: MQL4 | // +// | Development platform: MetaTrader 4 | // +// | End product: Indicator for MetaTrader 4 designed | // +// | for Build 229 (current version) | // +// +----------------------------------------------------------------------------------------+ // + +#property indicator_chart_window +//+------------------------------------------------------------------+ +extern color midcol = Blue; + +double s1[]; +extern int P = 512; +extern int FW = 512; +extern int StepBack = 0; + +extern bool show.timeleft=false; +extern bool show.symbol.price=false; +extern int win = 0; +extern int Adjust_Side_to_side = 10; +extern int Shift_UP_DN = 0; + +extern bool showcomments=true; +//+------------------------------------------------------------------+ +extern bool bml.25.lines=false; +extern color bml.25.color=DarkSlateGray; +extern int bml.25.style=0; +//+------ +extern bool bml.33.lines=true; +extern color bml.33.color=DarkSlateGray; +extern int bml.33.style=0; +//+------ +extern bool bml.50.lines=false; +extern color bml.50.color=DarkSlateGray; +extern int bml.50.style=1; +//+------------------------------------------------------------------+ +extern bool color.frame=false; +color MM1Color = C'0,6,60'; //C'0,90,90'; +color MM2Color = C'100,5,60'; //C'90,0,90'; +color MM3Color = C'0,6,60'; //C'0,30,90'; +//+------------------------------------------------------------------+ +#define FF1 "FF1" +#define FF2 "FF2" +#define FF3 "FF3" +#define FF4 "FF4" +#define FF5 "FF5" +//+------------------------------------------------------------------+ +int l996 = 0; +int l1004 = 0; + + +double bml.25[26], bml.33[26], bml.50[12]; +double dmml = 0, + dvtl = 0, + sum = 0, + v1 = 0, + v2 = 0, + mn = 0, + mx = 0, + x1 = 0, + x2 = 0, + x3 = 0, + x4 = 0, + x5 = 0, + x6 = 0, + y1 = 0, + y2 = 0, + y3 = 0, + y4 = 0, + y5 = 0, + y6 = 0, + octave = 0, + fractal = 0, + range = 0, + finalH = 0, + finalL = 0, + DecNos, + mml[13]; + + + +//+------------------------------------------------------------------+ +string ln_txt[13], ln_tx[13], + buff_str = "", buff_str2 = "", buff_str3 = "", buff_str4 = ""; +//+------------------------------------------------------------------+ +int bn_v1=0, bn_v2=0, OctLinesCnt=13, mml_thk=8, mml_clr[13], mml_shft=3, nTime=0, CurPeriod=0, x33 = 0, x25 = 0, x50 = 0, + nDigits=0, frametemp=0, i=0, gb=0, gb.T=0, mP=0, lperiod=0, d=0,ts=0, mml_wdth[13], + bml.33.Cnt = 26, bml.25.Cnt = 38, bml.50.Cnt = 12; +//+------------------------------------------------------------------+ +int init() { +//---- indicators + ln_txt[0] = "[-2/8] "; + ln_txt[1] = "[-1/8] "; + ln_txt[2] = "[0/8] "; + ln_txt[3] = "[1/8] "; + ln_txt[4] = "[2/8] "; + ln_txt[5] = "[3/8] "; + ln_txt[6] = "[4/8] "; + ln_txt[7] = "[5/8] "; + ln_txt[8] = "[6/8] "; + ln_txt[9] = "[7/8] "; + ln_txt[10] = "[8/8] "; + ln_txt[11] = "[+1/8] "; + ln_txt[12] = "[+2/8] "; +//+------------------------------------------------------------------+ + mml_wdth[0] = 2; + mml_wdth[1] = 1; + mml_wdth[2] = 3; + mml_wdth[3] = 1; + mml_wdth[4] = 2; + mml_wdth[5] = 1; + mml_wdth[6] = 3; + mml_wdth[7] = 1; + mml_wdth[8] = 2; + mml_wdth[9] = 1; + mml_wdth[10] = 3; + mml_wdth[11] = 1; + mml_wdth[12] = 2; +//+------------------------------------------------------------------+ + ln_tx[0] = ""; + ln_tx[1] = ""; + ln_tx[2] = ""; + ln_tx[3] = ""; + ln_tx[4] = ""; + ln_tx[5] = ""; + ln_tx[6] = ""; + ln_tx[7] = ""; + ln_tx[8] = ""; + ln_tx[9] = ""; + ln_tx[10] = ""; + ln_tx[11] = ""; + ln_tx[12] = ""; +//+------------------------------------------------------------------+ + mml_shft = 0;//original was 3 + mml_thk = 3; +//+------------------------------------------------------------------+ + mml_clr[0] = Red;//Maroon; // [-2]/8 + mml_clr[1] = Orange;//C'60,60,60'; // [-1]/8 + mml_clr[2] = Blue;//Red; // [0]/8 + mml_clr[3] = Yellow;//C'60,60,60'; // [1]/8 + mml_clr[4] = HotPink;//DarkGreen; // [2]/8 + mml_clr[5] = Lime;//C'60,60,60'; // [3]/8 + mml_clr[6] = midcol;//Lavender; // [4]/8 + mml_clr[7] = Lime;//C'60,60,60'; // [5]/8 + mml_clr[8] = HotPink;//DarkGreen; // [6]/8 + mml_clr[9] = Yellow;//C'60,60,60'; // [7]/8 + mml_clr[10] = Blue;//Red; // [8]/8 + mml_clr[11] = Orange;//C'60,60,60';//DarkViolet; // [+1]/8 + mml_clr[12] = Red;//Maroon;//LightSlateGray; // [+2]/8 +//+------------------------------------------------------------------+ + bn_v1 = Lowest(NULL,0,MODE_LOW,0); + bn_v2 = Highest(NULL,0,MODE_HIGH,0); + + v1 = Low[bn_v1]; + v2 = High[bn_v2]; + + return(0); + } +//+------------------------------------------------------------------+ +int deinit() { +//---- TODO: add your code here +Comment(" "); +//+------------------------------------------------------------------+ +for(i=0;i25000 ) + fractal=100000; + else + if( v2<=25000 && v2>2500 ) + fractal=10000; + else + if( v2<=2500 && v2>250 ) + fractal=1000; + else + if( v2<=250 && v2>25 ) + fractal=100; + else + if( v2<=25 && v2>12.5 ) + fractal=12.5; + else + if( v2<=12.5 && v2>6.25) + fractal=12.5; + else + if( v2<=6.25 && v2>3.125 ) + fractal=6.25; + else + if( v2<=3.125 && v2>1.5625 ) + fractal=3.125; + else + if( v2<=1.5625 && v2>0.390625 ) + fractal=1.5625; + else + if( v2<=0.390625 && v2>0) + fractal=0.1953125; +//+------------------------------------------------------------------+ + range=(v2-v1); + sum=MathFloor(MathLog(fractal/range)/MathLog(2)); + octave=fractal*(MathPow(0.5,sum)); + mn=MathFloor(v1/octave)*octave; + if( (mn+octave)>v2 ) + mx=mn+octave; + else + mx=mn+(2*octave); +//+------------------------------------------------------------------+ +// calculating xx +//x2 + if( (v1>=(3*(mx-mn)/16+mn)) && (v2<=(9*(mx-mn)/16+mn)) ) + x2=mn+(mx-mn)/2; + else x2=0; +//x1 + if( (v1>=(mn-(mx-mn)/8))&& (v2<=(5*(mx-mn)/8+mn)) && (x2==0) ) + x1=mn+(mx-mn)/2; + else x1=0; + +//x4 + if( (v1>=(mn+7*(mx-mn)/16))&& (v2<=(13*(mx-mn)/16+mn)) ) + x4=mn+3*(mx-mn)/4; + else x4=0; + +//x5 + if( (v1>=(mn+3*(mx-mn)/8))&& (v2<=(9*(mx-mn)/8+mn))&& (x4==0) ) + x5=mx; + else x5=0; + +//x3 + if( (v1>=(mn+(mx-mn)/8))&& (v2<=(7*(mx-mn)/8+mn))&& (x1==0) && (x2==0) && (x4==0) && (x5==0) ) + x3=mn+3*(mx-mn)/4; + else x3=0; + +//x6 + if( (x1+x2+x3+x4+x5) ==0 ) + x6=mx; + else x6=0; + + finalH = x1+x2+x3+x4+x5+x6; +// calculating yy +//y1 + if( x1>0 ) + y1=mn; + else y1=0; + +//y2 + if( x2>0 ) + y2=mn+(mx-mn)/4; + else y2=0; + +//y3 + if( x3>0 ) + y3=mn+(mx-mn)/4; + else y3=0; + +//y4 + if( x4>0 ) + y4=mn+(mx-mn)/2; + else y4=0; + +//y5 + if( x5>0 ) + y5=mn+(mx-mn)/2; + else y5=0; + +//y6 + if( (finalH>0) && ((y1+y2+y3+y4+y5)==0) ) + y6=mn; + else y6=0; + + finalL = y1+y2+y3+y4+y5+y6; +//+------------------------------------------------------------------+ +double xo = (finalH-finalL); +double xmm = xo/8; +//+------------------------------------------------------------------+ + for( i=0; i= 0; li_8--) + if (StringFind(ObjectName(li_8), as_0, 0) == 0) ObjectDelete(ObjectName(li_8)); +} + +int start() { + bool li_8; + bool li_12; + //if (TimeCurrent() > StrToTime("2050.04.20")) { + // Alert("New version available! Download it using re-activated link from Plimus"); + // return; + //} + int li_0 = Bars - IndicatorCounted(); + for (int li_4 = li_0 - 1; li_4 >= 0; li_4--) { + g_ibuf_164[li_4] = g_ibuf_164[li_4 + 1]; + g_ibuf_168[li_4] = g_ibuf_168[li_4 + 1]; + g_ibuf_172[li_4] = g_ibuf_172[li_4 + 1]; + g_ibuf_176[li_4] = g_ibuf_176[li_4 + 1]; + g_ibuf_180[li_4] = g_ibuf_180[li_4 + 1]; + g_ibuf_184[li_4] = g_ibuf_184[li_4 + 1]; + g_ibuf_188[li_4] = g_ibuf_188[li_4 + 1]; + li_8 = fTimeInZone(StartHour, gi_80, EndHour, gi_88, Time[li_4]); + li_12 = fTimeInZone(StartHour, gi_80, EndHour, gi_88, Time[li_4 + 1]); + if (li_8) { + if (!li_12) { + g_high_192 = High[li_4]; + g_low_200 = Low[li_4]; + gd_unused_208 = Open[li_4]; + } + g_high_192 = MathMax(g_high_192, High[li_4]); + g_low_200 = MathMin(g_low_200, Low[li_4]); + } + if (!li_8) { + if (li_12) { + g_ibuf_164[li_4] = (g_high_192 + g_low_200) / 2.0; + gd_216 = g_high_192 - g_low_200; + g_ibuf_168[li_4] = g_high_192 - 1.61 * gd_216; + g_ibuf_172[li_4] = g_high_192 - 2.0 * gd_216; + g_ibuf_176[li_4] = g_high_192 - 2.61 * gd_216; + g_ibuf_180[li_4] = g_low_200 + 1.61 * gd_216; + g_ibuf_184[li_4] = g_low_200 + 2.0 * gd_216; + g_ibuf_188[li_4] = g_low_200 + 2.61 * gd_216; + } + } + } + double l_iwpr_16 = iWPR(NULL, 0, g_period_116, 0); + double l_icci_24 = iCCI(NULL, 0, g_period_120, g_applied_price_124, 0); + double l_irsi_32 = iRSI(NULL, 0, g_period_128, g_applied_price_132, 0); + string ls_40 = "Direction: UNKN"; + string ls_48 = "Direction: UNKN"; + string ls_56 = "Direction: UNKN"; + string ls_64 = "Direction: UNKN"; + int l_color_72 = ColorUNKN; + if (l_iwpr_16 > -50.0 && l_icci_24 > 0.0 && l_irsi_32 > 50.0) { + ls_40 = "Direction: UP"; + l_color_72 = ColorUP; + ls_48 = "1. Target - " + DS(g_ibuf_180[0]); + ls_56 = "2. Target - " + DS(g_ibuf_184[0]); + ls_64 = "3. Target - " + DS(g_ibuf_188[0]); + } + if (l_iwpr_16 < -50.0 && l_icci_24 < 0.0 && l_irsi_32 < 50.0) { + ls_40 = "Direction: DN"; + l_color_72 = ColorDN; + ls_48 = "1. Target - " + DS(g_ibuf_168[0]); + ls_56 = "2. Target - " + DS(g_ibuf_172[0]); + ls_64 = "3. Target - " + DS(g_ibuf_176[0]); + } + if (Corner == 0 || Corner == 1) { + fObjLabel("MSFP2_1", PosX, PosY, " " + "++PALLADA ASSISTANT++", Corner, ColorCommon, 8, 0, "Arial", FALSE); + fObjLabel("MSFP2_2", PosX, PosY + 5, "_______________", Corner, ColorCommon, 8, 0, "Arial", FALSE); + fObjLabel("MSFP2_3", PosX, PosY + 20, " " + ls_40, Corner, l_color_72, 8, 0, "Arial", FALSE); + fObjLabel("MSFP2_4", PosX, PosY + 25, "_______________", Corner, ColorCommon, 8, 0, "Arial", FALSE); + fObjLabel("MSFP2_5", PosX, PosY + 40, " " + ls_48, Corner, ColorCommon, 8, 0, "Arial", FALSE); + fObjLabel("MSFP2_6", PosX, PosY + 50, " " + ls_56, Corner, ColorCommon, 8, 0, "Arial", FALSE); + fObjLabel("MSFP2_7", PosX, PosY + 60, " " + ls_64, Corner, ColorCommon, 8, 0, "Arial", FALSE); + fObjLabel("MSFP2_8", PosX, PosY + 65, "_______________", Corner, ColorCommon, 8, 0, "Arial", FALSE); + fObjLabel("MSFP2_9", PosX, PosY + 80, " Range: " + DS0(gd_216 / Point), Corner, ColorCommon, 8, 0, "Arial", FALSE); + fObjLabel("MSFP2_10", PosX, PosY + 85, "_______________", Corner, ColorCommon, 8, 0, "Arial", FALSE); + fObjLabel("MSFP2_11", PosX, PosY + 100, " " + "PalladaSE.©2009 TradeWays", Corner, ColorCommon, 8, 0, "Arial", FALSE); + } else { + fObjLabel("MSFP2_1", PosX, PosY + 100, " " + "++PALLADA ASSISTANT++", Corner, ColorCommon, 8, 0, "Arial", FALSE); + fObjLabel("MSFP2_2", PosX, PosY + 95, "_______________", Corner, ColorCommon, 8, 0, "Arial", FALSE); + fObjLabel("MSFP2_3", PosX, PosY + 80, " " + ls_40, Corner, l_color_72, 8, 0, "Arial", FALSE); + fObjLabel("MSFP2_4", PosX, PosY + 75, "_______________", Corner, ColorCommon, 8, 0, "Arial", FALSE); + fObjLabel("MSFP2_5", PosX, PosY + 60, " " + ls_48, Corner, ColorCommon, 8, 0, "Arial", FALSE); + fObjLabel("MSFP2_6", PosX, PosY + 50, " " + ls_56, Corner, ColorCommon, 8, 0, "Arial", FALSE); + fObjLabel("MSFP2_7", PosX, PosY + 40, " " + ls_64, Corner, ColorCommon, 8, 0, "Arial", FALSE); + fObjLabel("MSFP2_8", PosX, PosY + 35, "_______________", Corner, ColorCommon, 8, 0, "Arial", FALSE); + fObjLabel("MSFP2_9", PosX, PosY + 20, " Range: " + DS0(gd_216 / Point), Corner, ColorCommon, 8, 0, "Arial", FALSE); + fObjLabel("MSFP2_10", PosX, PosY + 15, "_______________", Corner, ColorCommon, 8, 0, "Arial", FALSE); + fObjLabel("MSFP2_11", PosX, PosY, " " + "PalladaSE.©2009 TradeWays", Corner, ColorCommon, 8, 0, "Arial", FALSE); + } + return (0); +} + +string DS0(double ad_0) { + return (DoubleToStr(ad_0, 0)); +} + +string DS(double ad_0) { + return (DoubleToStr(ad_0, Digits)); +} + +void fObjLabel(string a_name_0, int a_x_8, int a_y_12, string a_text_16, int a_corner_24 = 0, color a_color_28 = 255, int a_fontsize_32 = 8, int a_window_36 = 0, string a_fontname_40 = "Arial", bool a_bool_48 = FALSE) { + if (ObjectFind(a_name_0) != a_window_36) ObjectCreate(a_name_0, OBJ_LABEL, a_window_36, 0, 0); + ObjectSet(a_name_0, OBJPROP_XDISTANCE, a_x_8); + ObjectSet(a_name_0, OBJPROP_YDISTANCE, a_y_12); + ObjectSetText(a_name_0, a_text_16, a_fontsize_32, a_fontname_40, a_color_28); + ObjectSet(a_name_0, OBJPROP_BACK, a_bool_48); + ObjectSet(a_name_0, OBJPROP_CORNER, a_corner_24); +} + +int fTimeInZone(int ai_0, int ai_4, int ai_8, int ai_12, int ai_16) { + int li_20 = 3600 * ai_0 + 60 * ai_4; + int li_24 = 3600 * ai_8 + 60 * ai_12; + int li_28 = ai_16 - 86400 * (ai_16 / 86400); + if (li_20 <= li_24) { + if (li_28 >= li_20 && li_28 < li_24) return (1); + } else + if (li_28 >= li_20 || li_28 < li_24) return (1); + return (0); +} \ No newline at end of file diff --git a/#Pallada_Bars.mq4 b/#Pallada_Bars.mq4 new file mode 100644 index 0000000..344e39c --- /dev/null +++ b/#Pallada_Bars.mq4 @@ -0,0 +1,120 @@ + +#property copyright "Copyright © 2009, TradeWays" +#property link "http://www.tradeways.org" + +#property indicator_chart_window +#property indicator_buffers 8 +#property indicator_color1 Blue +#property indicator_color2 Red +#property indicator_color3 DodgerBlue +#property indicator_color4 Tomato +#property indicator_color5 Blue +#property indicator_color6 Red +#property indicator_color7 DodgerBlue +#property indicator_color8 Tomato + +double g_period_76 = 50.0; +double g_period_84 = 30.0; +double g_period_92 = 38.0; +double g_ibuf_100[]; +double g_ibuf_104[]; +double g_ibuf_108[]; +double g_ibuf_112[]; +double g_ibuf_116[]; +double g_ibuf_120[]; +double g_ibuf_124[]; +double g_ibuf_128[]; + +int init() { + SetIndexStyle(0, DRAW_HISTOGRAM); + SetIndexBuffer(0, g_ibuf_100); + SetIndexStyle(1, DRAW_HISTOGRAM); + SetIndexBuffer(1, g_ibuf_104); + SetIndexStyle(2, DRAW_HISTOGRAM); + SetIndexBuffer(2, g_ibuf_108); + SetIndexStyle(3, DRAW_HISTOGRAM); + SetIndexBuffer(3, g_ibuf_112); + SetIndexStyle(4, DRAW_HISTOGRAM); + SetIndexBuffer(4, g_ibuf_116); + SetIndexStyle(5, DRAW_HISTOGRAM); + SetIndexBuffer(5, g_ibuf_120); + SetIndexStyle(6, DRAW_HISTOGRAM); + SetIndexBuffer(6, g_ibuf_124); + SetIndexStyle(7, DRAW_HISTOGRAM); + SetIndexBuffer(7, g_ibuf_128); + string ls_0 = "#PalladaSE_Bars©2009 TradeWays"; + IndicatorShortName(ls_0); + return (0); +} + +int start() { + double l_icci_8; + double l_iwpr_16; + double l_iforce_24; + int li_32; + //if (TimeCurrent() > StrToTime("2050.04.20")) { + // Alert("New version available! Download it using re-activated link from Plimus"); + // return; + //} + //if (AccountNumber() != 0 && 0) { + // Alert("This expert is not licensed to your account number!"); + // return; + //} + int l_ind_counted_4 = IndicatorCounted(); + if (Bars <= 15) return (0); + if (l_ind_counted_4 < 1) { + for (int li_0 = 1; li_0 <= 15; li_0++) { + g_ibuf_100[Bars - li_0] = 0.0; + g_ibuf_108[Bars - li_0] = 0.0; + g_ibuf_104[Bars - li_0] = 0.0; + g_ibuf_112[Bars - li_0] = 0.0; + g_ibuf_116[Bars - li_0] = 0.0; + g_ibuf_124[Bars - li_0] = 0.0; + g_ibuf_120[Bars - li_0] = 0.0; + g_ibuf_128[Bars - li_0] = 0.0; + } + } + if (l_ind_counted_4 > 0) li_32 = Bars - l_ind_counted_4; + if (l_ind_counted_4 == 0) li_32 = Bars - 15 - 1; + for (li_0 = li_32; li_0 >= 0; li_0--) { + l_icci_8 = iCCI(NULL, 0, g_period_84, PRICE_TYPICAL, li_0); + l_iwpr_16 = iWPR(NULL, 0, g_period_92, li_0); + l_iforce_24 = iForce(NULL, 0, g_period_76, MODE_EMA, PRICE_CLOSE, li_0); + g_ibuf_100[li_0] = EMPTY_VALUE; + g_ibuf_108[li_0] = EMPTY_VALUE; + g_ibuf_104[li_0] = EMPTY_VALUE; + g_ibuf_112[li_0] = EMPTY_VALUE; + g_ibuf_116[li_0] = EMPTY_VALUE; + g_ibuf_124[li_0] = EMPTY_VALUE; + g_ibuf_120[li_0] = EMPTY_VALUE; + g_ibuf_128[li_0] = EMPTY_VALUE; + if (l_icci_8 > 0.0 && l_iwpr_16 > -50.0 && l_iforce_24 > 0.0) { + g_ibuf_100[li_0] = MathMax(Open[li_0], Close[li_0]); + g_ibuf_104[li_0] = MathMin(Open[li_0], Close[li_0]); + g_ibuf_116[li_0] = High[li_0]; + g_ibuf_120[li_0] = Low[li_0]; + } else { + if (l_icci_8 > 0.0 && l_iwpr_16 < -50.0) { + g_ibuf_108[li_0] = MathMax(Open[li_0], Close[li_0]); + g_ibuf_112[li_0] = MathMin(Open[li_0], Close[li_0]); + g_ibuf_124[li_0] = High[li_0]; + g_ibuf_128[li_0] = Low[li_0]; + } else { + if (l_icci_8 < 0.0 && l_iwpr_16 < -50.0 && l_iforce_24 < 0.0) { + g_ibuf_104[li_0] = MathMax(Open[li_0], Close[li_0]); + g_ibuf_100[li_0] = MathMin(Open[li_0], Close[li_0]); + g_ibuf_120[li_0] = High[li_0]; + g_ibuf_116[li_0] = Low[li_0]; + } else { + if (l_icci_8 < 0.0 && l_iwpr_16 > -50.0) { + g_ibuf_112[li_0] = MathMax(Open[li_0], Close[li_0]); + g_ibuf_108[li_0] = MathMin(Open[li_0], Close[li_0]); + g_ibuf_128[li_0] = High[li_0]; + g_ibuf_124[li_0] = Low[li_0]; + } + } + } + } + } + return (0); +} \ No newline at end of file diff --git a/#Pallada_ExitSignal.mq4 b/#Pallada_ExitSignal.mq4 new file mode 100644 index 0000000..8e20576 --- /dev/null +++ b/#Pallada_ExitSignal.mq4 @@ -0,0 +1,204 @@ +#property copyright "Copyright © 2008, TradeWays" +#property link "http://www.tradeways.org" + +#property indicator_chart_window +#property indicator_buffers 2 +#property indicator_color1 DodgerBlue +#property indicator_color2 Red + +extern int Fx = 34; +extern double Deviation = 5.0; +extern int FEMA = 5; +extern int SEMA = 13; +extern bool EmailON = TRUE; +extern bool SoundON = TRUE; +extern bool AlertON = TRUE; +extern int AlertRepeat = 3; +extern bool EndLessRepeat = FALSE; +extern string SoundFile = "Alert"; +double g_ibuf_124[]; +double g_ibuf_128[]; +double g_ibuf_132[]; +double g_ibuf_136[]; +double g_ibuf_140[]; +double g_ibuf_144[]; +int gi_148; +int gi_152; +int g_datetime_156; +int g_datetime_160; +int g_time_164 = 0; +int g_time_168 = 0; + +int init() { + ObjectDelete("Exit_Signal_Bell"); + IndicatorBuffers(6); + SetIndexStyle(0, DRAW_ARROW); + SetIndexArrow(0, 233); + SetIndexBuffer(0, g_ibuf_124); + SetIndexStyle(1, DRAW_ARROW); + SetIndexArrow(1, 234); + SetIndexBuffer(1, g_ibuf_128); + SetIndexBuffer(2, g_ibuf_136); + SetIndexBuffer(3, g_ibuf_132); + SetIndexBuffer(4, g_ibuf_140); + SetIndexBuffer(5, g_ibuf_144); + if (Fx < 2) Fx = 2; + if (Deviation < 0.0) Deviation = 1; + if (FEMA < 1) FEMA = 1; + if (SEMA < 1) SEMA = 1; + IndicatorShortName("Exit_Signal"); + SetIndexDrawBegin(0, Fx + SEMA); + SetIndexDrawBegin(1, Fx + SEMA); + SetIndexLabel(0, "Exit_Signal Up"); + SetIndexLabel(1, "Exit_Signal Down"); + SetIndexEmptyValue(0, 0); + SetIndexEmptyValue(1, 0); + IndicatorDigits(4); + return (0); +} + +int deinit() { + ObjectDelete("Exit_Signal_Bell"); + return (0); +} + +double NormalizedX(int a_period_0, int ai_4) { + double ld_ret_8; + double l_ima_16; + double l_istddev_24; + double l_close_32; + if (ai_4 < Bars - a_period_0) { + l_close_32 = Close[ai_4]; + l_ima_16 = iMA(NULL, 0, a_period_0, 0, MODE_SMA, PRICE_CLOSE, ai_4); + l_istddev_24 = iStdDev(NULL, 0, a_period_0, 0, MODE_SMA, PRICE_CLOSE, ai_4); + ld_ret_8 = (l_close_32 - l_ima_16) / l_istddev_24; + } else ld_ret_8 = 0; + return (ld_ret_8); +} + +double FisherNormalizedX(int ai_0, double ad_4, int ai_12) { + double ld_ret_16; + double ld_24; + if (ai_12 < Bars - ai_0 && ad_4 > 0.0) { + ld_24 = NormalizedX(ai_0, ai_12) / ad_4; + if (ld_24 > 0.99) ld_24 = 0.99; + if (ld_24 < -0.99) ld_24 = -0.99; + ld_ret_16 = MathLog((ld_24 + 1.0) / (1 - ld_24)) / 2.0; + } else ld_ret_16 = 0; + return (ld_ret_16); +} + +int start() { + int li_4 = IndicatorCounted(); + if (li_4 < 0) return (-1); + if (li_4 > 0) li_4--; + int li_0 = Bars - li_4; + for (int li_8 = 0; li_8 < li_0; li_8++) g_ibuf_144[li_8] = FisherNormalizedX(Fx, Deviation, li_8); + for (li_8 = 0; li_8 < li_0; li_8++) g_ibuf_140[li_8] = iMAOnArray(g_ibuf_144, Bars, SEMA, 0, MODE_EMA, li_8); + for (li_8 = 0; li_8 < li_0; li_8++) { + if (iMAOnArray(g_ibuf_144, Bars, FEMA, 0, MODE_EMA, li_8) > g_ibuf_140[li_8]) { + g_ibuf_132[li_8] = iMAOnArray(g_ibuf_144, Bars, FEMA, 0, MODE_EMA, li_8); + g_ibuf_136[li_8] = 0; + } else { + g_ibuf_132[li_8] = 0; + g_ibuf_136[li_8] = iMAOnArray(g_ibuf_144, Bars, FEMA, 0, MODE_EMA, li_8); + } + } + for (li_8 = 0; li_8 < li_0; li_8++) { + g_ibuf_124[li_8] = EMPTY_VALUE; + g_ibuf_128[li_8] = EMPTY_VALUE; + if (g_ibuf_132[li_8] != 0.0 && g_ibuf_132[li_8 + 1] == 0.0) g_ibuf_124[li_8] = Low[li_8] - 5.0 * Point; + if (g_ibuf_136[li_8] != 0.0 && g_ibuf_136[li_8 + 1] == 0.0) g_ibuf_128[li_8] = High[li_8] + 5.0 * Point; + } + int li_unused_12 = 1; + if (g_ibuf_132[1] != 0.0 && g_ibuf_132[2] == 0.0) { + if (Time[0] != g_time_164) { + g_time_164 = Time[0]; + if (EmailON) SendMail("Exit_Signal(" + Symbol() + " " + fTimeFrameName(Period()) + ")", "BUY"); + if (SoundON || AlertON) { + fObjLabel("Exit_Signal_Bell", 100, 100, StringSetChar("", 0, '%'), 3, Red, 16, 0, "Wingdings", FALSE); + if (EndLessRepeat) gi_148 = 1; + else gi_148 = AlertRepeat; + g_datetime_156 = 0; + gi_152 = 0; + } + } + } + if (g_ibuf_136[1] != 0.0 && g_ibuf_136[2] == 0.0) { + if (Time[0] != g_time_168) { + g_time_168 = Time[0]; + if (EmailON) SendMail("Exit_Signal(" + Symbol() + " " + fTimeFrameName(Period()) + ")", "SELL"); + if (SoundON || AlertON) { + fObjLabel("Exit_Signal_Bell", 100, 100, StringSetChar("", 0, '%'), 3, Red, 16, 0, "Wingdings", FALSE); + if (EndLessRepeat) gi_152 = 1; + else gi_152 = AlertRepeat; + g_datetime_160 = 0; + gi_148 = 0; + } + } + } + if (ObjectFind("Exit_Signal_Bell") == 0) { + if (gi_148 > 0) { + if (TimeLocal() > g_datetime_156 + 1) { + if (!EndLessRepeat) gi_148--; + g_datetime_156 = TimeLocal(); + if (AlertON) Alert("Exit_Signal(" + Symbol() + " " + fTimeFrameName(Period()) + "): BUY"); + if (SoundON) { + Print("Exit_Signal(" + Symbol() + " " + fTimeFrameName(Period()) + "): BUY"); + PlaySound(SoundFile); + } + } + } + if (gi_152 > 0) { + if (TimeLocal() > g_datetime_160 + 1) { + if (!EndLessRepeat) gi_152--; + g_datetime_160 = TimeLocal(); + if (AlertON) Alert("Exit_Signal(" + Symbol() + " " + fTimeFrameName(Period()) + "): SELL"); + if (SoundON) { + Print("Exit_Signal(" + Symbol() + " " + fTimeFrameName(Period()) + "): SELL"); + PlaySound(SoundFile); + } + } + } + } + if (gi_152 <= 0 && gi_148 <= 0) ObjectDelete("Exit_Signal_Bell"); + return (0); +} + +string fTimeFrameName(int ai_0) { + int l_timeframe_4; + if (ai_0 == 0) l_timeframe_4 = Period(); + else l_timeframe_4 = ai_0; + switch (l_timeframe_4) { + case 0: + return ("0"); + case PERIOD_M1: + return ("M1"); + case PERIOD_M5: + return ("M5"); + case PERIOD_M15: + return ("M15"); + case PERIOD_M30: + return ("M30"); + case PERIOD_H1: + return ("H1"); + case PERIOD_H4: + return ("H4"); + case PERIOD_D1: + return ("D1"); + case PERIOD_W1: + return ("W1"); + case PERIOD_MN1: + return ("MN1"); + } + return ("Wrong TimeFrame"); +} + +void fObjLabel(string a_name_0, int a_x_8, int a_y_12, string a_text_16, int a_corner_24 = 0, color a_color_28 = 255, int a_fontsize_32 = 8, int a_window_36 = 0, string a_fontname_40 = "Arial", bool a_bool_48 = FALSE) { + if (ObjectFind(a_name_0) != a_window_36) ObjectCreate(a_name_0, OBJ_LABEL, a_window_36, 0, 0); + ObjectSet(a_name_0, OBJPROP_XDISTANCE, a_x_8); + ObjectSet(a_name_0, OBJPROP_YDISTANCE, a_y_12); + ObjectSetText(a_name_0, a_text_16, a_fontsize_32, a_fontname_40, a_color_28); + ObjectSet(a_name_0, OBJPROP_BACK, a_bool_48); + ObjectSet(a_name_0, OBJPROP_CORNER, a_corner_24); +} \ No newline at end of file diff --git a/#Pallada_MainSignal_AllAverages.mq4 b/#Pallada_MainSignal_AllAverages.mq4 new file mode 100644 index 0000000..79a4511 --- /dev/null +++ b/#Pallada_MainSignal_AllAverages.mq4 @@ -0,0 +1,220 @@ +#property copyright "Copyright © 2008, TradeWays" +#property link "http://www.tradeways.org" + +#property indicator_chart_window +#property indicator_buffers 3 +#property indicator_color1 RoyalBlue +#property indicator_color2 Red +#property indicator_color3 Yellow + +extern int AAB_Price = 0; +extern int AAB_MAPeriod = 46; +extern int AAB_MAShift = 0; +extern int AAB_MAMethod = 11; +extern int AAB_BandsType = 1; +extern int AAB_STDPeriod = 20; +extern bool AAB_STDUseMAPeriod = TRUE; +extern double AAB_STDDevations = 1.5; +extern double AAB_ENVDevations = 0.1; +extern int AAB_ATRPeriod = 20; +extern bool AAB_ATRUseMAPeriod = TRUE; +extern double AAB_ATRDevations = 2.0; +extern double AAB_NLMADeviation = 0.0; +extern double AAB_NLMAPctFilter = 0.0; +extern bool EmailON = TRUE; +extern bool SoundON = TRUE; +extern bool AlertON = TRUE; +extern int AlertRepeat = 3; +extern bool EndLessRepeat = FALSE; +extern string SoundFile = "Alert"; +extern int Nbars = -1; +double gd_184 = 1.0; +int gi_unused_192 = 1; +double g_ibuf_196[]; +double g_ibuf_200[]; +double g_ibuf_204[]; +double g_ibuf_208[]; +double g_ibuf_212[]; +double g_ibuf_216[]; +double g_ibuf_220[]; +double g_ibuf_224[]; +bool gi_unused_228 = FALSE; +bool gi_unused_232 = FALSE; +int gi_236; +int gi_240; +int g_datetime_244; +int g_datetime_248; +int gi_252 = 0; +int gi_256 = 0; + +int init() { + string ls_unused_0; + ObjectDelete("B_Bell"); + gi_236 = 0; + gi_240 = 0; + IndicatorBuffers(8); + SetIndexBuffer(0, g_ibuf_196); + SetIndexBuffer(1, g_ibuf_200); + SetIndexBuffer(2, g_ibuf_204); + SetIndexBuffer(3, g_ibuf_208); + SetIndexBuffer(4, g_ibuf_212); + SetIndexBuffer(5, g_ibuf_216); + SetIndexBuffer(6, g_ibuf_220); + SetIndexBuffer(7, g_ibuf_224); + SetIndexEmptyValue(0, 0); + SetIndexEmptyValue(1, 0); + SetIndexEmptyValue(2, 0); + SetIndexEmptyValue(3, 0); + SetIndexEmptyValue(4, 0); + SetIndexEmptyValue(5, 0); + SetIndexEmptyValue(6, 0); + SetIndexEmptyValue(7, 0); + SetIndexStyle(0, DRAW_LINE, STYLE_SOLID); + SetIndexStyle(1, DRAW_LINE, STYLE_SOLID); + SetIndexStyle(2, DRAW_ARROW, STYLE_SOLID); + SetIndexArrow(2, 159); + SetIndexLabel(0, "UpTrend Stop"); + SetIndexLabel(1, "DownTrend Stop"); + SetIndexLabel(2, "UpTrend Signal"); + SetIndexLabel(3, "DownTrend Signal"); + return (0); +} + +int deinit() { + ObjectDelete("B_Bell"); + return (0); +} + +void start() { + double l_icustom_12; + double l_icustom_20; + int li_0 = Bars - IndicatorCounted(); + li_0 = MathMin(Bars - MathMax(AAB_MAPeriod, MathMax(AAB_STDPeriod, AAB_ATRPeriod)) - 10.0, li_0); + if (Nbars > 0) { + SetIndexDrawBegin(0, Bars - Nbars); + SetIndexDrawBegin(1, Bars - Nbars); + SetIndexDrawBegin(2, Bars - Nbars); + SetIndexDrawBegin(3, Bars - Nbars); + SetIndexDrawBegin(4, Bars - Nbars); + SetIndexDrawBegin(5, Bars - Nbars); + } + for (int li_8 = li_0 - 1; li_8 >= 0; li_8--) { + l_icustom_12 = iCustom(NULL, 0, "#Pallada_AllAveragesBands", AAB_Price, AAB_MAPeriod, AAB_MAShift, AAB_MAMethod, AAB_BandsType, AAB_STDPeriod, AAB_STDUseMAPeriod, AAB_STDDevations, AAB_ENVDevations, AAB_ATRPeriod, AAB_ATRUseMAPeriod, AAB_ATRDevations, AAB_NLMADeviation, AAB_NLMAPctFilter, 1, li_8); + l_icustom_20 = iCustom(NULL, 0, "#Pallada_AllAveragesBands", AAB_Price, AAB_MAPeriod, AAB_MAShift, AAB_MAMethod, AAB_BandsType, AAB_STDPeriod, AAB_STDUseMAPeriod, AAB_STDDevations, AAB_ENVDevations, AAB_ATRPeriod, AAB_ATRUseMAPeriod, AAB_ATRDevations, AAB_NLMADeviation, AAB_NLMAPctFilter, 2, li_8); + g_ibuf_196[li_8] = 0; + g_ibuf_200[li_8] = 0; + g_ibuf_204[li_8] = 0; + g_ibuf_208[li_8] = g_ibuf_208[li_8 + 1]; + g_ibuf_220[li_8] = l_icustom_12; + g_ibuf_224[li_8] = l_icustom_20; + if (Close[li_8] > g_ibuf_220[li_8 + 1]) g_ibuf_208[li_8] = 1; + if (Close[li_8] < g_ibuf_224[li_8 + 1]) g_ibuf_208[li_8] = -1; + if (g_ibuf_208[li_8] > 0.0 && g_ibuf_224[li_8] < g_ibuf_224[li_8 + 1]) g_ibuf_224[li_8] = g_ibuf_224[li_8 + 1]; + if (g_ibuf_208[li_8] < 0.0 && g_ibuf_220[li_8] > g_ibuf_220[li_8 + 1]) g_ibuf_220[li_8] = g_ibuf_220[li_8 + 1]; + g_ibuf_212[li_8] = g_ibuf_220[li_8] + (gd_184 - 1.0) / 2.0 * (g_ibuf_220[li_8] - g_ibuf_224[li_8]); + g_ibuf_216[li_8] = g_ibuf_224[li_8] - (gd_184 - 1.0) / 2.0 * (g_ibuf_220[li_8] - g_ibuf_224[li_8]); + if (g_ibuf_208[li_8] > 0.0 && g_ibuf_216[li_8] < g_ibuf_216[li_8 + 1]) g_ibuf_216[li_8] = g_ibuf_216[li_8 + 1]; + if (g_ibuf_208[li_8] < 0.0 && g_ibuf_212[li_8] > g_ibuf_212[li_8 + 1]) g_ibuf_212[li_8] = g_ibuf_212[li_8 + 1]; + if (g_ibuf_208[li_8] > 0.0) { + g_ibuf_196[li_8] = g_ibuf_216[li_8]; + g_ibuf_200[li_8] = 0; + } + if (g_ibuf_208[li_8] < 0.0) { + g_ibuf_200[li_8] = g_ibuf_212[li_8]; + g_ibuf_196[li_8] = 0; + } + g_ibuf_204[li_8] = 0; + if (g_ibuf_200[li_8] != 0.0 && g_ibuf_200[li_8 + 1] == 0.0) g_ibuf_204[li_8] = g_ibuf_200[li_8]; + if (g_ibuf_196[li_8] != 0.0 && g_ibuf_196[li_8 + 1] == 0.0) g_ibuf_204[li_8] = g_ibuf_196[li_8]; + } + int li_28 = 1; + if (g_ibuf_196[li_28] != 0.0 && g_ibuf_196[li_28 + 1] == 0.0) { + if (Time[0] != gi_252) { + gi_252 = Time[0]; + if (EmailON) SendMail("B_Sig(" + Symbol() + " " + fTimeFrameName(Period()) + ")", "Bands going Up"); + if (SoundON || AlertON) { + fObjLabel("B_Bell", 100, 100, StringSetChar("", 0, '%'), 3, Red, 16, 0, "Wingdings", FALSE); + if (EndLessRepeat) gi_236 = 1; + else gi_236 = AlertRepeat; + g_datetime_244 = 0; + gi_240 = 0; + } + } + } + if (g_ibuf_200[li_28] != 0.0 && g_ibuf_200[li_28 + 1] == 0.0) { + if (Time[0] != gi_256) { + gi_256 = Time[0]; + if (EmailON) SendMail("B_Sig(" + Symbol() + " " + fTimeFrameName(Period()) + ")", "Bands going Down"); + if (SoundON || AlertON) { + fObjLabel("B_Bell", 100, 100, StringSetChar("", 0, '%'), 3, Red, 16, 0, "Wingdings", FALSE); + if (EndLessRepeat) gi_240 = 1; + else gi_240 = AlertRepeat; + g_datetime_248 = 0; + gi_236 = 0; + } + } + } + if (ObjectFind("B_Bell") == 0) { + if (gi_236 > 0) { + if (TimeLocal() > g_datetime_244 + 1) { + if (!EndLessRepeat) gi_236--; + g_datetime_244 = TimeLocal(); + if (AlertON) Alert("B_Sig(" + Symbol() + " " + fTimeFrameName(Period()) + "): Bands going UP"); + if (SoundON) { + Print("B_Sig(" + Symbol() + " " + fTimeFrameName(Period()) + "): Bands going UP"); + PlaySound(SoundFile); + } + } + } + if (gi_240 > 0) { + if (TimeLocal() > g_datetime_248 + 1) { + if (!EndLessRepeat) gi_240--; + g_datetime_248 = TimeLocal(); + if (AlertON) Alert("B_Sig(" + Symbol() + " " + fTimeFrameName(Period()) + "): Bands going DOWN"); + if (SoundON) { + Print("B_Sig(" + Symbol() + " " + fTimeFrameName(Period()) + "): Bands going DOWN"); + PlaySound(SoundFile); + } + } + } + } + if (gi_240 <= 0 && gi_236 <= 0) ObjectDelete("B_Bell"); +} + +string fTimeFrameName(int ai_0) { + int l_timeframe_4; + if (ai_0 == 0) l_timeframe_4 = Period(); + else l_timeframe_4 = ai_0; + switch (l_timeframe_4) { + case 0: + return ("0"); + case PERIOD_M1: + return ("M1"); + case PERIOD_M5: + return ("M5"); + case PERIOD_M15: + return ("M15"); + case PERIOD_M30: + return ("M30"); + case PERIOD_H1: + return ("H1"); + case PERIOD_H4: + return ("H4"); + case PERIOD_D1: + return ("D1"); + case PERIOD_W1: + return ("W1"); + case PERIOD_MN1: + return ("MN1"); + } + return ("Wrong TimeFrame"); +} + +void fObjLabel(string a_name_0, int a_x_8, int a_y_12, string a_text_16, int a_corner_24 = 0, color a_color_28 = 255, int a_fontsize_32 = 8, int a_window_36 = 0, string a_fontname_40 = "Arial", bool a_bool_48 = FALSE) { + if (ObjectFind(a_name_0) != a_window_36) ObjectCreate(a_name_0, OBJ_LABEL, a_window_36, 0, 0); + ObjectSet(a_name_0, OBJPROP_XDISTANCE, a_x_8); + ObjectSet(a_name_0, OBJPROP_YDISTANCE, a_y_12); + ObjectSetText(a_name_0, a_text_16, a_fontsize_32, a_fontname_40, a_color_28); + ObjectSet(a_name_0, OBJPROP_BACK, a_bool_48); + ObjectSet(a_name_0, OBJPROP_CORNER, a_corner_24); +} \ No newline at end of file diff --git a/#Pallada_Volatility.mq4 b/#Pallada_Volatility.mq4 new file mode 100644 index 0000000..56c200c --- /dev/null +++ b/#Pallada_Volatility.mq4 @@ -0,0 +1,105 @@ + +#property copyright "Copyright © 2009, TradeWays" +#property link "http://www.tradeways.org" + +#property indicator_chart_window +#property indicator_buffers 1 +#property indicator_color1 Black + +extern int PosX = 10; +extern int PosY = 15; +extern int Corner = 1; +extern int N = 20; +string gs_92 = "1"; +double g_ibuf_100[]; +double g_ibuf_104[]; +double g_ibuf_108[]; +double g_ibuf_112[]; +double g_ibuf_116[]; +double g_ibuf_120[]; + +int init() { + IndicatorBuffers(6); + SetIndexBuffer(0, g_ibuf_100); + SetIndexBuffer(1, g_ibuf_104); + SetIndexBuffer(2, g_ibuf_108); + SetIndexBuffer(3, g_ibuf_112); + SetIndexBuffer(4, g_ibuf_116); + SetIndexBuffer(5, g_ibuf_120); + return (0); +} + +int deinit() { + fObjDeleteByPrefix("HHL_Semafor_" + gs_92); + return (0); +} + +int start() { + double l_high_8; + double l_low_16; + //if (TimeCurrent() > StrToTime("2050.04.20")) { + // Alert("New version available! Download it using re-activated link from Plimus"); + // return; + //} + int li_0 = Bars - IndicatorCounted(); + for (int li_4 = li_0 - 1; li_4 >= 0; li_4--) { + l_high_8 = High[iHighest(Symbol(), 0, MODE_HIGH, N, li_4)]; + l_low_16 = Low[iLowest(Symbol(), 0, MODE_LOW, N, li_4)]; + g_ibuf_100[li_4] = (l_high_8 - l_low_16) / Point; + g_ibuf_104[li_4] = EMPTY_VALUE; + g_ibuf_108[li_4] = EMPTY_VALUE; + g_ibuf_112[li_4] = EMPTY_VALUE; + if (g_ibuf_104[li_4 + 1] != EMPTY_VALUE) g_ibuf_104[li_4] = g_ibuf_100[li_4]; + if (g_ibuf_108[li_4 + 1] != EMPTY_VALUE) g_ibuf_108[li_4] = g_ibuf_100[li_4]; + if (g_ibuf_112[li_4 + 1] != EMPTY_VALUE) g_ibuf_112[li_4] = g_ibuf_100[li_4]; + g_ibuf_116[li_4] = g_ibuf_116[li_4 + 1]; + if (g_ibuf_100[li_4 + 1] > g_ibuf_100[li_4]) + if (g_ibuf_100[li_4 + 2] <= g_ibuf_100[li_4 + 1]) g_ibuf_116[li_4] = g_ibuf_100[li_4 + 1]; + if (g_ibuf_100[li_4 + 1] > g_ibuf_100[li_4]) { + g_ibuf_104[li_4] = g_ibuf_100[li_4]; + g_ibuf_108[li_4] = EMPTY_VALUE; + g_ibuf_112[li_4] = EMPTY_VALUE; + } + if (g_ibuf_100[li_4 + 1] < g_ibuf_100[li_4]) { + if (g_ibuf_116[li_4] < g_ibuf_100[li_4]) { + g_ibuf_104[li_4] = EMPTY_VALUE; + g_ibuf_108[li_4] = EMPTY_VALUE; + g_ibuf_112[li_4] = g_ibuf_100[li_4]; + } else { + g_ibuf_104[li_4] = EMPTY_VALUE; + g_ibuf_108[li_4] = g_ibuf_100[li_4]; + g_ibuf_112[li_4] = EMPTY_VALUE; + } + } + } + if (Corner < 2) { + fObjLabel("HHL_Semafor_" + gs_92 + "_Red", PosX, PosY, StringSetChar("", 0, 'l'), Corner, Gray, 16, 0, "Wingdings", FALSE); + fObjLabel("HHL_Semafor_" + gs_92 + "_Yellow", PosX, PosY + 15, StringSetChar("", 0, 'l'), Corner, Gray, 16, 0, "Wingdings", FALSE); + fObjLabel("HHL_Semafor_" + gs_92 + "_Green", PosX, PosY + 30, StringSetChar("", 0, 'l'), Corner, Gray, 16, 0, "Wingdings", FALSE); + if (g_ibuf_104[0] != EMPTY_VALUE) fObjLabel("HHL_Semafor_" + gs_92 + "_Red", PosX, PosY, StringSetChar("", 0, 'l'), Corner, Red, 16, 0, "Wingdings", FALSE); + if (g_ibuf_108[0] != EMPTY_VALUE) fObjLabel("HHL_Semafor_" + gs_92 + "_Yellow", PosX, PosY + 15, StringSetChar("", 0, 'l'), Corner, Yellow, 16, 0, "Wingdings", FALSE); + if (g_ibuf_112[0] != EMPTY_VALUE) fObjLabel("HHL_Semafor_" + gs_92 + "_Green", PosX, PosY + 30, StringSetChar("", 0, 'l'), Corner, Lime, 16, 0, "Wingdings", FALSE); + } else { + fObjLabel("HHL_Semafor_" + gs_92 + "_Red", PosX, PosY + 30, StringSetChar("", 0, 'l'), Corner, Gray, 16, 0, "Wingdings", FALSE); + fObjLabel("HHL_Semafor_" + gs_92 + "_Yellow", PosX, PosY + 15, StringSetChar("", 0, 'l'), Corner, Gray, 16, 0, "Wingdings", FALSE); + fObjLabel("HHL_Semafor_" + gs_92 + "_Green", PosX, PosY, StringSetChar("", 0, 'l'), Corner, Gray, 16, 0, "Wingdings", FALSE); + if (g_ibuf_104[0] != EMPTY_VALUE) fObjLabel("HHL_Semafor_" + gs_92 + "_Red", PosX, PosY + 30, StringSetChar("", 0, 'l'), Corner, Red, 16, 0, "Wingdings", FALSE); + if (g_ibuf_108[0] != EMPTY_VALUE) fObjLabel("HHL_Semafor_" + gs_92 + "_Yellow", PosX, PosY + 15, StringSetChar("", 0, 'l'), Corner, Yellow, 16, 0, "Wingdings", FALSE); + if (g_ibuf_112[0] != EMPTY_VALUE) fObjLabel("HHL_Semafor_" + gs_92 + "_Green", PosX, PosY, StringSetChar("", 0, 'l'), Corner, Lime, 16, 0, "Wingdings", FALSE); + } + return (0); +} + +void fObjLabel(string a_name_0, int a_x_8, int a_y_12, string a_text_16, int a_corner_24 = 0, color a_color_28 = 255, int a_fontsize_32 = 8, int a_window_36 = 0, string a_fontname_40 = "Arial", bool a_bool_48 = FALSE) { + if (ObjectFind(a_name_0) != a_window_36) ObjectCreate(a_name_0, OBJ_LABEL, a_window_36, 0, 0); + ObjectSet(a_name_0, OBJPROP_XDISTANCE, a_x_8); + ObjectSet(a_name_0, OBJPROP_YDISTANCE, a_y_12); + ObjectSetText(a_name_0, a_text_16, a_fontsize_32, a_fontname_40, a_color_28); + ObjectSet(a_name_0, OBJPROP_BACK, a_bool_48); + ObjectSet(a_name_0, OBJPROP_CORNER, a_corner_24); +} + +void fObjDeleteByPrefix(string as_0) { + for (int li_8 = ObjectsTotal() - 1; li_8 >= 0; li_8--) + if (StringFind(ObjectName(li_8), as_0, 0) == 0) ObjectDelete(ObjectName(li_8)); +} \ No newline at end of file diff --git a/00adx_close0test.mq4 b/00adx_close0test.mq4 new file mode 100644 index 0000000..d8b30b4 --- /dev/null +++ b/00adx_close0test.mq4 @@ -0,0 +1,132 @@ +//+------------------------------------------------------------------+ +//| ADX.mq4 | +//| Copyright © 2004, MetaQuotes Software Corp. | +//| http://www.metaquotes.net/ | +//+------------------------------------------------------------------+ +#property copyright "Copyright © 2004, MetaQuotes Software Corp." +#property link "http://www.metaquotes.net/" + +#property indicator_separate_window +#property indicator_buffers 3 +#property indicator_color1 LightSeaGreen +#property indicator_color2 YellowGreen +#property indicator_color3 Wheat +//---- input parameters +extern int ADXPeriod=14; +extern bool close0 = false; + +//---- buffers +double ADXBuffer[]; +double PlusDiBuffer[]; +double MinusDiBuffer[]; +double PlusSdiBuffer[]; +double MinusSdiBuffer[]; +double TempBuffer[]; +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +int init() + { +//---- 3 additional buffers are used for counting. + IndicatorBuffers(6); +//---- indicator buffers + SetIndexBuffer(0,ADXBuffer); + SetIndexBuffer(1,PlusDiBuffer); + SetIndexBuffer(2,MinusDiBuffer); + SetIndexBuffer(3,PlusSdiBuffer); + SetIndexBuffer(4,MinusSdiBuffer); + SetIndexBuffer(5,TempBuffer); +//---- name for DataWindow and indicator subwindow label + IndicatorShortName("ADX("+ADXPeriod+")"); + SetIndexLabel(0,"ADX"); + SetIndexLabel(1,"+DI"); + SetIndexLabel(2,"-DI"); +//---- + SetIndexDrawBegin(0,ADXPeriod); + SetIndexDrawBegin(1,ADXPeriod); + SetIndexDrawBegin(2,ADXPeriod); +//---- + return(0); + } +//+------------------------------------------------------------------+ +//| Average Directional Movement Index | +//+------------------------------------------------------------------+ +int start() + { + double pdm,mdm,tr; + double price_high,price_low; + int starti,i,counted_bars=IndicatorCounted(); +//---- + i=Bars-2; + PlusSdiBuffer[i+1]=0; + MinusSdiBuffer[i+1]=0; + if(counted_bars>=i) i=Bars-counted_bars-1; + starti=i; +//---- + while(i>=0) + { + price_low=Low[i]; + price_high=High[i]; + //---- + pdm=price_high-High[i+1]; + mdm=Low[i+1]-price_low; + if(pdm<0) pdm=0; // +DM + if(mdm<0) mdm=0; // -DM + if(pdm==mdm) { pdm=0; mdm=0; } + else if(pdm0) counted_bars--; + int limit=Bars-counted_bars; +//---- apply EMA to +DI + for(i=0; i<=limit; i++) + PlusDiBuffer[i]=iMAOnArray(PlusSdiBuffer,Bars,ADXPeriod,0,MODE_EMA,i); +//---- apply EMA to -DI + for(i=0; i<=limit; i++) + MinusDiBuffer[i]=iMAOnArray(MinusSdiBuffer,Bars,ADXPeriod,0,MODE_EMA,i); +//---- Directional Movement (DX) + i=Bars-2; + TempBuffer[i+1]=0; + i=starti; + while(i>=0) + { + double div=MathAbs(PlusDiBuffer[i]+MinusDiBuffer[i]); + if(div==0.00) TempBuffer[i]=0; + else TempBuffer[i]=100*(MathAbs(PlusDiBuffer[i]-MinusDiBuffer[i])/div); + i--; + } +//---- ADX is exponential moving average on DX + for(i=0; i=0; i--) + { + barTime=TimeToStr(Time[i], TIME_MINUTES); + lastBarTime=TimeToStr(Time[i+1], TIME_MINUTES); + barDay=TimeToStr(Time[i],TIME_DATE); + lastBarDay=TimeToStr(Time[i+1],TIME_DATE); + //need to handle if pivotrangestart/end is 00:00 + if ((PivotRangeEnd=="00:00" && barTime>=PivotRangeEnd && barDay>lastBarDay) || (barTime>=PivotRangeEnd && lastBarTime0) + { + calculatePivotRangeValues(openBar, closeBar); + } + } + if ((PivotRangeStart=="00:00" && barTime>=PivotRangeStart && barDay>lastBarDay) || (barTime>=PivotRangeStart && lastBarTime0) + { + drawIndicators(i); + } + } + return(0); + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +void calculatePivotRangeValues(int openBar, int closeBar) + { + pivotRangeHigh=High[Highest(NULL, 0, MODE_HIGH, (openBar - closeBar + 1), closeBar)]; + pivotRangeLow=Low[Lowest(NULL, 0, MODE_LOW, (openBar - closeBar + 1), closeBar)]; + pivotRangeClose=Close[closeBar]; + pivotPoint=(pivotRangeHigh + pivotRangeLow + pivotRangeClose)/3; + pivotDiff=MathAbs(((pivotRangeHigh + pivotRangeLow)/2) - pivotPoint); + pivotTop=pivotPoint + pivotDiff; + pivotBottom=pivotPoint - pivotDiff; +//---- + if (DisplayMAs) calcPivotMA(); + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +void calcPivotMA() + { + //create temp array + double pivs[50]; + //load new pivot + ArrayCopy(pivs,pivots,1,0,49); + pivs[0]=pivotPoint; + ArrayCopy(pivots, pivs, 0, 0, WHOLE_ARRAY); + //calcMA + double pivSum=0; + int count=ArraySize(pivots); + if (count>=14) + { + for(int p=0; p9.0170,1=>14.5898,2=>23.6068,3=>38.1966,4=>50.0000,5=>61.8034,Null +extern int GoldenRatioPwr;//default=8 +extern int ADXPr;//default = 50 (1-100) +extern int ADXtype;//0=ADX, 1=ADXR +//---- buffers +double FIMA[]; +double FIMA_Osc[]; +double StdFIMA[]; +double AdjFIMA[]; +double B1[]; +double B2[]; +double B3[]; +double B4[]; +double ADX[]; +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +int init() + { +//---- indicators + IndicatorBuffers(8); + SetIndexStyle(0,DRAW_LINE, STYLE_DOT); + SetIndexBuffer(0,FIMA); + SetIndexLabel(0,"FIMA"); + + SetIndexStyle(1,DRAW_LINE); + SetIndexBuffer(1,FIMA_Osc); + SetIndexLabel(1,"FIMA_Osc"); + + SetIndexStyle(2,DRAW_LINE); + SetIndexBuffer(2,StdFIMA); + SetIndexLabel(2,"StdFIMA"); + + SetIndexStyle(3,DRAW_LINE); + SetIndexBuffer(3,B1); + SetIndexLabel(3,"B1"); + + SetIndexStyle(4,DRAW_LINE); + SetIndexBuffer(4,B2); + SetIndexLabel(4,"B2"); + + SetIndexStyle(5,DRAW_LINE); + SetIndexBuffer(5,B3); + SetIndexLabel(5,"B3"); + + SetIndexStyle(6,DRAW_LINE); + SetIndexBuffer(6,B4); + SetIndexLabel(6,"B4"); + SetIndexStyle(7,DRAW_LINE); + SetIndexBuffer(7,ADX); +//---- + return(0); + } +//+------------------------------------------------------------------+ +//| Custor indicator deinitialization function | +//+------------------------------------------------------------------+ +int deinit() + { +//---- + +//---- + return(0); + } +//+------------------------------------------------------------------+ +//| Custom indicator iteration function | +//+------------------------------------------------------------------+ +int start() + { + int i,p; + int counted_bars = IndicatorCounted(); +//---- + + /* + double TR; + double TH; + double TL; + double PlusDM, PlusDI, MinusDM, MinusDI, DIDif, DISum; + */ + double FMA; + double ADXFinal; + double ADXRCustom; + double EmaIndex, Diff, MyConst; + double Hhv, Llv; + + double GoldenRatio, GoldVal,FBase,F0,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13; + + + //test default vals + FiboMA = 2; + GoldenRatio = 1;//=8; + ADXPr = 23;//50; + ADXtype = 0; +// + + if ( ADXPr<1 || ADXPr >100) {ADXPr =50;} //default = 50 (1-100) + + //calc FMA to use + switch (FiboMA) + { + case 0: FMA = 9.0170; break; + case 1: FMA = 14.5898; break; + case 2: FMA = 23.6068; break; + case 3: FMA = 38.1966; break; + case 4: FMA = 50.0000; break; + case 5: FMA = 61.8034; break; + default: FMA = 23.6068; break; + } + + //Calculate & Plot Tushar Chande style Fibonacci Based Moving Average Using Wilders ADX} + i=Bars; + //if (counted_bars>=i) {i=Bars-counted_bars-1;} + while (i>=0) + { + + ADXFinal = iADX(NULL,0,ADXPr,PRICE_CLOSE,MODE_MAIN,i); + ADXRCustom = ( ADXFinal + iADX(NULL,0,ADXPr,PRICE_CLOSE,MODE_MAIN,(i+ADXPr-1)) )/2; + if ( ADXtype == 0 ) { ADX[i] = ADXFinal; } else { ADX[i] = ADXRCustom;} + if ( FMA>0) { EmaIndex = (2/(1+FMA)); } else {EmaIndex = 0.20;} + + //get Hhv(_ADX, ADXPr) and Llv(_ADX, ADXPr) - substituted for VT Hhv and Llv functions + Hhv = ADX[i]; + Llv = ADX[i]; + for(p=i; p < (i+ADXPr) ; p++) + { + if (ADX[p]>Hhv) {Hhv = ADX[p];} + if (ADX[p] 0) {MyConst = (ADX[i] - Llv)/Diff;} else {MyConst = EmaIndex;} + if ( MyConst > EmaIndex) {MyConst = EmaIndex;} + //if (IndicatorCounted() < ADXPr+(ADXPr*1.5)) + if (Bars < ADXPr+(ADXPr*1.5)) + { + FIMA[i] = Close[i]; + } + else + { + //sub for VT expression, subst simple average for 2 period MA + //FIMA[i] = MOV( (((1 - MyConst) * Ref(FIMA,-1)) + (MyConst * Close)),2,s)); + FIMA[i] = ( (1-MyConst)*FIMA[i+1]+MyConst*Close[i] + (1-MyConst)*FIMA[i+2]+MyConst*Close[i+1] )/2; + } + FIMA_Osc[i] = iMAOnArray(FIMA, 0, FMA*0.236068 , 0,MODE_LWMA,i); + StdFIMA[i] = iMA(NULL,0,FMA,0,MODE_EMA,PRICE_CLOSE,i); + + //{Control the distance from Price to F Lines} + if (GoldenRatioPwr <=0) {GoldenRatioPwr=8;}//default=8 + GoldenRatio = MathPow(1.618034 ,GoldenRatioPwr ); + GoldVal = 1.618034; + FBase = 0.1919/2; + F0 = FBase * GoldenRatio; + + F1 = F0*GoldVal;F2 = F1*GoldVal;F3 = F2*GoldVal;F4 = F3*GoldVal; + F5 = F4*GoldVal;F6 = F5*GoldVal;F7 = F6*GoldVal;F8 = F7*GoldVal; + F9 = F8*GoldVal;F10 = F9*GoldVal;F11 = F10*GoldVal;F12 = F11*GoldVal; + F13 = F12*GoldVal; + + if (Close[i]>=FIMA[i]) + { + B1[i] = FIMA[i]+(FIMA[i]*(FMA*(F1/100000))); + B2[i] = FIMA[i]+(FIMA[i]*(FMA*(F2/100000))); + B3[i] = FIMA[i]+(FIMA[i]*(FMA*(F3/100000))); + B4[i] = FIMA[i]+(FIMA[i]*(FMA*(F4/100000))); + } + else + { + B1[i] = FIMA[i]-(FIMA[i]*(FMA*(F1/100000))); + B2[i] = FIMA[i]-(FIMA[i]*(FMA*(F2/100000))); + B3[i] = FIMA[i]-(FIMA[i]*(FMA*(F3/100000))); + B4[i] = FIMA[i]-(FIMA[i]*(FMA*(F4/100000))); + } + i--; + } + +//---- + return(0); + } + +//+------------------------------------------------------------------+ \ No newline at end of file diff --git a/ADX Filter sBarM mtf.mq4 b/ADX Filter sBarM mtf.mq4 new file mode 100644 index 0000000..d9ebefe --- /dev/null +++ b/ADX Filter sBarM mtf.mq4 @@ -0,0 +1,176 @@ +//+------------------------------------------------------------------+ +//| ADX Filter SideBar based on SAR Color Bar.mq4| +//+------------------------------------------------------------------+ +//2008fxtsd ki +//mod adx & +-di separate sett + +#property copyright "Kalenzo Code adapted by cja" +#property link "http://www.foreksik.prv.pl" + +#property indicator_color1 Green +#property indicator_color2 Red +#property indicator_color3 Yellow +#property indicator_color4 Lime +#property indicator_color5 Orchid + +#property indicator_width1 3 +#property indicator_width2 3 +#property indicator_width3 3 +#property indicator_width4 4 +#property indicator_width5 4 + +#property indicator_separate_window +#property indicator_buffers 5 +#property indicator_maximum 77 +#property indicator_minimum 1 + +double ADX_buff[],ADX_Up[],ADX_Dn[],PADX_buff[],NADX_buff[];//buffers + +extern int TimeFrame = 0; + +extern int ADX_Period = 14; +extern int ADX_Level = 20; +extern int DI_Period = 21; +extern int applied_price = 0; + +extern int sBarLevel = 5; + +extern bool _ADXstyleLine = false; +extern bool pADXstyleLine = false; +extern bool nADXstyleLine = true; + +extern int MaxBarsToCount = 1500; + +extern string note_sBarLevel = "sBarLevel:1-77(bar position)"; +extern string note_ADXstyle = " ADXstyle: Line/Dot"; +extern string note_TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN"; + + +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +int init() + { +//---- indicators + SetIndexBuffer(0,PADX_buff); + SetIndexStyle (0,DRAW_ARROW); + SetIndexArrow (0,167);//110 + SetIndexEmptyValue (0,EMPTY_VALUE); + + SetIndexBuffer(1,NADX_buff); + SetIndexStyle (1,DRAW_ARROW); + SetIndexArrow (1,167); + SetIndexEmptyValue (1,EMPTY_VALUE); + + + if (_ADXstyleLine) SetIndexStyle(2,DRAW_LINE); + else {SetIndexStyle (2,DRAW_ARROW); + SetIndexArrow (2,158); + SetIndexEmptyValue (2,EMPTY_VALUE);} + SetIndexBuffer(2,ADX_buff); + + if (pADXstyleLine) SetIndexStyle(3,DRAW_LINE); + else { SetIndexStyle (3,DRAW_ARROW); + SetIndexArrow (3,158); + SetIndexEmptyValue (3,EMPTY_VALUE);} + SetIndexBuffer(3,ADX_Up); + + if (nADXstyleLine) SetIndexStyle(4,DRAW_LINE); + else {SetIndexStyle (4,DRAW_ARROW); + SetIndexArrow (4,158); + SetIndexEmptyValue (4,EMPTY_VALUE);} + SetIndexBuffer(4,ADX_Dn); + + + + switch(TimeFrame) + { + case 1 : string TimeFrameStr="M1"; break; + case 5 : TimeFrameStr="M5"; break; + case 15 : TimeFrameStr="M15"; break; + case 30 : TimeFrameStr="M30"; break; + case 60 : TimeFrameStr="H1"; break; + case 240 : TimeFrameStr="H4"; break; + case 1440 : TimeFrameStr="D1"; break; + case 10080 : TimeFrameStr="W1"; break; + case 43200 : TimeFrameStr="MN"; break; + default : TimeFrameStr="TF0"; + } + TimeFrame = MathMax(TimeFrame, Period()); + + IndicatorShortName("ADX("+ADX_Period+")+-DI("+DI_Period+") Filter sBar["+TimeFrameStr+"]"); + + SetIndexLabel(0,"posDI ["+TimeFrame+"]Up"); + SetIndexLabel(1,"negDI ["+TimeFrame+"]Down"); + SetIndexLabel(2,"ADX ["+TimeFrame+"] Level < "+ADX_Level+""); + SetIndexLabel(3,"ADX ["+TimeFrame+"] Up"); + SetIndexLabel(4,"ADX ["+TimeFrame+"] Down"); + + SetIndexDrawBegin(0,2); + SetIndexDrawBegin(1,2); + SetIndexDrawBegin(2,2); + SetIndexDrawBegin(3,2); + SetIndexDrawBegin(4,2); + + return(0); + } + +//+--- +int deinit() + { + return(0); + } +//+------- + + +int start() + { + + int i,y,limit; + datetime TimeArray[]; + ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame); + + int counted_bars=IndicatorCounted(); + if(counted_bars<0) return(-1); + if(counted_bars>0) counted_bars--; + + limit=Bars-counted_bars; + limit = MathMax (limit,TimeFrame/Period()); + limit = MathMin (limit,MaxBarsToCount); + + + + for(i =0, y=0; iADX1) + { + ADX_Up[i] = sBarLevel; + ADX_Dn[i] = EMPTY_VALUE; + } + else + { + ADX_Up[i] = EMPTY_VALUE; + ADX_Dn[i] = sBarLevel; + } + + if(ADX < ADX_Level) ADX_buff[i]= sBarLevel+5; + if(PADX > NADX) PADX_buff[i]=sBarLevel+2; + if(PADX < NADX) NADX_buff[i]=sBarLevel+2; + + } + + return(0); + } + +//+------------------------------------------------------------- \ No newline at end of file diff --git a/ADX_Crossing_v_2_0.mq4 b/ADX_Crossing_v_2_0.mq4 new file mode 100644 index 0000000..171339d --- /dev/null +++ b/ADX_Crossing_v_2_0.mq4 @@ -0,0 +1,86 @@ +//+------------------------------------------------------------------+ +//| ADX Crossing.mq4 +//| Amir +//+------------------------------------------------------------------+ +#property copyright "Author - Amir" +//---- +#property indicator_chart_window +#property indicator_buffers 2 +#property indicator_color1 Lime +#property indicator_color2 Red +//---- input parameters +extern int ADXbars=50; +extern int CountBars=350; +extern bool UseSound=True; +extern string SoundFile="wait.waw"; +//---- buffers +double val1[]; +double val2[]; +double b4plusdi,nowplusdi,b4minusdi,nowminusdi; +bool SoundBuy=False; +bool SoundSell=False; +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +int init() + { + string short_name; +//---- indicator line + IndicatorBuffers(2); + SetIndexStyle(0,DRAW_ARROW); + SetIndexArrow(0,108); + SetIndexStyle(1,DRAW_ARROW); + SetIndexArrow(1,108); + SetIndexBuffer(0,val1); + SetIndexBuffer(1,val2); +//---- + return(0); + } +//+------------------------------------------------------------------+ +//| AltrTrend_Signal_v2_2 | +//+------------------------------------------------------------------+ +int start() + { + if (CountBars>=Bars) CountBars=Bars; + SetIndexDrawBegin(0,Bars-CountBars); + SetIndexDrawBegin(1,Bars-CountBars); + int i,shift,limit,CountedBars=IndicatorCounted(); + if (CountedBars < 1) + { + for(i=0; i<=CountBars; i++) {val1[i]=0.0; val2[i]=0.0;} + } + + if(CountedBars > 0) CountedBars--; +//---- + limit=Bars - CountedBars; +//---- + for(shift=limit; shift>=0; shift--) + { + b4plusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_PLUSDI,shift+1); + nowplusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_PLUSDI,shift); + b4minusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_MINUSDI,shift+1); + nowminusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_MINUSDI,shift); + if (b4plusdinowminusdi) + { + val1[shift]=Low[shift]-5*Point; + } + if (b4plusdi>b4minusdi && nowplusdi0) counted_bars--; + int limit=Bars-counted_bars; + if(counted_bars==0) limit-=1+ADXPeriod; +//----Calculation--------------------------- + for(i=0; inowplusdi) + { + ind_buffer2[i]=Low[i]; + ind_buffer1[i]=High[i]; + } + if(nowplusdi>nowminusdi) + { + ind_buffer1[i]=Low[i]; + ind_buffer2[i]=High[i]; + } + } +//---- done + return(0); + } +//+------------------------------------------------------------------+ diff --git a/Advanced_ADX.mq4 b/Advanced_ADX.mq4 new file mode 100644 index 0000000..7beda87 --- /dev/null +++ b/Advanced_ADX.mq4 @@ -0,0 +1,66 @@ +//+------------------------------------------------------------------+ +//| Advanced_ADX.mq4 | +//| Copyright © 2006, Eng. Waddah Attar | +//| waddahattar@hotmail.com | +//+------------------------------------------------------------------+ +#property copyright "Waddah Attar" +#property link "waddahattar@hotmail.com" +//---- +#property indicator_separate_window +#property indicator_buffers 2 +#property indicator_color1 Green +#property indicator_color2 Red +//---- +extern int ADXPeriod = 13; +//---- +double ExtBuffer1[]; +double ExtBuffer2[]; +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +int init() + { + SetIndexBuffer(0, ExtBuffer1); + SetIndexStyle(0, DRAW_HISTOGRAM, 0, 2); +//---- + SetIndexBuffer(1, ExtBuffer2); + SetIndexStyle(1, DRAW_HISTOGRAM, 0, 2); +//---- + IndicatorShortName("Advanced_ADX (" + ADXPeriod + ")"); + return(0); + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +int start() + { + int i, limit; + double ADX0,ADX1,ADX2; + int counted_bars = IndicatorCounted(); + if(counted_bars < 0) + return(-1); + if(counted_bars > 0) + counted_bars--; + limit = Bars - counted_bars; +//---- + for(i = 0; i < limit ; i++) + { + ADX0 = iADX(NULL, 0, ADXPeriod, PRICE_CLOSE, MODE_MAIN, i); + ADX1 = iADX(NULL, 0, ADXPeriod, PRICE_CLOSE, MODE_PLUSDI, i); + ADX2 = iADX(NULL, 0, ADXPeriod, PRICE_CLOSE, MODE_MINUSDI, i); + //---- + if(ADX1 >= ADX2) + { + ExtBuffer1[i] = ADX0; + ExtBuffer2[i] = 0; + } + else + { + ExtBuffer1[i] = 0; + ExtBuffer2[i] = ADX0; + } + } + return(0); + } +//+------------------------------------------------------------------+ + diff --git a/AlphaTrendSpotter_free.mq4 b/AlphaTrendSpotter_free.mq4 new file mode 100644 index 0000000..d4df778 Binary files /dev/null and b/AlphaTrendSpotter_free.mq4 differ diff --git a/BE-clock.mq4 b/BE-clock.mq4 new file mode 100644 index 0000000..ebf39a1 --- /dev/null +++ b/BE-clock.mq4 @@ -0,0 +1,66 @@ +//+------------------------------------------------------------------+ +//| b-clock.mq4 | +//| Core time code by Nick Bilak | +//| http://metatrader.50webs.com/ beluck[at]gmail.com | +//| modified by adoleh2000 and dwt5 | +//+------------------------------------------------------------------+ + +#property copyright "Copyright © 2005, Nick Bilak" +#property link "http://metatrader.50webs.com/" + +#property indicator_chart_window +extern color ClockColor = Magenta; + +//---- buffers +double s1[]; + +//+------------------------------------------------------------------+ +int deinit() { + ObjectDelete("time"); +return(0); +} +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ + +int init() + + { + + } + return(0); + + +//+------------------------------------------------------------------+ +//| Custom indicator iteration function | +//+------------------------------------------------------------------+ +int start() + { + + double i; + int m,s,k; + m=Time[0]+Period()*60-CurTime(); + i=m/60.0; + s=m%60; + m=(m-m%60)/60; +// Comment( m + " minutes " + s + " seconds left to bar end"); + + + ObjectDelete("time"); + + if(ObjectFind("time") != 0) + { + ObjectCreate("time", OBJ_TEXT, 0, Time[0], Close[0]+ 0.0001); + ObjectSetText("time", " <"+m+":"+s, 8, "Tahoma", ClockColor); + } + else + { + ObjectMove("time", 0, Time[0], Close[0]+0.0001); + } + + + return(0); + } +//+------------------------------------------------------------------+ + + diff --git a/Bears.mq4 b/Bears.mq4 new file mode 100644 index 0000000..2f55c7d --- /dev/null +++ b/Bears.mq4 @@ -0,0 +1,67 @@ +//+------------------------------------------------------------------+ +//| Bears.mq4 | +//| Copyright 2005-2014, MetaQuotes Software Corp. | +//| http://www.mql4.com | +//+------------------------------------------------------------------+ +#property copyright "2005-2014, MetaQuotes Software Corp." +#property link "http://www.mql4.com" +#property description "Bears Power" +#property strict + +//--- indicator settings +#property indicator_separate_window +#property indicator_buffers 1 +#property indicator_color1 Silver +//--- input parameter +input int InpBearsPeriod=13; // Bears Period +//--- buffers +double ExtBearsBuffer[]; +double ExtTempBuffer[]; +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +void OnInit(void) + { + string short_name; +//--- 1 additional buffer used for counting. + IndicatorBuffers(2); + IndicatorDigits(Digits); +//--- indicator line + SetIndexStyle(0,DRAW_HISTOGRAM); + SetIndexBuffer(0,ExtBearsBuffer); + SetIndexBuffer(1,ExtTempBuffer); +//--- name for DataWindow and indicator subwindow label + short_name="Bears("+IntegerToString(InpBearsPeriod)+")"; + IndicatorShortName(short_name); + SetIndexLabel(0,short_name); + } +//+------------------------------------------------------------------+ +//| Bears Power | +//+------------------------------------------------------------------+ +int OnCalculate(const int rates_total, + const int prev_calculated, + const datetime &time[], + const double &open[], + const double &high[], + const double &low[], + const double &close[], + const long &tick_volume[], + const long &volume[], + const int &spread[]) + { + int limit=rates_total-prev_calculated; +//--- + if(rates_total<=InpBearsPeriod) + return(0); +//--- + if(prev_calculated>0) + limit++; + for(int i=0; i0) + limit++; + for(int i=0; i + +#property indicator_separate_window +#property indicator_buffers 1 +#property indicator_color1 LightSeaGreen +#property indicator_level1 -100.0 +#property indicator_level2 100.0 +#property indicator_levelcolor clrSilver +#property indicator_levelstyle STYLE_DOT +//--- input parameter +input int InpCCIPeriod=14; // CCI Period +//--- buffers +double ExtCCIBuffer[]; +double ExtPriceBuffer[]; +double ExtMovBuffer[]; +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +int OnInit(void) + { + string short_name; +//--- 2 additional buffers are used for counting. + IndicatorBuffers(3); + SetIndexBuffer(1,ExtPriceBuffer); + SetIndexBuffer(2,ExtMovBuffer); +//--- indicator line + SetIndexStyle(0,DRAW_LINE); + SetIndexBuffer(0,ExtCCIBuffer); +//--- check for input parameter + if(InpCCIPeriod<=1) + { + Print("Wrong input parameter CCI Period=",InpCCIPeriod); + return(INIT_FAILED); + } +//--- + SetIndexDrawBegin(0,InpCCIPeriod); +//--- name for DataWindow and indicator subwindow label + short_name="CCI("+IntegerToString(InpCCIPeriod)+")"; + IndicatorShortName(short_name); + SetIndexLabel(0,short_name); +//--- initialization done + return(INIT_SUCCEEDED); + } +//+------------------------------------------------------------------+ +//| Commodity Channel Index | +//+------------------------------------------------------------------+ +int OnCalculate(const int rates_total, + const int prev_calculated, + const datetime &time[], + const double &open[], + const double &high[], + const double &low[], + const double &close[], + const long &tick_volume[], + const long &volume[], + const int &spread[]) + { + int i,k,pos; + double dSum,dMul; +//--- + if(rates_total<=InpCCIPeriod || InpCCIPeriod<=1) + return(0); +//--- counting from 0 to rates_total + ArraySetAsSeries(ExtCCIBuffer,false); + ArraySetAsSeries(ExtPriceBuffer,false); + ArraySetAsSeries(ExtMovBuffer,false); + ArraySetAsSeries(high,false); + ArraySetAsSeries(low,false); + ArraySetAsSeries(close,false); +//--- initial zero + if(prev_calculated<1) + { + for(i=0; i. + * + * FILE: CHT_Value_Chart_v2.5.mq4 + * VERSION: 2.5 + * AUTHOR: Thierry Chappuis + * DESCRIPTION: + * MT4 Custom indicator that aims at calculating and displaying a value chart + * + * LOG: + * - 20121104: version 1.0 + * - 20121207: version 2.0, improvement of the display + * - 20121211: version 2.1, multiple timeframes version + * - 20121228: version 2.2, bug fix with vc_delete(). VC_Bars2Check has been added. + * - 20130110: version 2.3, add support for automatic vc support/resistance display + * - 20130110: version 2.3.1 bug fix in the value chart computation algorithm + * - 20130110: version 2.4, bug fixes with multiple timeframes functionalities + * - 20130122: version 2.5, integration of the alert system + * + * Copyright 2012-2013 Thierry Chappuis + */ + +#property copyright "Copyright 2012-2013, Thierry Chappuis" + +#property indicator_separate_window + +#property indicator_buffers 4 + +#property indicator_level1 6 +#property indicator_level2 8 +#property indicator_level3 -6 +#property indicator_level4 -8 +#property indicator_level5 10 +#property indicator_level6 -10 +#property indicator_level7 12 +#property indicator_level8 -12 + +#property indicator_levelstyle 2 +#property indicator_levelcolor DimGray + +#property indicator_maximum 15 +#property indicator_minimum -15 + +/* Input parameters */ +extern int VC_Period = 0; +extern int VC_NumBars = 5; +extern int VC_Bars2Check = 500; +extern bool VC_DisplayChart = true; +extern bool VC_UseDynamicSRLevels = true; +extern int VC_DynamicSRPeriod = 100; +extern double VC_DynamicSRCut = 0.02; +extern double VC_Overbought = 6; +extern double VC_Oversold = -6; +extern bool VC_AlertON = false; +extern double VC_AlertSRAnticipation = 1.0; + +extern color VC_UpColor = Lime; +extern color VC_DownColor = Red; +extern int VC_WickWidth = 1; +extern int VC_BodyWidth = 4; +extern color VC_ResistanceColor = Red; +extern color VC_SupportColor = Lime; + +int alert_confirmation_value = 1; + +/* Buffers */ +double vcHigh[]; +double vcLow[]; +double vcOpen[]; +double vcClose[]; + +/* Global variables */ +string indicator_short_name; +int bar_new_ID; + +/* Initialisation of the indicator */ +int init() +{ + indicator_short_name = "CHT_Value_Chart (" + VC_NumBars + "," + VC_Period + ")"; + + IndicatorShortName(indicator_short_name); + + SetIndexStyle(0, DRAW_NONE); + SetIndexStyle(1, DRAW_NONE); + SetIndexStyle(2, DRAW_NONE); + SetIndexStyle(3, DRAW_NONE); + SetIndexStyle(4, DRAW_NONE); + + SetIndexBuffer(0, vcHigh); + SetIndexBuffer(1, vcLow); + SetIndexBuffer(2, vcOpen); + SetIndexBuffer(3, vcClose); + + SetIndexEmptyValue(0, 0.0); + SetIndexEmptyValue(1, 0.0); + SetIndexEmptyValue(2, 0.0); + SetIndexEmptyValue(3, 0.0); + + // Value chart can only calculate data for TFs >= Period() + if (VC_Period != 0 && VC_Period < Period()) + { + VC_Period = 0; + } + + string name; + for (int i = ObjectsTotal() - 1; i >= 0; i--) + { + name = ObjectName(i); + string s = "CHT_VC_"; + + if (StringSubstr(name, 0, StringLen(s)) == s) + { + ObjectDelete(name); + } + } + + return (0); +} + +/* Entry point for the indicator action */ +int start() +{ + int bars; + int counted_bars = IndicatorCounted(); + static int pa_profile[]; + + double vc_support; + double vc_resistance; + int alert_signal = 0; + + ObjectDelete("CHT_VC_(" + VC_NumBars + "," + VC_Period + ")" + "_Support"); + ObjectDelete("CHT_VC_(" + VC_NumBars + "," + VC_Period + ")" + "_Resistance"); + + // The last counted bar is counted again + if(counted_bars > 0) + { + counted_bars--; + } + + bars = Bars - counted_bars; + + if (bars > VC_Bars2Check && VC_Bars2Check > 10) + { + bars = VC_Bars2Check; + } + + computes_value_chart(bars, VC_Period); + + computes_pa_profile(VC_Period, pa_profile, vc_support, vc_resistance); + + if (VC_DisplayChart== true) + { + dispays_value_chart(bars); + vc_displays_sr(vc_support, vc_resistance); + } + + if (VC_UseDynamicSRLevels == true) + { + VC_Overbought = vc_resistance - VC_AlertSRAnticipation; + VC_Oversold = vc_support + VC_AlertSRAnticipation; + } + + vc_check(vcClose[0], alert_signal); + + vc_alert_trigger(alert_signal, VC_AlertON); + + return(0); +} + +int deinit() +{ + vc_delete(); + Comment(""); + return (0); +} + +void computes_value_chart(int bars, int period) +{ + double sum; + double floatingAxis; + double volatilityUnit; + static datetime last_time; + + static double high; + static double low; + static double open; + static double close; + + for(int i = bars-1; i >= 0; i--) + { + datetime t = Time[i]; + int y = iBarShift(NULL, period, t); + int z = iBarShift(NULL, 0, iTime(NULL, period, y)); + + /* Determination of the floating axis */ + sum = 0; + for (int k = y; k < y+VC_NumBars; k++) + { + sum += (iHigh(NULL, period, k) + iLow(NULL, period, k)) / 2.0; + } + floatingAxis = sum / VC_NumBars; + + /* Determination of the volatility unit */ + sum = 0; + for (k = y; k < VC_NumBars + y; k++) + { + sum += iHigh(NULL, period, k) - iLow(NULL, period, k); + } + volatilityUnit = 0.2 * (sum / VC_NumBars); + + /* Determination of relative high, low, open and close values */ + vcHigh[i] = (iHigh(NULL, period, y) - floatingAxis) / volatilityUnit; + vcLow[i] = (iLow(NULL, period, y) - floatingAxis) / volatilityUnit; + vcOpen[i] = (iOpen(NULL, period, y) - floatingAxis) / volatilityUnit; + vcClose[i] = (iClose(NULL, period, y) - floatingAxis) / volatilityUnit; + } +} + +void dispays_value_chart(int bars) +{ + int window = WindowFind(indicator_short_name); + + string current_body_ID; + string current_wick_ID; + + for(int i = 0; i < bars; i++) + { + if (vcHigh[i] == 0.0 && vcOpen[i] == 0.0 && vcClose[i] == 0.0 && vcLow[i] == 0.0) + { + // Do nothing + } + else + { + current_body_ID = "CHT_VC_(" + VC_NumBars + "," + VC_Period + ")" + "_BODY_ID(" + Time[i] + ")"; + current_wick_ID = "CHT_VC_(" + VC_NumBars + "," + VC_Period + ")" + "_WICK_ID(" + Time[i] + ")"; + + ObjectDelete(current_body_ID); + ObjectDelete(current_wick_ID); + + ObjectCreate(current_body_ID, OBJ_TREND, window, Time[i], vcOpen[i], Time[i], vcClose[i]); + ObjectSet(current_body_ID, OBJPROP_STYLE, STYLE_SOLID); + ObjectSet(current_body_ID, OBJPROP_RAY, false); + ObjectSet(current_body_ID, OBJPROP_WIDTH, VC_BodyWidth); + + + ObjectCreate(current_wick_ID, OBJ_TREND, window, Time[i], vcHigh[i], Time[i], vcLow[i]); + ObjectSet(current_wick_ID, OBJPROP_STYLE, STYLE_SOLID); + ObjectSet(current_wick_ID, OBJPROP_RAY, false); + ObjectSet(current_wick_ID, OBJPROP_WIDTH, VC_WickWidth); + + if (vcOpen[i] <= vcClose[i]) + { + ObjectSet(current_body_ID, OBJPROP_COLOR, VC_UpColor); + ObjectSet(current_wick_ID, OBJPROP_COLOR, VC_UpColor); + } + else + { + ObjectSet(current_body_ID, OBJPROP_COLOR, VC_DownColor); + ObjectSet(current_wick_ID, OBJPROP_COLOR, VC_DownColor); + } + } + } +} + +void vc_delete() +{ + string name; + for (int i = ObjectsTotal() - 1; i >= 0; i--) + { + name = ObjectName(i); + string s = "CHT_VC_(" + VC_NumBars + "," + VC_Period + ")"; + + if (StringSubstr(name, 0, StringLen(s)) == s) + { + ObjectDelete(name); + } + } +} + +int computes_pa_profile(int period, int & pa_profile[], double & support, double & resistance) +{ + int err = 0; + static datetime last_time; + static bool initialized = false; + + if (err == 0 && VC_UseDynamicSRLevels) + { + double pap_max = 15; + double pap_min = -15; + double pap_increment = 0.1; + int pap_size = (pap_max - pap_min) / pap_increment + 1; + double value; + int n; + int sum; + + if (initialized == false) + { + ArrayResize(pa_profile, pap_size); + initialized = true; + } + + int i, j; + + if (last_time < iTime(NULL, period, 0)) + { + // Initialization + for (j = 0; j < pap_size; j++) + { + pa_profile[j] = 0; + } + + // Scan of value chart + for (i = 1; i < VC_DynamicSRPeriod; i++) + { + int z = iBarShift(NULL, 0, iTime(NULL, period, i)); + + for (j = 1; j < pap_size; j++) + { + value = pap_min + j * pap_increment; + + if (vcLow[z] <= value && vcHigh[z] > value) + { + pa_profile[0]++; + pa_profile[j]++; + } + } + } + } + + n = VC_DynamicSRCut * pa_profile[0]; + for (j = 1, sum = 0; j < pap_size; j++) + { + sum += pa_profile[j]; + if (sum >= n) + { + break; + } + } + + support = pap_min + j * pap_increment; + + for (j = pap_size - 1, sum = 0; j > 0; j--) + { + sum = sum + pa_profile[j]; + if (sum >= n) + { + break; + } + } + + resistance = pap_min + j * pap_increment; + } + + return (err); +} + +int vc_displays_sr(double & vc_support, double & vc_resistance) +{ + int err = 0; + + vc_delete_sr(); + + if (err == 0 && VC_UseDynamicSRLevels) + { + int window = WindowFind(indicator_short_name); + string support_name = "CHT_VC_(" + VC_NumBars + "," + VC_Period + ")" + "_Support"; + string resistance_name = "CHT_VC_(" + VC_NumBars + "," + VC_Period + ")" + "_Resistance"; + + ObjectCreate(support_name, OBJ_HLINE, window, Time[0], vc_support); + ObjectSet(support_name, OBJPROP_COLOR, VC_SupportColor); + + ObjectCreate(resistance_name, OBJ_HLINE, window, Time[0], vc_resistance); + ObjectSet(resistance_name, OBJPROP_COLOR, VC_ResistanceColor); + + } + + return (err); +} + +void vc_delete_sr() +{ + string name; + for (int i = ObjectsTotal() - 1; i >= 0; i--) + { + name = ObjectName(i); + + if (StringSubstr(name, StringLen(name) - 12, 11) == "_Resistance" && StringSubstr(name, 0, 7) == "CHT_VC_") + { + ObjectDelete(name); + } + if (StringSubstr(name, StringLen(name) - 9, 8) == "_Support" && StringSubstr(name, 0, 7) == "CHT_VC_") + { + ObjectDelete(name); + } + } +} + +void vc_check(double value, int & alert_signal) +{ + if (value > VC_Overbought) + { + alert_signal++; + } + else if (value > VC_Oversold) + { + // Do nothing + } + else // value < VC_Oversold + { + alert_signal--; + } +} + +void vc_alert_trigger(int alert_signal, bool use_alert) +{ + if (use_alert) + { + static datetime last_alert; + static int last_alert_signal; + + if (VC_Period == 0) + { + VC_Period = Period(); + } + + if (last_alert_signal != alert_signal && last_alert < iTime(NULL, VC_Period, 0)) + { + if (alert_signal == alert_confirmation_value) // Overbought + { + + Alert(Symbol() + "(" + VC_Period + "min): value chart is overbought. vcClose = " + vcClose[0] + "!"); + } + else if (alert_signal == -alert_confirmation_value) // Oversold + { + Alert(Symbol() + "(" + VC_Period + "min): value chart is oversold. vcClose = " + vcClose[0] + "!"); + } + + last_alert = iTime(NULL, VC_Period, 0); + last_alert_signal = alert_signal; + } + } +} + diff --git a/Channels.mq4 b/Channels.mq4 new file mode 100644 index 0000000..44ec631 Binary files /dev/null and b/Channels.mq4 differ diff --git a/CurrencyStrengthAlerts (2).mq4 b/CurrencyStrengthAlerts (2).mq4 new file mode 100644 index 0000000..2bb06ec Binary files /dev/null and b/CurrencyStrengthAlerts (2).mq4 differ diff --git a/Custom Moving Averages.mq4 b/Custom Moving Averages.mq4 new file mode 100644 index 0000000..8c31531 --- /dev/null +++ b/Custom Moving Averages.mq4 @@ -0,0 +1,190 @@ +//+------------------------------------------------------------------+ +//| Custom Moving Averages.mq4 | +//| Copyright 2005-2015, MetaQuotes Software Corp. | +//| http://www.mql4.com | +//+------------------------------------------------------------------+ +#property copyright "2005-2015, MetaQuotes Software Corp." +#property link "http://www.mql4.com" +#property description "Moving Average" +#property strict + +#property indicator_chart_window +#property indicator_buffers 1 +#property indicator_color1 Red +//--- indicator parameters +input int InpMAPeriod=13; // Period +input int InpMAShift=0; // Shift +input ENUM_MA_METHOD InpMAMethod=MODE_SMA; // Method +//--- indicator buffer +double ExtLineBuffer[]; +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +int OnInit(void) + { + string short_name; + int draw_begin=InpMAPeriod-1; +//--- indicator short name + switch(InpMAMethod) + { + case MODE_SMA : short_name="SMA("; break; + case MODE_EMA : short_name="EMA("; draw_begin=0; break; + case MODE_SMMA : short_name="SMMA("; break; + case MODE_LWMA : short_name="LWMA("; break; + default : return(INIT_FAILED); + } + IndicatorShortName(short_name+string(InpMAPeriod)+")"); + IndicatorDigits(Digits); +//--- check for input + if(InpMAPeriod<2) + return(INIT_FAILED); +//--- drawing settings + SetIndexStyle(0,DRAW_LINE); + SetIndexShift(0,InpMAShift); + SetIndexDrawBegin(0,draw_begin); +//--- indicator buffers mapping + SetIndexBuffer(0,ExtLineBuffer); +//--- initialization done + return(INIT_SUCCEEDED); + } +//+------------------------------------------------------------------+ +//| Moving Average | +//+------------------------------------------------------------------+ +int OnCalculate(const int rates_total, + const int prev_calculated, + const datetime &time[], + const double &open[], + const double &high[], + const double &low[], + const double &close[], + const long &tick_volume[], + const long &volume[], + const int &spread[]) + { +//--- check for bars count + if(rates_total= 0; l_shift_4--) { + g_ibuf_104[l_shift_4] = 0; + g_ibuf_108[l_shift_4] = 0; + g_ibuf_112[l_shift_4] = 0; + g_ibuf_116[l_shift_4] = 0; + g_ibuf_120[l_shift_4] = EMPTY_VALUE; + g_ibuf_124[l_shift_4] = EMPTY_VALUE; + } + for (l_shift_4 = Nbars - Length - 1; l_shift_4 >= 0; l_shift_4--) { + lda_12[l_shift_4] = iBands(NULL, 0, Length, Deviation, 0, PRICE_CLOSE, MODE_UPPER, l_shift_4); + lda_16[l_shift_4] = iBands(NULL, 0, Length, Deviation, 0, PRICE_CLOSE, MODE_LOWER, l_shift_4); + if (Close[l_shift_4] > lda_12[l_shift_4 + 1]) li_8 = 1; + if (Close[l_shift_4] < lda_16[l_shift_4 + 1]) li_8 = -1; + if (li_8 > 0 && lda_16[l_shift_4] < lda_16[l_shift_4 + 1]) lda_16[l_shift_4] = lda_16[l_shift_4 + 1]; + if (li_8 < 0 && lda_12[l_shift_4] > lda_12[l_shift_4 + 1]) lda_12[l_shift_4] = lda_12[l_shift_4 + 1]; + lda_20[l_shift_4] = lda_12[l_shift_4] + (MoneyRisk - 1.0) / 2.0 * (lda_12[l_shift_4] - lda_16[l_shift_4]); + lda_24[l_shift_4] = lda_16[l_shift_4] - (MoneyRisk - 1.0) / 2.0 * (lda_12[l_shift_4] - lda_16[l_shift_4]); + if (li_8 > 0 && lda_24[l_shift_4] < lda_24[l_shift_4 + 1]) lda_24[l_shift_4] = lda_24[l_shift_4 + 1]; + if (li_8 < 0 && lda_20[l_shift_4] > lda_20[l_shift_4 + 1]) lda_20[l_shift_4] = lda_20[l_shift_4 + 1]; + if (li_8 > 0) { + if (Signal > 0 && g_ibuf_104[l_shift_4 + 1] == -1.0) { + g_ibuf_112[l_shift_4] = lda_24[l_shift_4]; + g_ibuf_104[l_shift_4] = lda_24[l_shift_4]; + if (Line > 0) g_ibuf_120[l_shift_4] = lda_24[l_shift_4]; + if (SoundON == TRUE && l_shift_4 == 0 && !gi_132) { + Alert("Xtra Sig going Up on ", Symbol(), "-", Period()); + gi_132 = TRUE; + gi_136 = FALSE; + } + } else { + g_ibuf_104[l_shift_4] = lda_24[l_shift_4]; + if (Line > 0) g_ibuf_120[l_shift_4] = lda_24[l_shift_4]; + g_ibuf_112[l_shift_4] = -1; + } + if (Signal == 2) g_ibuf_104[l_shift_4] = 0; + g_ibuf_116[l_shift_4] = -1; + g_ibuf_108[l_shift_4] = -1.0; + g_ibuf_124[l_shift_4] = EMPTY_VALUE; + } + if (li_8 < 0) { + if (Signal > 0 && g_ibuf_108[l_shift_4 + 1] == -1.0) { + g_ibuf_116[l_shift_4] = lda_20[l_shift_4]; + g_ibuf_108[l_shift_4] = lda_20[l_shift_4]; + if (Line > 0) g_ibuf_124[l_shift_4] = lda_20[l_shift_4]; + if (SoundON == TRUE && l_shift_4 == 0 && !gi_136) { + Alert("Xtra Sig going Down on ", Symbol(), "-", Period()); + gi_136 = TRUE; + gi_132 = FALSE; + } + } else { + g_ibuf_108[l_shift_4] = lda_20[l_shift_4]; + if (Line > 0) g_ibuf_124[l_shift_4] = lda_20[l_shift_4]; + g_ibuf_116[l_shift_4] = -1; + } + if (Signal == 2) g_ibuf_108[l_shift_4] = 0; + g_ibuf_112[l_shift_4] = -1; + g_ibuf_104[l_shift_4] = -1.0; + g_ibuf_120[l_shift_4] = EMPTY_VALUE; + } + } + return (0); +} diff --git a/DarvasBoxes nmc.mq4 b/DarvasBoxes nmc.mq4 new file mode 100644 index 0000000..a7c0003 --- /dev/null +++ b/DarvasBoxes nmc.mq4 @@ -0,0 +1,515 @@ +//+------------------------------------------------------------------+ +//| DarvasBoxes_v3.mq4 | +//| Copyright © 2013, TrendLaboratory | +//| http://finance.groups.yahoo.com/group/TrendLaboratory | +//| E-mail: igorad2003@yahoo.co.uk | +//+------------------------------------------------------------------+ +#property copyright "Copyright © 2013, TrendLaboratory" +#property link "http://finance.groups.yahoo.com/group/TrendLaboratory" + +#include + +#property indicator_chart_window +#property indicator_buffers 6 +#property indicator_color1 RoyalBlue +#property indicator_color2 Tomato +#property indicator_color3 RoyalBlue +#property indicator_color4 Tomato +#property indicator_color5 RoyalBlue +#property indicator_color6 Tomato + +#property indicator_width1 1 +#property indicator_width2 1 +#property indicator_width3 2 +#property indicator_width4 2 +#property indicator_width5 2 +#property indicator_width6 2 + +//Darvas Modes; +//0-Classic (by Upper Pivot) +//1-Modern (by Upper Pivot) +//2-Bi-directional Classic (UpTrend by Upper Pivot, DownTrend by Lower Pivot) +//3-Bi-directional Modern (UpTrend by Upper Pivot, DownTrend by Lower Pivot) +//4-Classic by 1st Pivot (Upper or Lower) +//5-Modern by 1st Pivot (Upper or Lower) + +//---- input parameters +extern string UniqueName = "D_Box"; +extern int DarvasMode = 3; //Darvas Modes (See table above) +extern int PivotStrength = 3; //Pivot Strength in bars +extern int RollingPeriod = 1; //Rolling period of evaluation(Classic-12 months,Modern-6 months or less) +extern color NeutralColor = Silver; +extern color UpTrendColor = DodgerBlue; +extern color DnTrendColor = Coral; +extern int BoxWidth = 2; +extern int BoxesMode = 1; //0-off,1-on +extern int ChannelMode = 0; //0-off,1-on +extern int PivotsMode = 1; //0-off,1-on +extern int GhostBoxesMode = 0; //0-off,1-on +extern int SignalMode = 1; //0-off,1-on + +//---- buffers +double topBox[]; +double botBox[]; +double pivotHi[]; +double pivotLo[]; +double upSignal[]; +double dnSignal[]; +double trend[]; + +double HiArray[],LoArray[], boxTop[2], boxBottom[2], ghostHeight[2], ghostTop[2], ghostBottom[2], hiPrice[2], loPrice[2]; +int Length, startState[2], confirmState[2], prevState; +string short_name, IndicatorName, name; +datetime prevtime, startTime[2], endTime[2], ghostTime[2], prevTime, confTime, prevGhostTime; +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +int init() +{ + IndicatorDigits(Digits); +//---- indicator line + IndicatorBuffers(7); + SetIndexBuffer(0, topBox); SetIndexStyle(0, DRAW_LINE); + SetIndexBuffer(1, botBox); SetIndexStyle(1, DRAW_LINE); + SetIndexBuffer(2, pivotHi); SetIndexStyle(2,DRAW_ARROW); SetIndexArrow(2,159); + SetIndexBuffer(3, pivotLo); SetIndexStyle(3,DRAW_ARROW); SetIndexArrow(3,159); + SetIndexBuffer(4,upSignal); SetIndexStyle(4,DRAW_ARROW); SetIndexArrow(4,233); + SetIndexBuffer(5,dnSignal); SetIndexStyle(5,DRAW_ARROW); SetIndexArrow(5,234); + SetIndexBuffer(6, trend); +//---- name for DataWindow and indicator subwindow label + IndicatorName = WindowExpertName(); + short_name = IndicatorName+"("+DarvasMode+","+PivotStrength+","+RollingPeriod+")"; + IndicatorShortName(short_name); + SetIndexLabel(0,"Top of Darvas Box"); + SetIndexLabel(1,"Bottom of Darvas Box"); + SetIndexLabel(2,"Pivot High"); + SetIndexLabel(3,"Pivot Low"); +//---- + Length = PivotStrength+2; + int begin = MathMax(2,Length); + SetIndexDrawBegin(0,begin); + SetIndexDrawBegin(1,begin); + SetIndexDrawBegin(2,begin); + SetIndexDrawBegin(3,begin); + +//---- + ArrayResize(HiArray,Length); + ArrayResize(LoArray,Length); + + return(0); +} +//+------------------------------------------------------------------+ +//| Custom indicator deinitialization function | +//+------------------------------------------------------------------+ +int deinit() + { +//---- + deleteObj(UniqueName); + +//---- + return(0); + } +//+------------------------------------------------------------------+ +//| DarvasBoxes_v3 | +//+------------------------------------------------------------------+ +int start() +{ + int counted_bars=IndicatorCounted(); + + + if ( counted_bars > 0 ) int limit = Bars-counted_bars-1; + if ( counted_bars < 0 ) return(0); + if ( counted_bars ==0 ) limit = Bars-Length; + + if ( counted_bars < 1 ) + { + for(int i=0;i=0;shift--) + { + if(prevtime != Time[shift]) + { + startState[1] = startState[0]; + confirmState[1] = confirmState[0]; + boxTop[1] = boxTop[0]; + boxBottom[1] = boxBottom[0]; + startTime[1] = startTime[0]; + endTime[1] = endTime[0]; + ghostHeight[1] = ghostHeight[0]; + ghostTime[1] = ghostTime[0]; + ghostTop[1] = ghostTop[0]; + ghostBottom[1] = ghostBottom[0]; + hiPrice[1] = hiPrice[0]; + loPrice[1] = loPrice[0]; + prevtime = Time[shift]; + } + + for(int j = 0; j < Length; j++) + { + HiArray[j] = iMA(NULL,0,1,0,0,PRICE_HIGH,shift+j); + LoArray[j] = iMA(NULL,0,1,0,0,PRICE_LOW,shift+j); + } + + double hiBoxPrice = High[shift]; + double loBoxPrice = Low [shift]; + + if(DarvasMode == 0 || DarvasMode == 2 || DarvasMode == 4) {hiPrice[0] = High[shift]; loPrice[0] = Low[shift];} + else {hiPrice[0] = Close[shift]; loPrice[0] = Close[shift];} + + trend[shift] = trend[shift+1]; + botBox[shift] = botBox[shift+1]; + topBox[shift] = topBox[shift+1]; + + double upPivot = DarvasPivot(HiArray,0,PivotStrength); + double loPivot = DarvasPivot(LoArray,1,PivotStrength); + + if(PivotsMode > 0) + { + pivotHi[shift+PivotStrength] = EMPTY_VALUE; + pivotLo[shift+PivotStrength] = EMPTY_VALUE; + + if(upPivot > 0) pivotHi[shift+PivotStrength] = upPivot; + if(loPivot > 0) pivotLo[shift+PivotStrength] = loPivot; + } + + startState[0] = startState[1]; + confirmState[0] = confirmState[1]; + boxTop[0] = boxTop[1]; + boxBottom[0] = boxBottom[1]; + startTime[0] = startTime[1]; + endTime[0] = endTime[1]; + ghostHeight[0] = ghostHeight[1]; + ghostTime[0] = ghostTime[1]; + ghostTop[0] = ghostTop[1]; + ghostBottom[0] = ghostBottom[1]; + + + if(startState[0] == 0) + { + bool allPivotVerify = false; + + bool upPivotVerify = upPivot > 0 && shift+PivotStrength == iHighest(NULL,0,MODE_HIGH,RollingPeriod,shift+PivotStrength); + bool loPivotVerify = loPivot > 0 && shift+PivotStrength == iLowest (NULL,0,MODE_LOW ,RollingPeriod,shift+PivotStrength); + + if(DarvasMode < 2) allPivotVerify = upPivotVerify; + else + if(DarvasMode < 4) {if(trend[shift] > 0) allPivotVerify = upPivotVerify; else allPivotVerify = loPivotVerify;} + else allPivotVerify = upPivotVerify || loPivotVerify; + + if(allPivotVerify) + { + startTime[0] = Time[shift+PivotStrength]; + if(startTime[0] >= endTime[0]) + { + if(DarvasMode < 2) {boxTop[0] = upPivot; startState[0] = 1;} + else + if(DarvasMode < 4) + { + startState[0] = 1; + if(trend[shift] > 0) boxTop[0] = upPivot; else boxBottom[0] = loPivot; + } + else + { + if(upPivotVerify ||(upPivotVerify && loPivotVerify)) {boxTop[0] = upPivot; startState[0] = 1;} + else {boxBottom[0] = loPivot; startState[0] =-1;} + } + + prevTime = startTime[0]; + prevState = startState[0]; + } + } + } + + if(startState[0] != 0 && confirmState[0] == 0) + { + if(DarvasMode < 2) + { + if(upPivot > boxTop[0] || hiBoxPrice > boxTop[0]) {startState[0] = 0; startTime[0] = 0;} + else + if(loPivot > 0 && Time[shift] > startTime[0]) {confirmState[0] = 1; boxBottom[0] = loPivot; confTime = Time[shift];} + } + else + if(DarvasMode < 4) + { + + if(trend[shift] > 0 && (upPivot > boxTop[0] || hiBoxPrice > boxTop[0])) {startState[0] = 0; startTime[0] = 0;} + else + if(trend[shift] < 0 && ((loPivot > 0 && loPivot < boxBottom[0]) || loBoxPrice < boxBottom[0])) {startState[0] = 0; startTime[0] = 0; } + else + if(Time[shift] > startTime[0]) + { + if(trend[shift] > 0 && loPivot > 0){confirmState[0] = 1; boxBottom[0] = loPivot; confTime = Time[shift];} + else + if(trend[shift] < 0 && upPivot > 0){confirmState[0] = 1; boxTop[0] = upPivot; confTime = Time[shift];} + } + } + else + { + if(startState[0] > 0 && (upPivot > boxTop[0] || hiBoxPrice > boxTop[0])) {startState[0] = 0; startTime[0] = 0;} + else + if(startState[0] < 0 && ((loPivot > 0 && loPivot < boxBottom[0]) || loBoxPrice < boxBottom[0])) {startState[0] = 0; startTime[0] = 0;} + else + if(Time[shift] > startTime[0]) + { + if(startState[0] > 0 && loPivot > 0 && confirmState[0] == 0){confirmState[0] = 1; boxBottom[0] = loPivot; confTime = Time[shift];} + else + if(startState[0] < 0 && upPivot > 0 && confirmState[0] == 0){confirmState[0] = 1; boxTop[0] = upPivot; confTime = Time[shift];} + } + } + } + else + if(startState[0] != 0 && confirmState[0] != 0) + { + if(BoxesMode > 0) + { + name = UniqueName + " " + TimeToStr(startTime[0]); + DeleteBox(name); + + if(DarvasMode < 2) PlotBox(name,startTime[0],boxTop[0],Time[shift],boxBottom[0],STYLE_SOLID,NeutralColor,BoxWidth,0); + else + if(DarvasMode < 4) + { + if(trend[shift] > 0) PlotBox(name,startTime[0],boxTop[0],Time[shift],boxBottom[0],STYLE_SOLID,NeutralColor,BoxWidth,0); + else + if(trend[shift] < 0) PlotBox(name,startTime[0],boxBottom[0],Time[shift],boxTop[0],STYLE_SOLID,NeutralColor,BoxWidth,0); + } + else + { + if(startState[0] > 0) PlotBox(name,startTime[0],boxTop[0],Time[shift],boxBottom[0],STYLE_SOLID,NeutralColor,BoxWidth,0); + else + if(startState[0] < 0) PlotBox(name,startTime[0],boxBottom[0],Time[shift],boxTop[0],STYLE_SOLID,NeutralColor,BoxWidth,0); + } + } + + upSignal[shift] = EMPTY_VALUE; + dnSignal[shift] = EMPTY_VALUE; + + double gap = 0.5*MathCeil(iATR(NULL,0,14,shift)/Point); + + if(hiPrice[0] > boxTop[0]) + { + trend[shift] = 1; + startState[0] = 0; + confirmState[0] = 0; + endTime[0] = Time[shift]; + startTime[0] = 0; + if(SignalMode > 0) upSignal[shift] = Low [shift] - gap*Point; + } + + if(loPrice[0] < boxBottom[0]) + { + trend[shift] =-1; + startState[0] = 0; + confirmState[0] = 0; + endTime[0] = Time[shift]; + startTime[0] = 0; + if(SignalMode > 0) dnSignal[shift] = High[shift] + gap*Point; + } + + if(ChannelMode > 0) {botBox[shift] = boxBottom[0]; topBox[shift] = boxTop[0];} + + if(endTime[0] != endTime[1]) + { + if(BoxesMode > 0) + { + DeleteBox(name); + if(trend[shift] > 0) + { + PlotBox(name,prevTime,boxTop[0],endTime[0],boxBottom[0],STYLE_SOLID,UpTrendColor,BoxWidth,0); + PlotBox(name,prevTime,boxTop[0],endTime[0],boxBottom[0],STYLE_SOLID,UpTrendColor,BoxWidth,1); + } + else + if(trend[shift] < 0) + { + if(DarvasMode < 2) + { + PlotBox(name,prevTime,boxTop[0],endTime[0],boxBottom[0],STYLE_SOLID,DnTrendColor,BoxWidth,0); + PlotBox(name,prevTime,boxTop[0],endTime[0],boxBottom[0],STYLE_SOLID,DnTrendColor,BoxWidth,1); + } + else + { + PlotBox(name,prevTime,boxBottom[0],endTime[0],boxTop[0],STYLE_SOLID,DnTrendColor,BoxWidth,0); + PlotBox(name,prevTime,boxBottom[0],endTime[0],boxTop[0],STYLE_SOLID,DnTrendColor,BoxWidth,1); + } + } + } + + if(GhostBoxesMode > 0) + { + ghostTime[0] = endTime[0]; + ghostHeight[0] = boxTop[0] - boxBottom[0]; + prevGhostTime = ghostTime[0]; + + if(trend[shift] > 0) + { + ghostBottom[0] = boxTop[0]; + ghostTop[0] = ghostBottom[0] + ghostHeight[0]; + } + else + { + ghostTop[0] = boxBottom[0]; + ghostBottom[0] = ghostTop[0] - ghostHeight[0]; + } + } + } + } + else if(prevState > 0 && prevTime > 0 && confTime == Time[shift]) DeleteBox(UniqueName+" "+TimeToStr(prevTime)); + + + if(GhostBoxesMode > 0) + { + if(trend[shift] > 0) + { + string gname = UniqueName+" Ghost "+TimeToStr(ghostTime[0]); + + if(confirmState[0] == 0 || (confirmState[0] > 0 && confirmState[1] == 0)) + { + DeleteBox(gname); + PlotBox(gname,ghostTime[0],ghostTop[0],Time[shift],ghostBottom[0],STYLE_DOT,UpTrendColor,1,0); + + if(hiPrice[0] <= ghostTop[0] && ghostTime[0] == Time[shift]) DeleteBox(UniqueName+" Ghost "+TimeToStr(prevGhostTime)); + + if(hiPrice[0] > ghostTop[0] && hiPrice[1] <= ghostTop[1]) + { + PlotBox(gname,ghostTime[0],ghostTop[0],Time[shift],ghostBottom[0],STYLE_DOT,UpTrendColor,1,1); + + ghostTime[0] = Time[shift]; + ghostBottom[0] = ghostTop[0]; + ghostTop[0] = ghostBottom[0] + ghostHeight[0]; + prevGhostTime = ghostTime[0]; + } + } + + if(confirmState[0] > 0) + { + + PlotBox(gname,ghostTime[0],ghostTop[0],Time[shift],ghostBottom[0],STYLE_DOT,UpTrendColor,1,1); + } + } + else + { + gname = UniqueName+" Ghost "+TimeToStr(ghostTime[0]); + + if(confirmState[0] == 0 || (confirmState[0] > 0 && confirmState[1] == 0)) + { + DeleteBox(gname); + PlotBox(gname,ghostTime[0],ghostTop[0],Time[shift],ghostBottom[0],STYLE_DOT,DnTrendColor,1,0); + + if(loPrice[0] >= ghostBottom[0] && ghostTime[0] == Time[shift]) DeleteBox(UniqueName+" Ghost "+TimeToStr(prevGhostTime)); + + if(loPrice[0] < ghostBottom[0] && loPrice[1] >= ghostBottom[1]) + { + PlotBox(gname,ghostTime[0],ghostTop[0],Time[shift],ghostBottom[0],STYLE_DOT,DnTrendColor,1,1); + + ghostTime[0] = Time[shift]; + ghostTop[0] = ghostBottom[0]; + ghostBottom[0] = ghostTop[0] - ghostHeight[0]; + prevGhostTime = ghostTime[0]; + } + } + + if(confirmState[0] > 0) + { + + PlotBox(gname,ghostTime[0],ghostTop[0],Time[shift],ghostBottom[0],STYLE_DOT,DnTrendColor,1,1); + } + } + } + } +} + + +double DarvasPivot(double& price[],int type,int size) +{ + + double upPivot; + + if (type==0) bool condition = ArrayMaximum(price,0,0) == size; + else condition = ArrayMinimum(price,0,0) == size; + + if(condition) upPivot = price[size]; else upPivot=0; + +return(upPivot); +} + +//+------------------------------------------------------------------+ + + +void PlotBox(string tname,datetime time1,double value1, datetime time2,double value2,int style,color clr,double width,int mode) +{ + + if(mode == 0) + { + ObjectCreate(tname+" 1H",OBJ_TREND,0,time1,value1,time2,value1); + ObjectSet(tname+" 1H",OBJPROP_COLOR,clr); + ObjectSet(tname+" 1H",OBJPROP_STYLE,style); + ObjectSet(tname+" 1H",OBJPROP_RAY,false); + ObjectSet(tname+" 1H",OBJPROP_BACK,true); + ObjectSet(tname+" 1H",OBJPROP_WIDTH,width); + + ObjectCreate(tname+" 1V",OBJ_TREND,0,time1,value1,time1,value2); + ObjectSet(tname+" 1V",OBJPROP_COLOR,clr); + ObjectSet(tname+" 1V",OBJPROP_STYLE,style); + ObjectSet(tname+" 1V",OBJPROP_RAY,false); + ObjectSet(tname+" 1V",OBJPROP_BACK,true); + ObjectSet(tname+" 1V",OBJPROP_WIDTH,width); + + ObjectCreate(tname+" 2H",OBJ_TREND,0,time1,value2,time2,value2); + ObjectSet(tname+" 2H",OBJPROP_COLOR,clr); + ObjectSet(tname+" 2H",OBJPROP_STYLE,style); + ObjectSet(tname+" 2H",OBJPROP_RAY,false); + ObjectSet(tname+" 2H",OBJPROP_BACK,true); + ObjectSet(tname+" 2H",OBJPROP_WIDTH,width); + } + + if(mode == 1) + { + ObjectCreate(tname+" 2V",OBJ_TREND,0,time2,value1,time2,value2); + ObjectSet(tname+" 2V",OBJPROP_COLOR,clr); + ObjectSet(tname+" 2V",OBJPROP_STYLE,style); + ObjectSet(tname+" 2V",OBJPROP_RAY,false); + ObjectSet(tname+" 2V",OBJPROP_BACK,true); + ObjectSet(tname+" 2V",OBJPROP_WIDTH,width); + } +} + +void DeleteBox(string tname) +{ + ObjectDelete(tname+" 1H"); + ObjectDelete(tname+" 2H"); + ObjectDelete(tname+" 1V"); + ObjectDelete(tname+" 2V"); +} + +bool deleteObj(string tname) +{ + bool result = false; + + int length = StringLen(tname); + for(int i=ObjectsTotal()-1; i>=0; i--) + { + string objName = ObjectName(i); + if(StringSubstr(objName,0,length) == tname) {ObjectDelete(objName); result = true;} + } + + return(result); +} + diff --git a/Equity-Free-Margin-Manager-EA.mq4 b/Equity-Free-Margin-Manager-EA.mq4 new file mode 100644 index 0000000..788379b --- /dev/null +++ b/Equity-Free-Margin-Manager-EA.mq4 @@ -0,0 +1,224 @@ +//+------------------------------------------------------------------+ +//| Profit Protection, Stop Loss Hedge Balance Trader.mq4 | +//| Copyright © 2011, DancingPhil | +//| | +//+------------------------------------------------------------------+ +#property copyright "Copyright © 2011, DancingPhil" +#property link "bad-boy-phil@hotmail.com" + +extern int Magic = 2; +extern int LookBack = 3; // Bars back from current open to look for a Fractal +extern int Slippage = 0; +extern int TakeprofitHP = 30; +extern int TakeprofitML =30; +extern int TakeprofitFM = 30; +extern double FM = 0.30; +extern int Stoploss = 0; +extern double MaxLoss = 0.25; +extern double HeapsProfit = 0.26; +string Comments = ""; +double LowestFreeMargin=1000000; +double StartingEquity=0; +double WorstEquity=0; +double BestEquity=0; +double TargetBestEquity=0; +bool buyFlag = false, sellFlag = false; +datetime barStart = 0; +//+------------------------------------------------------------------+ +//| expert initialization function | +//+------------------------------------------------------------------+ +int init() + { +//---- + StartingEquity=AccountEquity(); + + if(Digits == 5) + { + TakeprofitML = TakeprofitML * 10; + TakeprofitHP = TakeprofitHP * 10; + TakeprofitFM = TakeprofitFM * 10; + Stoploss = Stoploss * 10; + + } + +//---- + return(0); + } +//+------------------------------------------------------------------+ +//| expert deinitialization function | +//+------------------------------------------------------------------+ +int deinit() + { +//---- + +//---- + return(0); + } +//+------------------------------------------------------------------+ +//| expert start function | +//+------------------------------------------------------------------+ +int start() + { +//---- +/*if (barStart < Time[0]) //start of new bar +{ +barStart = Time[0]; +buyFlag = false; +sellFlag = false; +} +*/ + double total_selllots =0; //define variable total_sellots, starting at =0 + double total_buylots =0; //define variable total_buylots, starting at =0 + double lotdifference=0; + int t; + + double upfractal = GetFractal(MODE_UPPER), + dnfractal = GetFractal(MODE_LOWER); + + //Calculate total_buylots + + for (int i = OrdersTotal()-1; i >=0; i--) //scanning all trades + { + if (! OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { Sleep(10); continue; } + if(OrderSymbol() == Symbol() ) //check the currency and magic number are correct + { + if (OrderType() == OP_BUY) //with OP_BUY trades + { + total_buylots = total_buylots + OrderLots(); //add them up and keep a tally of them + + } + //Calculate total_selllots + + if (OrderType() == OP_SELL) //with the OP_SELL trades + { + total_selllots = total_selllots + OrderLots(); //add them up and keep a tally of them too + } + + } + } + if (LowestFreeMargin>AccountFreeMargin()) + { + LowestFreeMargin=AccountFreeMargin(); + } + if (BestEquity 1){ + if (OrderSelect(t, SELECT_BY_TICKET))OrderModify(OrderTicket(),OrderOpenPrice(),0,Ask + TakeprofitML*Point,0,Blue ); + else Print("OrderModify() ticket=",t," failed with error code ",GetLastError()); + } + else Print("OrderSend ticket=",t," failed with error code ",GetLastError()); + + } + if( total_buylots>total_selllots) + if (AccountEquity()<((1-MaxLoss)*BestEquity)) + + { + + lotdifference = total_buylots - total_selllots; //Check difference in lots, if buylots is smaller then we will sell + t = OrderSend(Symbol(),OP_SELL,lotdifference,Bid,Slippage,0,0,Comments + "SellOnMaxLoss",Magic,0,Blue); + BestEquity=AccountEquity(); + if (t > 1){ + if (OrderSelect(t, SELECT_BY_TICKET))OrderModify(OrderTicket(),OrderOpenPrice(),0,Bid - TakeprofitML*Point,0,Red ); + else Print("OrderModify() ticket=",t," failed with error code ",GetLastError()); + } + else Print("OrderSend ticket=",t," failed with error code ",GetLastError()); + } + if( total_buylots((1+HeapsProfit)*StartingEquity)) + + { + + lotdifference = total_selllots - total_buylots; //Check difference in lots, if buylots is smaller then we will buy + t = OrderSend(Symbol(),OP_BUY,lotdifference,Ask,Slippage,0,0,Comments + "BuyOnHeapsProfit",Magic,0,Red); + StartingEquity=AccountEquity(); + if (t > 1){ + if (OrderSelect(t, SELECT_BY_TICKET))OrderModify(OrderTicket(),OrderOpenPrice(),0,Ask + TakeprofitHP*Point,0,Blue ); + else Print("OrderModify() ticket=",t," failed with error code ",GetLastError()); + } + else Print("OrderSend ticket=",t," failed with error code ",GetLastError()); + + } + if( total_buylots>total_selllots) + if (AccountEquity()>((1+HeapsProfit)*StartingEquity)) + + { + + lotdifference = total_buylots - total_selllots; //Check difference in lots, if buylots is smaller then we will sell + t = OrderSend(Symbol(),OP_SELL,lotdifference,Bid,Slippage,0,0,Comments + "SellOnHeaps",Magic,0,Red); + StartingEquity=AccountEquity(); + if (t > 1){ + if (OrderSelect(t, SELECT_BY_TICKET))OrderModify(OrderTicket(),OrderOpenPrice(),0,Bid - TakeprofitHP*Point,0,Red ); + else Print("OrderModify() ticket=",t," failed with error code ",GetLastError()); + } + else Print("OrderSend ticket=",t," failed with error code ",GetLastError()); + } + if( total_buylots 1){ + if (OrderSelect(t, SELECT_BY_TICKET))OrderModify(OrderTicket(),OrderOpenPrice(),0,0,0,Blue ); + else Print("OrderModify() ticket=",t," failed with error code ",GetLastError()); + } + else Print("OrderSend ticket=",t," failed with error code ",GetLastError()); + + } + if( total_buylots>total_selllots) + if (AccountFreeMargin()<(FM*BestEquity)) + + { + + lotdifference = total_buylots - total_selllots; //Check difference in lots, if buylots is smaller then we will sell + t = OrderSend(Symbol(),OP_SELL,(lotdifference*0.5),Bid,Slippage,0,0,Comments + "FreeMarginWorry",Magic,0,Green); + + if (t > 1){ + if (OrderSelect(t, SELECT_BY_TICKET))OrderModify(OrderTicket(),OrderOpenPrice(),0,0,0,Red ); + else Print("OrderModify() ticket=",t," failed with error code ",GetLastError()); + } + else Print("OrderSend ticket=",t," failed with error code ",GetLastError()); + } + +//---- + return(0); + } +//+------------------------------------------------------------------+ + +double GetFractal(int mode) + { + double tempup=0, tempdn=0, fup=0, fdn=0; + tempup = iFractals(Symbol(), 0, MODE_UPPER, LookBack); + tempdn = iFractals(Symbol(), 0, MODE_LOWER, LookBack); + if(tempup != 0) fup = tempup; + if(tempdn != 0) fdn = tempdn; + + if ( fup != 0 && fdn == 0 && mode == MODE_UPPER ) return(fup); + if ( fdn != 0 && fup == 0 && mode == MODE_LOWER ) return(fdn); + return(0); + } + diff --git a/FTLM-STLMxAMm.mq4 b/FTLM-STLMxAMm.mq4 new file mode 100644 index 0000000..73cb232 --- /dev/null +++ b/FTLM-STLMxAMm.mq4 @@ -0,0 +1,582 @@ +//+------------------------------------------------------------------+ +//| +//+------------------------------------------------------------------+ + + +#property indicator_separate_window +#property indicator_buffers 4 +#property indicator_color1 Green +#property indicator_color2 Red +#property indicator_color3 Green +#property indicator_color4 Red + + +#property indicator_width1 2 +#property indicator_width2 2 +#property indicator_width3 2 +#property indicator_width4 2 + + +extern int CountBars=3000; +//---- buffers +double Up1[]; +double Down1[]; +double Up2[]; +double Down2[]; +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +int init() + { + string short_name; +//---- indicator line + IndicatorBuffers(5); + SetIndexStyle(0,DRAW_HISTOGRAM); + SetIndexBuffer(0,Up2); + SetIndexStyle(1,DRAW_HISTOGRAM); + SetIndexBuffer(1,Down2); + SetIndexStyle(2,DRAW_ARROW); + SetIndexArrow(2,159); + SetIndexBuffer(2,Up1); + SetIndexStyle(3,DRAW_ARROW); + SetIndexArrow(3,159); + SetIndexBuffer(3,Down1); + + SetIndexLabel(0,"STLM+"); + SetIndexLabel(1,"STLM-"); + SetIndexLabel(2,"FTLM+"); + SetIndexLabel(3,"FTLM-"); +//---- + return(0); + } +//+------------------------------------------------------------------+ +//| FTLM | +//+------------------------------------------------------------------+ +int start() + { + SetIndexDrawBegin(0,Bars-CountBars+43); + SetIndexDrawBegin(1,Bars-CountBars+43); + int i,i2; + double FTLM,FTLM1,value11,value21,value31,value41; + double STLM,STLM1,value12,value22,value32,value42; +//---- + if(Bars<=90) return(0); + + int counted_bars=IndicatorCounted(); + if(counted_bars<0) return(-1); + if(counted_bars>0) counted_bars--; + i=Bars-counted_bars; + if(counted_bars==0) i-=1+91; + + while(i>=0) + { + + value11= + 0.4360409450*Close[i+0] + +0.3658689069*Close[i+1] + +0.2460452079*Close[i+2] + +0.1104506886*Close[i+3] + -0.0054034585*Close[i+4] + -0.0760367731*Close[i+5] + -0.0933058722*Close[i+6] + -0.0670110374*Close[i+7] + -0.0190795053*Close[i+8] + +0.0259609206*Close[i+9] + +0.0502044896*Close[i+10] + +0.0477818607*Close[i+11] + +0.0249252327*Close[i+12] + -0.0047706151*Close[i+13] + -0.0272432537*Close[i+14] + -0.0338917071*Close[i+15] + -0.0244141482*Close[i+16] + -0.0055774838*Close[i+17] + +0.0128149838*Close[i+18] + +0.0226522218*Close[i+19] + +0.0208778257*Close[i+20] + +0.0100299086*Close[i+21] + -0.0036771622*Close[i+22] + -0.0136744850*Close[i+23] + -0.0160483392*Close[i+24] + -0.0108597376*Close[i+25] + -0.0016060704*Close[i+26] + +0.0069480557*Close[i+27] + +0.0110573605*Close[i+28] + +0.0095711419*Close[i+29] + +0.0040444064*Close[i+30] + -0.0023824623*Close[i+31] + -0.0067093714*Close[i+32] + -0.0072003400*Close[i+33] + -0.0047717710*Close[i+34] + +0.0005541115*Close[i+35] + +0.0007860160*Close[i+36] + +0.0130129076*Close[i+37] + +0.0040364019*Close[i+38]; + + value21= + -0.0025097319*Close[i+0] + +0.0513007762*Close[i+1] + +0.1142800493*Close[i+2] + +0.1699342860*Close[i+3] + +0.2025269304*Close[i+4] + +0.2025269304*Close[i+5] + +0.1699342860*Close[i+6] + +0.1142800493*Close[i+7] + +0.0513007762*Close[i+8] + -0.0025097319*Close[i+9] + -0.0353166244*Close[i+10] + -0.0433375629*Close[i+11] + -0.0311244617*Close[i+12] + -0.0088618137*Close[i+13] + +0.0120580088*Close[i+14] + +0.0233183633*Close[i+15] + +0.0221931304*Close[i+16] + +0.0115769653*Close[i+17] + -0.0022157966*Close[i+18] + -0.0126536111*Close[i+19] + -0.0157416029*Close[i+20] + -0.0113395830*Close[i+21] + -0.0025905610*Close[i+22] + +0.0059521459*Close[i+23] + +0.0105212252*Close[i+24] + +0.0096970755*Close[i+25] + +0.0046585685*Close[i+26] + -0.0017079230*Close[i+27] + -0.0063513565*Close[i+28] + -0.0074539350*Close[i+29] + -0.0050439973*Close[i+30] + -0.0007459678*Close[i+31] + +0.0032271474*Close[i+32] + +0.0051357867*Close[i+33] + +0.0044454862*Close[i+34] + +0.0018784961*Close[i+35] + -0.0011065767*Close[i+36] + -0.0031162862*Close[i+37] + -0.0033443253*Close[i+38] + -0.0022163335*Close[i+39] + +0.0002573669*Close[i+40] + +0.0003650790*Close[i+41] + +0.0060440751*Close[i+42] + +0.0018747783*Close[i+43]; + + + + value31= + 0.4360409450*Close[i+0+1] + +0.3658689069*Close[i+1+1] + +0.2460452079*Close[i+2+1] + +0.1104506886*Close[i+3+1] + -0.0054034585*Close[i+4+1] + -0.0760367731*Close[i+5+1] + -0.0933058722*Close[i+6+1] + -0.0670110374*Close[i+7+1] + -0.0190795053*Close[i+8+1] + +0.0259609206*Close[i+9+1] + +0.0502044896*Close[i+10+1] + +0.0477818607*Close[i+11+1] + +0.0249252327*Close[i+12+1] + -0.0047706151*Close[i+13+1] + -0.0272432537*Close[i+14+1] + -0.0338917071*Close[i+15+1] + -0.0244141482*Close[i+16+1] + -0.0055774838*Close[i+17+1] + +0.0128149838*Close[i+18+1] + +0.0226522218*Close[i+19+1] + +0.0208778257*Close[i+20+1] + +0.0100299086*Close[i+21+1] + -0.0036771622*Close[i+22+1] + -0.0136744850*Close[i+23+1] + -0.0160483392*Close[i+24+1] + -0.0108597376*Close[i+25+1] + -0.0016060704*Close[i+26+1] + +0.0069480557*Close[i+27+1] + +0.0110573605*Close[i+28+1] + +0.0095711419*Close[i+29+1] + +0.0040444064*Close[i+30+1] + -0.0023824623*Close[i+31+1] + -0.0067093714*Close[i+32+1] + -0.0072003400*Close[i+33+1] + -0.0047717710*Close[i+34+1] + +0.0005541115*Close[i+35+1] + +0.0007860160*Close[i+36+1] + +0.0130129076*Close[i+37+1] + +0.0040364019*Close[i+38+1]; + + value41= + -0.0025097319*Close[i+0+1] + +0.0513007762*Close[i+1+1] + +0.1142800493*Close[i+2+1] + +0.1699342860*Close[i+3+1] + +0.2025269304*Close[i+4+1] + +0.2025269304*Close[i+5+1] + +0.1699342860*Close[i+6+1] + +0.1142800493*Close[i+7+1] + +0.0513007762*Close[i+8+1] + -0.0025097319*Close[i+9+1] + -0.0353166244*Close[i+10+1] + -0.0433375629*Close[i+11+1] + -0.0311244617*Close[i+12+1] + -0.0088618137*Close[i+13+1] + +0.0120580088*Close[i+14+1] + +0.0233183633*Close[i+15+1] + +0.0221931304*Close[i+16+1] + +0.0115769653*Close[i+17+1] + -0.0022157966*Close[i+18+1] + -0.0126536111*Close[i+19+1] + -0.0157416029*Close[i+20+1] + -0.0113395830*Close[i+21+1] + -0.0025905610*Close[i+22+1] + +0.0059521459*Close[i+23+1] + +0.0105212252*Close[i+24+1] + +0.0096970755*Close[i+25+1] + +0.0046585685*Close[i+26+1] + -0.0017079230*Close[i+27+1] + -0.0063513565*Close[i+28+1] + -0.0074539350*Close[i+29+1] + -0.0050439973*Close[i+30+1] + -0.0007459678*Close[i+31+1] + +0.0032271474*Close[i+32+1] + +0.0051357867*Close[i+33+1] + +0.0044454862*Close[i+34+1] + +0.0018784961*Close[i+35+1] + -0.0011065767*Close[i+36+1] + -0.0031162862*Close[i+37+1] + -0.0033443253*Close[i+38+1] + -0.0022163335*Close[i+39+1] + +0.0002573669*Close[i+40+1] + +0.0003650790*Close[i+41+1] + +0.0060440751*Close[i+42+1] + +0.0018747783*Close[i+43+1]; + + value12= + 0.0982862174*Close[i+0] + +0.0975682269*Close[i+1] + +0.0961401078*Close[i+2] + +0.0940230544*Close[i+3] + +0.0912437090*Close[i+4] + +0.0878391006*Close[i+5] + +0.0838544303*Close[i+6] + +0.0793406350*Close[i+7] + +0.0743569346*Close[i+8] + +0.0689666682*Close[i+9] + +0.0632381578*Close[i+10] + +0.0572428925*Close[i+11] + +0.0510534242*Close[i+12] + +0.0447468229*Close[i+13] + +0.0383959950*Close[i+14] + +0.0320735368*Close[i+15] + +0.0258537721*Close[i+16] + +0.0198005183*Close[i+17] + +0.0139807863*Close[i+18] + +0.0084512448*Close[i+19] + +0.0032639979*Close[i+20] + -0.0015350359*Close[i+21] + -0.0059060082*Close[i+22] + -0.0098190256*Close[i+23] + -0.0132507215*Close[i+24] + -0.0161875265*Close[i+25] + -0.0186164872*Close[i+26] + -0.0205446727*Close[i+27] + -0.0219739146*Close[i+28] + -0.0229204861*Close[i+29] + -0.0234080863*Close[i+30] + -0.0234566315*Close[i+31] + -0.0231017777*Close[i+32] + -0.0223796900*Close[i+33] + -0.0213300463*Close[i+34] + -0.0199924534*Close[i+35] + -0.0184126992*Close[i+36] + -0.0166377699*Close[i+37] + -0.0147139428*Close[i+38] + -0.0126796776*Close[i+39] + -0.0105938331*Close[i+40] + -0.0084736770*Close[i+41] + -0.0063841850*Close[i+42] + -0.0043466731*Close[i+43] + -0.0023956944*Close[i+44] + -0.0005535180*Close[i+45] + +0.0011421469*Close[i+46] + +0.0026845693*Close[i+47] + +0.0040471369*Close[i+48] + +0.0052380201*Close[i+49] + +0.0062194591*Close[i+50] + +0.0070340085*Close[i+51] + +0.0076266453*Close[i+52] + +0.0080376628*Close[i+53] + +0.0083037666*Close[i+54] + +0.0083694798*Close[i+55] + +0.0082901022*Close[i+56] + +0.0080741359*Close[i+57] + +0.0077543820*Close[i+58] + +0.0073260526*Close[i+59] + +0.0068163569*Close[i+60] + +0.0062325477*Close[i+61] + +0.0056078229*Close[i+62] + +0.0049516078*Close[i+63] + +0.0161380976*Close[i+64]; + + value22= + -0.0074151919*Close[i+0] + -0.0060698985*Close[i+1] + -0.0044979052*Close[i+2] + -0.0027054278*Close[i+3] + -0.0007031702*Close[i+4] + +0.0014951741*Close[i+5] + +0.0038713513*Close[i+6] + +0.0064043271*Close[i+7] + +0.0090702334*Close[i+8] + +0.0118431116*Close[i+9] + +0.0146922652*Close[i+10] + +0.0175884606*Close[i+11] + +0.0204976517*Close[i+12] + +0.0233865835*Close[i+13] + +0.0262218588*Close[i+14] + +0.0289681736*Close[i+15] + +0.0315922931*Close[i+16] + +0.0340614696*Close[i+17] + +0.0363444061*Close[i+18] + +0.0384120882*Close[i+19] + +0.0402373884*Close[i+20] + +0.0417969735*Close[i+21] + +0.0430701377*Close[i+22] + +0.0440399188*Close[i+23] + +0.0446941124*Close[i+24] + +0.0450230100*Close[i+25] + +0.0450230100*Close[i+26] + +0.0446941124*Close[i+27] + +0.0440399188*Close[i+28] + +0.0430701377*Close[i+29] + +0.0417969735*Close[i+30] + +0.0402373884*Close[i+31] + +0.0384120882*Close[i+32] + +0.0363444061*Close[i+33] + +0.0340614696*Close[i+34] + +0.0315922931*Close[i+35] + +0.0289681736*Close[i+36] + +0.0262218588*Close[i+37] + +0.0233865835*Close[i+38] + +0.0204976517*Close[i+39] + +0.0175884606*Close[i+40] + +0.0146922652*Close[i+41] + +0.0118431116*Close[i+42] + +0.0090702334*Close[i+43] + +0.0064043271*Close[i+44] + +0.0038713513*Close[i+45] + +0.0014951741*Close[i+46] + -0.0007031702*Close[i+47] + -0.0027054278*Close[i+48] + -0.0044979052*Close[i+49] + -0.0060698985*Close[i+50] + -0.0074151919*Close[i+51] + -0.0085278517*Close[i+52] + -0.0094111161*Close[i+53] + -0.0100658241*Close[i+54] + -0.0104994302*Close[i+55] + -0.0107227904*Close[i+56] + -0.0107450280*Close[i+57] + -0.0105824763*Close[i+58] + -0.0102517019*Close[i+59] + -0.0097708805*Close[i+60] + -0.0091581551*Close[i+61] + -0.0084345004*Close[i+62] + -0.0076214397*Close[i+63] + -0.0067401718*Close[i+64] + -0.0058083144*Close[i+65] + -0.0048528295*Close[i+66] + -0.0038816271*Close[i+67] + -0.0029244713*Close[i+68] + -0.0019911267*Close[i+69] + -0.0010974211*Close[i+70] + -0.0002535559*Close[i+71] + +0.0005231953*Close[i+72] + +0.0012297491*Close[i+73] + +0.0018539149*Close[i+74] + +0.0023994354*Close[i+75] + +0.0028490136*Close[i+76] + +0.0032221429*Close[i+77] + +0.0034936183*Close[i+78] + +0.0036818974*Close[i+79] + +0.0038037944*Close[i+80] + +0.0038338964*Close[i+81] + +0.0037975350*Close[i+82] + +0.0036986051*Close[i+83] + +0.0035521320*Close[i+84] + +0.0033559226*Close[i+85] + +0.0031224409*Close[i+86] + +0.0028550092*Close[i+87] + +0.0025688349*Close[i+88] + +0.0022682355*Close[i+89] + +0.0073925495*Close[i+90]; + + value32= + 0.0982862174*Close[i+0+1] + +0.0975682269*Close[i+1+1] + +0.0961401078*Close[i+2+1] + +0.0940230544*Close[i+3+1] + +0.0912437090*Close[i+4+1] + +0.0878391006*Close[i+5+1] + +0.0838544303*Close[i+6+1] + +0.0793406350*Close[i+7+1] + +0.0743569346*Close[i+8+1] + +0.0689666682*Close[i+9+1] + +0.0632381578*Close[i+10+1] + +0.0572428925*Close[i+11+1] + +0.0510534242*Close[i+12+1] + +0.0447468229*Close[i+13+1] + +0.0383959950*Close[i+14+1] + +0.0320735368*Close[i+15+1] + +0.0258537721*Close[i+16+1] + +0.0198005183*Close[i+17+1] + +0.0139807863*Close[i+18+1] + +0.0084512448*Close[i+19+1] + +0.0032639979*Close[i+20+1] + -0.0015350359*Close[i+21+1] + -0.0059060082*Close[i+22+1] + -0.0098190256*Close[i+23+1] + -0.0132507215*Close[i+24+1] + -0.0161875265*Close[i+25+1] + -0.0186164872*Close[i+26+1] + -0.0205446727*Close[i+27+1] + -0.0219739146*Close[i+28+1] + -0.0229204861*Close[i+29+1] + -0.0234080863*Close[i+30+1] + -0.0234566315*Close[i+31+1] + -0.0231017777*Close[i+32+1] + -0.0223796900*Close[i+33+1] + -0.0213300463*Close[i+34+1] + -0.0199924534*Close[i+35+1] + -0.0184126992*Close[i+36+1] + -0.0166377699*Close[i+37+1] + -0.0147139428*Close[i+38+1] + -0.0126796776*Close[i+39+1] + -0.0105938331*Close[i+40+1] + -0.0084736770*Close[i+41+1] + -0.0063841850*Close[i+42+1] + -0.0043466731*Close[i+43+1] + -0.0023956944*Close[i+44+1] + -0.0005535180*Close[i+45+1] + +0.0011421469*Close[i+46+1] + +0.0026845693*Close[i+47+1] + +0.0040471369*Close[i+48+1] + +0.0052380201*Close[i+49+1] + +0.0062194591*Close[i+50+1] + +0.0070340085*Close[i+51+1] + +0.0076266453*Close[i+52+1] + +0.0080376628*Close[i+53+1] + +0.0083037666*Close[i+54+1] + +0.0083694798*Close[i+55+1] + +0.0082901022*Close[i+56+1] + +0.0080741359*Close[i+57+1] + +0.0077543820*Close[i+58+1] + +0.0073260526*Close[i+59+1] + +0.0068163569*Close[i+60+1] + +0.0062325477*Close[i+61+1] + +0.0056078229*Close[i+62+1] + +0.0049516078*Close[i+63+1] + +0.0161380976*Close[i+64+1]; + + value42= + -0.0074151919*Close[i+0+1] + -0.0060698985*Close[i+1+1] + -0.0044979052*Close[i+2+1] + -0.0027054278*Close[i+3+1] + -0.0007031702*Close[i+4+1] + +0.0014951741*Close[i+5+1] + +0.0038713513*Close[i+6+1] + +0.0064043271*Close[i+7+1] + +0.0090702334*Close[i+8+1] + +0.0118431116*Close[i+9+1] + +0.0146922652*Close[i+10+1] + +0.0175884606*Close[i+11+1] + +0.0204976517*Close[i+12+1] + +0.0233865835*Close[i+13+1] + +0.0262218588*Close[i+14+1] + +0.0289681736*Close[i+15+1] + +0.0315922931*Close[i+16+1] + +0.0340614696*Close[i+17+1] + +0.0363444061*Close[i+18+1] + +0.0384120882*Close[i+19+1] + +0.0402373884*Close[i+20+1] + +0.0417969735*Close[i+21+1] + +0.0430701377*Close[i+22+1] + +0.0440399188*Close[i+23+1] + +0.0446941124*Close[i+24+1] + +0.0450230100*Close[i+25+1] + +0.0450230100*Close[i+26+1] + +0.0446941124*Close[i+27+1] + +0.0440399188*Close[i+28+1] + +0.0430701377*Close[i+29+1] + +0.0417969735*Close[i+30+1] + +0.0402373884*Close[i+31+1] + +0.0384120882*Close[i+32+1] + +0.0363444061*Close[i+33+1] + +0.0340614696*Close[i+34+1] + +0.0315922931*Close[i+35+1] + +0.0289681736*Close[i+36+1] + +0.0262218588*Close[i+37+1] + +0.0233865835*Close[i+38+1] + +0.0204976517*Close[i+39+1] + +0.0175884606*Close[i+40+1] + +0.0146922652*Close[i+41+1] + +0.0118431116*Close[i+42+1] + +0.0090702334*Close[i+43+1] + +0.0064043271*Close[i+44+1] + +0.0038713513*Close[i+45+1] + +0.0014951741*Close[i+46+1] + -0.0007031702*Close[i+47+1] + -0.0027054278*Close[i+48+1] + -0.0044979052*Close[i+49+1] + -0.0060698985*Close[i+50+1] + -0.0074151919*Close[i+51+1] + -0.0085278517*Close[i+52+1] + -0.0094111161*Close[i+53+1] + -0.0100658241*Close[i+54+1] + -0.0104994302*Close[i+55+1] + -0.0107227904*Close[i+56+1] + -0.0107450280*Close[i+57+1] + -0.0105824763*Close[i+58+1] + -0.0102517019*Close[i+59+1] + -0.0097708805*Close[i+60+1] + -0.0091581551*Close[i+61+1] + -0.0084345004*Close[i+62+1] + -0.0076214397*Close[i+63+1] + -0.0067401718*Close[i+64+1] + -0.0058083144*Close[i+65+1] + -0.0048528295*Close[i+66+1] + -0.0038816271*Close[i+67+1] + -0.0029244713*Close[i+68+1] + -0.0019911267*Close[i+69+1] + -0.0010974211*Close[i+70+1] + -0.0002535559*Close[i+71+1] + +0.0005231953*Close[i+72+1] + +0.0012297491*Close[i+73+1] + +0.0018539149*Close[i+74+1] + +0.0023994354*Close[i+75+1] + +0.0028490136*Close[i+76+1] + +0.0032221429*Close[i+77+1] + +0.0034936183*Close[i+78+1] + +0.0036818974*Close[i+79+1] + +0.0038037944*Close[i+80+1] + +0.0038338964*Close[i+81+1] + +0.0037975350*Close[i+82+1] + +0.0036986051*Close[i+83+1] + +0.0035521320*Close[i+84+1] + +0.0033559226*Close[i+85+1] + +0.0031224409*Close[i+86+1] + +0.0028550092*Close[i+87+1] + +0.0025688349*Close[i+88+1] + +0.0022682355*Close[i+89+1] + +0.0073925495*Close[i+90+1]; + + FTLM=(value11-value21); + FTLM1=(value31-value41); + STLM=(value12-value22); + STLM1=(value32-value42); + + if(FTLM>FTLM1) {Up1[i]=FTLM;Down1[i]=EMPTY_VALUE;} else {Down1[i]=FTLM;Up1[i]=EMPTY_VALUE;} + if(STLM>STLM1) {Up2[i]=STLM;Down2[i]=EMPTY_VALUE;} else {Down2[i]=STLM;Up2[i]=EMPTY_VALUE;} + + i--; + } + return(0); + } +//+------------------------------------------------------------------+ diff --git a/ForexComboSystem_v5.0(4in1)EURUSD.mq4 b/ForexComboSystem_v5.0(4in1)EURUSD.mq4 new file mode 100644 index 0000000..a851a7a --- /dev/null +++ b/ForexComboSystem_v5.0(4in1)EURUSD.mq4 @@ -0,0 +1,1529 @@ +#property copyright "http://myfxbook.3dn.ru/" +#property link "http://myfxbook.3dn.ru/" + +#import "wininet.dll" + int InternetOpenA(string a0, int a1, string a2, string a3, int a4); + int InternetOpenUrlA(int a0, string a1, string a2, int a3, int a4, int a5); + int InternetReadFile(int a0, string a1, int a2, int& a3[]); + int InternetCloseHandle(int a0); +#import "FCS500.dll" + int dllInit(int a0, int a1, int a2, int a3, int a4); + int dllOpenCond1(int a0, double a1, double a2, double a3, double a4, double a5, double a6, int a7, int a8, int a9); + int dllCloseCond1(int a0, double a1, double a2); + int dllOpenCond2(int a0, double a1, double a2, double a3, double a4, double a5, double a6); + int dllCloseCond2(int a0, double a1, double a2, double a3, double a4); + int dllOpenCond3(int a0, double a1, double a2, double a3, double a4, double a5, double a6); + int dllCloseCond3(int a0, double a1, double a2, double a3, double a4, double a5, double a6); + int dllOpenCond4(int a0, int a1, int a2, int a3, double a4, double a5, double a6, double a7, double a8, double a9); + int dllCloseCond4(int a0, double a1, double a2, double a3, double a4); + int dllParamInit1(int a0); + int dllParamInit2(int a0); + double dllExpTrailLong(double a0, double a1, double a2); + double dllExpTrailShort(double a0, double a1, double a2); + int dllGMTOffset(); +#import + +//string gs_76 = "http://forex-combo.com/verify4in1.php"; +bool gi_84 = FALSE; +extern string A = "===================="; +extern bool Use_FXCOMBO_Scalping = TRUE; +extern bool Use_FXCOMBO_Breakout = TRUE; +extern bool Use_FXCOMBO_Reversal = TRUE; +extern bool Use_FXCOMBO_EuroRange = TRUE; +extern string B = "===================="; +extern bool Use_ECN_Execution = TRUE; +extern bool Hidden_StopAndTarget = FALSE; +extern bool No_Hedge_Trades = FALSE; +extern bool NFA_Compatibility = FALSE; +extern string C = "===================="; +extern string CommentSys1 = "*** 1 ***"; +extern string CommentSys2 = "*** 2 ***"; +extern string CommentSys3 = "*** 3 ***"; +extern string CommentSys4 = "*** 4 ***"; +extern string D = "===================="; +extern int Magic1 = 111; +extern int Magic2 = 222; +extern int Magic3 = 333; +extern int Magic4 = 444; +extern string E = "===================="; +extern double MaxSPREAD = 4.0; +extern int Slippage = 2; +extern bool AutoGMT_Offset = TRUE; +extern int ManualGMT_Offset = 2; +extern bool Calculate_DST = TRUE; +extern bool UseAgresiveMM = FALSE; +extern bool EMAIL_Notification = FALSE; +extern string MMSys1 = "==== FXCOMBO Scalping MM Parameters ===="; +extern double LotsSys1 = 0.1; +extern double TradeMMSys1 = 0.0; +extern double LossFactorSys1 = 2.0; +int gi_272 = 0; +int gi_276 = 2; +int gi_280 = 0; +extern string MMSys2 = "==== FXCOMBO Breakout MM Parameters ===="; +extern double LotsSys2 = 0.1; +extern double TradeMMSys2 = 0.0; +extern double LossFactorSys2 = 2.0; +int gi_316 = 0; +int gi_320 = 2; +int gi_324 = 0; +extern string MMSys3 = "==== FXCOMBO Reversal MM Parameters ===="; +extern double LotsSys3 = 0.1; +extern double TradeMMSys3 = 0.0; +extern double LossFactorSys3 = 2.0; +int gi_360 = 0; +int gi_364 = 2; +int gi_368 = 0; +extern string MMSys4 = "==== FXCOMBO EuroRange MM Parameters ===="; +extern double LotsSys4 = 0.1; +extern double TradeMMSys4 = 0.0; +extern double LossFactorSys4 = 2.0; +int gi_404 = 0; +int gi_408 = 2; +int gi_412 = 0; +extern string CommonMM = "==== Main MM Parameters ===="; +extern double MMMax = 20.0; +extern double MaximalLots = 50.0; +extern string Scalping = "==== FXCOMBO Scalping System Parameters ===="; +extern int StopLoss = 40; +extern int TakeProfit = 19; +int g_period_456 = 60; +extern int TREND_STR = 24; +int g_period_464 = 11; +extern int OSC_open = 5; +extern int OSC_close = 14; +int gi_476 = -5; +int gi_480 = -1; +int gi_484 = -1; +int gi_488 = 6; +extern string Breakout = "==== FXCOMBO Breakout System Parameters ===="; +extern int TakeProfit_II = 70; +extern int StopLoss_II = 34; +extern int MaxPipsTrailing2 = 45; +extern int MinPipsTrailing2 = 10; +extern int Break = 6; +int g_period_520 = 1; +int g_period_524 = 19; +double gd_528 = 1.45; +extern double ATRTrailingFactor2 = 1.15; +int gi_544 = 300; +extern int F_TrailingProfit_II = 40; +extern int F_Trailing_II = 30; +extern bool Use_Exp_Trailing_II = FALSE; +extern double Exp_Trail_Factor_II = 0.16; +int gi_568 = 30; +int gi_572 = 45; +int gi_576 = 0; +int gi_580 = 3; +int gi_584 = 0; +int gi_588 = 19; +int gi_592 = 14; +int gi_596 = 17; +int gi_600 = 20; +int gi_604 = 9; +int gi_608 = 7; +int gi_612 = 13; +int gi_616 = 8; +int gi_620 = 3; +int gi_624 = 3; +extern string Reversal = "==== FXCOMBO Reversal System Parameters ===="; +extern int BegHourSys_III = 22; +extern int EndHourSys_III = 0; +extern int TakeProfit_III = 170; +extern int StopLoss_III = 70; +int gi_652 = 300; +extern int MaxPipsTrailing3 = 140; +extern int MinPipsTrailing3 = 20; +int g_period_664 = 50; +double gd_668 = 9.0; +int g_period_676 = 18; +int gi_680 = -6; +int gi_684 = 25; +extern int F_TrailingProfit_III = 160; +extern int F_Trailing_III = 20; +extern bool Use_Exp_Trailing_III = FALSE; +extern double Exp_Trail_Factor_III = 1.0; +extern string EuroRange = "==== FXCOMBO EuroRange System Parameters ===="; +int gi_716 = 5; +int gi_720 = 40; +extern int MaxRangePips = 95; +extern int BreakPips = -12; +extern double TargetPercent = 5.0; +extern int StopLoss_IV = 41; +int gi_744 = 300; +int gi_748 = 100; +int gi_752 = 5; +double gd_756 = 100.0; +int gi_764 = 300; +int gi_768 = 30; +extern bool Use_Exp_Trailing_IV = TRUE; +extern double Exp_Trail_Factor_IV = 0.15; +extern int ReverseTF = 5; +extern int ExitProfit = 80; +extern string NF = "==== News Filter Settings ===="; +extern bool Include_Medium_News = TRUE; +extern int Wait_Before_News = 30; +extern int Wait_After_News = 30; +extern bool NewsFilterSys1 = FALSE; +extern bool NewsFilterSys2 = FALSE; +extern bool NewsFilterSys3 = FALSE; +extern bool NewsFilterSys4 = FALSE; +string gs_828 = ""; +string gs_836 = ""; +string gs_844 = ""; +int g_datetime_852 = 0; +bool gi_856 = TRUE; +string gs_860 = ""; +string gs_868 = ""; +int gi_876 = 0; +int gi_880 = -1; +double g_minlot_884 = 0.0; +double g_maxlot_892 = 0.0; +int g_leverage_900 = 0; +int g_lotsize_904 = 0; +double g_lotstep_908 = 0.0; +int g_datetime_916 = 0; +int g_datetime_920 = 0; +int g_datetime_924 = 0; +int g_datetime_928 = 0; +int gi_932; +int gi_936; +int gi_940 = 0; +int gi_944 = 1; +int gi_unused_948 = 3; +int gi_952 = 13; +int g_datetime_956 = 0; +int g_index_960 = 0; +int gia_964[1000]; +string gsa_968[1000]; +string gsa_972[1000]; + +// E37F0136AA3FFAF149B351F6A4C948E9 +int init() { + gi_856 = TRUE; + gi_84 = FALSE; + Comment(""); + if (ObjectFind("klc") >= 0) ObjectDelete("klc"); + if (ObjectFind("klc2") >= 0) ObjectDelete("klc2"); + if (ObjectFind("klc3") >= 0) ObjectDelete("klc3"); + return (0); +} + +// 52D46093050F38C27267BCE42543EF60 +int deinit() { + Comment(""); + if (ObjectFind("klc") >= 0) ObjectDelete("klc"); + if (ObjectFind("klc2") >= 0) ObjectDelete("klc2"); + if (ObjectFind("klc3") >= 0) ObjectDelete("klc3"); + return (0); +} + +// EA2B2676C28C0DB26D39331A336C6B92 +int start() { + double price_0; + double price_8; + double price_16; + color color_32; + string ls_48; + int li_56; + string ls_60; + bool bool_68; + bool bool_72; + bool bool_76; + double ld_88; + string ls_104; + int li_120; + int li_300; + int li_304; + int li_308; + int li_312; + int li_316; + int li_320; + int li_324; + int ticket_452; + int ticket_456; + int ticket_460; + int ticket_464; + double price_472; + double price_480; + double price_488; + double price_496; + double ld_504; + double price_512; + double price_520; + double price_528; + double ld_536; + double price_544; + double price_552; + double price_560; + string ls_616; + double ld_40 = 1; + if (gi_856) { + gi_856 = FALSE; + g_minlot_884 = MarketInfo(Symbol(), MODE_MINLOT); + g_maxlot_892 = MarketInfo(Symbol(), MODE_MAXLOT); + g_leverage_900 = AccountLeverage(); + g_lotsize_904 = MarketInfo(Symbol(), MODE_LOTSIZE); + g_lotstep_908 = MarketInfo(Symbol(), MODE_LOTSTEP); + gi_880 = -1; + gs_828 = ""; + gs_836 = ""; + gs_844 = ""; + g_datetime_852 = 0; + } + if ((!IsTesting()) && IsStopped()) return (0); + if ((!IsTesting()) && !IsTradeAllowed()) { + Comment("Trading server: Trading is not Allowed ..."); + return (0); + } + if ((!IsTesting()) && IsTradeContextBusy()) { + Comment("Trading server: Trade Context is Busy ..."); + return (0); + } + if (iATR(NULL, PERIOD_M5, 1, 1) < Point / 2.0) return (0); + if (IsDllsAllowed() == FALSE) { + Comment("Warning: Set Parameter **AllowDLL Imports** ON in menu Tools -> Options -> ExpertAdvisors."); + Print("Warning: Set Parameter **AllowDLL Imports** ON in menu Tools -> Options -> ExpertAdvisors."); + Alert("Warning: Set Parameter **AllowDLL Imports** ON in menu Tools -> Options -> ExpertAdvisors."); + Sleep(30000); + return (0); + } + gi_84 = TRUE; + /*if ((!gi_84) && !IsTesting()) { + if (IsDemo() == FALSE) ls_60 = "AccountType=2"; + else ls_60 = "AccountType=1"; + if (f0_11(gs_76 + "?AccountId=" + DoubleToStr(AccountNumber(), 0) + "&" + ls_60, ls_48)) { + if (StringTrimRight(StringTrimLeft(f0_10(ls_48, 0, "", "", li_56))) == "OK") gi_84 = TRUE; + else { + Comment("Online validation is not passed. For more information, contact us at support@forex-combo.com!"); + Alert("Online validation is not passed. For more information, contact us at support@forex-combo.com!"); + Sleep(30000); + return (0); + } + } else { + Comment("\n Online validation failed (error number " + DoubleToStr(GetLastError(), 0) + "). Visit www.forex-combo.com for more information!"); + Alert("Online validation failed (error number " + DoubleToStr(GetLastError(), 0) + "). Visit www.forex-combo.com for more information!"); + Sleep(30000); + return (0); + } + }*/ + if (gi_880 <= 0) { + gi_880 = f0_23(AccountNumber(), IsTesting(), IsDemo(), WindowHandle(Symbol(), Period()), TimeCurrent()); + if (IsTesting()) Calculate_DST = FALSE; + if (IsTesting() || AutoGMT_Offset == FALSE) gi_876 = ManualGMT_Offset; + if (!IsTesting() && AutoGMT_Offset == TRUE && Calculate_DST == TRUE && (Month() > 3 && Month() < 11)) gi_876 = f0_17() - 1; + if (!IsTesting() && AutoGMT_Offset == TRUE && Calculate_DST == TRUE && Month() <= 3 || Month() >= 11) gi_876 = f0_17(); + if (!IsTesting() && AutoGMT_Offset == TRUE && Calculate_DST == FALSE) gi_876 = f0_17(); + } + if (gi_880 <= 0 && gi_84 && (!IsTesting())) { + Comment("DLL initialization is failed (" + DoubleToStr(gi_880, 0) + "). For more information, contact us at support@forex-combo.com!"); + Alert("DLL initialization is failed (" + DoubleToStr(gi_880, 0) + "). For more information, contact us at support@forex-combo.com!"); + Sleep(10000); + return (0); + } + if (gi_880 <= 0 && IsTesting()) Print("DLL initialization is failed (" + DoubleToStr(gi_880, 0) + "). Please register you test account at forex-combo.com!"); + int stoplevel_80 = MarketInfo(Symbol(), MODE_STOPLEVEL); + bool li_84 = TRUE; + if (stoplevel_80 == 0 || Use_ECN_Execution == TRUE || Hidden_StopAndTarget == TRUE) li_84 = FALSE; + if (Digits <= 3) ld_88 = 0.01; + else ld_88 = 0.0001; + double ld_96 = NormalizeDouble((Ask - Bid) / ld_88, 1); + if (IsTesting()) Calculate_DST = FALSE; + if (Calculate_DST == TRUE) ls_104 = "YES"; + if (Calculate_DST == FALSE) ls_104 = "NO"; + string ls_112 = "*** SPREAD OK ***"; + if (ld_96 > MaxSPREAD) ls_112 = "*** SPREAD IS TOO HIGH ***"; + if (!IsTesting()) li_120 = f0_17(); + else li_120 = ManualGMT_Offset; + gs_860 = "\n\n Greenwich Mean Time : " + TimeToStr(TimeCurrent() - 3600 * li_120, TIME_DATE|TIME_MINUTES|TIME_SECONDS) + + "\n Broker Time : " + TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS) + + "\n Calculate DST: " + ls_104; + string ls_124 = "FX COMBO is running on your account - Validation OK"; + string ls_132 = "FX COMBO is set up for time zone GMT " + gi_876; + string ls_140 = "Spread= " + DoubleToStr(ld_96, 1) + " pips"; + string ls_148 = "Account Balance= " + DoubleToStr(AccountBalance(), 2); + string ls_156 = ls_112; + string ls_164 = ""; + f0_2(); + if (gs_836 != "") { + ls_164 = "\n" + + gs_836; + } + ls_164 = ls_164 + + "\n\n " + gs_828; + Comment("\n\n\n\n\n " + ls_124 + " \n " + ls_132 + " \n " + ls_140 + " \n " + ls_148 + " \n\n " + ls_156 + " " + gs_860 + " " + gs_868 + ls_164); + ObjectCreate("klc", OBJ_LABEL, 0, 0, 0); + ObjectSetText("klc", " ** FOREX COMBO SYSTEM 4 in 1 **", 9, "System", Red); + ObjectSet("klc", OBJPROP_CORNER, 0); + ObjectSet("klc", OBJPROP_XDISTANCE, 0); + ObjectSet("klc", OBJPROP_YDISTANCE, 29); + ObjectCreate("klc3", OBJ_LABEL, 0, 0, 0); + ObjectSetText("klc3", " Copyright © www.fxautomater.com ", 9, "System", Gray); + ObjectSet("klc3", OBJPROP_CORNER, 0); + ObjectSet("klc3", OBJPROP_XDISTANCE, 0); + ObjectSet("klc3", OBJPROP_YDISTANCE, 45); + if (UseAgresiveMM != TRUE) { + LossFactorSys1 = 1; + LossFactorSys2 = 1; + LossFactorSys3 = 1; + LossFactorSys4 = 1; + } + HideTestIndicators(TRUE); + double iclose_172 = iClose(NULL, PERIOD_M15, 1); + double ima_180 = iMA(NULL, PERIOD_M15, g_period_456, 0, MODE_SMMA, PRICE_CLOSE, 1); + double iwpr_188 = iWPR(NULL, PERIOD_M15, g_period_464, 1); + double iatr_196 = iATR(NULL, PERIOD_H1, g_period_524, 1); + double ima_204 = iMA(NULL, PERIOD_H1, g_period_520, 0, MODE_EMA, PRICE_CLOSE, 1); + double ld_212 = ima_204 + iatr_196 * gd_528; + double ld_220 = ima_204 - iatr_196 * gd_528; + double iclose_228 = iClose(NULL, PERIOD_M5, 1); + double iatr_236 = iATR(NULL, PERIOD_M5, 5, 1); + double iatr_244 = iATR(NULL, PERIOD_M5, g_period_664, 1); + double ihigh_252 = iHigh(NULL, PERIOD_H1, 1); + double ilow_260 = iLow(NULL, PERIOD_H1, 1); + double ibands_268 = iBands(NULL, PERIOD_H1, g_period_676, 2, 0, PRICE_CLOSE, MODE_UPPER, 1); + double ibands_276 = iBands(NULL, PERIOD_H1, g_period_676, 2, 0, PRICE_CLOSE, MODE_LOWER, 1); + HideTestIndicators(FALSE); + double ihigh_284 = iHigh(NULL, PERIOD_H1, iHighest(NULL, PERIOD_H1, MODE_HIGH, gi_716, 1)); + double ilow_292 = iLow(NULL, PERIOD_H1, iLowest(NULL, PERIOD_H1, MODE_LOW, gi_716, 1)); + if (gi_480 < 0) f0_19(gi_480, gi_484); + if (gi_580 < 0) f0_8(gi_580, gi_584, gi_588, gi_592, gi_596, gi_600, gi_604, gi_608, gi_612, gi_616, gi_620, gi_624); + if (TakeProfit < stoplevel_80 * Point / ld_88) li_300 = stoplevel_80 * Point / ld_88; + else li_300 = TakeProfit; + if (StopLoss < stoplevel_80 * Point / ld_88) li_304 = stoplevel_80 * Point / ld_88; + else li_304 = StopLoss; + if (TakeProfit_II < stoplevel_80 * Point / ld_88) li_308 = stoplevel_80 * Point / ld_88; + else li_308 = TakeProfit_II; + if (StopLoss_II < stoplevel_80 * Point / ld_88) li_312 = stoplevel_80 * Point / ld_88; + else li_312 = StopLoss_II; + if (TakeProfit_III < stoplevel_80 * Point / ld_88) li_316 = stoplevel_80 * Point / ld_88; + else li_316 = TakeProfit_III; + if (StopLoss_III < stoplevel_80 * Point / ld_88) li_320 = stoplevel_80 * Point / ld_88; + else li_320 = StopLoss_III; + if (StopLoss_IV < stoplevel_80 * Point / ld_88) li_324 = stoplevel_80 * Point / ld_88; + else li_324 = StopLoss_IV; + int li_328 = gi_480 + gi_876; + int li_332 = gi_480 + gi_876; + int li_336 = BegHourSys_III + gi_876; + int li_340 = EndHourSys_III + gi_876; + if (li_328 > 23) li_328 -= 24; + if (li_328 < 0) li_328 += 24; + if (li_336 > 23) li_336 -= 24; + if (li_336 < 0) li_336 += 24; + if (li_332 > 23) li_332 -= 24; + if (li_332 < 0) li_332 += 24; + if (li_340 > 23) li_340 -= 24; + if (li_340 < 0) li_340 += 24; + int li_344 = gi_580 + gi_876; + int li_348 = gi_584 + gi_876; + int li_352 = gi_588 + gi_876; + int li_356 = gi_592 + gi_876; + int li_360 = gi_596 + gi_876; + int li_364 = gi_600 + gi_876; + int li_368 = gi_604 + gi_876; + int li_372 = gi_608 + gi_876; + int li_376 = gi_612 + gi_876; + int li_380 = gi_616 + gi_876; + int li_384 = gi_620 + gi_876; + int li_388 = gi_624 + gi_876; + if (li_344 > 23) li_344 -= 24; + if (li_344 < 0) li_344 += 24; + if (li_348 > 23) li_348 -= 24; + if (li_348 < 0) li_348 += 24; + if (li_352 > 23) li_352 -= 24; + if (li_352 < 0) li_352 += 24; + if (li_356 > 23) li_356 -= 24; + if (li_356 < 0) li_356 += 24; + if (li_360 > 23) li_360 -= 24; + if (li_360 < 0) li_360 += 24; + if (li_364 > 23) li_364 -= 24; + if (li_364 < 0) li_364 += 24; + if (li_368 > 23) li_368 -= 24; + if (li_368 < 0) li_368 += 24; + if (li_372 > 23) li_372 -= 24; + if (li_372 < 0) li_372 += 24; + if (li_376 > 23) li_376 -= 24; + if (li_376 < 0) li_376 += 24; + if (li_380 > 23) li_380 -= 24; + if (li_380 < 0) li_380 += 24; + if (li_384 > 23) li_384 -= 24; + if (li_384 < 0) li_384 += 24; + if (li_388 > 23) li_388 -= 24; + if (li_388 < 0) li_388 += 24; + int slippage_392 = Slippage * (ld_88 / Point); + int count_396 = 0; + int count_400 = 0; + int count_404 = 0; + int count_408 = 0; + int count_412 = 0; + int count_416 = 0; + int count_420 = 0; + int count_424 = 0; + int datetime_428 = g_datetime_916; + int li_432 = g_datetime_916 + gi_544; + int datetime_436 = g_datetime_920; + int li_440 = g_datetime_920 + gi_652; + int datetime_444 = g_datetime_924; + int li_448 = g_datetime_924 + gi_744; + for (int pos_468 = OrdersTotal() - 1; pos_468 >= 0; pos_468--) { + if (!OrderSelect(pos_468, SELECT_BY_POS, MODE_TRADES)) Print("Error in OrderSelect! Position:", pos_468); + else { + if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { + if (OrderMagicNumber() == Magic1) { + if (OrderType() == OP_BUY) { + if (OrderStopLoss() == 0.0 && Hidden_StopAndTarget == FALSE) { + price_472 = NormalizeDouble(OrderOpenPrice() - li_304 * ld_88, Digits); + price_480 = NormalizeDouble(OrderOpenPrice() + li_300 * ld_88, Digits); + OrderModify(OrderTicket(), OrderOpenPrice(), price_472, price_480, 0, Green); + } + if ((f0_22(gi_880, iwpr_188, OSC_close) == 0 && Bid > iclose_172 + gi_476 * ld_88) || Bid >= OrderOpenPrice() + li_300 * ld_88 || Bid <= OrderOpenPrice() - li_304 * ld_88) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), slippage_392, Violet); + Sleep(5000); + } else count_396++; + } else { + if (OrderStopLoss() == 0.0 && Hidden_StopAndTarget == FALSE) { + price_472 = NormalizeDouble(OrderOpenPrice() + li_304 * ld_88, Digits); + price_480 = NormalizeDouble(OrderOpenPrice() - li_300 * ld_88, Digits); + OrderModify(OrderTicket(), OrderOpenPrice(), price_472, price_480, 0, Green); + } + if ((f0_22(gi_880, iwpr_188, OSC_close) == 1 && Bid < iclose_172 - gi_476 * ld_88) || Ask <= OrderOpenPrice() - li_300 * ld_88 || Ask >= OrderOpenPrice() + li_304 * ld_88) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), slippage_392, Violet); + Sleep(5000); + } else count_400++; + } + } + if (OrderMagicNumber() == Magic2) { + if (OrderType() == OP_BUY) { + if (OrderStopLoss() == 0.0 && Hidden_StopAndTarget == FALSE) { + price_488 = NormalizeDouble(OrderOpenPrice() - li_312 * ld_88, Digits); + price_496 = NormalizeDouble(OrderOpenPrice() + li_308 * ld_88, Digits); + OrderModify(OrderTicket(), OrderOpenPrice(), price_488, price_496, 0, Green); + } + if ((f0_24(gi_880, iclose_228, ld_220, ld_212, Break * ld_88) == 0 && TimeCurrent() - OrderOpenTime() > 3600) || Bid >= OrderOpenPrice() + li_308 * ld_88 || Bid <= OrderOpenPrice() - li_312 * ld_88) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), slippage_392, Violet); + Sleep(5000); + } else count_404++; + if (TimeCurrent() >= li_432) { + if (Use_Exp_Trailing_II) { + ld_504 = f0_9(Exp_Trail_Factor_II * ld_88, OrderOpenPrice(), iHigh(NULL, PERIOD_M5, iHighest(NULL, PERIOD_M5, MODE_HIGH, iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + + 1, 0))); + } else ld_504 = iatr_196 * ATRTrailingFactor2; + if (ld_504 > MaxPipsTrailing2 * ld_88) ld_504 = MaxPipsTrailing2 * ld_88; + if (ld_504 < MinPipsTrailing2 * ld_88) ld_504 = MinPipsTrailing2 * ld_88; + if (Bid - OrderOpenPrice() > F_TrailingProfit_II * ld_88 && (!Use_Exp_Trailing_II)) ld_504 = F_Trailing_II * ld_88; + price_512 = NormalizeDouble(Bid - ld_504, Digits); + if (Hidden_StopAndTarget) { + if (TimeCurrent() - OrderOpenTime() > 60 && Bid <= MathMax(OrderOpenPrice() - li_312 * ld_88, iHigh(NULL, PERIOD_M5, iHighest(NULL, PERIOD_M5, MODE_HIGH, iBarShift(NULL, + PERIOD_M5, OrderOpenTime()) + 1, 0)) - ld_504) && iHigh(NULL, PERIOD_M5, iHighest(NULL, PERIOD_M5, MODE_HIGH, iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + 1, 0)) - OrderOpenPrice() > ld_504) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), slippage_392, Violet); + Sleep(5000); + } + } else { + if (Bid - OrderOpenPrice() > ld_504) { + if (OrderStopLoss() <= price_512 - Point) { + bool_68 = OrderModify(OrderTicket(), OrderOpenPrice(), price_512, OrderTakeProfit(), 0, Blue); + if (bool_68) { + datetime_428 = TimeCurrent(); + g_datetime_916 = datetime_428; + } + } + } + } + } + } else { + if (OrderStopLoss() == 0.0 && Hidden_StopAndTarget == FALSE) { + price_488 = NormalizeDouble(OrderOpenPrice() + li_312 * ld_88, Digits); + price_496 = NormalizeDouble(OrderOpenPrice() - li_308 * ld_88, Digits); + OrderModify(OrderTicket(), OrderOpenPrice(), price_488, price_496, 0, Green); + } + if ((f0_24(gi_880, iclose_228, ld_220, ld_212, Break * ld_88) == 1 && TimeCurrent() - OrderOpenTime() > 3600) || Ask <= OrderOpenPrice() - li_308 * ld_88 || Ask >= OrderOpenPrice() + + li_312 * ld_88) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), slippage_392, Violet); + Sleep(5000); + } else count_408++; + if (TimeCurrent() >= li_432) { + if (Use_Exp_Trailing_II) { + ld_504 = f0_16(Exp_Trail_Factor_II * ld_88, OrderOpenPrice(), iLow(NULL, PERIOD_M5, iLowest(NULL, PERIOD_M5, MODE_LOW, iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + + 1, 0)) + Ask - Bid); + } else ld_504 = iatr_196 * ATRTrailingFactor2; + if (ld_504 > MaxPipsTrailing2 * ld_88) ld_504 = MaxPipsTrailing2 * ld_88; + if (ld_504 < MinPipsTrailing2 * ld_88) ld_504 = MinPipsTrailing2 * ld_88; + if (OrderOpenPrice() - Ask > F_TrailingProfit_II * ld_88 && (!Use_Exp_Trailing_II)) ld_504 = F_Trailing_II * ld_88; + price_512 = NormalizeDouble(Ask + ld_504, Digits); + if (Hidden_StopAndTarget) { + if (TimeCurrent() - OrderOpenTime() > 60 && Ask >= Ask - Bid + MathMin(OrderOpenPrice() + li_312 * ld_88, iLow(NULL, PERIOD_M5, iLowest(NULL, PERIOD_M5, MODE_LOW, + iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + 1, 0)) + ld_504) && OrderOpenPrice() - (iLow(NULL, PERIOD_M5, iLowest(NULL, PERIOD_M5, MODE_LOW, iBarShift(NULL, PERIOD_M5, + OrderOpenTime()) + 1, 0)) + Ask - Bid) > ld_504) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), slippage_392, Violet); + Sleep(5000); + } + } else { + if (OrderOpenPrice() - Ask > ld_504) { + if (OrderStopLoss() >= price_512 + Point) { + bool_68 = OrderModify(OrderTicket(), OrderOpenPrice(), price_512, OrderTakeProfit(), 0, Red); + if (bool_68) { + datetime_428 = TimeCurrent(); + g_datetime_916 = datetime_428; + } + } + } + } + } + } + } + if (OrderMagicNumber() == Magic3) { + if (OrderType() == OP_BUY) { + if (OrderStopLoss() == 0.0 && Hidden_StopAndTarget == FALSE) { + price_520 = NormalizeDouble(OrderOpenPrice() - li_320 * ld_88, Digits); + price_528 = NormalizeDouble(OrderOpenPrice() + li_316 * ld_88, Digits); + OrderModify(OrderTicket(), OrderOpenPrice(), price_520, price_528, 0, Green); + } + if (((li_336 <= li_340 && TimeHour(TimeCurrent()) >= li_336 && TimeHour(TimeCurrent()) <= li_340) || (li_336 > li_340 && TimeHour(TimeCurrent()) >= li_336 || TimeHour(TimeCurrent()) <= li_340) && + f0_20(gi_880, ibands_268, ibands_276, gi_684 * ld_88, ihigh_252, ilow_260, gi_680 * ld_88) == 0 && TimeCurrent() - OrderOpenTime() > 7200) || Bid >= OrderOpenPrice() + + li_316 * ld_88 || Bid <= OrderOpenPrice() - li_320 * ld_88) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), slippage_392, Violet); + Sleep(5000); + } else count_412++; + if (TimeCurrent() >= li_440) { + if (Use_Exp_Trailing_III) { + ld_536 = Exp_Trail_Factor_III * ld_88 / MathMax(ld_88, iHigh(NULL, PERIOD_M5, iHighest(NULL, PERIOD_M5, MODE_HIGH, iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + 1, + 0)) - OrderOpenPrice()); + } else ld_536 = iatr_244 * gd_668; + if (ld_536 > MaxPipsTrailing3 * ld_88) ld_536 = MaxPipsTrailing3 * ld_88; + if (ld_536 < MinPipsTrailing3 * ld_88) ld_536 = MinPipsTrailing3 * ld_88; + if (Bid - OrderOpenPrice() > F_TrailingProfit_III * ld_88 && (!Use_Exp_Trailing_III)) ld_536 = F_Trailing_III * ld_88; + price_544 = NormalizeDouble(Bid - ld_536, Digits); + if (Hidden_StopAndTarget) { + if (TimeCurrent() - OrderOpenTime() > 300 && Bid <= MathMax(OrderOpenPrice() - li_320 * ld_88, iHigh(NULL, PERIOD_M5, iHighest(NULL, PERIOD_M5, MODE_HIGH, iBarShift(NULL, + PERIOD_M5, OrderOpenTime()) + 1, 0)) - ld_536) && iHigh(NULL, PERIOD_M5, iHighest(NULL, PERIOD_M5, MODE_HIGH, iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + 1, 0)) - OrderOpenPrice() > ld_536) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), slippage_392, Violet); + Sleep(5000); + } + } else { + if (Bid - OrderOpenPrice() > ld_536) { + if (OrderStopLoss() <= price_544 - Point) { + bool_72 = OrderModify(OrderTicket(), OrderOpenPrice(), price_544, OrderTakeProfit(), 0, Blue); + if (bool_72) { + datetime_436 = TimeCurrent(); + g_datetime_920 = datetime_436; + } + } + } + } + } + } else { + if (OrderStopLoss() == 0.0 && Hidden_StopAndTarget == FALSE) { + price_520 = NormalizeDouble(OrderOpenPrice() + li_320 * ld_88, Digits); + price_528 = NormalizeDouble(OrderOpenPrice() - li_316 * ld_88, Digits); + OrderModify(OrderTicket(), OrderOpenPrice(), price_520, price_528, 0, Green); + } + if (((li_336 <= li_340 && TimeHour(TimeCurrent()) >= li_336 && TimeHour(TimeCurrent()) <= li_340) || (li_336 > li_340 && TimeHour(TimeCurrent()) >= li_336 || TimeHour(TimeCurrent()) <= li_340) && + f0_20(gi_880, ibands_268, ibands_276, gi_684 * ld_88, ihigh_252, ilow_260, gi_680 * ld_88) == 1 && TimeCurrent() - OrderOpenTime() > 7200) || Ask <= OrderOpenPrice() - li_316 * ld_88 || + Ask >= OrderOpenPrice() + li_320 * ld_88) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), slippage_392, Violet); + Sleep(5000); + } else count_416++; + if (TimeCurrent() >= li_440) { + if (Use_Exp_Trailing_III) { + ld_536 = Exp_Trail_Factor_III * ld_88 / MathMax(ld_88, OrderOpenPrice() - (iLow(NULL, PERIOD_M5, iLowest(NULL, PERIOD_M5, MODE_LOW, iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + + 1, 0)) + Ask - Bid)); + } else ld_536 = iatr_244 * gd_668; + if (ld_536 > MaxPipsTrailing3 * ld_88) ld_536 = MaxPipsTrailing3 * ld_88; + if (ld_536 < MinPipsTrailing3 * ld_88) ld_536 = MinPipsTrailing3 * ld_88; + if (OrderOpenPrice() - Ask > F_TrailingProfit_III * ld_88 && (!Use_Exp_Trailing_III)) ld_536 = F_Trailing_III * ld_88; + price_544 = NormalizeDouble(Ask + ld_536, Digits); + if (Hidden_StopAndTarget) { + if (TimeCurrent() - OrderOpenTime() > 300 && Ask >= Ask - Bid + MathMin(OrderOpenPrice() + li_320 * ld_88, iLow(NULL, PERIOD_M5, iLowest(NULL, PERIOD_M5, MODE_LOW, + iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + 1, 0)) + ld_536) && OrderOpenPrice() - (iLow(NULL, PERIOD_M5, iLowest(NULL, PERIOD_M5, MODE_LOW, iBarShift(NULL, PERIOD_M5, + OrderOpenTime()) + 1, 0)) + Ask - Bid) > ld_536) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), slippage_392, Violet); + Sleep(5000); + } + } else { + if (OrderOpenPrice() - Ask > ld_536) { + if (OrderStopLoss() >= price_544 + Point) { + bool_72 = OrderModify(OrderTicket(), OrderOpenPrice(), price_544, OrderTakeProfit(), 0, Red); + if (bool_72) { + datetime_436 = TimeCurrent(); + g_datetime_920 = datetime_436; + } + } + } + } + } + } + } + if (OrderMagicNumber() == Magic4) { + if (OrderType() == OP_BUY) { + if (OrderStopLoss() == 0.0 && Hidden_StopAndTarget == FALSE) { + price_552 = NormalizeDouble(ilow_292 - li_324 * ld_88, Digits); + price_560 = NormalizeDouble(OrderOpenPrice() + (ihigh_284 - ilow_292) * TargetPercent, Digits); + OrderModify(OrderTicket(), OrderOpenPrice(), price_552, price_560, 0, Green); + } + if ((TimeCurrent() - OrderOpenTime() > 300 && f0_15(gi_880, iClose(NULL, ReverseTF, 1), iOpen(NULL, ReverseTF, 1), Bid - OrderOpenPrice(), ExitProfit * ld_88) == 0) || + Bid >= OrderOpenPrice() + (iHigh(NULL, PERIOD_H1, iHighest(NULL, PERIOD_H1, MODE_HIGH, gi_716, iBarShift(NULL, PERIOD_H1, OrderOpenTime()) + 1)) - iLow(NULL, PERIOD_H1, + iLowest(NULL, PERIOD_H1, MODE_LOW, gi_716, iBarShift(NULL, PERIOD_H1, OrderOpenTime()) + 1))) * TargetPercent || Bid <= iLow(NULL, PERIOD_H1, iLowest(NULL, PERIOD_H1, + MODE_LOW, gi_716, iBarShift(NULL, PERIOD_H1, OrderOpenTime()) + 1)) - li_324 * ld_88) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), slippage_392, Violet); + Sleep(5000); + } else count_420++; + if (TimeCurrent() < li_448) continue; + if (Use_Exp_Trailing_IV) { + ld_536 = Exp_Trail_Factor_IV * ld_88 / MathMax(ld_88, iHigh(NULL, PERIOD_M5, iHighest(NULL, PERIOD_M5, MODE_HIGH, iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + 1, + 0)) - OrderOpenPrice()); + } else ld_536 = iatr_244 * gd_756; + if (ld_536 > gi_748 * ld_88) ld_536 = gi_748 * ld_88; + if (ld_536 < gi_752 * ld_88) ld_536 = gi_752 * ld_88; + if (Bid - OrderOpenPrice() > gi_764 * ld_88 && (!Use_Exp_Trailing_IV)) ld_536 = gi_768 * ld_88; + price_544 = NormalizeDouble(Bid - ld_536, Digits); + if (Hidden_StopAndTarget) { + if (!(TimeCurrent() - OrderOpenTime() > 300 && Bid <= MathMax(OrderOpenPrice() - li_324 * ld_88, iHigh(NULL, PERIOD_M5, iHighest(NULL, PERIOD_M5, MODE_HIGH, iBarShift(NULL, + PERIOD_M5, OrderOpenTime()) + 1, 0)) - ld_536) && iHigh(NULL, PERIOD_M5, iHighest(NULL, PERIOD_M5, MODE_HIGH, iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + 1, 0)) - OrderOpenPrice() > ld_536)) continue; + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), slippage_392, Violet); + Sleep(5000); + } else { + if (Bid - OrderOpenPrice() <= ld_536) continue; + if (OrderStopLoss() > price_544 - Point) continue; + bool_76 = OrderModify(OrderTicket(), OrderOpenPrice(), price_544, OrderTakeProfit(), 0, Blue); + if (!(bool_76)) continue; + datetime_444 = TimeCurrent(); + g_datetime_924 = datetime_444; + continue; + } + } + if (OrderStopLoss() == 0.0 && Hidden_StopAndTarget == FALSE) { + price_552 = NormalizeDouble(ihigh_284 + li_324 * ld_88, Digits); + price_560 = NormalizeDouble(OrderOpenPrice() - (ihigh_284 - ilow_292) * TargetPercent, Digits); + OrderModify(OrderTicket(), OrderOpenPrice(), price_552, price_560, 0, Green); + } + if ((TimeCurrent() - OrderOpenTime() > 300 && f0_15(gi_880, iClose(NULL, ReverseTF, 1), iOpen(NULL, ReverseTF, 1), OrderOpenPrice() - Ask, ExitProfit * ld_88) == 1) || + Ask <= OrderOpenPrice() - (iHigh(NULL, PERIOD_H1, iHighest(NULL, PERIOD_H1, MODE_HIGH, gi_716, iBarShift(NULL, PERIOD_H1, OrderOpenTime()) + 1)) - iLow(NULL, PERIOD_H1, + iLowest(NULL, PERIOD_H1, MODE_LOW, gi_716, iBarShift(NULL, PERIOD_H1, OrderOpenTime()) + 1))) * TargetPercent || Ask >= iHigh(NULL, PERIOD_H1, iHighest(NULL, PERIOD_H1, + MODE_HIGH, gi_716, iBarShift(NULL, PERIOD_H1, OrderOpenTime()) + 1)) + li_324 * ld_88) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), slippage_392, Violet); + Sleep(5000); + } else count_424++; + if (TimeCurrent() >= li_448) { + if (Use_Exp_Trailing_IV) { + ld_536 = Exp_Trail_Factor_IV * ld_88 / MathMax(ld_88, OrderOpenPrice() - (iLow(NULL, PERIOD_M5, iLowest(NULL, PERIOD_M5, MODE_LOW, iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + + 1, 0)) + Ask - Bid)); + } else ld_536 = iatr_244 * gd_756; + if (ld_536 > gi_748 * ld_88) ld_536 = gi_748 * ld_88; + if (ld_536 < gi_752 * ld_88) ld_536 = gi_752 * ld_88; + if (OrderOpenPrice() - Ask > F_TrailingProfit_III * ld_88 && (!Use_Exp_Trailing_IV)) ld_536 = gi_768 * ld_88; + price_544 = NormalizeDouble(Ask + ld_536, Digits); + if (Hidden_StopAndTarget) { + if (!(TimeCurrent() - OrderOpenTime() > 300 && Ask >= Ask - Bid + MathMin(OrderOpenPrice() + li_324 * ld_88, iLow(NULL, PERIOD_M5, iLowest(NULL, PERIOD_M5, MODE_LOW, + iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + 1, 0)) + ld_536) && OrderOpenPrice() - (iLow(NULL, PERIOD_M5, iLowest(NULL, PERIOD_M5, MODE_LOW, iBarShift(NULL, PERIOD_M5, + OrderOpenTime()) + 1, 0)) + Ask - Bid) > ld_536)) continue; + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), slippage_392, Violet); + Sleep(5000); + continue; + } + if (OrderOpenPrice() - Ask > ld_536) { + if (OrderStopLoss() >= price_544 + Point) { + bool_76 = OrderModify(OrderTicket(), OrderOpenPrice(), price_544, OrderTakeProfit(), 0, Red); + if (bool_76) { + datetime_444 = TimeCurrent(); + g_datetime_924 = datetime_444; + } + } + } + } + } + } + } + } + double ld_568 = 0; + if (StringSubstr(AccountCurrency(), 0, 3) == "JPY") { + ld_568 = MarketInfo("USDJPY" + StringSubstr(Symbol(), 6), MODE_BID); + if (ld_568 > 0.1) ld_40 = ld_568; + else ld_40 = 84; + } + if (StringSubstr(AccountCurrency(), 0, 3) == "GBP") { + ld_568 = MarketInfo("GBPUSD" + StringSubstr(Symbol(), 6), MODE_BID); + if (ld_568 > 0.1) ld_40 = 1 / ld_568; + else ld_40 = 0.6211180124; + } + if (StringSubstr(AccountCurrency(), 0, 3) == "EUR") { + ld_568 = MarketInfo("EURUSD" + StringSubstr(Symbol(), 6), MODE_BID); + if (ld_568 > 0.1) ld_40 = 1 / ld_568; + else ld_40 = 0.7042253521; + } + if (EMAIL_Notification == TRUE) f0_7(); + bool li_576 = TRUE; + bool li_580 = TRUE; + if (No_Hedge_Trades == TRUE && count_400 > 0 || count_408 > 0 || count_416 > 0 || count_424 > 0) li_576 = FALSE; + if (No_Hedge_Trades == TRUE && count_396 > 0 || count_404 > 0 || count_412 > 0 || count_420 > 0) li_580 = FALSE; + if (NFA_Compatibility == TRUE && count_400 > 0 || count_408 > 0 || count_416 > 0 || count_424 > 0 || count_396 > 0 || count_404 > 0 || count_412 > 0 || count_420 > 0) { + li_576 = FALSE; + li_580 = FALSE; + } + double lots_584 = MathMin(g_maxlot_892, MathMax(g_minlot_884, LotsSys1)); + if (TradeMMSys1 > 0.0) lots_584 = MathMax(g_minlot_884, MathMin(g_maxlot_892, NormalizeDouble(f0_18() / ld_40 / 100.0 * AccountFreeMargin() / g_lotstep_908 / (g_lotsize_904 / 100), 0) * g_lotstep_908)); + if (lots_584 > MaximalLots) lots_584 = MaximalLots; + double lots_592 = MathMin(g_maxlot_892, MathMax(g_minlot_884, LotsSys2)); + if (TradeMMSys2 > 0.0) lots_592 = MathMax(g_minlot_884, MathMin(g_maxlot_892, NormalizeDouble(f0_0() / ld_40 / 100.0 * AccountFreeMargin() / g_lotstep_908 / (g_lotsize_904 / 100), 0) * g_lotstep_908)); + if (lots_592 > MaximalLots) lots_592 = MaximalLots; + double lots_600 = MathMin(g_maxlot_892, MathMax(g_minlot_884, LotsSys3)); + if (TradeMMSys3 > 0.0) lots_600 = MathMax(g_minlot_884, MathMin(g_maxlot_892, NormalizeDouble(f0_13() / ld_40 / 100.0 * AccountFreeMargin() / g_lotstep_908 / (g_lotsize_904 / 100), 0) * g_lotstep_908)); + if (lots_600 > MaximalLots) lots_600 = MaximalLots; + double lots_608 = MathMin(g_maxlot_892, MathMax(g_minlot_884, LotsSys4)); + if (TradeMMSys4 > 0.0) lots_608 = MathMax(g_minlot_884, MathMin(g_maxlot_892, NormalizeDouble(f0_21() / ld_40 / 100.0 * AccountFreeMargin() / g_lotstep_908 / (g_lotsize_904 / 100), 0) * g_lotstep_908)); + if (lots_608 > MaximalLots) lots_608 = MaximalLots; + if (!Use_FXCOMBO_Scalping) lots_584 = 0; + if (!Use_FXCOMBO_Breakout) lots_592 = 0; + if (!Use_FXCOMBO_Reversal) lots_600 = 0; + if (!Use_FXCOMBO_EuroRange) lots_608 = 0; + gs_868 = "\n\n LOTS Sys1 : " + DoubleToStr(lots_584, 2) + + "\n LOTS Sys2 : " + DoubleToStr(lots_592, 2) + + "\n LOTS Sys3 : " + DoubleToStr(lots_600, 2) + + "\n LOTS Sys4 : " + DoubleToStr(lots_608, 2); + int cmd_36 = -1; + if (Use_FXCOMBO_Scalping != FALSE) { + if (count_396 < 1 && li_576 && f0_3(gi_880, iclose_172, ima_180, TREND_STR * ld_88, iwpr_188, OSC_open, gi_488, Hour(), li_328, li_332) == 0 && Bid < iclose_172 - gi_476 * ld_88) { + if (ld_96 > MaxSPREAD) Print("System 1 BUY not taken due to high spead!"); + else { + ls_616 = "BUY"; + cmd_36 = 0; + color_32 = Aqua; + RefreshRates(); + price_0 = NormalizeDouble(Ask, Digits); + price_8 = price_0 - li_304 * ld_88; + price_16 = price_0 + li_300 * ld_88; + } + } + if (count_400 < 1 && li_580 && f0_3(gi_880, iclose_172, ima_180, TREND_STR * ld_88, iwpr_188, OSC_open, gi_488, Hour(), li_328, li_332) == 1 && Bid > iclose_172 + + gi_476 * ld_88) { + if (ld_96 > MaxSPREAD) Print("System 1 SELL not taken due to high spead!"); + else { + ls_616 = "SELL"; + cmd_36 = 1; + color_32 = Red; + RefreshRates(); + price_0 = NormalizeDouble(Bid, Digits); + price_8 = price_0 + li_304 * ld_88; + price_16 = price_0 - li_300 * ld_88; + } + } + } + if (cmd_36 >= OP_BUY && NewsFilterSys1 == FALSE || (NewsFilterSys1 && f0_12())) { + if (li_84 == FALSE) ticket_452 = OrderSend(Symbol(), cmd_36, lots_584, price_0, slippage_392, 0, 0, CommentSys1, Magic1, 0, color_32); + else ticket_452 = OrderSend(Symbol(), cmd_36, lots_584, price_0, slippage_392, price_8, price_16, CommentSys1, Magic1, 0, color_32); + Sleep(5000); + if (ticket_452 > 0) { + if (OrderSelect(ticket_452, SELECT_BY_TICKET, MODE_TRADES)) Print("Order " + ls_616 + " opened!: ", OrderOpenPrice()); + } else Print("Error opening " + ls_616 + " order!: ", GetLastError()); + } else { + if (cmd_36 >= OP_BUY && NewsFilterSys1 && g_datetime_928 != iTime(NULL, PERIOD_M5, 1)) { + g_datetime_928 = iTime(NULL, PERIOD_M5, 1); + if (cmd_36 == OP_BUY) Print("BUY skipped: " + gs_844); + else Print("SELL skipped: " + gs_844); + } + } + cmd_36 = -1; + if (!(TimeHour(TimeCurrent()) != li_344 && TimeHour(TimeCurrent()) != li_348 && TimeHour(TimeCurrent()) != li_352 && TimeHour(TimeCurrent()) != li_356 && TimeHour(TimeCurrent()) != li_360 && + TimeHour(TimeCurrent()) != li_364 && TimeHour(TimeCurrent()) != li_368 && TimeHour(TimeCurrent()) != li_372 && TimeHour(TimeCurrent()) != li_376 && TimeHour(TimeCurrent()) != li_380 && TimeHour(TimeCurrent()) != li_384) || + !(TimeHour(TimeCurrent()) != li_388)) { + if (Use_FXCOMBO_Breakout != FALSE) { + if (DayOfWeek() != gi_576) { + if (f0_4()) { + if (count_408 < 1 && li_580 && f0_6(gi_880, iclose_228, ld_220, ld_212, Break * ld_88, Bid, (Break - 3) * ld_88) == 1) { + if (ld_96 > MaxSPREAD) Print("System 2 SELL not taken due to high spead!"); + else { + ls_616 = "SELL"; + cmd_36 = 1; + color_32 = Yellow; + RefreshRates(); + price_0 = NormalizeDouble(Bid, Digits); + price_8 = price_0 + li_312 * ld_88; + price_16 = price_0 - li_308 * ld_88; + } + } + if (count_404 < 1 && li_576 && f0_6(gi_880, iclose_228, ld_220, ld_212, Break * ld_88, Bid, (Break - 3) * ld_88) == 0) { + if (ld_96 > MaxSPREAD) Print("System 2 BUY not taken due to high spead!"); + else { + ls_616 = "BUY"; + cmd_36 = 0; + color_32 = DodgerBlue; + RefreshRates(); + price_0 = NormalizeDouble(Ask, Digits); + price_8 = price_0 - li_312 * ld_88; + price_16 = price_0 + li_308 * ld_88; + } + } + } + } + } + } + if (cmd_36 >= OP_BUY && NewsFilterSys2 == FALSE || (NewsFilterSys2 && f0_12())) { + if (li_84 == FALSE) ticket_456 = OrderSend(Symbol(), cmd_36, lots_592, price_0, slippage_392, 0, 0, CommentSys2, Magic2, 0, color_32); + else ticket_456 = OrderSend(Symbol(), cmd_36, lots_592, price_0, slippage_392, price_8, price_16, CommentSys2, Magic2, 0, color_32); + Sleep(5000); + if (ticket_456 > 0) { + if (OrderSelect(ticket_456, SELECT_BY_TICKET, MODE_TRADES)) Print("Order " + ls_616 + " opened!: ", OrderOpenPrice()); + } else Print("Error opening " + ls_616 + " order!: ", GetLastError()); + } else { + if (cmd_36 >= OP_BUY && NewsFilterSys2 && g_datetime_928 != iTime(NULL, PERIOD_M5, 1)) { + g_datetime_928 = iTime(NULL, PERIOD_M5, 1); + if (cmd_36 == OP_BUY) Print("BUY skipped: " + gs_844); + else Print("SELL skipped: " + gs_844); + } + } + cmd_36 = -1; + if (Use_FXCOMBO_Reversal != FALSE) { + if (count_412 < 1 && li_576 && (li_336 <= li_340 && TimeHour(TimeCurrent()) >= li_336 && TimeHour(TimeCurrent()) <= li_340) || (li_336 > li_340 && TimeHour(TimeCurrent()) >= li_336 || + TimeHour(TimeCurrent()) <= li_340) && f0_14(gi_880, ibands_268, ibands_276, gi_684 * ld_88, ihigh_252, ilow_260, gi_680 * ld_88) == 0) { + if (ld_96 > MaxSPREAD) Print("System 3 BUY not taken due to high spead!"); + else { + ls_616 = "BUY"; + cmd_36 = 0; + color_32 = Aqua; + RefreshRates(); + price_0 = NormalizeDouble(Ask, Digits); + price_8 = price_0 - li_320 * ld_88; + price_16 = price_0 + li_316 * ld_88; + } + } + if (count_416 < 1 && li_580 && (li_336 <= li_340 && TimeHour(TimeCurrent()) >= li_336 && TimeHour(TimeCurrent()) <= li_340) || (li_336 > li_340 && TimeHour(TimeCurrent()) >= li_336 || + TimeHour(TimeCurrent()) <= li_340) && f0_14(gi_880, ibands_268, ibands_276, gi_684 * ld_88, ihigh_252, ilow_260, gi_680 * ld_88) == 1) { + if (ld_96 > MaxSPREAD) Print("System 3 SELL not taken due to high spead!"); + else { + ls_616 = "SELL"; + cmd_36 = 1; + color_32 = DeepPink; + RefreshRates(); + price_0 = NormalizeDouble(Bid, Digits); + price_8 = price_0 + li_320 * ld_88; + price_16 = price_0 - li_316 * ld_88; + } + } + } + if (cmd_36 >= OP_BUY && NewsFilterSys3 == FALSE || (NewsFilterSys3 && f0_12())) { + if (li_84 == FALSE) ticket_460 = OrderSend(Symbol(), cmd_36, lots_600, price_0, slippage_392, 0, 0, CommentSys3, Magic3, 0, color_32); + else ticket_460 = OrderSend(Symbol(), cmd_36, lots_600, price_0, slippage_392, price_8, price_16, CommentSys3, Magic3, 0, color_32); + Sleep(5000); + if (ticket_460 > 0) { + if (OrderSelect(ticket_460, SELECT_BY_TICKET, MODE_TRADES)) Print("Order " + ls_616 + " opened!: ", OrderOpenPrice()); + } else Print("Error opening " + ls_616 + " order!: ", GetLastError()); + } else { + if (cmd_36 >= OP_BUY && NewsFilterSys3 && g_datetime_928 != iTime(NULL, PERIOD_M5, 1)) { + g_datetime_928 = iTime(NULL, PERIOD_M5, 1); + if (cmd_36 == OP_BUY) Print("BUY skipped: " + gs_844); + else Print("SELL skipped: " + gs_844); + } + } + cmd_36 = -1; + if (Use_FXCOMBO_EuroRange != FALSE) { + if (count_420 < 1 && li_576 && f0_5(gi_880, gi_876, Hour(), Minute(), iOpen(NULL, PERIOD_M5, 0), ilow_292, ihigh_284, BreakPips * ld_88, gi_720 * ld_88, MaxRangePips * ld_88) == 0) { + if (ld_96 > MaxSPREAD) Print("System 4 BUY not taken due to high spead!"); + else { + ls_616 = "BUY"; + cmd_36 = 0; + color_32 = Aqua; + RefreshRates(); + price_0 = NormalizeDouble(Ask, Digits); + price_8 = NormalizeDouble(ilow_292 - li_324 * ld_88, Digits); + price_16 = NormalizeDouble(Ask + (ihigh_284 - ilow_292) * TargetPercent, Digits); + } + } + if (count_424 < 1 && li_580 && f0_5(gi_880, gi_876, Hour(), Minute(), iOpen(NULL, PERIOD_M5, 0), ilow_292, ihigh_284, BreakPips * ld_88, gi_720 * ld_88, MaxRangePips * ld_88) == 1) { + if (ld_96 > MaxSPREAD) Print("System 3 SELL not taken due to high spead!"); + else { + ls_616 = "SELL"; + cmd_36 = 1; + color_32 = DeepPink; + RefreshRates(); + price_0 = NormalizeDouble(Bid, Digits); + price_8 = NormalizeDouble(ihigh_284 + li_324 * ld_88, Digits); + price_16 = NormalizeDouble(Bid - (ihigh_284 - ilow_292) * TargetPercent, Digits); + } + } + } + if (cmd_36 >= OP_BUY && NewsFilterSys4 == FALSE || (NewsFilterSys4 && f0_12())) { + if (li_84 == FALSE) ticket_464 = OrderSend(Symbol(), cmd_36, lots_608, price_0, slippage_392, 0, 0, CommentSys4, Magic4, 0, color_32); + else ticket_464 = OrderSend(Symbol(), cmd_36, lots_608, price_0, slippage_392, price_8, price_16, CommentSys4, Magic4, 0, color_32); + Sleep(5000); + if (ticket_464 > 0) { + if (OrderSelect(ticket_464, SELECT_BY_TICKET, MODE_TRADES)) Print("Order " + ls_616 + " opened!: ", OrderOpenPrice()); + } else Print("Error opening " + ls_616 + " order!: ", GetLastError()); + } else { + if (cmd_36 >= OP_BUY && NewsFilterSys4 && g_datetime_928 != iTime(NULL, PERIOD_M5, 1)) { + g_datetime_928 = iTime(NULL, PERIOD_M5, 1); + if (cmd_36 == OP_BUY) Print("BUY skipped: " + gs_844); + else Print("SELL skipped: " + gs_844); + } + } + return (0); +} + +// D02E3467D6EE65679474EA510952586A +double f0_18() { + int li_8; + double ld_16; + double ld_ret_0 = TradeMMSys1; + int li_12 = 0; + if (Digits <= 3) ld_16 = 0.01; + else ld_16 = 0.0001; + for (int hist_total_24 = OrdersHistoryTotal(); hist_total_24 >= 0; hist_total_24--) { + if (OrderSelect(hist_total_24, SELECT_BY_POS, MODE_HISTORY)) { + if (OrderType() <= OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == Magic1) { + if (OrderProfit() > 0.0) { + if (gi_280 == 0) break; + if (MathAbs(OrderClosePrice() - OrderOpenPrice()) / ld_16 > gi_280) break; + continue; + } + li_12++; + } + } + } + if (li_12 > gi_272 && gi_276 > 1) { + li_8 = MathMod(li_12, gi_276); + ld_ret_0 *= MathPow(LossFactorSys1, li_8); + } + if (MMMax > 0.0 && ld_ret_0 > MMMax) ld_ret_0 = MMMax; + return (ld_ret_0); +} + +// 1426E1C9819471BC17C98E7E2C7DD408 +double f0_0() { + int li_8; + double ld_16; + double ld_ret_0 = TradeMMSys2; + int li_12 = 0; + if (Digits <= 3) ld_16 = 0.01; + else ld_16 = 0.0001; + for (int hist_total_24 = OrdersHistoryTotal(); hist_total_24 >= 0; hist_total_24--) { + if (OrderSelect(hist_total_24, SELECT_BY_POS, MODE_HISTORY)) { + if (OrderType() <= OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == Magic2) { + if (OrderProfit() > 0.0) { + if (gi_324 == 0) break; + if (MathAbs(OrderClosePrice() - OrderOpenPrice()) / ld_16 > gi_324) break; + continue; + } + li_12++; + } + } + } + if (li_12 > gi_316 && gi_320 > 1) { + li_8 = MathMod(li_12, gi_320); + ld_ret_0 *= MathPow(LossFactorSys2, li_8); + } + if (MMMax > 0.0 && ld_ret_0 > MMMax) ld_ret_0 = MMMax; + return (ld_ret_0); +} + +// 83F4D115D503A4449CBA89CBA1C83522 +double f0_13() { + int li_8; + double ld_16; + double ld_ret_0 = TradeMMSys3; + int li_12 = 0; + if (Digits <= 3) ld_16 = 0.01; + else ld_16 = 0.0001; + for (int hist_total_24 = OrdersHistoryTotal(); hist_total_24 >= 0; hist_total_24--) { + if (OrderSelect(hist_total_24, SELECT_BY_POS, MODE_HISTORY)) { + if (OrderType() <= OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == Magic3) { + if (OrderProfit() > 0.0) { + if (gi_368 == 0) break; + if (MathAbs(OrderClosePrice() - OrderOpenPrice()) / ld_16 > gi_368) break; + continue; + } + li_12++; + } + } + } + if (li_12 > gi_360 && gi_364 > 1) { + li_8 = MathMod(li_12, gi_364); + ld_ret_0 *= MathPow(LossFactorSys3, li_8); + } + if (MMMax > 0.0 && ld_ret_0 > MMMax) ld_ret_0 = MMMax; + return (ld_ret_0); +} + +// D641B0C57C7A54EBE0F39CE9DC45E7CA +double f0_21() { + int li_8; + double ld_16; + double ld_ret_0 = TradeMMSys4; + int li_12 = 0; + if (Digits <= 3) ld_16 = 0.01; + else ld_16 = 0.0001; + for (int hist_total_24 = OrdersHistoryTotal(); hist_total_24 >= 0; hist_total_24--) { + if (OrderSelect(hist_total_24, SELECT_BY_POS, MODE_HISTORY)) { + if (OrderType() <= OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == Magic4) { + if (OrderProfit() > 0.0) { + if (gi_412 == 0) break; + if (MathAbs(OrderClosePrice() - OrderOpenPrice()) / ld_16 > gi_412) break; + continue; + } + li_12++; + } + } + } + if (li_12 > gi_404 && gi_408 > 1) { + li_8 = MathMod(li_12, gi_408); + ld_ret_0 *= MathPow(LossFactorSys4, li_8); + } + if (MMMax > 0.0 && ld_ret_0 > MMMax) ld_ret_0 = MMMax; + return (ld_ret_0); +} + +// 1BBC94D06E1F0D3B9CFC87C094EBA75D +int f0_1(bool ai_0) { + string ls_4; + if (gi_932 == 0) { + ls_4 = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)"; + gi_932 = InternetOpenA(ls_4, gi_940, "0", "0", 0); + gi_936 = InternetOpenA(ls_4, gi_944, "0", "0", 0); + } + if (ai_0) return (gi_936); + return (gi_932); +} + +// 67B5F51F6CCDE3F6F9D86EE70C3F4037 +int f0_11(string as_0, string &as_8) { + int lia_24[] = {1}; + string ls_28 = "x"; + int li_16 = InternetOpenUrlA(f0_1(0), as_0, "0", 0, -2080374528, 0); + if (li_16 == 0) return (0); + int li_20 = InternetReadFile(li_16, ls_28, gi_952, lia_24); + if (li_20 == 0) return (0); + int li_36 = lia_24[0]; + for (as_8 = StringSubstr(ls_28, 0, lia_24[0]); lia_24[0] != 0; as_8 = as_8 + StringSubstr(ls_28, 0, lia_24[0])) { + li_20 = InternetReadFile(li_16, ls_28, gi_952, lia_24); + if (lia_24[0] == 0) break; + li_36 += lia_24[0]; + } + li_20 = InternetCloseHandle(li_16); + if (li_20 == 0) return (0); + return (1); +} + +// 52600E5BE768512CC215866649A5EEE8 +string f0_10(string as_0, int ai_8, string as_12, string as_20, int &ai_28) { + int li_40; + string ls_ret_32 = ""; + ai_28 = StringFind(as_0, as_12, ai_8); + if (ai_28 != -1) { + ai_28 += StringLen(as_12); + li_40 = StringFind(as_0, as_20, ai_28 + 1); + ls_ret_32 = StringTrimLeft(StringTrimRight(StringSubstr(as_0, ai_28, li_40 - ai_28))); + } + return (ls_ret_32); +} + +// 2ECDE036AF96C414B28F3D71FF3E5C89 +bool f0_4() { + double ld_4; + int datetime_12; + bool li_ret_0 = TRUE; + if (Digits <= 3) ld_4 = 0.01; + else ld_4 = 0.0001; + if (gi_568 > 0 && gi_572 > 0) { + datetime_12 = 0; + for (int pos_16 = OrdersHistoryTotal() - 1; pos_16 >= 0; pos_16--) { + if (OrderSelect(pos_16, SELECT_BY_POS, MODE_HISTORY)) { + if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic2) { + if (!((OrderType() == OP_BUY && (OrderClosePrice() - OrderOpenPrice()) / ld_4 <= (-gi_568)) || (OrderType() == OP_SELL && (OrderOpenPrice() - OrderClosePrice()) / ld_4 <= (-gi_568)))) break; + datetime_12 = OrderCloseTime(); + break; + } + } + } + if (TimeCurrent() - datetime_12 < 60 * gi_572) li_ret_0 = FALSE; + } + return (li_ret_0); +} + +// 4562D26A98BEC98E7F1F6ECD0D270191 +void f0_7() { + string ls_0; + string ls_8; + bool li_16 = FALSE; + if (IsTesting() || EMAIL_Notification == FALSE) return; + if (g_datetime_956 == 0) { + g_datetime_956 = TimeCurrent(); + return; + } + if (g_datetime_956 != TimeCurrent()) { + for (int pos_20 = 0; pos_20 <= OrdersTotal() - 1; pos_20++) { + if (OrderSelect(pos_20, SELECT_BY_POS, MODE_TRADES)) { + if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { + ls_0 = ""; + ls_8 = ""; + if (OrderOpenTime() >= g_datetime_956) { + if (OrderMagicNumber() == Magic1) ls_0 = "FX COMBO - System 1"; + else { + if (OrderMagicNumber() == Magic2) ls_0 = "FX COMBO - System 2"; + else { + if (OrderMagicNumber() == Magic3) ls_0 = "FX COMBO - System 3"; + else + if (OrderMagicNumber() == Magic4) ls_0 = "FX COMBO - System 4"; + } + } + } + if (StringLen(ls_0) > 1) { + if (OrderType() == OP_BUY) ls_8 = "Buy"; + else ls_8 = "Sell"; + ls_8 = ls_8 + " order (" + OrderTicket() + ") is opened: " + DoubleToStr(OrderOpenPrice(), Digits) + ", SL:" + DoubleToStr(OrderStopLoss(), Digits) + ", TP:" + DoubleToStr(OrderTakeProfit(), + Digits); + li_16 = TRUE; + SendMail(ls_0, ls_8); + } + } + } + } + for (pos_20 = OrdersHistoryTotal() - 1; pos_20 >= 0; pos_20--) { + if (OrderSelect(pos_20, SELECT_BY_POS, MODE_HISTORY)) { + if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { + if (OrderCloseTime() <= g_datetime_956) break; + ls_0 = ""; + ls_8 = ""; + if (OrderMagicNumber() == Magic1) ls_0 = "FX COMBO - System 1"; + else { + if (OrderMagicNumber() == Magic2) ls_0 = "FX COMBO - System 2"; + else { + if (OrderMagicNumber() == Magic3) ls_0 = "FX COMBO - System 3"; + else + if (OrderMagicNumber() == Magic4) ls_0 = "FX COMBO - System 4"; + } + } + if (StringLen(ls_0) > 1) { + if (OrderType() == OP_BUY) ls_8 = "Buy"; + else ls_8 = "Sell"; + ls_8 = ls_8 + " order (" + OrderTicket() + ") is closed at " + DoubleToStr(OrderClosePrice(), Digits) + ", result: " + DoubleToStr(OrderProfit(), 2); + li_16 = TRUE; + SendMail(ls_0, ls_8); + } + } + } + } + g_datetime_956 = TimeCurrent(); + if (li_16) Sleep(1000); + } +} + +// E3B8CE68351C84C8B515C82ACBBB0EE6 +int f0_23(int ai_0, int ai_4, int ai_8, int ai_12, int ai_16) { + return (dllInit(ai_0, ai_4, ai_8, ai_12, ai_16)); +} + +// 29DAC705E91697557643EA4C711D8B68 +int f0_3(int ai_0, double ad_4, double ad_12, double ad_20, double ad_28, double ad_36, double ad_44, int ai_52, int ai_56, int ai_60) { + return (dllOpenCond1(ai_0, ad_4, ad_12, ad_20, ad_28, ad_36, ad_44, ai_52, ai_56, ai_60)); +} + +// D9202589407AB6642667D56EE84254EA +int f0_22(int ai_0, double ad_4, double ad_12) { + return (dllCloseCond1(ai_0, ad_4, ad_12)); +} + +// 44567E69B823BB26B6869904454BF05C +int f0_6(int ai_0, double ad_4, double ad_12, double ad_20, double ad_28, double ad_36, double ad_44) { + return (dllOpenCond2(ai_0, ad_4, ad_12, ad_20, ad_28, ad_36, ad_44)); +} + +// EEF41F888AA1DBD8510C8683BC48D7AD +int f0_24(int ai_0, double ad_4, double ad_12, double ad_20, double ad_28) { + return (dllCloseCond2(ai_0, ad_4, ad_12, ad_20, ad_28)); +} + +// 92A3FDDEEEC551F0BD51E1CA298C5AD1 +int f0_14(int ai_0, double ad_4, double ad_12, double ad_20, double ad_28, double ad_36, double ad_44) { + return (dllOpenCond3(ai_0, ad_4, ad_12, ad_20, ad_28, ad_36, ad_44)); +} + +// D46589441045E3AD992FFC65BB286757 +int f0_20(int ai_0, double ad_4, double ad_12, double ad_20, double ad_28, double ad_36, double ad_44) { + return (dllCloseCond3(ai_0, ad_4, ad_12, ad_20, ad_28, ad_36, ad_44)); +} + +// 3B7B45F7BE75FFD320F254B07E5B03F8 +int f0_5(int ai_0, int ai_4, int ai_8, int ai_12, double ad_16, double ad_24, double ad_32, double ad_40, double ad_48, double ad_56) { + return (dllOpenCond4(ai_0, ai_4, ai_8, ai_12, ad_16, ad_24, ad_32, ad_40, ad_48, ad_56)); +} + +// A3F60245633C3C27AC5CFCF739CC878C +int f0_15(int ai_0, double ad_4, double ad_12, double ad_20, double ad_28) { + return (dllCloseCond4(ai_0, ad_4, ad_12, ad_20, ad_28)); +} + +// D2144D62ECAE784A90B5A1507B3470E5 +void f0_19(int &ai_0, int &ai_4) { + ai_0 = dllParamInit1(1); + ai_4 = dllParamInit1(2); +} + +// 4EC5637CC867CE5029614AE3D5C0250E +void f0_8(int &ai_0, int &ai_4, int &ai_8, int &ai_12, int &ai_16, int &ai_20, int &ai_24, int &ai_28, int &ai_32, int &ai_36, int &ai_40, int &ai_44) { + ai_0 = dllParamInit2(1); + ai_4 = dllParamInit2(2); + ai_8 = dllParamInit2(3); + ai_12 = dllParamInit2(4); + ai_16 = dllParamInit2(5); + ai_20 = dllParamInit2(6); + ai_24 = dllParamInit2(7); + ai_28 = dllParamInit2(8); + ai_32 = dllParamInit2(9); + ai_36 = dllParamInit2(10); + ai_40 = dllParamInit2(11); + ai_44 = dllParamInit2(12); +} + +// 4FDB54BD385BA8F60BAEB409EB093F11 +double f0_9(double ad_0, double ad_8, double ad_16) { + return (dllExpTrailLong(ad_0, ad_8, ad_16)); +} + +// B16077AEC05278814CF99921982899CE +double f0_16(double ad_0, double ad_8, double ad_16) { + return (dllExpTrailShort(ad_0, ad_8, ad_16)); +} + +// B95D831F7DC28FD0740EAF9E89023C16 +int f0_17() { + return (dllGMTOffset()); +} + +// 1C73977C8A2A8C537EB65C934BBA7E7B +void f0_2() { + int file_0; + int li_8; + int li_12; + string ls_16; + string ls_24; + bool li_32; + string ls_44; + string ls_52; + string ls_60; + string ls_68; + string ls_76; + string ls_84; + string ls_92; + int li_100; + string name_104; + string ls_112; + string ls_120; + bool li_128; + int li_132; + int li_136; + int li_140; + int li_144; + string ls_152; + int li_160; + gs_828 = ""; + if (NewsFilterSys1 == FALSE && NewsFilterSys2 == FALSE && NewsFilterSys3 == FALSE && NewsFilterSys4 == FALSE) { + gs_828 = "News Filter - OFF"; + return; + } + gs_836 = ""; + if (NewsFilterSys1) { + gs_836 = gs_836 + + "\n News Filter System 1: ENABLED "; + } else { + gs_836 = gs_836 + + "\n News Filter System 1: DISABLED "; + } + if (NewsFilterSys2) { + gs_836 = gs_836 + + "\n News Filter System 2: ENABLED "; + } else { + gs_836 = gs_836 + + "\n News Filter System 2: DISABLED "; + } + if (NewsFilterSys3) { + gs_836 = gs_836 + + "\n News Filter System 3: ENABLED "; + } else { + gs_836 = gs_836 + + "\n News Filter System 3: DISABLED "; + } + if (NewsFilterSys4) { + gs_836 = gs_836 + + "\n News Filter System 4: ENABLED "; + } else { + gs_836 = gs_836 + + "\n News Filter System 4: DISABLED "; + } + gs_828 = "News Filter - No Important News"; + if (MathAbs(TimeCurrent() - g_datetime_852) >= 86400.0 || TimeDay(TimeCurrent()) != TimeDay(g_datetime_852)) { + name_104 = "forex_combo_system_current_news.csv"; + ls_112 = "http://www.forex-combo.com/calendar.php?all=0"; + g_datetime_852 = TimeCurrent(); + if (IsTesting()) { + name_104 = "forex_combo_system_history_news.csv"; + ls_112 = "http://www.forex-combo.com/calendar.php?all=1"; + } + ls_112 = ls_112 + "&AccountId=" + DoubleToStr(AccountNumber(), 0) + "&AccountType="; + if (IsDemo()) ls_112 = ls_112 + "1"; + else ls_112 = ls_112 + "2"; + li_32 = TRUE; + for (int li_4 = 1; li_4 <= 3; li_4++) { + file_0 = FileOpen(name_104, FILE_CSV|FILE_READ, ';'); + if (file_0 >= 0) break; + Sleep(1000); + } + if (file_0 >= 0) { + while (!FileIsEnding(file_0)) { + for (string ls_36 = FileReadString(file_0); !FileIsEnding(file_0); ls_36 = FileReadString(file_0)) + if (StringLen(ls_36) == 10 && StringFind(ls_36, ".") == 4) break; + ls_44 = FileReadString(file_0); + if (StringLen(ls_44) != 5 || StringFind(ls_44, ":") != 2) continue; + ls_52 = FileReadString(file_0); + ls_60 = FileReadString(file_0); + ls_68 = FileReadString(file_0); + ls_76 = FileReadString(file_0); + ls_84 = FileReadString(file_0); + ls_92 = FileReadString(file_0); + if (StringLen(ls_36) > 0 && StringLen(ls_44) > 0) { + li_100 = StrToTime(ls_36 + " " + ls_44) + 3600 * gi_876; + if ((IsTesting() && li_100 >= TimeCurrent() - 86400) || (!IsTesting() && li_100 >= TimeCurrent() + 86400) || (!IsTesting() && Day() >= 5 && li_100 - 3600 * gi_876 > iTime(NULL, + PERIOD_D1, 0))) { + li_32 = FALSE; + break; + } + } + } + FileClose(file_0); + if (li_32) FileDelete(name_104); + } + if (li_32) { + li_12 = 0; + for (li_4 = 1; li_4 <= 3; li_4++) { + file_0 = FileOpen(name_104, FILE_CSV|FILE_WRITE, ';'); + if (file_0 >= 0) break; + Sleep(1000); + } + if (file_0 >= 0) { + ls_120 = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)"; + li_128 = FALSE; + li_144 = 120; + int lia_148[] = {1}; + ls_152 = " "; + ls_16 = ""; + for (li_4 = 1; li_4 <= 3; li_4++) { + li_132 = InternetOpenA(ls_120, li_128, "0", "0", 0); + if (li_132 != 0) break; + Sleep(1000); + } + if (li_132 != 0) { + for (li_4 = 1; li_4 <= 3; li_4++) { + li_136 = InternetOpenUrlA(li_132, ls_112, "0", 0, -2080374528, 0); + if (li_136 != 0) break; + Sleep(1000); + } + if (li_136 != 0) { + li_140 = InternetReadFile(li_136, ls_152, li_144, lia_148); + if (li_140 != 0) { + ls_16 = StringSubstr(ls_152, 0, lia_148[0]); + while (lia_148[0] != 0) { + li_140 = InternetReadFile(li_136, ls_152, li_144, lia_148); + if (lia_148[0] == 0) break; + ls_16 = ls_16 + StringSubstr(ls_152, 0, lia_148[0]); + li_12 += lia_148[0]; + while (true) { + li_8 = -1; + for (li_4 = 0; li_4 < StringLen(ls_16); li_4++) { + li_160 = StringGetChar(ls_16, li_4); + if (li_160 == 10 || li_160 == 13) { + li_8 = li_4; + break; + } + } + if (li_8 < 0) break; + if (li_8 > 0) { + ls_24 = StringSubstr(ls_16, 0, li_8); + FileWrite(file_0, ls_24); + } + ls_16 = StringSubstr(ls_16, li_8 + 1); + } + } + if (StringLen(ls_16) > 0) FileWrite(file_0, ls_16); + ls_16 = ""; + } + InternetCloseHandle(li_136); + } + InternetCloseHandle(li_132); + } + FileClose(file_0); + } + if (li_12 <= 10) { + Alert("Can\'t download " + name_104 + ". News Filter was turned OFF"); + if (IsTesting()) Print("Can\'t download " + name_104 + ". News Filter was turned OFF"); + Sleep(5000); + } else Print("Downloaded " + DoubleToStr(li_12, 0) + " bytes (" + name_104 + ")"); + } + g_index_960 = 0; + for (li_4 = 1; li_4 <= 3; li_4++) { + file_0 = FileOpen(name_104, FILE_CSV|FILE_READ, ';'); + if (file_0 >= 0) break; + Sleep(1000); + } + if (file_0 < 0) { + Alert("Can\'t open " + name_104 + ". Error code: ", GetLastError()); + if (IsTesting()) Print("Can\'t open " + name_104 + ". Error code: ", GetLastError()); + Sleep(5000); + } else { + while (!FileIsEnding(file_0)) { + for (ls_36 = FileReadString(file_0); !FileIsEnding(file_0); ls_36 = FileReadString(file_0)) + if (StringLen(ls_36) == 10 && StringFind(ls_36, ".") == 4) break; + ls_44 = FileReadString(file_0); + if (StringLen(ls_44) != 5 || StringFind(ls_44, ":") != 2) continue; + ls_52 = FileReadString(file_0); + ls_60 = FileReadString(file_0); + ls_68 = FileReadString(file_0); + ls_76 = FileReadString(file_0); + ls_84 = FileReadString(file_0); + ls_92 = FileReadString(file_0); + if (StringLen(ls_36) > 0 && StringLen(ls_44) > 0) { + li_100 = StrToTime(ls_36 + " " + ls_44) + 3600 * gi_876; + if (li_100 >= TimeCurrent() - 86400 && li_100 <= TimeCurrent() + 86400 && StringFind(Symbol(), ls_52) >= 0 && ls_68 == "3" || (ls_68 == "2" && Include_Medium_News)) { + g_index_960++; + gia_964[g_index_960] = li_100; + gsa_968[g_index_960] = ls_52; + gsa_972[g_index_960] = ls_60; + } + } + } + FileClose(file_0); + } + } + for (li_4 = 1; li_4 <= g_index_960; li_4++) { + if (gia_964[li_4] >= TimeCurrent() && gia_964[li_4] <= TimeCurrent() + 86400 && TimeDay(gia_964[li_4]) == TimeDay(TimeCurrent())) { + gs_828 = TimeToStr(gia_964[li_4], TIME_MINUTES) + " " + gsa_968[li_4] + " News - " + gsa_972[li_4]; + break; + } + } + if (StringLen(gs_828) > 33) gs_828 = StringSubstr(gs_828, 0, 30) + "..."; +} + +// 697A7D88FF8EA0B64CD60B324DDE1103 +int f0_12() { + bool li_ret_0 = TRUE; + if (NewsFilterSys1 || NewsFilterSys2 || NewsFilterSys3 || NewsFilterSys4) { + gs_844 = ""; + for (int li_4 = 1; li_4 <= g_index_960; li_4++) { + if ((gia_964[li_4] < TimeCurrent() && gia_964[li_4] + 60 * Wait_After_News >= TimeCurrent()) || (gia_964[li_4] >= TimeCurrent() && gia_964[li_4] - 60 * Wait_Before_News <= TimeCurrent())) { + gs_844 = TimeToStr(gia_964[li_4], TIME_MINUTES) + " " + gsa_968[li_4] + " News - " + gsa_972[li_4]; + li_ret_0 = FALSE; + break; + } + } + } + return (li_ret_0); +} \ No newline at end of file diff --git a/ForexComboSystem_v5.0(4in1)GBPUSD.mq4 b/ForexComboSystem_v5.0(4in1)GBPUSD.mq4 new file mode 100644 index 0000000..9335ac1 --- /dev/null +++ b/ForexComboSystem_v5.0(4in1)GBPUSD.mq4 @@ -0,0 +1,1551 @@ +#property copyright "http://myfxbook.3dn.ru/" +#property link "http://myfxbook.3dn.ru/" + +#import "wininet.dll" + int InternetOpenA(string a0, int a1, string a2, string a3, int a4); + int InternetOpenUrlA(int a0, string a1, string a2, int a3, int a4, int a5); + int InternetReadFile(int a0, string a1, int a2, int& a3[]); + int InternetCloseHandle(int a0); +#import "FCS500.dll" + int dllInit(int a0, int a1, int a2, int a3, int a4); + int dllOpenCond1(int a0, double a1, double a2, double a3, double a4, double a5, double a6, int a7, int a8, int a9); + int dllCloseCond1(int a0, double a1, double a2); + int dllOpenCond2(int a0, double a1, double a2, double a3, double a4, double a5, double a6); + int dllCloseCond2(int a0, double a1, double a2, double a3, double a4); + int dllOpenCond3(int a0, double a1, double a2, double a3, double a4, double a5, double a6); + int dllCloseCond3(int a0, double a1, double a2, double a3, double a4, double a5, double a6); + int dllOpenCond4(int a0, int a1, int a2, int a3, double a4, double a5, double a6, double a7, double a8, double a9); + int dllCloseCond4(int a0, double a1, double a2, double a3, double a4); + int dllParamInit1(int a0); + int dllParamInit2(int a0); + double dllExpTrailLong(double a0, double a1, double a2); + double dllExpTrailShort(double a0, double a1, double a2); + int dllGMTOffset(); +#import + +//string gs_76 = "http://forex-combo.com/verify4in1.php"; +bool gi_84 = FALSE; +extern string A = "===================="; +extern bool Use_FXCOMBO_Scalping = TRUE; +extern bool Use_FXCOMBO_Breakout = TRUE; +extern bool Use_FXCOMBO_Reversal = TRUE; +extern bool Use_FXCOMBO_EuroRange = TRUE; +extern string B = "===================="; +extern bool Use_ECN_Execution = TRUE; +extern bool Hidden_StopAndTarget = FALSE; +extern bool No_Hedge_Trades = FALSE; +extern bool NFA_Compatibility = FALSE; +extern string C = "===================="; +extern string CommentSys1 = "*** 1 ***"; +extern string CommentSys2 = "*** 2 ***"; +extern string CommentSys3 = "*** 3 ***"; +extern string CommentSys4 = "*** 4 ***"; +extern string D = "===================="; +extern int Magic1 = 111; +extern int Magic2 = 222; +extern int Magic3 = 333; +extern int Magic4 = 444; +extern string E = "===================="; +extern double MaxSPREAD = 4.0; +extern int Slippage = 2; +extern bool AutoGMT_Offset = TRUE; +extern int ManualGMT_Offset = 2; +extern bool Calculate_DST = TRUE; +extern bool UseAgresiveMM = FALSE; +extern bool EMAIL_Notification = FALSE; +extern string MMSys1 = "==== FXCOMBO Scalping MM Parameters ===="; +extern double LotsSys1 = 0.1; +extern double TradeMMSys1 = 0.0; +extern double LossFactorSys1 = 2.0; +int gi_272 = 0; +int gi_276 = 2; +int gi_280 = 0; +extern string MMSys2 = "==== FXCOMBO Breakout MM Parameters ===="; +extern double LotsSys2 = 0.1; +extern double TradeMMSys2 = 0.0; +extern double LossFactorSys2 = 2.0; +int gi_316 = 0; +int gi_320 = 2; +int gi_324 = 0; +extern string MMSys3 = "==== FXCOMBO Reversal MM Parameters ===="; +extern double LotsSys3 = 0.1; +extern double TradeMMSys3 = 0.0; +extern double LossFactorSys3 = 2.0; +int gi_360 = 0; +int gi_364 = 2; +int gi_368 = 0; +extern string MMSys4 = "==== FXCOMBO EuroRange MM Parameters ===="; +extern double LotsSys4 = 0.1; +extern double TradeMMSys4 = 0.0; +extern double LossFactorSys4 = 2.0; +int gi_404 = 0; +int gi_408 = 2; +int gi_412 = 0; +extern string CommonMM = "==== Main MM Parameters ===="; +extern double MMMax = 20.0; +extern double MaximalLots = 50.0; +extern string Scalping = "==== FXCOMBO Scalping System Parameters ===="; +extern int StopLoss = 165; +extern int TakeProfit = 16; +int g_period_456 = 75; +extern int TREND_STR = 34; +int g_period_464 = 13; +extern int OSC_open = 6; +extern int OSC_close = 19; +int gi_476 = -5; +int gi_480 = 22; +int gi_484 = 22; +int gi_488 = 12; +extern string Breakout = "==== FXCOMBO Breakout System Parameters ===="; +extern int TakeProfit_II = 140; +extern int StopLoss_II = 35; +extern int MaxPipsTrailing2 = 200; +extern int MinPipsTrailing2 = 10; +extern int Break = 12; +int g_period_520 = 1; +int g_period_524 = 20; +double gd_528 = 1.25; +extern double ATRTrailingFactor2 = 1.6; +int gi_544 = 60; +extern int F_TrailingProfit_II = 125; +extern int F_Trailing_II = 20; +extern bool Use_Exp_Trailing_II = FALSE; +extern double Exp_Trail_Factor_II = 0.22; +int g_timeframe_568 = PERIOD_M15; +int gi_572 = 30; +int gi_576 = 75; +int gi_580 = 5; +int gi_584 = 19; +int gi_588 = 20; +int gi_592 = 17; +int gi_596 = 5; +int gi_600 = 23; +int gi_604 = 11; +int gi_608 = 13; +int gi_612 = 16; +int gi_616 = 2; +int gi_620 = 1; +int gi_624 = 5; +int gi_628 = 5; +int gi_unused_632 = 5; +int gi_636 = 5; +int gi_640 = 5; +int gi_644 = 5; +extern string Reversal = "==== FXCOMBO Reversal System Parameters ===="; +extern int BegHourSys_III = 23; +extern int EndHourSys_III = 0; +extern int TakeProfit_III = 90; +extern int StopLoss_III = 250; +int gi_672 = 300; +extern int MaxPipsTrailing3 = 300; +extern int MinPipsTrailing3 = 10; +int g_period_684 = 80; +double gd_688 = 17.0; +int g_period_696 = 6; +int gi_700 = -1; +int gi_704 = 25; +extern int F_TrailingProfit_III = 300; +extern int F_Trailing_III = 30; +extern bool Use_Exp_Trailing_III = TRUE; +extern double Exp_Trail_Factor_III = 0.4; +int gi_728 = 1; +int gi_732 = 5; +extern string EuroRange = "==== FXCOMBO EuroRange System Parameters ===="; +int gi_744 = 3; +int gi_748 = 23; +extern int MaxRangePips = 100; +extern int BreakPips = -6; +extern double TargetPercent = 2.1; +extern int StopLoss_IV = 25; +int gi_772 = 300; +int gi_776 = 300; +int gi_780 = 10; +double gd_784 = 100.0; +extern int F_TrailingProfit_IV = 300; +extern int F_Trailing_IV = 30; +extern bool Use_Exp_Trailing_IV = TRUE; +extern double Exp_Trail_Factor_IV = 0.44; +int g_timeframe_812 = PERIOD_M5; +int gi_816 = 60; +extern string NF = "==== News Filter Settings ===="; +extern bool Include_Medium_News = TRUE; +extern int Wait_Before_News = 30; +extern int Wait_After_News = 30; +extern bool NewsFilterSys1 = FALSE; +extern bool NewsFilterSys2 = FALSE; +extern bool NewsFilterSys3 = FALSE; +extern bool NewsFilterSys4 = FALSE; +string gs_856 = ""; +string gs_864 = ""; +string gs_872 = ""; +int g_datetime_880 = 0; +bool gi_884 = TRUE; +string gs_888 = ""; +string gs_896 = ""; +int gi_904 = 0; +int gi_908 = -1; +double g_minlot_912 = 0.0; +double g_maxlot_920 = 0.0; +int g_leverage_928 = 0; +int g_lotsize_932 = 0; +double g_lotstep_936 = 0.0; +int g_datetime_944 = 0; +int g_datetime_948 = 0; +int g_datetime_952 = 0; +int g_datetime_956 = 0; +int gi_960; +int gi_964; +int gi_968 = 0; +int gi_972 = 1; +int gi_unused_976 = 3; +int gi_980 = 13; +int g_datetime_984 = 0; +int g_index_988 = 0; +int gia_992[1000]; +string gsa_996[1000]; +string gsa_1000[1000]; + +// E37F0136AA3FFAF149B351F6A4C948E9 +int init() { + gi_884 = TRUE; + gi_84 = FALSE; + Comment(""); + if (ObjectFind("klc") >= 0) ObjectDelete("klc"); + if (ObjectFind("klc2") >= 0) ObjectDelete("klc2"); + if (ObjectFind("klc3") >= 0) ObjectDelete("klc3"); + return (0); +} + +// 52D46093050F38C27267BCE42543EF60 +int deinit() { + Comment(""); + if (ObjectFind("klc") >= 0) ObjectDelete("klc"); + if (ObjectFind("klc2") >= 0) ObjectDelete("klc2"); + if (ObjectFind("klc3") >= 0) ObjectDelete("klc3"); + return (0); +} + +// EA2B2676C28C0DB26D39331A336C6B92 +int start() { + double price_0; + double price_8; + double price_16; + color color_32; + string ls_48; + int li_56; + string ls_60; + bool bool_68; + bool bool_72; + bool bool_76; + double ld_88; + string ls_104; + int li_120; + int li_292; + int li_296; + int li_300; + int li_304; + int li_308; + int li_312; + int li_316; + int ticket_460; + int ticket_464; + int ticket_468; + int ticket_472; + double price_480; + double price_488; + double price_496; + double price_504; + double ld_512; + double price_520; + double price_528; + double price_536; + double ld_544; + double price_552; + double price_560; + double price_568; + string ls_624; + double ld_40 = 1; + if (gi_884) { + gi_884 = FALSE; + g_minlot_912 = MarketInfo(Symbol(), MODE_MINLOT); + g_maxlot_920 = MarketInfo(Symbol(), MODE_MAXLOT); + g_leverage_928 = AccountLeverage(); + g_lotsize_932 = MarketInfo(Symbol(), MODE_LOTSIZE); + g_lotstep_936 = MarketInfo(Symbol(), MODE_LOTSTEP); + gi_908 = -1; + gs_856 = ""; + gs_864 = ""; + gs_872 = ""; + g_datetime_880 = 0; + } + if ((!IsTesting()) && IsStopped()) return (0); + if ((!IsTesting()) && !IsTradeAllowed()) { + Comment("Trading server: Trading is not Allowed ..."); + return (0); + } + if ((!IsTesting()) && IsTradeContextBusy()) { + Comment("Trading server: Trade Context is Busy ..."); + return (0); + } + if (iATR(NULL, PERIOD_M5, 1, 1) < Point / 2.0) return (0); + if (IsDllsAllowed() == FALSE) { + Comment("Warning: Set Parameter **AllowDLL Imports** ON in menu Tools -> Options -> ExpertAdvisors."); + Print("Warning: Set Parameter **AllowDLL Imports** ON in menu Tools -> Options -> ExpertAdvisors."); + Alert("Warning: Set Parameter **AllowDLL Imports** ON in menu Tools -> Options -> ExpertAdvisors."); + Sleep(30000); + return (0); + } + + gi_84 = TRUE; // to trade - yes;) educated by 4words (WWI) + + /*if ((!gi_84) && !IsTesting()) { + if (IsDemo() == FALSE) ls_60 = "AccountType=2"; + else ls_60 = "AccountType=1"; + if (f0_11(gs_76 + "?AccountId=" + DoubleToStr(AccountNumber(), 0) + "&" + ls_60, ls_48)) { + if (StringTrimRight(StringTrimLeft(f0_10(ls_48, 0, "", "", li_56))) == "OK") gi_84 = TRUE; + else { + Comment("Online validation is not passed. For more information, contact us at support@forex-combo.com!"); + Alert("Online validation is not passed. For more information, contact us at support@forex-combo.com!"); + Sleep(30000); + return (0); + } + } else { + Comment("\n Online validation failed (error number " + DoubleToStr(GetLastError(), 0) + "). Visit www.fxautomater.com for more information!"); + Alert("Online validation failed (error number " + DoubleToStr(GetLastError(), 0) + "). Visit www.fxautomater.com for more information!"); + Sleep(30000); + return (0); + } + }*/ + if (gi_908 <= 0) { + gi_908 = f0_23(AccountNumber(), IsTesting(), IsDemo(), WindowHandle(Symbol(), Period()), TimeCurrent()); + if (IsTesting()) Calculate_DST = FALSE; + if (IsTesting() || AutoGMT_Offset == FALSE) gi_904 = ManualGMT_Offset; + if (!IsTesting() && AutoGMT_Offset == TRUE && Calculate_DST == TRUE && (Month() > 3 && Month() < 11)) gi_904 = f0_17() - 1; + if (!IsTesting() && AutoGMT_Offset == TRUE && Calculate_DST == TRUE && Month() <= 3 || Month() >= 11) gi_904 = f0_17(); + if (!IsTesting() && AutoGMT_Offset == TRUE && Calculate_DST == FALSE) gi_904 = f0_17(); + } + if (gi_908 <= 0 && gi_84 && (!IsTesting())) { + Comment("DLL initialization is failed (" + DoubleToStr(gi_908, 0) + "). For more information, contact us at support@forex-combo.com!"); + Alert("DLL initialization is failed (" + DoubleToStr(gi_908, 0) + "). For more information, contact us at support@forex-combo.com!"); + Sleep(10000); + return (0); + } + if (gi_908 <= 0 && IsTesting()) Print("DLL initialization is failed (" + DoubleToStr(gi_908, 0) + "). Please register you test account at forex-combo.com!"); + int stoplevel_80 = MarketInfo(Symbol(), MODE_STOPLEVEL); + bool li_84 = TRUE; + if (stoplevel_80 == 0 || Use_ECN_Execution == TRUE || Hidden_StopAndTarget == TRUE) li_84 = FALSE; + if (Digits <= 3) ld_88 = 0.01; + else ld_88 = 0.0001; + double ld_96 = NormalizeDouble((Ask - Bid) / ld_88, 1); + if (IsTesting()) Calculate_DST = FALSE; + if (Calculate_DST == TRUE) ls_104 = "YES"; + if (Calculate_DST == FALSE) ls_104 = "NO"; + string ls_112 = "*** SPREAD OK ***"; + if (ld_96 > MaxSPREAD) ls_112 = "*** SPREAD IS TOO HIGH ***"; + if (!IsTesting()) li_120 = f0_17(); + else li_120 = ManualGMT_Offset; + gs_888 = "\n\n Greenwich Mean Time : " + TimeToStr(TimeCurrent() - 3600 * li_120, TIME_DATE|TIME_MINUTES|TIME_SECONDS) + + "\n Broker Time : " + TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS) + + "\n Calculate DST: " + ls_104; + string ls_124 = "FX COMBO is running on your account - Validation OK"; + string ls_132 = "FX COMBO is set up for time zone GMT " + gi_904; + string ls_140 = "Spread= " + DoubleToStr(ld_96, 1) + " pips"; + string ls_148 = "Account Balance= " + DoubleToStr(AccountBalance(), 2); + string ls_156 = ls_112; + string ls_164 = ""; + f0_2(); + if (gs_864 != "") { + ls_164 = "\n" + + gs_864; + } + ls_164 = ls_164 + + "\n\n " + gs_856; + Comment("\n\n\n\n\n " + ls_124 + " \n " + ls_132 + " \n " + ls_140 + " \n " + ls_148 + " \n\n " + ls_156 + " " + gs_888 + " " + gs_896 + ls_164); + ObjectCreate("klc", OBJ_LABEL, 0, 0, 0); + ObjectSetText("klc", " ** FOREX COMBO SYSTEM 4 in 1 **", 9, "System", Red); + ObjectSet("klc", OBJPROP_CORNER, 0); + ObjectSet("klc", OBJPROP_XDISTANCE, 0); + ObjectSet("klc", OBJPROP_YDISTANCE, 29); + ObjectCreate("klc3", OBJ_LABEL, 0, 0, 0); + ObjectSetText("klc3", " Copyright © www.fxautomater.com ", 9, "System", Gray); + ObjectSet("klc3", OBJPROP_CORNER, 0); + ObjectSet("klc3", OBJPROP_XDISTANCE, 0); + ObjectSet("klc3", OBJPROP_YDISTANCE, 45); + if (UseAgresiveMM != TRUE) { + LossFactorSys1 = 1; + LossFactorSys2 = 1; + LossFactorSys3 = 1; + LossFactorSys4 = 1; + } + HideTestIndicators(TRUE); + double iclose_172 = iClose(NULL, PERIOD_M15, 1); + double ima_180 = iMA(NULL, PERIOD_M15, g_period_456, 0, MODE_SMMA, PRICE_CLOSE, 1); + double iwpr_188 = iWPR(NULL, PERIOD_M15, g_period_464, 1); + double iatr_196 = iATR(NULL, PERIOD_H1, g_period_524, 1); + double ima_204 = iMA(NULL, PERIOD_H1, g_period_520, 0, MODE_EMA, PRICE_CLOSE, 1); + double ld_212 = ima_204 + iatr_196 * gd_528; + double ld_220 = ima_204 - iatr_196 * gd_528; + double iclose_228 = iClose(NULL, g_timeframe_568, 1); + double iatr_236 = iATR(NULL, PERIOD_M5, g_period_684, 1); + double ihigh_244 = iHigh(NULL, PERIOD_H1, 1); + double ilow_252 = iLow(NULL, PERIOD_H1, 1); + double ibands_260 = iBands(NULL, PERIOD_H1, g_period_696, 2, 0, PRICE_CLOSE, MODE_UPPER, 1); + double ibands_268 = iBands(NULL, PERIOD_H1, g_period_696, 2, 0, PRICE_CLOSE, MODE_LOWER, 1); + HideTestIndicators(FALSE); + double ihigh_276 = iHigh(NULL, PERIOD_H1, iHighest(NULL, PERIOD_H1, MODE_HIGH, gi_744, 1)); + double ilow_284 = iLow(NULL, PERIOD_H1, iLowest(NULL, PERIOD_H1, MODE_LOW, gi_744, 1)); + if (gi_480 < 0) f0_19(gi_480, gi_484); + if (gi_584 < 0) f0_8(gi_584, gi_588, gi_592, gi_596, gi_600, gi_604, gi_608, gi_612, gi_616, gi_620, gi_624, gi_628); + if (TakeProfit < stoplevel_80 * Point / ld_88) li_292 = stoplevel_80 * Point / ld_88; + else li_292 = TakeProfit; + if (StopLoss < stoplevel_80 * Point / ld_88) li_296 = stoplevel_80 * Point / ld_88; + else li_296 = StopLoss; + if (TakeProfit_II < stoplevel_80 * Point / ld_88) li_300 = stoplevel_80 * Point / ld_88; + else li_300 = TakeProfit_II; + if (StopLoss_II < stoplevel_80 * Point / ld_88) li_304 = stoplevel_80 * Point / ld_88; + else li_304 = StopLoss_II; + if (TakeProfit_III < stoplevel_80 * Point / ld_88) li_308 = stoplevel_80 * Point / ld_88; + else li_308 = TakeProfit_III; + if (StopLoss_III < stoplevel_80 * Point / ld_88) li_312 = stoplevel_80 * Point / ld_88; + else li_312 = StopLoss_III; + if (StopLoss_IV < stoplevel_80 * Point / ld_88) li_316 = stoplevel_80 * Point / ld_88; + else li_316 = StopLoss_IV; + int li_320 = gi_480 + gi_904; + int li_324 = gi_480 + gi_904; + int li_328 = BegHourSys_III + gi_904; + int li_332 = EndHourSys_III + gi_904; + if (li_320 > 23) li_320 -= 24; + if (li_320 < 0) li_320 += 24; + if (li_328 > 23) li_328 -= 24; + if (li_328 < 0) li_328 += 24; + if (li_324 > 23) li_324 -= 24; + if (li_324 < 0) li_324 += 24; + if (li_332 > 23) li_332 -= 24; + if (li_332 < 0) li_332 += 24; + int li_336 = gi_584 + gi_904; + int li_340 = gi_588 + gi_904; + int li_344 = gi_592 + gi_904; + int li_348 = gi_596 + gi_904; + int li_352 = gi_600 + gi_904; + int li_356 = gi_604 + gi_904; + int li_360 = gi_608 + gi_904; + int li_364 = gi_612 + gi_904; + int li_368 = gi_616 + gi_904; + int li_372 = gi_620 + gi_904; + int li_376 = gi_624 + gi_904; + int li_380 = gi_628 + gi_904; + int li_384 = gi_592 + gi_904; + int li_388 = gi_636 + gi_904; + int li_392 = gi_640 + gi_904; + int li_396 = gi_644 + gi_904; + if (li_336 > 23) li_336 -= 24; + if (li_336 < 0) li_336 += 24; + if (li_340 > 23) li_340 -= 24; + if (li_340 < 0) li_340 += 24; + if (li_344 > 23) li_344 -= 24; + if (li_344 < 0) li_344 += 24; + if (li_348 > 23) li_348 -= 24; + if (li_348 < 0) li_348 += 24; + if (li_352 > 23) li_352 -= 24; + if (li_352 < 0) li_352 += 24; + if (li_356 > 23) li_356 -= 24; + if (li_356 < 0) li_356 += 24; + if (li_360 > 23) li_360 -= 24; + if (li_360 < 0) li_360 += 24; + if (li_364 > 23) li_364 -= 24; + if (li_364 < 0) li_364 += 24; + if (li_368 > 23) li_368 -= 24; + if (li_368 < 0) li_368 += 24; + if (li_372 > 23) li_372 -= 24; + if (li_372 < 0) li_372 += 24; + if (li_376 > 23) li_376 -= 24; + if (li_376 < 0) li_376 += 24; + if (li_380 > 23) li_380 -= 24; + if (li_380 < 0) li_380 += 24; + if (li_384 > 23) li_384 -= 24; + if (li_384 < 0) li_384 += 24; + if (li_388 > 23) li_388 -= 24; + if (li_388 < 0) li_388 += 24; + if (li_392 > 23) li_392 -= 24; + if (li_392 < 0) li_392 += 24; + if (li_396 > 23) li_396 -= 24; + if (li_396 < 0) li_396 += 24; + int slippage_400 = Slippage * (ld_88 / Point); + int count_404 = 0; + int count_408 = 0; + int count_412 = 0; + int count_416 = 0; + int count_420 = 0; + int count_424 = 0; + int count_428 = 0; + int count_432 = 0; + int datetime_436 = g_datetime_944; + int li_440 = g_datetime_944 + gi_544; + int datetime_444 = g_datetime_948; + int li_448 = g_datetime_948 + gi_672; + int datetime_452 = g_datetime_952; + int li_456 = g_datetime_952 + gi_772; + for (int pos_476 = OrdersTotal() - 1; pos_476 >= 0; pos_476--) { + if (!OrderSelect(pos_476, SELECT_BY_POS, MODE_TRADES)) Print("Error in OrderSelect! Position:", pos_476); + else { + if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { + if (OrderMagicNumber() == Magic1) { + if (OrderType() == OP_BUY) { + if (OrderStopLoss() == 0.0 && Hidden_StopAndTarget == FALSE) { + price_480 = NormalizeDouble(OrderOpenPrice() - li_296 * ld_88, Digits); + price_488 = NormalizeDouble(OrderOpenPrice() + li_292 * ld_88, Digits); + OrderModify(OrderTicket(), OrderOpenPrice(), price_480, price_488, 0, Green); + } + if ((f0_22(gi_908, iwpr_188, OSC_close) == 0 && Bid > iclose_172 + gi_476 * ld_88) || Bid >= OrderOpenPrice() + li_292 * ld_88 || Bid <= OrderOpenPrice() - li_296 * ld_88) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), slippage_400, Violet); + Sleep(5000); + } else count_404++; + } else { + if (OrderStopLoss() == 0.0 && Hidden_StopAndTarget == FALSE) { + price_480 = NormalizeDouble(OrderOpenPrice() + li_296 * ld_88, Digits); + price_488 = NormalizeDouble(OrderOpenPrice() - li_292 * ld_88, Digits); + OrderModify(OrderTicket(), OrderOpenPrice(), price_480, price_488, 0, Green); + } + if ((f0_22(gi_908, iwpr_188, OSC_close) == 1 && Bid < iclose_172 - gi_476 * ld_88) || Ask <= OrderOpenPrice() - li_292 * ld_88 || Ask >= OrderOpenPrice() + li_296 * ld_88) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), slippage_400, Violet); + Sleep(5000); + } else count_408++; + } + } + if (OrderMagicNumber() == Magic2) { + if (OrderType() == OP_BUY) { + if (OrderStopLoss() == 0.0 && Hidden_StopAndTarget == FALSE) { + price_496 = NormalizeDouble(OrderOpenPrice() - li_304 * ld_88, Digits); + price_504 = NormalizeDouble(OrderOpenPrice() + li_300 * ld_88, Digits); + OrderModify(OrderTicket(), OrderOpenPrice(), price_496, price_504, 0, Green); + } + if ((f0_24(gi_908, iclose_228, ld_220, ld_212, Break * ld_88) == 0 && TimeCurrent() - OrderOpenTime() > 3600) || Bid >= OrderOpenPrice() + li_300 * ld_88 || Bid <= OrderOpenPrice() - li_304 * ld_88) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), slippage_400, Violet); + Sleep(5000); + } else count_412++; + if (TimeCurrent() >= li_440) { + if (Use_Exp_Trailing_II) { + ld_512 = f0_9(Exp_Trail_Factor_II * ld_88, OrderOpenPrice(), iHigh(NULL, PERIOD_M5, iHighest(NULL, PERIOD_M5, MODE_HIGH, iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + + 1, 0))); + } else ld_512 = iatr_196 * ATRTrailingFactor2; + if (ld_512 > MaxPipsTrailing2 * ld_88) ld_512 = MaxPipsTrailing2 * ld_88; + if (ld_512 < MinPipsTrailing2 * ld_88) ld_512 = MinPipsTrailing2 * ld_88; + if (Bid - OrderOpenPrice() > F_TrailingProfit_II * ld_88 && (!Use_Exp_Trailing_II)) ld_512 = F_Trailing_II * ld_88; + price_520 = NormalizeDouble(Bid - ld_512, Digits); + if (Hidden_StopAndTarget) { + if (TimeCurrent() - OrderOpenTime() > 60 && Bid <= MathMax(OrderOpenPrice() - li_304 * ld_88, iHigh(NULL, PERIOD_M5, iHighest(NULL, PERIOD_M5, MODE_HIGH, iBarShift(NULL, + PERIOD_M5, OrderOpenTime()) + 1, 0)) - ld_512) && iHigh(NULL, PERIOD_M5, iHighest(NULL, PERIOD_M5, MODE_HIGH, iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + 1, 0)) - OrderOpenPrice() > ld_512) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), slippage_400, Violet); + Sleep(5000); + } + } else { + if (Bid - OrderOpenPrice() > ld_512) { + if (OrderStopLoss() <= price_520 - Point) { + bool_68 = OrderModify(OrderTicket(), OrderOpenPrice(), price_520, OrderTakeProfit(), 0, Blue); + if (bool_68) { + datetime_436 = TimeCurrent(); + g_datetime_944 = datetime_436; + } + } + } + } + } + } else { + if (OrderStopLoss() == 0.0 && Hidden_StopAndTarget == FALSE) { + price_496 = NormalizeDouble(OrderOpenPrice() + li_304 * ld_88, Digits); + price_504 = NormalizeDouble(OrderOpenPrice() - li_300 * ld_88, Digits); + OrderModify(OrderTicket(), OrderOpenPrice(), price_496, price_504, 0, Green); + } + if ((f0_24(gi_908, iclose_228, ld_220, ld_212, Break * ld_88) == 1 && TimeCurrent() - OrderOpenTime() > 3600) || Ask <= OrderOpenPrice() - li_300 * ld_88 || Ask >= OrderOpenPrice() + + li_304 * ld_88) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), slippage_400, Violet); + Sleep(5000); + } else count_416++; + if (TimeCurrent() >= li_440) { + if (Use_Exp_Trailing_II) { + ld_512 = f0_16(Exp_Trail_Factor_II * ld_88, OrderOpenPrice(), iLow(NULL, PERIOD_M5, iLowest(NULL, PERIOD_M5, MODE_LOW, iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + + 1, 0)) + Ask - Bid); + } else ld_512 = iatr_196 * ATRTrailingFactor2; + if (ld_512 > MaxPipsTrailing2 * ld_88) ld_512 = MaxPipsTrailing2 * ld_88; + if (ld_512 < MinPipsTrailing2 * ld_88) ld_512 = MinPipsTrailing2 * ld_88; + if (OrderOpenPrice() - Ask > F_TrailingProfit_II * ld_88 && (!Use_Exp_Trailing_II)) ld_512 = F_Trailing_II * ld_88; + price_520 = NormalizeDouble(Ask + ld_512, Digits); + if (Hidden_StopAndTarget) { + if (TimeCurrent() - OrderOpenTime() > 60 && Ask >= Ask - Bid + MathMin(OrderOpenPrice() + li_304 * ld_88, iLow(NULL, PERIOD_M5, iLowest(NULL, PERIOD_M5, MODE_LOW, + iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + 1, 0)) + ld_512) && OrderOpenPrice() - (iLow(NULL, PERIOD_M5, iLowest(NULL, PERIOD_M5, MODE_LOW, iBarShift(NULL, PERIOD_M5, + OrderOpenTime()) + 1, 0)) + Ask - Bid) > ld_512) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), slippage_400, Violet); + Sleep(5000); + } + } else { + if (OrderOpenPrice() - Ask > ld_512) { + if (OrderStopLoss() >= price_520 + Point) { + bool_68 = OrderModify(OrderTicket(), OrderOpenPrice(), price_520, OrderTakeProfit(), 0, Red); + if (bool_68) { + datetime_436 = TimeCurrent(); + g_datetime_944 = datetime_436; + } + } + } + } + } + } + } + if (OrderMagicNumber() == Magic3) { + if (OrderType() == OP_BUY) { + if (OrderStopLoss() == 0.0 && Hidden_StopAndTarget == FALSE) { + price_528 = NormalizeDouble(OrderOpenPrice() - li_312 * ld_88, Digits); + price_536 = NormalizeDouble(OrderOpenPrice() + li_308 * ld_88, Digits); + OrderModify(OrderTicket(), OrderOpenPrice(), price_528, price_536, 0, Green); + } + if (((li_328 <= li_332 && TimeHour(TimeCurrent()) >= li_328 && TimeHour(TimeCurrent()) <= li_332) || (li_328 > li_332 && TimeHour(TimeCurrent()) >= li_328 || TimeHour(TimeCurrent()) <= li_332) && + f0_20(gi_908, ibands_260, ibands_268, gi_704 * ld_88, ihigh_244, ilow_252, gi_700 * ld_88) == 0 && TimeCurrent() - OrderOpenTime() > 7200) || Bid >= OrderOpenPrice() + + li_308 * ld_88 || Bid <= OrderOpenPrice() - li_312 * ld_88) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), slippage_400, Violet); + Sleep(5000); + } else count_420++; + if (TimeCurrent() >= li_448) { + if (Use_Exp_Trailing_III) ld_544 = Exp_Trail_Factor_III * ld_88 / (iHigh(NULL, PERIOD_M5, iHighest(NULL, PERIOD_M5, MODE_HIGH, iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + 1, 0)) - OrderOpenPrice()); + else ld_544 = iatr_236 * gd_688; + if (ld_544 > MaxPipsTrailing3 * ld_88) ld_544 = MaxPipsTrailing3 * ld_88; + if (ld_544 < MinPipsTrailing3 * ld_88) ld_544 = MinPipsTrailing3 * ld_88; + if (Bid - OrderOpenPrice() > F_TrailingProfit_III * ld_88 && (!Use_Exp_Trailing_III)) ld_544 = F_Trailing_III * ld_88; + price_552 = NormalizeDouble(Bid - ld_544, Digits); + if (Hidden_StopAndTarget) { + if (TimeCurrent() - OrderOpenTime() > 300 && Bid <= MathMax(OrderOpenPrice() - li_312 * ld_88, iHigh(NULL, PERIOD_M5, iHighest(NULL, PERIOD_M5, MODE_HIGH, iBarShift(NULL, + PERIOD_M5, OrderOpenTime()) + 1, 0)) - ld_544) && iHigh(NULL, PERIOD_M5, iHighest(NULL, PERIOD_M5, MODE_HIGH, iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + 1, 0)) - OrderOpenPrice() > ld_544) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), slippage_400, Violet); + Sleep(5000); + } + } else { + if (Bid - OrderOpenPrice() > ld_544) { + if (OrderStopLoss() <= price_552 - Point) { + bool_72 = OrderModify(OrderTicket(), OrderOpenPrice(), price_552, OrderTakeProfit(), 0, Blue); + if (bool_72) { + datetime_444 = TimeCurrent(); + g_datetime_948 = datetime_444; + } + } + } + } + } + } else { + if (OrderStopLoss() == 0.0 && Hidden_StopAndTarget == FALSE) { + price_528 = NormalizeDouble(OrderOpenPrice() + li_312 * ld_88, Digits); + price_536 = NormalizeDouble(OrderOpenPrice() - li_308 * ld_88, Digits); + OrderModify(OrderTicket(), OrderOpenPrice(), price_528, price_536, 0, Green); + } + if (((li_328 <= li_332 && TimeHour(TimeCurrent()) >= li_328 && TimeHour(TimeCurrent()) <= li_332) || (li_328 > li_332 && TimeHour(TimeCurrent()) >= li_328 || TimeHour(TimeCurrent()) <= li_332) && + f0_20(gi_908, ibands_260, ibands_268, gi_704 * ld_88, ihigh_244, ilow_252, gi_700 * ld_88) == 1 && TimeCurrent() - OrderOpenTime() > 7200) || Ask <= OrderOpenPrice() - li_308 * ld_88 || + Ask >= OrderOpenPrice() + li_312 * ld_88) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), slippage_400, Violet); + Sleep(5000); + } else count_424++; + if (TimeCurrent() >= li_448) { + if (Use_Exp_Trailing_III) { + ld_544 = Exp_Trail_Factor_III * ld_88 / (OrderOpenPrice() - (iLow(NULL, PERIOD_M5, iLowest(NULL, PERIOD_M5, MODE_LOW, iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + + 1, 0)) + Ask - Bid)); + } else ld_544 = iatr_236 * gd_688; + if (ld_544 > MaxPipsTrailing3 * ld_88) ld_544 = MaxPipsTrailing3 * ld_88; + if (ld_544 < MinPipsTrailing3 * ld_88) ld_544 = MinPipsTrailing3 * ld_88; + if (OrderOpenPrice() - Ask > F_TrailingProfit_III * ld_88 && (!Use_Exp_Trailing_III)) ld_544 = F_Trailing_III * ld_88; + price_552 = NormalizeDouble(Ask + ld_544, Digits); + if (Hidden_StopAndTarget) { + if (TimeCurrent() - OrderOpenTime() > 300 && Ask >= Ask - Bid + MathMin(OrderOpenPrice() + li_312 * ld_88, iLow(NULL, PERIOD_M5, iLowest(NULL, PERIOD_M5, MODE_LOW, + iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + 1, 0)) + ld_544) && OrderOpenPrice() - (iLow(NULL, PERIOD_M5, iLowest(NULL, PERIOD_M5, MODE_LOW, iBarShift(NULL, PERIOD_M5, + OrderOpenTime()) + 1, 0)) + Ask - Bid) > ld_544) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), slippage_400, Violet); + Sleep(5000); + } + } else { + if (OrderOpenPrice() - Ask > ld_544) { + if (OrderStopLoss() >= price_552 + Point) { + bool_72 = OrderModify(OrderTicket(), OrderOpenPrice(), price_552, OrderTakeProfit(), 0, Red); + if (bool_72) { + datetime_444 = TimeCurrent(); + g_datetime_948 = datetime_444; + } + } + } + } + } + } + } + if (OrderMagicNumber() == Magic4) { + if (OrderType() == OP_BUY) { + if (OrderStopLoss() == 0.0 && Hidden_StopAndTarget == FALSE) { + price_560 = NormalizeDouble(ilow_284 - li_316 * ld_88, Digits); + price_568 = NormalizeDouble(OrderOpenPrice() + (ihigh_276 - ilow_284) * TargetPercent, Digits); + OrderModify(OrderTicket(), OrderOpenPrice(), price_560, price_568, 0, Green); + } + if ((TimeCurrent() - OrderOpenTime() > 300 && f0_15(gi_908, iClose(NULL, g_timeframe_812, 1), iOpen(NULL, g_timeframe_812, 1), Bid - OrderOpenPrice(), gi_816 * ld_88) == 0) || + Bid >= OrderOpenPrice() + (iHigh(NULL, PERIOD_H1, iHighest(NULL, PERIOD_H1, MODE_HIGH, gi_744, iBarShift(NULL, PERIOD_H1, OrderOpenTime()) + 1)) - iLow(NULL, PERIOD_H1, + iLowest(NULL, PERIOD_H1, MODE_LOW, gi_744, iBarShift(NULL, PERIOD_H1, OrderOpenTime()) + 1))) * TargetPercent || Bid <= iLow(NULL, PERIOD_H1, iLowest(NULL, PERIOD_H1, + MODE_LOW, gi_744, iBarShift(NULL, PERIOD_H1, OrderOpenTime()) + 1)) - li_316 * ld_88) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), slippage_400, Violet); + Sleep(5000); + } else count_428++; + if (TimeCurrent() < li_456) continue; + if (Use_Exp_Trailing_IV) { + ld_544 = Exp_Trail_Factor_IV * ld_88 / MathMax(ld_88, iHigh(NULL, PERIOD_M5, iHighest(NULL, PERIOD_M5, MODE_HIGH, iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + 1, + 0)) - OrderOpenPrice()); + } else ld_544 = iatr_236 * gd_784; + if (ld_544 > gi_776 * ld_88) ld_544 = gi_776 * ld_88; + if (ld_544 < gi_780 * ld_88) ld_544 = gi_780 * ld_88; + if (Bid - OrderOpenPrice() > F_TrailingProfit_IV * ld_88 && (!Use_Exp_Trailing_IV)) ld_544 = F_Trailing_IV * ld_88; + price_552 = NormalizeDouble(Bid - ld_544, Digits); + if (Hidden_StopAndTarget) { + if (!(TimeCurrent() - OrderOpenTime() > 300 && Bid <= MathMax(OrderOpenPrice() - li_316 * ld_88, iHigh(NULL, PERIOD_M5, iHighest(NULL, PERIOD_M5, MODE_HIGH, iBarShift(NULL, + PERIOD_M5, OrderOpenTime()) + 1, 0)) - ld_544) && iHigh(NULL, PERIOD_M5, iHighest(NULL, PERIOD_M5, MODE_HIGH, iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + 1, 0)) - OrderOpenPrice() > ld_544)) continue; + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), slippage_400, Violet); + Sleep(5000); + } else { + if (Bid - OrderOpenPrice() <= ld_544) continue; + if (OrderStopLoss() > price_552 - Point) continue; + bool_76 = OrderModify(OrderTicket(), OrderOpenPrice(), price_552, OrderTakeProfit(), 0, Blue); + if (!(bool_76)) continue; + datetime_452 = TimeCurrent(); + g_datetime_952 = datetime_452; + continue; + } + } + if (OrderStopLoss() == 0.0 && Hidden_StopAndTarget == FALSE) { + price_560 = NormalizeDouble(ihigh_276 + li_316 * ld_88, Digits); + price_568 = NormalizeDouble(OrderOpenPrice() - (ihigh_276 - ilow_284) * TargetPercent, Digits); + OrderModify(OrderTicket(), OrderOpenPrice(), price_560, price_568, 0, Green); + } + if ((TimeCurrent() - OrderOpenTime() > 300 && f0_15(gi_908, iClose(NULL, g_timeframe_812, 1), iOpen(NULL, g_timeframe_812, 1), OrderOpenPrice() - Ask, gi_816 * ld_88) == 1) || + Ask <= OrderOpenPrice() - (iHigh(NULL, PERIOD_H1, iHighest(NULL, PERIOD_H1, MODE_HIGH, gi_744, iBarShift(NULL, PERIOD_H1, OrderOpenTime()) + 1)) - iLow(NULL, PERIOD_H1, + iLowest(NULL, PERIOD_H1, MODE_LOW, gi_744, iBarShift(NULL, PERIOD_H1, OrderOpenTime()) + 1))) * TargetPercent || Ask >= iHigh(NULL, PERIOD_H1, iHighest(NULL, PERIOD_H1, + MODE_HIGH, gi_744, iBarShift(NULL, PERIOD_H1, OrderOpenTime()) + 1)) + li_316 * ld_88) { + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), slippage_400, Violet); + Sleep(5000); + } else count_432++; + if (TimeCurrent() >= li_456) { + if (Use_Exp_Trailing_IV) { + ld_544 = Exp_Trail_Factor_IV * ld_88 / MathMax(ld_88, OrderOpenPrice() - (iLow(NULL, PERIOD_M5, iLowest(NULL, PERIOD_M5, MODE_LOW, iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + + 1, 0)) + Ask - Bid)); + } else ld_544 = iatr_236 * gd_784; + if (ld_544 > gi_776 * ld_88) ld_544 = gi_776 * ld_88; + if (ld_544 < gi_780 * ld_88) ld_544 = gi_780 * ld_88; + if (OrderOpenPrice() - Ask > F_TrailingProfit_III * ld_88 && (!Use_Exp_Trailing_IV)) ld_544 = F_Trailing_IV * ld_88; + price_552 = NormalizeDouble(Ask + ld_544, Digits); + if (Hidden_StopAndTarget) { + if (!(TimeCurrent() - OrderOpenTime() > 300 && Ask >= Ask - Bid + MathMin(OrderOpenPrice() + li_316 * ld_88, iLow(NULL, PERIOD_M5, iLowest(NULL, PERIOD_M5, MODE_LOW, + iBarShift(NULL, PERIOD_M5, OrderOpenTime()) + 1, 0)) + ld_544) && OrderOpenPrice() - (iLow(NULL, PERIOD_M5, iLowest(NULL, PERIOD_M5, MODE_LOW, iBarShift(NULL, PERIOD_M5, + OrderOpenTime()) + 1, 0)) + Ask - Bid) > ld_544)) continue; + RefreshRates(); + OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), slippage_400, Violet); + Sleep(5000); + continue; + } + if (OrderOpenPrice() - Ask > ld_544) { + if (OrderStopLoss() >= price_552 + Point) { + bool_76 = OrderModify(OrderTicket(), OrderOpenPrice(), price_552, OrderTakeProfit(), 0, Red); + if (bool_76) { + datetime_452 = TimeCurrent(); + g_datetime_952 = datetime_452; + } + } + } + } + } + } + } + } + double ld_576 = 0; + if (StringSubstr(AccountCurrency(), 0, 3) == "JPY") { + ld_576 = MarketInfo("USDJPY" + StringSubstr(Symbol(), 6), MODE_BID); + if (ld_576 > 0.1) ld_40 = ld_576; + else ld_40 = 84; + } + if (StringSubstr(AccountCurrency(), 0, 3) == "GBP") { + ld_576 = MarketInfo("GBPUSD" + StringSubstr(Symbol(), 6), MODE_BID); + if (ld_576 > 0.1) ld_40 = 1 / ld_576; + else ld_40 = 0.6211180124; + } + if (StringSubstr(AccountCurrency(), 0, 3) == "EUR") { + ld_576 = MarketInfo("EURUSD" + StringSubstr(Symbol(), 6), MODE_BID); + if (ld_576 > 0.1) ld_40 = 1 / ld_576; + else ld_40 = 0.7042253521; + } + if (EMAIL_Notification == TRUE) f0_7(); + bool li_584 = TRUE; + bool li_588 = TRUE; + if (No_Hedge_Trades == TRUE && count_408 > 0 || count_416 > 0 || count_424 > 0 || count_432 > 0) li_584 = FALSE; + if (No_Hedge_Trades == TRUE && count_404 > 0 || count_412 > 0 || count_420 > 0 || count_428 > 0) li_588 = FALSE; + if (NFA_Compatibility == TRUE && count_408 > 0 || count_416 > 0 || count_424 > 0 || count_432 > 0 || count_404 > 0 || count_412 > 0 || count_420 > 0 || count_428 > 0) { + li_584 = FALSE; + li_588 = FALSE; + } + double lots_592 = MathMin(g_maxlot_920, MathMax(g_minlot_912, LotsSys1)); + if (TradeMMSys1 > 0.0) lots_592 = MathMax(g_minlot_912, MathMin(g_maxlot_920, NormalizeDouble(f0_18() / ld_40 / 100.0 * AccountFreeMargin() / g_lotstep_936 / (g_lotsize_932 / 100), 0) * g_lotstep_936)); + if (lots_592 > MaximalLots) lots_592 = MaximalLots; + double lots_600 = MathMin(g_maxlot_920, MathMax(g_minlot_912, LotsSys2)); + if (TradeMMSys2 > 0.0) lots_600 = MathMax(g_minlot_912, MathMin(g_maxlot_920, NormalizeDouble(f0_0() / ld_40 / 100.0 * AccountFreeMargin() / g_lotstep_936 / (g_lotsize_932 / 100), 0) * g_lotstep_936)); + if (lots_600 > MaximalLots) lots_600 = MaximalLots; + double lots_608 = MathMin(g_maxlot_920, MathMax(g_minlot_912, LotsSys3)); + if (TradeMMSys3 > 0.0) lots_608 = MathMax(g_minlot_912, MathMin(g_maxlot_920, NormalizeDouble(f0_13() / ld_40 / 100.0 * AccountFreeMargin() / g_lotstep_936 / (g_lotsize_932 / 100), 0) * g_lotstep_936)); + if (lots_608 > MaximalLots) lots_608 = MaximalLots; + double lots_616 = MathMin(g_maxlot_920, MathMax(g_minlot_912, LotsSys4)); + if (TradeMMSys4 > 0.0) lots_616 = MathMax(g_minlot_912, MathMin(g_maxlot_920, NormalizeDouble(f0_21() / ld_40 / 100.0 * AccountFreeMargin() / g_lotstep_936 / (g_lotsize_932 / 100), 0) * g_lotstep_936)); + if (lots_616 > MaximalLots) lots_616 = MaximalLots; + if (!Use_FXCOMBO_Scalping) lots_592 = 0; + if (!Use_FXCOMBO_Breakout) lots_600 = 0; + if (!Use_FXCOMBO_Reversal) lots_608 = 0; + if (!Use_FXCOMBO_EuroRange) lots_616 = 0; + gs_896 = "\n\n LOTS Sys1 : " + DoubleToStr(lots_592, 2) + + "\n LOTS Sys2 : " + DoubleToStr(lots_600, 2) + + "\n LOTS Sys3 : " + DoubleToStr(lots_608, 2) + + "\n LOTS Sys4 : " + DoubleToStr(lots_616, 2); + int cmd_36 = -1; + if (Use_FXCOMBO_Scalping != FALSE) { + if (count_404 < 1 && li_584 && f0_3(gi_908, iclose_172, ima_180, TREND_STR * ld_88, iwpr_188, OSC_open, gi_488, Hour(), li_320, li_324) == 0 && Bid < iclose_172 - gi_476 * ld_88) { + if (ld_96 > MaxSPREAD) Print("System 1 BUY not taken due to high spead!"); + else { + ls_624 = "BUY"; + cmd_36 = 0; + color_32 = Aqua; + RefreshRates(); + price_0 = NormalizeDouble(Ask, Digits); + price_8 = price_0 - li_296 * ld_88; + price_16 = price_0 + li_292 * ld_88; + } + } + if (count_408 < 1 && li_588 && f0_3(gi_908, iclose_172, ima_180, TREND_STR * ld_88, iwpr_188, OSC_open, gi_488, Hour(), li_320, li_324) == 1 && Bid > iclose_172 + + gi_476 * ld_88) { + if (ld_96 > MaxSPREAD) Print("System 1 SELL not taken due to high spead!"); + else { + ls_624 = "SELL"; + cmd_36 = 1; + color_32 = Red; + RefreshRates(); + price_0 = NormalizeDouble(Bid, Digits); + price_8 = price_0 + li_296 * ld_88; + price_16 = price_0 - li_292 * ld_88; + } + } + } + if (cmd_36 >= OP_BUY && NewsFilterSys1 == FALSE || (NewsFilterSys1 && f0_12())) { + if (li_84 == FALSE) ticket_460 = OrderSend(Symbol(), cmd_36, lots_592, price_0, slippage_400, 0, 0, CommentSys1, Magic1, 0, color_32); + else ticket_460 = OrderSend(Symbol(), cmd_36, lots_592, price_0, slippage_400, price_8, price_16, CommentSys1, Magic1, 0, color_32); + Sleep(5000); + if (ticket_460 > 0) { + if (OrderSelect(ticket_460, SELECT_BY_TICKET, MODE_TRADES)) Print("Order " + ls_624 + " opened!: ", OrderOpenPrice()); + } else Print("Error opening " + ls_624 + " order!: ", GetLastError()); + } else { + if (cmd_36 >= OP_BUY && NewsFilterSys1 && g_datetime_956 != iTime(NULL, PERIOD_M5, 1)) { + g_datetime_956 = iTime(NULL, PERIOD_M5, 1); + if (cmd_36 == OP_BUY) Print("BUY skipped: " + gs_872); + else Print("SELL skipped: " + gs_872); + } + } + cmd_36 = -1; + if (!(TimeHour(TimeCurrent()) != li_336 && TimeHour(TimeCurrent()) != li_340 && TimeHour(TimeCurrent()) != li_344 && TimeHour(TimeCurrent()) != li_348 && TimeHour(TimeCurrent()) != li_352 && + TimeHour(TimeCurrent()) != li_356 && TimeHour(TimeCurrent()) != li_360 && TimeHour(TimeCurrent()) != li_364 && TimeHour(TimeCurrent()) != li_368 && TimeHour(TimeCurrent()) != li_372 && TimeHour(TimeCurrent()) != li_376 && TimeHour(TimeCurrent()) != li_380 && TimeHour(TimeCurrent()) != li_384 && TimeHour(TimeCurrent()) != li_388 && TimeHour(TimeCurrent()) != li_392) || + !(TimeHour(TimeCurrent()) != li_396)) { + if (Use_FXCOMBO_Breakout != FALSE) { + if (DayOfWeek() != gi_580) { + if (f0_4()) { + if (count_416 < 1 && li_588 && f0_6(gi_908, iclose_228, ld_220, ld_212, Break * ld_88, Bid, (Break - 3) * ld_88) == 1) { + if (ld_96 > MaxSPREAD) Print("System 2 SELL not taken due to high spead!"); + else { + ls_624 = "SELL"; + cmd_36 = 1; + color_32 = Yellow; + RefreshRates(); + price_0 = NormalizeDouble(Bid, Digits); + price_8 = price_0 + li_304 * ld_88; + price_16 = price_0 - li_300 * ld_88; + } + } + if (count_412 < 1 && li_584 && f0_6(gi_908, iclose_228, ld_220, ld_212, Break * ld_88, Bid, (Break - 3) * ld_88) == 0) { + if (ld_96 > MaxSPREAD) Print("System 2 BUY not taken due to high spead!"); + else { + ls_624 = "BUY"; + cmd_36 = 0; + color_32 = DodgerBlue; + RefreshRates(); + price_0 = NormalizeDouble(Ask, Digits); + price_8 = price_0 - li_304 * ld_88; + price_16 = price_0 + li_300 * ld_88; + } + } + } + } + } + } + if (cmd_36 >= OP_BUY && NewsFilterSys2 == FALSE || (NewsFilterSys2 && f0_12())) { + if (li_84 == FALSE) ticket_464 = OrderSend(Symbol(), cmd_36, lots_600, price_0, slippage_400, 0, 0, CommentSys2, Magic2, 0, color_32); + else ticket_464 = OrderSend(Symbol(), cmd_36, lots_600, price_0, slippage_400, price_8, price_16, CommentSys2, Magic2, 0, color_32); + Sleep(5000); + if (ticket_464 > 0) { + if (OrderSelect(ticket_464, SELECT_BY_TICKET, MODE_TRADES)) Print("Order " + ls_624 + " opened!: ", OrderOpenPrice()); + } else Print("Error opening " + ls_624 + " order!: ", GetLastError()); + } else { + if (cmd_36 >= OP_BUY && NewsFilterSys2 && g_datetime_956 != iTime(NULL, PERIOD_M5, 1)) { + g_datetime_956 = iTime(NULL, PERIOD_M5, 1); + if (cmd_36 == OP_BUY) Print("BUY skipped: " + gs_872); + else Print("SELL skipped: " + gs_872); + } + } + cmd_36 = -1; + if (Use_FXCOMBO_Reversal != FALSE) { + if (DayOfWeek() != gi_728) { + if (DayOfWeek() != gi_732) { + if (count_420 < 1 && li_584 && (li_328 <= li_332 && TimeHour(TimeCurrent()) >= li_328 && TimeHour(TimeCurrent()) <= li_332) || (li_328 > li_332 && TimeHour(TimeCurrent()) >= li_328 || + TimeHour(TimeCurrent()) <= li_332) && f0_14(gi_908, ibands_260, ibands_268, gi_704 * ld_88, ihigh_244, ilow_252, gi_700 * ld_88) == 0) { + if (ld_96 > MaxSPREAD) Print("System 3 BUY not taken due to high spead!"); + else { + ls_624 = "BUY"; + cmd_36 = 0; + color_32 = Aqua; + RefreshRates(); + price_0 = NormalizeDouble(Ask, Digits); + price_8 = price_0 - li_312 * ld_88; + price_16 = price_0 + li_308 * ld_88; + } + } + if (count_424 < 1 && li_588 && (li_328 <= li_332 && TimeHour(TimeCurrent()) >= li_328 && TimeHour(TimeCurrent()) <= li_332) || (li_328 > li_332 && TimeHour(TimeCurrent()) >= li_328 || + TimeHour(TimeCurrent()) <= li_332) && f0_14(gi_908, ibands_260, ibands_268, gi_704 * ld_88, ihigh_244, ilow_252, gi_700 * ld_88) == 1) { + if (ld_96 > MaxSPREAD) Print("System 3 SELL not taken due to high spead!"); + else { + ls_624 = "SELL"; + cmd_36 = 1; + color_32 = DeepPink; + RefreshRates(); + price_0 = NormalizeDouble(Bid, Digits); + price_8 = price_0 + li_312 * ld_88; + price_16 = price_0 - li_308 * ld_88; + } + } + } + } + } + if (cmd_36 >= OP_BUY && NewsFilterSys3 == FALSE || (NewsFilterSys3 && f0_12())) { + if (li_84 == FALSE) ticket_468 = OrderSend(Symbol(), cmd_36, lots_608, price_0, slippage_400, 0, 0, CommentSys3, Magic3, 0, color_32); + else ticket_468 = OrderSend(Symbol(), cmd_36, lots_608, price_0, slippage_400, price_8, price_16, CommentSys3, Magic3, 0, color_32); + Sleep(5000); + if (ticket_468 > 0) { + if (OrderSelect(ticket_468, SELECT_BY_TICKET, MODE_TRADES)) Print("Order " + ls_624 + " opened!: ", OrderOpenPrice()); + } else Print("Error opening " + ls_624 + " order!: ", GetLastError()); + } else { + if (cmd_36 >= OP_BUY && NewsFilterSys3 && g_datetime_956 != iTime(NULL, PERIOD_M5, 1)) { + g_datetime_956 = iTime(NULL, PERIOD_M5, 1); + if (cmd_36 == OP_BUY) Print("BUY skipped: " + gs_872); + else Print("SELL skipped: " + gs_872); + } + } + cmd_36 = -1; + if (Use_FXCOMBO_EuroRange != FALSE) { + if (count_428 < 1 && li_584 && f0_5(gi_908, gi_904, Hour(), Minute(), iOpen(NULL, PERIOD_M5, 0), ilow_284, ihigh_276, BreakPips * ld_88, gi_748 * ld_88, MaxRangePips * ld_88) == 0) { + if (ld_96 > MaxSPREAD) Print("System 4 BUY not taken due to high spead!"); + else { + ls_624 = "BUY"; + cmd_36 = 0; + color_32 = Aqua; + RefreshRates(); + price_0 = NormalizeDouble(Ask, Digits); + price_8 = NormalizeDouble(ilow_284 - li_316 * ld_88, Digits); + price_16 = NormalizeDouble(Ask + (ihigh_276 - ilow_284) * TargetPercent, Digits); + } + } + if (count_432 < 1 && li_588 && f0_5(gi_908, gi_904, Hour(), Minute(), iOpen(NULL, PERIOD_M5, 0), ilow_284, ihigh_276, BreakPips * ld_88, gi_748 * ld_88, MaxRangePips * ld_88) == 1) { + if (ld_96 > MaxSPREAD) Print("System 3 SELL not taken due to high spead!"); + else { + ls_624 = "SELL"; + cmd_36 = 1; + color_32 = DeepPink; + RefreshRates(); + price_0 = NormalizeDouble(Bid, Digits); + price_8 = NormalizeDouble(ihigh_276 + li_316 * ld_88, Digits); + price_16 = NormalizeDouble(Bid - (ihigh_276 - ilow_284) * TargetPercent, Digits); + } + } + } + if (cmd_36 >= OP_BUY && NewsFilterSys4 == FALSE || (NewsFilterSys4 && f0_12())) { + if (li_84 == FALSE) ticket_472 = OrderSend(Symbol(), cmd_36, lots_616, price_0, slippage_400, 0, 0, CommentSys4, Magic4, 0, color_32); + else ticket_472 = OrderSend(Symbol(), cmd_36, lots_616, price_0, slippage_400, price_8, price_16, CommentSys4, Magic4, 0, color_32); + Sleep(5000); + if (ticket_472 > 0) { + if (OrderSelect(ticket_472, SELECT_BY_TICKET, MODE_TRADES)) Print("Order " + ls_624 + " opened!: ", OrderOpenPrice()); + } else Print("Error opening " + ls_624 + " order!: ", GetLastError()); + } else { + if (cmd_36 >= OP_BUY && NewsFilterSys4 && g_datetime_956 != iTime(NULL, PERIOD_M5, 1)) { + g_datetime_956 = iTime(NULL, PERIOD_M5, 1); + if (cmd_36 == OP_BUY) Print("BUY skipped: " + gs_872); + else Print("SELL skipped: " + gs_872); + } + } + return (0); +} + +// D02E3467D6EE65679474EA510952586A +double f0_18() { + int li_8; + double ld_16; + double ld_ret_0 = TradeMMSys1; + int li_12 = 0; + if (Digits <= 3) ld_16 = 0.01; + else ld_16 = 0.0001; + for (int hist_total_24 = OrdersHistoryTotal(); hist_total_24 >= 0; hist_total_24--) { + if (OrderSelect(hist_total_24, SELECT_BY_POS, MODE_HISTORY)) { + if (OrderType() <= OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == Magic1) { + if (OrderProfit() > 0.0) { + if (gi_280 == 0) break; + if (MathAbs(OrderClosePrice() - OrderOpenPrice()) / ld_16 > gi_280) break; + continue; + } + li_12++; + } + } + } + if (li_12 > gi_272 && gi_276 > 1) { + li_8 = MathMod(li_12, gi_276); + ld_ret_0 *= MathPow(LossFactorSys1, li_8); + } + if (MMMax > 0.0 && ld_ret_0 > MMMax) ld_ret_0 = MMMax; + return (ld_ret_0); +} + +// 1426E1C9819471BC17C98E7E2C7DD408 +double f0_0() { + int li_8; + double ld_16; + double ld_ret_0 = TradeMMSys2; + int li_12 = 0; + if (Digits <= 3) ld_16 = 0.01; + else ld_16 = 0.0001; + for (int hist_total_24 = OrdersHistoryTotal(); hist_total_24 >= 0; hist_total_24--) { + if (OrderSelect(hist_total_24, SELECT_BY_POS, MODE_HISTORY)) { + if (OrderType() <= OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == Magic2) { + if (OrderProfit() > 0.0) { + if (gi_324 == 0) break; + if (MathAbs(OrderClosePrice() - OrderOpenPrice()) / ld_16 > gi_324) break; + continue; + } + li_12++; + } + } + } + if (li_12 > gi_316 && gi_320 > 1) { + li_8 = MathMod(li_12, gi_320); + ld_ret_0 *= MathPow(LossFactorSys2, li_8); + } + if (MMMax > 0.0 && ld_ret_0 > MMMax) ld_ret_0 = MMMax; + return (ld_ret_0); +} + +// 83F4D115D503A4449CBA89CBA1C83522 +double f0_13() { + int li_8; + double ld_16; + double ld_ret_0 = TradeMMSys3; + int li_12 = 0; + if (Digits <= 3) ld_16 = 0.01; + else ld_16 = 0.0001; + for (int hist_total_24 = OrdersHistoryTotal(); hist_total_24 >= 0; hist_total_24--) { + if (OrderSelect(hist_total_24, SELECT_BY_POS, MODE_HISTORY)) { + if (OrderType() <= OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == Magic3) { + if (OrderProfit() > 0.0) { + if (gi_368 == 0) break; + if (MathAbs(OrderClosePrice() - OrderOpenPrice()) / ld_16 > gi_368) break; + continue; + } + li_12++; + } + } + } + if (li_12 > gi_360 && gi_364 > 1) { + li_8 = MathMod(li_12, gi_364); + ld_ret_0 *= MathPow(LossFactorSys3, li_8); + } + if (MMMax > 0.0 && ld_ret_0 > MMMax) ld_ret_0 = MMMax; + return (ld_ret_0); +} + +// D641B0C57C7A54EBE0F39CE9DC45E7CA +double f0_21() { + int li_8; + double ld_16; + double ld_ret_0 = TradeMMSys4; + int li_12 = 0; + if (Digits <= 3) ld_16 = 0.01; + else ld_16 = 0.0001; + for (int hist_total_24 = OrdersHistoryTotal(); hist_total_24 >= 0; hist_total_24--) { + if (OrderSelect(hist_total_24, SELECT_BY_POS, MODE_HISTORY)) { + if (OrderType() <= OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == Magic4) { + if (OrderProfit() > 0.0) { + if (gi_412 == 0) break; + if (MathAbs(OrderClosePrice() - OrderOpenPrice()) / ld_16 > gi_412) break; + continue; + } + li_12++; + } + } + } + if (li_12 > gi_404 && gi_408 > 1) { + li_8 = MathMod(li_12, gi_408); + ld_ret_0 *= MathPow(LossFactorSys4, li_8); + } + if (MMMax > 0.0 && ld_ret_0 > MMMax) ld_ret_0 = MMMax; + return (ld_ret_0); +} + +// 1BBC94D06E1F0D3B9CFC87C094EBA75D +int f0_1(bool ai_0) { + string ls_4; + if (gi_960 == 0) { + ls_4 = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)"; + gi_960 = InternetOpenA(ls_4, gi_968, "0", "0", 0); + gi_964 = InternetOpenA(ls_4, gi_972, "0", "0", 0); + } + if (ai_0) return (gi_964); + return (gi_960); +} + +// 67B5F51F6CCDE3F6F9D86EE70C3F4037 +int f0_11(string as_0, string &as_8) { + int lia_24[] = {1}; + string ls_28 = "x"; + int li_16 = InternetOpenUrlA(f0_1(0), as_0, "0", 0, -2080374528, 0); + if (li_16 == 0) return (0); + int li_20 = InternetReadFile(li_16, ls_28, gi_980, lia_24); + if (li_20 == 0) return (0); + int li_36 = lia_24[0]; + for (as_8 = StringSubstr(ls_28, 0, lia_24[0]); lia_24[0] != 0; as_8 = as_8 + StringSubstr(ls_28, 0, lia_24[0])) { + li_20 = InternetReadFile(li_16, ls_28, gi_980, lia_24); + if (lia_24[0] == 0) break; + li_36 += lia_24[0]; + } + li_20 = InternetCloseHandle(li_16); + if (li_20 == 0) return (0); + return (1); +} + +// 52600E5BE768512CC215866649A5EEE8 +string f0_10(string as_0, int ai_8, string as_12, string as_20, int &ai_28) { + int li_40; + string ls_ret_32 = ""; + ai_28 = StringFind(as_0, as_12, ai_8); + if (ai_28 != -1) { + ai_28 += StringLen(as_12); + li_40 = StringFind(as_0, as_20, ai_28 + 1); + ls_ret_32 = StringTrimLeft(StringTrimRight(StringSubstr(as_0, ai_28, li_40 - ai_28))); + } + return (ls_ret_32); +} + +// 2ECDE036AF96C414B28F3D71FF3E5C89 +bool f0_4() { + double ld_4; + int datetime_12; + bool li_ret_0 = TRUE; + if (Digits <= 3) ld_4 = 0.01; + else ld_4 = 0.0001; + if (gi_572 > 0 && gi_576 > 0) { + datetime_12 = 0; + for (int pos_16 = OrdersHistoryTotal() - 1; pos_16 >= 0; pos_16--) { + if (OrderSelect(pos_16, SELECT_BY_POS, MODE_HISTORY)) { + if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic2) { + if (!((OrderType() == OP_BUY && (OrderClosePrice() - OrderOpenPrice()) / ld_4 <= (-gi_572)) || (OrderType() == OP_SELL && (OrderOpenPrice() - OrderClosePrice()) / ld_4 <= (-gi_572)))) break; + datetime_12 = OrderCloseTime(); + break; + } + } + } + if (TimeCurrent() - datetime_12 < 60 * gi_576) li_ret_0 = FALSE; + } + return (li_ret_0); +} + +// 4562D26A98BEC98E7F1F6ECD0D270191 +void f0_7() { + string ls_0; + string ls_8; + bool li_16 = FALSE; + if (IsTesting() || EMAIL_Notification == FALSE) return; + if (g_datetime_984 == 0) { + g_datetime_984 = TimeCurrent(); + return; + } + if (g_datetime_984 != TimeCurrent()) { + for (int pos_20 = 0; pos_20 <= OrdersTotal() - 1; pos_20++) { + if (OrderSelect(pos_20, SELECT_BY_POS, MODE_TRADES)) { + if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { + ls_0 = ""; + ls_8 = ""; + if (OrderOpenTime() >= g_datetime_984) { + if (OrderMagicNumber() == Magic1) ls_0 = "FX COMBO - System 1"; + else { + if (OrderMagicNumber() == Magic2) ls_0 = "FX COMBO - System 2"; + else { + if (OrderMagicNumber() == Magic3) ls_0 = "FX COMBO - System 3"; + else + if (OrderMagicNumber() == Magic4) ls_0 = "FX COMBO - System 4"; + } + } + } + if (StringLen(ls_0) > 1) { + if (OrderType() == OP_BUY) ls_8 = "Buy"; + else ls_8 = "Sell"; + ls_8 = ls_8 + " order (" + OrderTicket() + ") is opened: " + DoubleToStr(OrderOpenPrice(), Digits) + ", SL:" + DoubleToStr(OrderStopLoss(), Digits) + ", TP:" + DoubleToStr(OrderTakeProfit(), + Digits); + li_16 = TRUE; + SendMail(ls_0, ls_8); + } + } + } + } + for (pos_20 = OrdersHistoryTotal() - 1; pos_20 >= 0; pos_20--) { + if (OrderSelect(pos_20, SELECT_BY_POS, MODE_HISTORY)) { + if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { + if (OrderCloseTime() <= g_datetime_984) break; + ls_0 = ""; + ls_8 = ""; + if (OrderMagicNumber() == Magic1) ls_0 = "FX COMBO - System 1"; + else { + if (OrderMagicNumber() == Magic2) ls_0 = "FX COMBO - System 2"; + else { + if (OrderMagicNumber() == Magic3) ls_0 = "FX COMBO - System 3"; + else + if (OrderMagicNumber() == Magic4) ls_0 = "FX COMBO - System 4"; + } + } + if (StringLen(ls_0) > 1) { + if (OrderType() == OP_BUY) ls_8 = "Buy"; + else ls_8 = "Sell"; + ls_8 = ls_8 + " order (" + OrderTicket() + ") is closed at " + DoubleToStr(OrderClosePrice(), Digits) + ", result: " + DoubleToStr(OrderProfit(), 2); + li_16 = TRUE; + SendMail(ls_0, ls_8); + } + } + } + } + g_datetime_984 = TimeCurrent(); + if (li_16) Sleep(1000); + } +} + +// E3B8CE68351C84C8B515C82ACBBB0EE6 +int f0_23(int ai_0, int ai_4, int ai_8, int ai_12, int ai_16) { + return (dllInit(ai_0, ai_4, ai_8, ai_12, ai_16)); +} + +// 29DAC705E91697557643EA4C711D8B68 +int f0_3(int ai_0, double ad_4, double ad_12, double ad_20, double ad_28, double ad_36, double ad_44, int ai_52, int ai_56, int ai_60) { + return (dllOpenCond1(ai_0, ad_4, ad_12, ad_20, ad_28, ad_36, ad_44, ai_52, ai_56, ai_60)); +} + +// D9202589407AB6642667D56EE84254EA +int f0_22(int ai_0, double ad_4, double ad_12) { + return (dllCloseCond1(ai_0, ad_4, ad_12)); +} + +// 44567E69B823BB26B6869904454BF05C +int f0_6(int ai_0, double ad_4, double ad_12, double ad_20, double ad_28, double ad_36, double ad_44) { + return (dllOpenCond2(ai_0, ad_4, ad_12, ad_20, ad_28, ad_36, ad_44)); +} + +// EEF41F888AA1DBD8510C8683BC48D7AD +int f0_24(int ai_0, double ad_4, double ad_12, double ad_20, double ad_28) { + return (dllCloseCond2(ai_0, ad_4, ad_12, ad_20, ad_28)); +} + +// 92A3FDDEEEC551F0BD51E1CA298C5AD1 +int f0_14(int ai_0, double ad_4, double ad_12, double ad_20, double ad_28, double ad_36, double ad_44) { + return (dllOpenCond3(ai_0, ad_4, ad_12, ad_20, ad_28, ad_36, ad_44)); +} + +// D46589441045E3AD992FFC65BB286757 +int f0_20(int ai_0, double ad_4, double ad_12, double ad_20, double ad_28, double ad_36, double ad_44) { + return (dllCloseCond3(ai_0, ad_4, ad_12, ad_20, ad_28, ad_36, ad_44)); +} + +// 3B7B45F7BE75FFD320F254B07E5B03F8 +int f0_5(int ai_0, int ai_4, int ai_8, int ai_12, double ad_16, double ad_24, double ad_32, double ad_40, double ad_48, double ad_56) { + return (dllOpenCond4(ai_0, ai_4, ai_8, ai_12, ad_16, ad_24, ad_32, ad_40, ad_48, ad_56)); +} + +// A3F60245633C3C27AC5CFCF739CC878C +int f0_15(int ai_0, double ad_4, double ad_12, double ad_20, double ad_28) { + return (dllCloseCond4(ai_0, ad_4, ad_12, ad_20, ad_28)); +} + +// D2144D62ECAE784A90B5A1507B3470E5 +void f0_19(int &ai_0, int &ai_4) { + ai_0 = dllParamInit1(1); + ai_4 = dllParamInit1(2); +} + +// 4EC5637CC867CE5029614AE3D5C0250E +void f0_8(int &ai_0, int &ai_4, int &ai_8, int &ai_12, int &ai_16, int &ai_20, int &ai_24, int &ai_28, int &ai_32, int &ai_36, int &ai_40, int &ai_44) { + ai_0 = dllParamInit2(1); + ai_4 = dllParamInit2(2); + ai_8 = dllParamInit2(3); + ai_12 = dllParamInit2(4); + ai_16 = dllParamInit2(5); + ai_20 = dllParamInit2(6); + ai_24 = dllParamInit2(7); + ai_28 = dllParamInit2(8); + ai_32 = dllParamInit2(9); + ai_36 = dllParamInit2(10); + ai_40 = dllParamInit2(11); + ai_44 = dllParamInit2(12); +} + +// 4FDB54BD385BA8F60BAEB409EB093F11 +double f0_9(double ad_0, double ad_8, double ad_16) { + return (dllExpTrailLong(ad_0, ad_8, ad_16)); +} + +// B16077AEC05278814CF99921982899CE +double f0_16(double ad_0, double ad_8, double ad_16) { + return (dllExpTrailShort(ad_0, ad_8, ad_16)); +} + +// B95D831F7DC28FD0740EAF9E89023C16 +int f0_17() { + return (dllGMTOffset()); +} + +// 1C73977C8A2A8C537EB65C934BBA7E7B +void f0_2() { + int file_0; + int li_8; + int li_12; + string ls_16; + string ls_24; + bool li_32; + string ls_44; + string ls_52; + string ls_60; + string ls_68; + string ls_76; + string ls_84; + string ls_92; + int li_100; + string name_104; + string ls_112; + string ls_120; + bool li_128; + int li_132; + int li_136; + int li_140; + int li_144; + string ls_152; + int li_160; + gs_856 = ""; + if (NewsFilterSys1 == FALSE && NewsFilterSys2 == FALSE && NewsFilterSys3 == FALSE && NewsFilterSys4 == FALSE) { + gs_856 = "News Filter - OFF"; + return; + } + gs_864 = ""; + if (NewsFilterSys1) { + gs_864 = gs_864 + + "\n News Filter System 1: ENABLED "; + } else { + gs_864 = gs_864 + + "\n News Filter System 1: DISABLED "; + } + if (NewsFilterSys2) { + gs_864 = gs_864 + + "\n News Filter System 2: ENABLED "; + } else { + gs_864 = gs_864 + + "\n News Filter System 2: DISABLED "; + } + if (NewsFilterSys3) { + gs_864 = gs_864 + + "\n News Filter System 3: ENABLED "; + } else { + gs_864 = gs_864 + + "\n News Filter System 3: DISABLED "; + } + if (NewsFilterSys4) { + gs_864 = gs_864 + + "\n News Filter System 4: ENABLED "; + } else { + gs_864 = gs_864 + + "\n News Filter System 4: DISABLED "; + } + gs_856 = "News Filter - No Important News"; + if (MathAbs(TimeCurrent() - g_datetime_880) >= 86400.0 || TimeDay(TimeCurrent()) != TimeDay(g_datetime_880)) { + name_104 = "forex_combo_system_current_news.csv"; + ls_112 = "http://www.forex-combo.com/calendar.php?all=0"; + g_datetime_880 = TimeCurrent(); + if (IsTesting()) { + name_104 = "forex_combo_system_history_news.csv"; + ls_112 = "http://www.forex-combo.com/calendar.php?all=1"; + } + ls_112 = ls_112 + "&AccountId=" + DoubleToStr(AccountNumber(), 0) + "&AccountType="; + if (IsDemo()) ls_112 = ls_112 + "1"; + else ls_112 = ls_112 + "2"; + li_32 = TRUE; + for (int li_4 = 1; li_4 <= 3; li_4++) { + file_0 = FileOpen(name_104, FILE_CSV|FILE_READ, ';'); + if (file_0 >= 0) break; + Sleep(1000); + } + if (file_0 >= 0) { + while (!FileIsEnding(file_0)) { + for (string ls_36 = FileReadString(file_0); !FileIsEnding(file_0); ls_36 = FileReadString(file_0)) + if (StringLen(ls_36) == 10 && StringFind(ls_36, ".") == 4) break; + ls_44 = FileReadString(file_0); + if (StringLen(ls_44) != 5 || StringFind(ls_44, ":") != 2) continue; + ls_52 = FileReadString(file_0); + ls_60 = FileReadString(file_0); + ls_68 = FileReadString(file_0); + ls_76 = FileReadString(file_0); + ls_84 = FileReadString(file_0); + ls_92 = FileReadString(file_0); + if (StringLen(ls_36) > 0 && StringLen(ls_44) > 0) { + li_100 = StrToTime(ls_36 + " " + ls_44) + 3600 * gi_904; + if ((IsTesting() && li_100 >= TimeCurrent() - 86400) || (!IsTesting() && li_100 >= TimeCurrent() + 86400) || (!IsTesting() && Day() >= 5 && li_100 - 3600 * gi_904 > iTime(NULL, + PERIOD_D1, 0))) { + li_32 = FALSE; + break; + } + } + } + FileClose(file_0); + if (li_32) FileDelete(name_104); + } + if (li_32) { + li_12 = 0; + for (li_4 = 1; li_4 <= 3; li_4++) { + file_0 = FileOpen(name_104, FILE_CSV|FILE_WRITE, ';'); + if (file_0 >= 0) break; + Sleep(1000); + } + if (file_0 >= 0) { + ls_120 = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)"; + li_128 = FALSE; + li_144 = 120; + int lia_148[] = {1}; + ls_152 = " "; + ls_16 = ""; + for (li_4 = 1; li_4 <= 3; li_4++) { + li_132 = InternetOpenA(ls_120, li_128, "0", "0", 0); + if (li_132 != 0) break; + Sleep(1000); + } + if (li_132 != 0) { + for (li_4 = 1; li_4 <= 3; li_4++) { + li_136 = InternetOpenUrlA(li_132, ls_112, "0", 0, -2080374528, 0); + if (li_136 != 0) break; + Sleep(1000); + } + if (li_136 != 0) { + li_140 = InternetReadFile(li_136, ls_152, li_144, lia_148); + if (li_140 != 0) { + ls_16 = StringSubstr(ls_152, 0, lia_148[0]); + while (lia_148[0] != 0) { + li_140 = InternetReadFile(li_136, ls_152, li_144, lia_148); + if (lia_148[0] == 0) break; + ls_16 = ls_16 + StringSubstr(ls_152, 0, lia_148[0]); + li_12 += lia_148[0]; + while (true) { + li_8 = -1; + for (li_4 = 0; li_4 < StringLen(ls_16); li_4++) { + li_160 = StringGetChar(ls_16, li_4); + if (li_160 == 10 || li_160 == 13) { + li_8 = li_4; + break; + } + } + if (li_8 < 0) break; + if (li_8 > 0) { + ls_24 = StringSubstr(ls_16, 0, li_8); + FileWrite(file_0, ls_24); + } + ls_16 = StringSubstr(ls_16, li_8 + 1); + } + } + if (StringLen(ls_16) > 0) FileWrite(file_0, ls_16); + ls_16 = ""; + } + InternetCloseHandle(li_136); + } + InternetCloseHandle(li_132); + } + FileClose(file_0); + } + if (li_12 <= 10) { + Alert("Can\'t download " + name_104 + ". News Filter was turned OFF"); + if (IsTesting()) Print("Can\'t download " + name_104 + ". News Filter was turned OFF"); + Sleep(5000); + } else Print("Downloaded " + DoubleToStr(li_12, 0) + " bytes (" + name_104 + ")"); + } + g_index_988 = 0; + for (li_4 = 1; li_4 <= 3; li_4++) { + file_0 = FileOpen(name_104, FILE_CSV|FILE_READ, ';'); + if (file_0 >= 0) break; + Sleep(1000); + } + if (file_0 < 0) { + Alert("Can\'t open " + name_104 + ". Error code: ", GetLastError()); + if (IsTesting()) Print("Can\'t open " + name_104 + ". Error code: ", GetLastError()); + Sleep(5000); + } else { + while (!FileIsEnding(file_0)) { + for (ls_36 = FileReadString(file_0); !FileIsEnding(file_0); ls_36 = FileReadString(file_0)) + if (StringLen(ls_36) == 10 && StringFind(ls_36, ".") == 4) break; + ls_44 = FileReadString(file_0); + if (StringLen(ls_44) != 5 || StringFind(ls_44, ":") != 2) continue; + ls_52 = FileReadString(file_0); + ls_60 = FileReadString(file_0); + ls_68 = FileReadString(file_0); + ls_76 = FileReadString(file_0); + ls_84 = FileReadString(file_0); + ls_92 = FileReadString(file_0); + if (StringLen(ls_36) > 0 && StringLen(ls_44) > 0) { + li_100 = StrToTime(ls_36 + " " + ls_44) + 3600 * gi_904; + if (li_100 >= TimeCurrent() - 86400 && li_100 <= TimeCurrent() + 86400 && StringFind(Symbol(), ls_52) >= 0 && ls_68 == "3" || (ls_68 == "2" && Include_Medium_News)) { + g_index_988++; + gia_992[g_index_988] = li_100; + gsa_996[g_index_988] = ls_52; + gsa_1000[g_index_988] = ls_60; + } + } + } + FileClose(file_0); + } + } + for (li_4 = 1; li_4 <= g_index_988; li_4++) { + if (gia_992[li_4] >= TimeCurrent() && gia_992[li_4] <= TimeCurrent() + 86400 && TimeDay(gia_992[li_4]) == TimeDay(TimeCurrent())) { + gs_856 = TimeToStr(gia_992[li_4], TIME_MINUTES) + " " + gsa_996[li_4] + " News - " + gsa_1000[li_4]; + break; + } + } + if (StringLen(gs_856) > 33) gs_856 = StringSubstr(gs_856, 0, 30) + "..."; +} + +// 697A7D88FF8EA0B64CD60B324DDE1103 +int f0_12() { + bool li_ret_0 = TRUE; + if (NewsFilterSys1 || NewsFilterSys2 || NewsFilterSys3 || NewsFilterSys4) { + gs_872 = ""; + for (int li_4 = 1; li_4 <= g_index_988; li_4++) { + if ((gia_992[li_4] < TimeCurrent() && gia_992[li_4] + 60 * Wait_After_News >= TimeCurrent()) || (gia_992[li_4] >= TimeCurrent() && gia_992[li_4] - 60 * Wait_Before_News <= TimeCurrent())) { + gs_872 = TimeToStr(gia_992[li_4], TIME_MINUTES) + " " + gsa_996[li_4] + " News - " + gsa_1000[li_4]; + li_ret_0 = FALSE; + break; + } + } + } + return (li_ret_0); +} \ No newline at end of file diff --git a/GPSForexRobotEURGBP_edu.mq4 b/GPSForexRobotEURGBP_edu.mq4 new file mode 100644 index 0000000..ad3f71c --- /dev/null +++ b/GPSForexRobotEURGBP_edu.mq4 @@ -0,0 +1,1210 @@ +/* + Generated by EX4-TO-MQ4 decompiler V4.0.224.1 [] + Website: http://purebeam.biz + E-mail : purebeam@gmail.com +*/ +#property copyright "Copyright © 2010, GPSForexRobot.com" +#property link "http://gpsforexrobot.com/" + +#import "GPSForexRobotEURGBP.dll" +// int GPSForexRobot(double& a0[], string a1, string a2, int a3, int a4); + int GetGMT(); +#import + +extern string GPS_Forex_Robot_EURGBP = " "; +/* +extern string ____Authentication________ = "---------------------------------------------"; +extern string EMail = ""; +extern string CBReceipt = ""; +*/ +extern string ____Size_of_lots________ = "---------------------------------------------"; +extern bool UseMM = FALSE; +extern double Lots = 0.01; +extern double LotsRiskReductor = 10.0; +extern double MaxLots = 1000.0; +extern string ____General_Options_____ = "---------------------------------------------"; +extern bool AutoGMTOffset = TRUE; +extern int GMTOffset = 1; +bool gi_160 = FALSE; +int gi_164 = 2; +bool gi_168 = TRUE; +double gd_172 = 34.0; +double gd_180 = 10.0; +int gi_188 = 7; +int gi_192 = 0; +bool gi_196 = FALSE; +bool gi_200 = TRUE; +bool gi_204 = FALSE; +bool gi_208 = TRUE; +bool gi_212 = FALSE; +int gi_216 = -6; +int gi_220 = 1; +int gi_224 = 20100109; +bool gi_228 = TRUE; +double gd_232 = 30.0; +double gd_240 = 11.0; +double gd_248 = 3.0; +int gi_256 = 20100129; +extern string ____Others______________ = "---------------------------------------------"; +extern string ExpertComment = "GPS Forex Robot"; +extern color ColorBuy = Blue; +extern color ColorSell = Red; +extern bool SendEmail = FALSE; +extern bool SoundAlert = FALSE; +extern string SoundFileAtOpen = "alert.wav"; +extern string SoundFileAtClose = "alert.wav"; +extern bool WriteLog = FALSE; +extern bool WriteDebugLog = FALSE; +bool gi_316 = TRUE; +int gi_320 = 2; +int gi_324 = 1; +string gs_unused_328 = "New Trade Information"; +string gs_336 = "New Trade Information"; +int g_bool_344; +int gi_348; +int gi_352; +int g_slippage_356; +double gd_360; +double g_maxlot_368; +double g_minlot_376; +double gd_384; +double gd_392; +double g_lotstep_400; +double gd_408; +string g_symbol_416; +string gs_424; +bool gba_432[4]; +double gda_436[4]; +double gda_440[4]; +int gia_444[4]; +int gia_448[4]; +bool gba_452[4][5]; +int gia_456[4]; +int gia_460[4]; +int gia_464[4]; +bool gba_468[4]; +double gda_472[4]; +double gda_476[4]; +double gda_480[4]; +int gia_484[4]; +bool gi_488; +bool gi_492; +int gi_496 = 0; +bool gi_500 = FALSE; +int gi_504 = 0; +double gda_508[52] = {0}; +string gs_512 = ""; +string gs_520 = ""; +string gs_528 = ""; +bool gi_536 = FALSE; + +int init() { + gi_492 = TRUE; + if (!IsDllsAllowed()) { + SetCommentPrint("WARNING: Set Parameter \"AllowDLL Imports\" ON in menu Tools -> Options -> ExpertAdvisors.", "comment"); + gi_492 = FALSE; + return (0); + } + if (StringSubstr(Symbol(), 0, 6) != "EURGBP") { + SetCommentPrint("WARNING: Use GPS Forex Robot EURGBP only on EURGBP pair.", "comment"); + gi_492 = FALSE; + return (0); + } + if (IsTesting()) { + if (AutoGMTOffset) { + SetCommentPrint("WARNING: Automatic GMT offset calculation works only on live/demo trading " + "and should be set as FALSE for backtests - strategy testing.", "comment"); + gi_492 = FALSE; + return (0); + } + } + if (WriteDebugLog) { + WriteLog = TRUE; + Print("*************************** Initialization ***************************"); + } + g_symbol_416 = Symbol(); + g_maxlot_368 = MarketInfo(g_symbol_416, MODE_MAXLOT); + g_minlot_376 = MarketInfo(g_symbol_416, MODE_MINLOT); + g_lotstep_400 = MarketInfo(g_symbol_416, MODE_LOTSTEP); + if (g_lotstep_400 == 0.01) gi_348 = 2; + else { + if (g_lotstep_400 == 0.1) gi_348 = 1; + else { + if (g_lotstep_400 == 1.0) gi_348 = 0; + else { + if (g_lotstep_400 == 0.001) gi_348 = 3; + else gi_348 = 4; + } + } + } + double l_leverage_0 = AccountLeverage(); + gd_408 = NormalizeDouble(LotsRiskReductor * (100 / l_leverage_0), 2); + gs_424 = AccountCurrency(); + g_bool_344 = IsTesting(); + if (Digits < 4) { + gd_360 = 0.01; + gi_352 = 2; + } else { + gd_360 = 0.0001; + gi_352 = 4; + } + int li_8 = MathPow(10, Digits - gi_352); + g_slippage_356 = gi_164 * li_8; + gd_384 = MarketInfo(Symbol(), MODE_SPREAD) / MathPow(10, Digits - gi_352); + gd_392 = gd_384; + if (IsTesting()) { + Authentication(); + if (gi_496 != 1) { + PrintInformation(); + gi_492 = FALSE; + return (0); + } + } + gi_488 = TRUE; + return (0); +} + +int deinit() { + Comment(""); + if (WriteDebugLog) Print("*************************** Deinitialization ***************************"); + return (0); +} + +int start() { + double ld_24; + if (!gi_492) return (0); + int l_datetime_0 = TimeCurrent(); + if (!IsTesting()) { + if (gi_488) { + if (AutoGMTOffset) { + if (AutoGMTOffset(GMTOffset)) gs_512 = GMTOffset + " (automatic)"; + else gs_512 = "Error"; + } else gs_512 = GMTOffset + " (manual)"; + Authentication(); + gi_500 = TRUE; + gi_504 = l_datetime_0; + gi_488 = FALSE; + } + if (gi_500 == TRUE && gi_504 < l_datetime_0 - 60) { + gi_500 = FALSE; + gi_504 = l_datetime_0 + 60 * (780 - Rand(120)); + } + if (gi_500 == FALSE && l_datetime_0 >= gi_504) { + gi_500 = TRUE; + Authentication(); + } + PrintInformation(); + } + if (gi_496 != 1) return (0); + gd_384 = MarketInfo(Symbol(), MODE_SPREAD) / MathPow(10, Digits - gi_352); + if (gd_384 > gd_392) gd_392 = gd_384; + int l_datetime_4 = TimeCurrent(); + int li_8 = l_datetime_4 - 3600 * GMTOffset; + int l_day_of_week_12 = TimeDayOfWeek(l_datetime_4); + int l_datetime_16 = iTime(NULL, PERIOD_D1, 0); + for (int l_index_20 = 0; l_index_20 < 4; l_index_20++) { + if (gba_432[l_index_20]) { + if (!gi_160) SetOrderLevels(gda_440[l_index_20], gda_436[l_index_20], gia_460[l_index_20]); + WatchOrderLevels(gda_440[l_index_20], gda_436[l_index_20], gia_460[l_index_20]); + if (gba_468[l_index_20]) { + if (!gi_160) SetOrderLevels(gda_476[l_index_20], gda_472[l_index_20], gia_484[l_index_20]); + WatchOrderLevels(gda_476[l_index_20], gda_472[l_index_20], gia_484[l_index_20]); + if (HaveOrdersInDay(-2, gia_484[l_index_20], l_datetime_16) == 0) WatchReverseAfterSL(l_index_20); + } + if (l_day_of_week_12 <= 0 || l_day_of_week_12 > 5) continue; + if ((gba_452[l_index_20][l_day_of_week_12 - 1])) { + if (gia_444[l_index_20] != TimeHour(l_datetime_4) || gia_448[l_index_20] != TimeMinute(l_datetime_4)) continue; + if (HaveOrdersInDay(-2, gia_460[l_index_20], l_datetime_16) <= 0) { + ld_24 = LotsOptimized(gia_464[l_index_20]); + if (gia_456[l_index_20] >= 0) + if (l_day_of_week_12 == gia_456[l_index_20]) ld_24 = NormalizeDouble(2.0 * ld_24, gi_348); + OpenOrder(gia_464[l_index_20], gia_460[l_index_20], ExpertComment, ld_24); + } + } + } + } + return (0); +} + +string ErrorDescription(int ai_0) { + string ls_ret_8; + switch (ai_0) { + case 0: + case 1: + ls_ret_8 = "no error"; + break; + case 2: + ls_ret_8 = "common error"; + break; + case 3: + ls_ret_8 = "invalid trade parameters"; + break; + case 4: + ls_ret_8 = "trade server is busy"; + break; + case 5: + ls_ret_8 = "old version of the client terminal"; + break; + case 6: + ls_ret_8 = "no connection with trade server"; + break; + case 7: + ls_ret_8 = "not enough rights"; + break; + case 8: + ls_ret_8 = "too frequent requests"; + break; + case 9: + ls_ret_8 = "malfunctional trade operation (never returned error)"; + break; + case 64: + ls_ret_8 = "account disabled"; + break; + case 65: + ls_ret_8 = "invalid account"; + break; + case 128: + ls_ret_8 = "trade timeout"; + break; + case 129: + ls_ret_8 = "invalid price"; + break; + case 130: + ls_ret_8 = "invalid stops"; + break; + case 131: + ls_ret_8 = "invalid trade volume"; + break; + case 132: + ls_ret_8 = "market is closed"; + break; + case 133: + ls_ret_8 = "trade is disabled"; + break; + case 134: + ls_ret_8 = "not enough money"; + break; + case 135: + ls_ret_8 = "price changed"; + break; + case 136: + ls_ret_8 = "off quotes"; + break; + case 137: + ls_ret_8 = "broker is busy (never returned error)"; + break; + case 138: + ls_ret_8 = "requote"; + break; + case 139: + ls_ret_8 = "order is locked"; + break; + case 140: + ls_ret_8 = "long positions only allowed"; + break; + case 141: + ls_ret_8 = "too many requests"; + break; + case 145: + ls_ret_8 = "modification denied because order too close to market"; + break; + case 146: + ls_ret_8 = "trade context is busy"; + break; + case 147: + ls_ret_8 = "expirations are denied by broker"; + break; + case 148: + ls_ret_8 = "amount of open and pending orders has reached the limit"; + break; + case 149: + ls_ret_8 = "hedging is prohibited"; + break; + case 150: + ls_ret_8 = "prohibited by FIFO rules"; + break; + case 4000: + ls_ret_8 = "no error (never generated code)"; + break; + case 4001: + ls_ret_8 = "wrong function pointer"; + break; + case 4002: + ls_ret_8 = "array index is out of range"; + break; + case 4003: + ls_ret_8 = "no memory for function call stack"; + break; + case 4004: + ls_ret_8 = "recursive stack overflow"; + break; + case 4005: + ls_ret_8 = "not enough stack for parameter"; + break; + case 4006: + ls_ret_8 = "no memory for parameter string"; + break; + case 4007: + ls_ret_8 = "no memory for temp string"; + break; + case 4008: + ls_ret_8 = "not initialized string"; + break; + case 4009: + ls_ret_8 = "not initialized string in array"; + break; + case 4010: + ls_ret_8 = "no memory for array\' string"; + break; + case 4011: + ls_ret_8 = "too long string"; + break; + case 4012: + ls_ret_8 = "remainder from zero divide"; + break; + case 4013: + ls_ret_8 = "zero divide"; + break; + case 4014: + ls_ret_8 = "unknown command"; + break; + case 4015: + ls_ret_8 = "wrong jump (never generated error)"; + break; + case 4016: + ls_ret_8 = "not initialized array"; + break; + case 4017: + ls_ret_8 = "dll calls are not allowed"; + break; + case 4018: + ls_ret_8 = "cannot load library"; + break; + case 4019: + ls_ret_8 = "cannot call function"; + break; + case 4020: + ls_ret_8 = "expert function calls are not allowed"; + break; + case 4021: + ls_ret_8 = "not enough memory for temp string returned from function"; + break; + case 4022: + ls_ret_8 = "system is busy (never generated error)"; + break; + case 4050: + ls_ret_8 = "invalid function parameters count"; + break; + case 4051: + ls_ret_8 = "invalid function parameter value"; + break; + case 4052: + ls_ret_8 = "string function internal error"; + break; + case 4053: + ls_ret_8 = "some array error"; + break; + case 4054: + ls_ret_8 = "incorrect series array using"; + break; + case 4055: + ls_ret_8 = "custom indicator error"; + break; + case 4056: + ls_ret_8 = "arrays are incompatible"; + break; + case 4057: + ls_ret_8 = "global variables processing error"; + break; + case 4058: + ls_ret_8 = "global variable not found"; + break; + case 4059: + ls_ret_8 = "function is not allowed in testing mode"; + break; + case 4060: + ls_ret_8 = "function is not confirmed"; + break; + case 4061: + ls_ret_8 = "send mail error"; + break; + case 4062: + ls_ret_8 = "string parameter expected"; + break; + case 4063: + ls_ret_8 = "integer parameter expected"; + break; + case 4064: + ls_ret_8 = "double parameter expected"; + break; + case 4065: + ls_ret_8 = "array as parameter expected"; + break; + case 4066: + ls_ret_8 = "requested history data in update state"; + break; + case 4099: + ls_ret_8 = "end of file"; + break; + case 4100: + ls_ret_8 = "some file error"; + break; + case 4101: + ls_ret_8 = "wrong file name"; + break; + case 4102: + ls_ret_8 = "too many opened files"; + break; + case 4103: + ls_ret_8 = "cannot open file"; + break; + case 4104: + ls_ret_8 = "incompatible access to a file"; + break; + case 4105: + ls_ret_8 = "no order selected"; + break; + case 4106: + ls_ret_8 = "unknown symbol"; + break; + case 4107: + ls_ret_8 = "invalid price parameter for trade function"; + break; + case 4108: + ls_ret_8 = "invalid ticket"; + break; + case 4109: + ls_ret_8 = "trade is not allowed in the expert properties"; + break; + case 4110: + ls_ret_8 = "longs are not allowed in the expert properties"; + break; + case 4111: + ls_ret_8 = "shorts are not allowed in the expert properties"; + break; + case 4200: + ls_ret_8 = "object is already exist"; + break; + case 4201: + ls_ret_8 = "unknown object property"; + break; + case 4202: + ls_ret_8 = "object is not exist"; + break; + case 4203: + ls_ret_8 = "unknown object type"; + break; + case 4204: + ls_ret_8 = "no object name"; + break; + case 4205: + ls_ret_8 = "object coordinates error"; + break; + case 4206: + ls_ret_8 = "no specified subwindow"; + break; + default: + ls_ret_8 = "unknown error"; + } + return (ls_ret_8); +} + +string OrderTypeToStr(int ai_0) { + string ls_ret_8; + switch (ai_0) { + case 0: + ls_ret_8 = "Buy"; + break; + case 1: + ls_ret_8 = "Sell"; + break; + case 2: + ls_ret_8 = "BuyLimit"; + break; + case 3: + ls_ret_8 = "SellLimit"; + break; + case 4: + ls_ret_8 = "BuyStop"; + break; + case 5: + ls_ret_8 = "SellStop"; + break; + default: + ls_ret_8 = "Unknown"; + } + return (ls_ret_8); +} + +int GetGMTCorrection(int ai_0) { + ai_0 += GMTOffset; + while (true) { + if (ai_0 >= 24) { + ai_0 -= 24; + continue; + } + if (ai_0 >= 0) break; + ai_0 += 24; + } + return (ai_0); +} + +void SetOrderLevels(double ad_0, double ad_8, int a_magic_16) { + int l_cmd_36; + double ld_40; + double l_price_48; + double ld_56; + double ld_64; + bool li_72; + double l_price_76; + bool li_84; + double l_price_88; + bool l_bool_96; + double ld_20 = NormalizeDouble(MarketInfo(g_symbol_416, MODE_STOPLEVEL) * Point, Digits); + int li_28 = OrdersTotal() - 1; + for (int l_pos_32 = li_28; l_pos_32 >= 0; l_pos_32--) { + if (!OrderSelect(l_pos_32, SELECT_BY_POS, MODE_TRADES)) { + if (WriteLog) Print(StringConcatenate("SetOrderLevels: OrderSelect() error = ", ErrorDescription(GetLastError()))); + } else { + if (OrderMagicNumber() == a_magic_16) { + if (OrderSymbol() == g_symbol_416) { + l_cmd_36 = OrderType(); + ld_40 = NormalizeDouble(OrderClosePrice(), Digits); + l_price_48 = NormalizeDouble(OrderOpenPrice(), Digits); + if (l_cmd_36 > OP_SELL) + if (NormalizeDouble(MathAbs(l_price_48 - ld_40), Digits) <= ld_20) continue; + ld_56 = NormalizeDouble(OrderStopLoss(), Digits); + ld_64 = NormalizeDouble(OrderTakeProfit(), Digits); + li_72 = FALSE; + if (ld_56 == 0.0) { + if (ad_8 < 0.0) { + if (l_cmd_36 % 2 == 0) { + l_price_76 = NormalizeDouble(l_price_48 + ad_8, Digits); + if (NormalizeDouble(ld_40 - l_price_76, Digits) > ld_20) li_72 = TRUE; + else l_price_76 = ld_56; + } else { + l_price_76 = NormalizeDouble(l_price_48 - ad_8, Digits); + if (NormalizeDouble(l_price_76 - ld_40, Digits) > ld_20) li_72 = TRUE; + else l_price_76 = ld_56; + } + } else l_price_76 = ld_56; + } else l_price_76 = ld_56; + li_84 = FALSE; + if (ld_64 == 0.0) { + if (ad_0 > 0.0) { + if (l_cmd_36 % 2 == 0) { + l_price_88 = NormalizeDouble(l_price_48 + ad_0, Digits); + if (NormalizeDouble(l_price_88 - ld_40, Digits) > ld_20) li_84 = TRUE; + else l_price_88 = ld_64; + } else { + l_price_88 = NormalizeDouble(l_price_48 - ad_0, Digits); + if (NormalizeDouble(ld_40 - l_price_88, Digits) > ld_20) li_84 = TRUE; + else l_price_88 = ld_64; + } + } else l_price_88 = ld_64; + } else l_price_88 = ld_64; + if (li_72 || li_84) { + while (!IsTradeAllowed()) Sleep(1000); + l_bool_96 = OrderModify(OrderTicket(), l_price_48, l_price_76, l_price_88, 0, CLR_NONE); + if (!l_bool_96) + if (WriteLog) Print(StringConcatenate("SetOrderLevels: OrderModify(", OrderTypeToStr(OrderType()), ") error = ", ErrorDescription(GetLastError()))); + } + } + } + } + } +} + +void WatchOrderLevels(double ad_0, double ad_8, int a_magic_16) { + double ld_28; + double ld_36; + double ld_44; + if (ad_0 <= 0.0 && ad_8 >= 0.0) return; + int li_20 = OrdersTotal() - 1; + for (int l_pos_24 = li_20; l_pos_24 >= 0; l_pos_24--) { + if (!OrderSelect(l_pos_24, SELECT_BY_POS, MODE_TRADES)) { + if (WriteLog) Print(StringConcatenate("WatchOrderLevels: OrderSelect() error = ", ErrorDescription(GetLastError()))); + } else { + if (OrderMagicNumber() == a_magic_16) { + if (OrderType() <= OP_SELL) { + if (OrderSymbol() == g_symbol_416) { + ld_28 = NormalizeDouble(OrderClosePrice(), Digits); + ld_36 = NormalizeDouble(OrderOpenPrice(), Digits); + if (OrderType() == OP_BUY) { + ld_44 = NormalizeDouble(ld_28 - ld_36, Digits); + if ((ad_0 > 0.0 && ld_44 >= ad_0) || (ad_8 < 0.0 && ld_44 <= ad_8)) { + if (WriteLog) Print("WatchOrderLevels: level for close BUY"); + CloseOrder(OrderTicket(), OrderLots(), 0, g_slippage_356); + } + } else { + ld_44 = NormalizeDouble(ld_36 - ld_28, Digits); + if ((ad_0 > 0.0 && ld_44 >= ad_0) || (ad_8 < 0.0 && ld_44 <= ad_8)) { + if (WriteLog) Print("WatchOrderLevels: level for close SELL"); + CloseOrder(OrderTicket(), OrderLots(), 1, g_slippage_356); + } + } + } + } + } + } + } +} + +double LotsOptimized(int ai_unused_0) { + double ld_ret_4; + double ld_12; + double ld_20; + if (!UseMM) ld_ret_4 = Lots; + else { + ld_12 = AccountFreeMargin() * gd_408 / 100.0; + ld_20 = MarketInfo(g_symbol_416, MODE_MARGINREQUIRED) * g_lotstep_400; + ld_ret_4 = NormalizeDouble(MathFloor(ld_12 / ld_20) * g_lotstep_400, gi_348); + } + if (ld_ret_4 > MaxLots) ld_ret_4 = MaxLots; + if (ld_ret_4 < g_minlot_376) ld_ret_4 = g_minlot_376; + if (ld_ret_4 > g_maxlot_368) ld_ret_4 = g_maxlot_368; + return (ld_ret_4); +} + +int OpenOrder(int a_cmd_0, int a_magic_4, string a_comment_8, double ad_16, double a_price_24 = 0.0) { + color l_color_36; + int l_ticket_72; + int l_error_76; + double ld_80; + if (a_cmd_0 > OP_SELL && a_price_24 == 0.0) return (-1); + int l_cmd_32 = a_cmd_0 % 2; + if (ad_16 < g_minlot_376) ad_16 = g_minlot_376; + else + if (ad_16 > g_maxlot_368) ad_16 = g_maxlot_368; + if (AccountFreeMarginCheck(g_symbol_416, l_cmd_32, ad_16) <= 0.0 || GetLastError() == 134/* NOT_ENOUGH_MONEY */) { + if (WriteLog) Print("OpenOrder: you don\'t have free margin."); + return (-1); + } + if (l_cmd_32 == OP_BUY) l_color_36 = ColorBuy; + else l_color_36 = ColorSell; + RefreshRates(); + double ld_40 = NormalizeDouble(MarketInfo(g_symbol_416, MODE_STOPLEVEL) * Point, Digits); + double ld_48 = NormalizeDouble(Ask, Digits); + double ld_56 = NormalizeDouble(Bid, Digits); + switch (a_cmd_0) { + case OP_BUY: + a_price_24 = ld_48; + break; + case OP_SELL: + a_price_24 = ld_56; + break; + case OP_BUYLIMIT: + if (a_price_24 >= ld_48) { + a_price_24 = ld_48; + a_cmd_0 = 0; + } else + if (NormalizeDouble(ld_48 - a_price_24, Digits) < ld_40) return (-1); + break; + case OP_SELLLIMIT: + if (a_price_24 <= ld_56) { + a_price_24 = ld_56; + a_cmd_0 = 1; + } else + if (NormalizeDouble(a_price_24 - ld_56, Digits) < ld_40) return (-1); + break; + case OP_BUYSTOP: + if (a_price_24 <= ld_48) { + a_price_24 = ld_48; + a_cmd_0 = 0; + } else + if (NormalizeDouble(a_price_24 - ld_48, Digits) < ld_40) return (-1); + break; + case OP_SELLSTOP: + if (a_price_24 >= ld_56) { + a_price_24 = ld_56; + a_cmd_0 = 1; + } else + if (NormalizeDouble(ld_56 - a_price_24, Digits) < ld_40) return (-1); + break; + default: + return (-1); + } + int li_68 = gi_320; + while (li_68 > 0) { + while (!IsTradeAllowed()) Sleep(1000); + l_ticket_72 = OrderSend(g_symbol_416, a_cmd_0, ad_16, a_price_24, g_slippage_356, 0, 0, a_comment_8, a_magic_4, 0, l_color_36); + Sleep(MathRand() / 1000); + if (l_ticket_72 < 0) { + l_error_76 = GetLastError(); + if (WriteLog) { + Print("OpenOrder: OrderSend(", OrderTypeToStr(a_cmd_0), ") error = ", ErrorDescription(l_error_76)); + Print("OpenOrder: order ", g_symbol_416, " ", OrderTypeToStr(a_cmd_0), " lot = ", DoubleToStr(ad_16, 8), " op = ", DoubleToStr(a_price_24, 8), " slippage = ", g_slippage_356); + } + if (l_error_76 != 136/* OFF_QUOTES */) break; + if (!(gi_316)) break; + Sleep(6000); + RefreshRates(); + if (a_cmd_0 == OP_BUY) ld_80 = NormalizeDouble(Ask, Digits); + else ld_80 = NormalizeDouble(Bid, Digits); + if (NormalizeDouble(MathAbs((ld_80 - a_price_24) / gd_360), 0) > gi_324) break; + a_price_24 = ld_80; + li_68--; + if (li_68 > 0) + if (WriteLog) Print("... Possible to open order."); + ad_16 = NormalizeDouble(ad_16 / 2.0, gi_348); + if (ad_16 < g_minlot_376) ad_16 = g_minlot_376; + } else { + if (OrderSelect(l_ticket_72, SELECT_BY_TICKET)) a_price_24 = OrderOpenPrice(); + if (SendEmail) { + SendMail(gs_336, StringConcatenate("GPS Forex Robot trade Information\nCurrency Pair: ", StringSubstr(g_symbol_416, 0, 6), + "\nTime: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS), + "\nOrder Type: ", OrderTypeToStr(a_cmd_0), + "\nPrice: ", DoubleToStr(a_price_24, Digits), + "\nLot size: ", DoubleToStr(ad_16, gi_348), + "\nEvent: Trade Opened", + "\n\nCurrent Balance: ", DoubleToStr(AccountBalance(), 2), " ", gs_424, + "\nCurrent Equity: ", DoubleToStr(AccountEquity(), 2), " ", gs_424)); + } + if (!(SoundAlert)) break; + PlaySound(SoundFileAtOpen); + break; + } + } + return (l_ticket_72); +} + +int CloseOrder(int a_ticket_0, double a_lots_4, int ai_12, int a_slippage_16) { + color l_color_20; + double l_price_40; + bool l_ord_close_48; + int l_error_52; + bool li_56; + if (ai_12 == 0) l_color_20 = ColorBuy; + else l_color_20 = ColorSell; + int l_count_24 = 0; + int l_count_28 = 0; + int l_count_32 = 0; + int l_count_36 = 0; + while (true) { + while (!IsTradeAllowed()) Sleep(1000); + RefreshRates(); + if (ai_12 == 0) l_price_40 = NormalizeDouble(Bid, Digits); + else l_price_40 = NormalizeDouble(Ask, Digits); + l_ord_close_48 = OrderClose(a_ticket_0, a_lots_4, l_price_40, a_slippage_16, l_color_20); + if (!l_ord_close_48) { + l_error_52 = GetLastError(); + if (WriteLog) Print(StringConcatenate("OrderClose(", OrderTypeToStr(ai_12), ",", DoubleToStr(a_ticket_0, 0), ") error = ", ErrorDescription(l_error_52))); + li_56 = FALSE; + switch (l_error_52) { + case 0/* NO_ERROR */: + Sleep(10000); + if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) + if (OrderCloseTime() == 0) li_56 = TRUE; + break; + case 1/* NO_RESULT */: break; + case 2/* COMMON_ERROR */: break; + case 3/* INVALID_TRADE_PARAMETERS */: break; + case 4/* SERVER_BUSY */: break; + case 5/* OLD_VERSION */: break; + case 6/* NO_CONNECTION */: + Sleep(10000); + if (IsConnected()) li_56 = TRUE; + break; + case 7/* NOT_ENOUGH_RIGHTS */: break; + case 8/* TOO_FREQUENT_REQUESTS */: break; + case 9/* MALFUNCTIONAL_TRADE */: break; + case 64/* ACCOUNT_DISABLED */: break; + case 65/* INVALID_ACCOUNT */: break; + case 128/* TRADE_TIMEOUT */: + Sleep(70000); + if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) + if (OrderCloseTime() == 0) li_56 = TRUE; + break; + case 129/* INVALID_PRICE */: + Sleep(6000); + l_count_24++; + if (l_count_24 <= 3) li_56 = TRUE; + break; + case 130/* INVALID_STOPS */: + Sleep(6000); + l_count_28++; + if (l_count_28 <= 3) li_56 = TRUE; + break; + case 131/* INVALID_TRADE_VOLUME */: break; + case 132/* MARKET_CLOSED */: break; + case 133/* TRADE_DISABLED */: break; + case 134/* NOT_ENOUGH_MONEY */: break; + case 135/* PRICE_CHANGED */: + li_56 = TRUE; + break; + case 136/* OFF_QUOTES */: + Sleep(6000); + li_56 = TRUE; + break; + case 137/* BROKER_BUSY */: + Sleep(20000); + l_count_32++; + if (l_count_32 <= 3) li_56 = TRUE; + break; + case 138/* REQUOTE */: + l_count_36++; + if (l_count_36 <= 3) li_56 = TRUE; + break; + case 139/* ORDER_LOCKED */: break; + case 140/* LONG_POSITIONS_ONLY_ALLOWED */: break; + case 141/* TOO_MANY_REQUESTS */: break; + case 142: + Sleep(70000); + if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) + if (OrderCloseTime() == 0) li_56 = TRUE; + break; + case 143: + Sleep(70000); + if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) + if (OrderCloseTime() == 0) li_56 = TRUE; + break; + case 144: break; + case 145/* TRADE_MODIFY_DENIED */: + Sleep(20000); + li_56 = TRUE; + break; + case 146/* TRADE_CONTEXT_BUSY */: + while (IsTradeContextBusy()) Sleep(1000); + li_56 = TRUE; + break; + case 147/* ERR_TRADE_EXPIRATION_DENIED */: break; + case 148/* ERR_TRADE_TOO_MANY_ORDERS */: break; + case 149/* ? */: break; + case 150: break; + case 4000/* NO_MQLERROR */: + Sleep(10000); + if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) + if (OrderCloseTime() == 0) li_56 = TRUE; + case 4051/* INVALID_FUNCTION_PARAMETER_VALUE */: break; + case 4062/* STRING_PARAMETER_EXPECTED */: break; + case 4063/* INTEGER_PARAMETER_EXPECTED */: break; + case 4064/* DOUBLE_PARAMETER_EXPECTED */: break; + case 4105/* NO_ORDER_SELECTED */: break; + case 4106/* UNKNOWN_SYMBOL */: break; + case 4107/* INVALID_PRICE_PARAM */: break; + case 4108/* INVALID_TICKET */: break; + case 4109/* TRADE_NOT_ALLOWED */: break; + case 4110/* LONGS__NOT_ALLOWED */: break; + case 4111/* SHORTS_NOT_ALLOWED */: break; + } + if (!(li_56)) break; + continue; + } + if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) l_price_40 = OrderClosePrice(); + if (SendEmail) { + SendMail(gs_336, StringConcatenate("GPS Forex Robot trade Information\nCurrency Pair: ", StringSubstr(g_symbol_416, 0, 6), + "\nTime: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS), + "\nOrder Type: ", OrderTypeToStr(ai_12), + "\nPrice: ", DoubleToStr(l_price_40, Digits), + "\nLot size: ", DoubleToStr(a_lots_4, gi_348), + "\nEvent: Trade Closed", + "\n\nCurrent Balance: ", DoubleToStr(AccountBalance(), 2), " ", gs_424, + "\nCurrent Equity: ", DoubleToStr(AccountEquity(), 2), " ", gs_424)); + } + if (!(SoundAlert)) break; + PlaySound(SoundFileAtClose); + break; + } + return (l_ord_close_48); +} + +int HaveOrdersInDay(int a_cmd_0, int a_magic_4, int ai_8) { + int l_cmd_24; + int l_count_12 = 0; + int li_16 = OrdersTotal() - 1; + for (int l_pos_20 = li_16; l_pos_20 >= 0; l_pos_20--) { + if (!OrderSelect(l_pos_20, SELECT_BY_POS, MODE_TRADES)) { + if (WriteLog) Print(StringConcatenate("HaveOrdersInDay: OrderSelect() error = ", ErrorDescription(GetLastError()))); + } else { + if (OrderMagicNumber() == a_magic_4) { + if (OrderSymbol() == g_symbol_416) { + l_cmd_24 = OrderType(); + if (a_cmd_0 == -4) { + if (l_cmd_24 % 2 != 0) continue; + } else { + if (a_cmd_0 == -5) { + if (l_cmd_24 % 2 != 1) continue; + } else { + if (a_cmd_0 == -3) { + if (l_cmd_24 <= OP_SELL) continue; + } else { + if (a_cmd_0 == -2) { + if (l_cmd_24 > OP_SELL) continue; + } else { + if (a_cmd_0 >= OP_BUY) + if (l_cmd_24 != a_cmd_0) continue; + } + } + } + } + if (OrderOpenTime() >= ai_8) l_count_12++; + } + } + } + } + if (l_count_12 == 0) { + li_16 = OrdersHistoryTotal() - 1; + for (l_pos_20 = li_16; l_pos_20 >= 0; l_pos_20--) { + if (!OrderSelect(l_pos_20, SELECT_BY_POS, MODE_HISTORY)) { + if (WriteLog) Print(StringConcatenate("HaveOrdersInDay: OrderSelect_2() error = ", ErrorDescription(GetLastError()))); + } else { + if (OrderMagicNumber() == a_magic_4) { + if (OrderSymbol() == g_symbol_416) { + l_cmd_24 = OrderType(); + if (a_cmd_0 == -4) { + if (l_cmd_24 % 2 != 0) continue; + } else { + if (a_cmd_0 == -5) { + if (l_cmd_24 % 2 != 1) continue; + } else { + if (a_cmd_0 == -3) { + if (l_cmd_24 <= OP_SELL) continue; + } else { + if (a_cmd_0 == -2) { + if (l_cmd_24 > OP_SELL) continue; + } else { + if (a_cmd_0 >= OP_BUY) + if (l_cmd_24 != a_cmd_0) continue; + } + } + } + } + if (OrderOpenTime() < ai_8) break; + l_count_12++; + } + } + } + } + } + return (l_count_12); +} + +void WatchReverseAfterSL(int ai_0) { + int l_magic_12; + int l_datetime_16; + double ld_20; + int li_4 = OrdersHistoryTotal() - 1; + for (int l_pos_8 = li_4; l_pos_8 >= 0; l_pos_8--) { + if (!OrderSelect(l_pos_8, SELECT_BY_POS, MODE_HISTORY)) { + if (WriteLog) Print(StringConcatenate("WatchReverseAfterSL: OrderSelect() error = ", ErrorDescription(GetLastError()))); + } else { + l_magic_12 = OrderMagicNumber(); + if (l_magic_12 == gia_484[ai_0]) break; + if (l_magic_12 == gia_460[ai_0]) { + if (OrderSymbol() == g_symbol_416) { + if (OrderProfit() >= 0.0) break; + l_datetime_16 = OrderCloseTime(); + if (TimeHour(l_datetime_16) != Hour()) break; + if (TimeMinute(l_datetime_16) != Minute()) break; + if (TimeDay(l_datetime_16) != Day()) break; + if (TimeMonth(l_datetime_16) != Month()) break; + ld_20 = NormalizeDouble(OrderLots() * gda_480[ai_0], gi_348); + if (ld_20 > MaxLots) ld_20 = MaxLots; + if (ld_20 < g_minlot_376) ld_20 = g_minlot_376; + if (ld_20 > g_maxlot_368) ld_20 = g_maxlot_368; + OpenOrder(MathAbs(gia_464[ai_0] - 1), gia_484[ai_0], ExpertComment, ld_20); + return; + } + } + } + } +} + +bool AutoGMTOffset(int &ai_0) { + int li_4 = GetGMT(); + if (li_4 < 0) return (FALSE); + int li_8 = TimeCurrent() - li_4; + ai_0 = MathFloor((li_8 + 1800) / 3600); + return (TRUE); +} + +int SetCommentPrint(string as_0, string as_8 = "") { + Comment("\n\n" + "GPS FOREX ROBOT" + + "\n" + + "www.gpsforexrobot.com" + + "\n\n" + as_0); + if (as_8 != "") { + if (as_8 == "comment") Print(as_0); + else Print(as_8); + } + return (1); +} + +int PrintInformation() { + string ls_0; + if (gi_496 == 1) { + if (IsDemo()) ls_0 = "Demo"; + else ls_0 = "Real"; + SetCommentPrint("AUTHENTICATION STATUS: " + + "\n" + + gs_520 + + "\n" + + "---------------------------------------------------" + + "\n" + + "GENERAL INFORMATION:" + + "\n" + + "Broker Company: " + AccountCompany() + + "\n" + + "Terminal Company: " + TerminalCompany() + + "\n" + + "Server Name: " + AccountServer() + + "\n" + + "Current Server Time: " + TimeToStr(TimeCurrent(), TIME_SECONDS) + + "\n" + + "---------------------------------------------------" + + "\n" + + "ACCOUNT INFORMATION:" + + "\n" + + "Account Name: " + AccountName() + + "\n" + + "Account Number: " + AccountNumber() + + "\n" + + "Account Type: " + ls_0 + + "\n" + + "Account Leverage: 1:" + DoubleToStr(AccountLeverage(), 0) + + "\n" + + "Account Balance: " + DoubleToStr(AccountBalance(), 2) + + "\n" + + "Account Equity: " + DoubleToStr(AccountEquity(), 2) + + "\n" + + "Account Floating P/L: " + DoubleToStr(AccountProfit(), 2) + + "\n" + + "Account Currency: " + AccountCurrency() + + "\n" + + "---------------------------------------------------" + + "\n" + + "ADDITIONAL INFORMATION:" + + "\n" + + "Current Spread: " + DoubleToStr(gd_384, Digits - gi_352) + + "\n" + + "Maximum Spread: " + DoubleToStr(gd_392, Digits - gi_352) + + "\n" + + "Free Margin: " + DoubleToStr(AccountFreeMargin(), 2) + + "\n" + + "Used Margin: " + DoubleToStr(AccountMargin(), 2) + + "\n" + + "---------------------------------------------------" + + "\n" + + "GMT SETTINGS:" + + "\n" + + "GMT Offset: " + gs_512); + } else { + if (!gi_536) { + SetCommentPrint("AUTHENTICATION STATUS: " + + "\n" + + gs_520, gs_528); + gi_536 = TRUE; + } + } + return (0); +} + +int SetVariables() { + gda_508[16] = 1.00000000; + gda_508[17] = 2.00000000; + gda_508[18] = 86.50000000; + gda_508[19] = 3.00000000; + gda_508[20] = 23.00000000; + gda_508[21] = 0.00000000; + gda_508[22] = 0.00000000; + gda_508[23] = 0.00000000; + gda_508[24] = 1.00000000; + gda_508[25] = 1.00000000; + gda_508[26] = 1.00000000; + gda_508[27] = 1.00000000; + gda_508[28] = 0.00000000; + gda_508[29] = -2.00000000; + gda_508[30] = 1.00000000; + gda_508[31] = 220.00000000; + gda_508[32] = 14.60000000; + gda_508[33] = 6.00000000; + + if (gda_508[16] == 1.0) gi_160 = TRUE; + else gi_160 = FALSE; + gi_164 = gda_508[17]; + gd_172 = gda_508[18]; + gd_180 = gda_508[19]; + gi_188 = gda_508[20]; + gi_192 = gda_508[21]; + if (gda_508[22] == 1.0) gi_196 = TRUE; + else gi_196 = FALSE; + if (gda_508[23] == 1.0) gi_200 = TRUE; + else gi_200 = FALSE; + if (GMTOffset <= 0) { + if (gda_508[24] == 1.0) gi_200 = TRUE; + else gi_200 = FALSE; + } + if (gda_508[25] == 1.0) gi_204 = TRUE; + else gi_204 = FALSE; + if (gda_508[26] == 1.0) gi_208 = TRUE; + else gi_208 = FALSE; + if (gda_508[27] == 1.0) gi_212 = TRUE; + else gi_212 = FALSE; + if (GMTOffset <= 0) { + if (gda_508[28] == 1.0) gi_212 = TRUE; + else gi_212 = FALSE; + } + gi_216 = gda_508[29]; + if (gda_508[30] == 1.0) gi_220 = TRUE; + else gi_220 = FALSE; + gd_232 = gda_508[31]; + gd_240 = gda_508[32]; + gd_248 = gda_508[33]; + gba_432[0] = gi_168; + gda_436[0] = NormalizeDouble((-1.0 * gd_172) * gd_360, Digits); + gda_440[0] = NormalizeDouble(gd_180 * gd_360, Digits); + gia_444[0] = GetGMTCorrection(gi_188); + gia_448[0] = gi_192; + gba_452[0][0] = gi_196; + gba_452[0][1] = gi_200; + gba_452[0][2] = gi_204; + gba_452[0][3] = gi_208; + gba_452[0][4] = gi_212; + gia_456[0] = gi_216; + gia_464[0] = gi_220; + gia_460[0] = gi_224; + gba_468[0] = gi_228; + gda_472[0] = NormalizeDouble((-1.0 * gd_232) * gd_360, Digits); + gda_476[0] = NormalizeDouble(gd_240 * gd_360, Digits); + gda_480[0] = gd_248; + gia_484[0] = gi_256; + return (1); +} + +int Authentication() { +/* + gi_496 = GPSForexRobot(gda_508, EMail, CBReceipt, IsDemo(), AccountNumber()); + if (gi_496 == -1) { + gs_520 = "Authentication Failed [Invalid Internet Connection]\n[Trades are not available]"; + gs_528 = "Authentication Failed: [Invalid Internet Connection] [Trades are not available]"; + return (-1); + } + if (gi_496 == -2) { + gs_520 = "Authentication Failed [Invalid Internet Connection]\n[Trades are not available]"; + gs_528 = "Authentication Failed: [Invalid Internet Connection] [Trades are not available]"; + return (-2); + } + if (gi_496 == -3) { + gs_520 = "Authentication Failed [Wrong E-Mail or CBReceipt]\n[Trades are not available]"; + gs_528 = "Authentication Failed: [Wrong E-Mail or CBReceipt] [Trades are not available]"; + return (-2); + } + if (gi_496 == -4) { + gs_520 = "Authentication Failed [Invalid Real Money Account Number]\n[Trades are not available]"; + gs_528 = "Authentication Failed: [Invalid Real Money Account Number] [Trades are not available]"; + return (-2); + } + if (*/gi_496 = 1;/*) {*/ + SetVariables(); + gs_520 = "Authenticated [Trades are available]\nThank you for joining the GPS Robot Team!"; + gs_528 = "Authenticatd: [Trades are available]"; + return (1); +/* + } + return (0); +*/ +} + +int Rand(int ai_0) { + MathSrand(TimeLocal()); + return (MathRand() % ai_0); +} \ No newline at end of file diff --git a/GPSForexRobotEURUSD_edu.mq4 b/GPSForexRobotEURUSD_edu.mq4 new file mode 100644 index 0000000..022f544 --- /dev/null +++ b/GPSForexRobotEURUSD_edu.mq4 @@ -0,0 +1,1200 @@ +/* + Generated by EX4-TO-MQ4 decompiler V4.0.224.1 [] + Website: http://purebeam.biz + E-mail : purebeam@gmail.com +*/ +#property copyright "Copyright © 2010, GPSForexRobot.com" +#property link "http://gpsforexrobot.com/" + +#import "GPSForexRobotEURUSD.dll" +// int GPSForexRobot(double& a0[], string a1, string a2, int a3, int a4); + int GetGMT(); +#import + +extern string GPS_Forex_Robot_EURUSD = " "; +/* +extern string ____Authentication________ = "---------------------------------------------"; +extern string EMail = ""; +extern string CBReceipt = ""; +*/ +extern string ____Size_of_lots________ = "---------------------------------------------"; +extern bool UseMM = FALSE; +extern double Lots = 0.01; +extern double LotsRiskReductor = 10.0; +extern double MaxLots = 1000.0; +extern string ____General_Options_____ = "---------------------------------------------"; +extern bool AutoGMTOffset = TRUE; +extern int GMTOffset = 1; +bool gi_160 = FALSE; +int gi_164 = 2; +bool gi_168 = TRUE; +double gd_172 = 64.0; +double gd_180 = 8.0; +int gi_188 = 11; +int gi_192 = 0; +bool gi_196 = TRUE; +bool gi_200 = FALSE; +bool gi_204 = TRUE; +bool gi_208 = FALSE; +bool gi_212 = TRUE; +int gi_216 = -14; +int gi_220 = 0; +int gi_224 = 20100106; +bool gi_228 = TRUE; +double gd_232 = 53.0; +double gd_240 = 14.0; +double gd_248 = 3.0; +int gi_256 = 20100126; +extern string ____Others______________ = "---------------------------------------------"; +extern string ExpertComment = "GPS Forex Robot"; +extern color ColorBuy = Blue; +extern color ColorSell = Red; +extern bool SendEmail = FALSE; +extern bool SoundAlert = FALSE; +extern string SoundFileAtOpen = "alert.wav"; +extern string SoundFileAtClose = "alert.wav"; +extern bool WriteLog = FALSE; +extern bool WriteDebugLog = FALSE; +bool gi_316 = TRUE; +int gi_320 = 2; +int gi_324 = 1; +string gs_unused_328 = "New Trade Information"; +string gs_336 = "New Trade Information"; +int g_bool_344; +int gi_348; +int gi_352; +int g_slippage_356; +double gd_360; +double g_maxlot_368; +double g_minlot_376; +double gd_384; +double gd_392; +double g_lotstep_400; +double gd_408; +string g_symbol_416; +string gs_424; +bool gba_432[1]; +double gda_436[1]; +double gda_440[1]; +int gia_444[1]; +int gia_448[1]; +bool gba_452[1][5]; +int gia_456[1]; +int gia_460[1]; +int gia_464[1]; +bool gba_468[1]; +double gda_472[1]; +double gda_476[1]; +double gda_480[1]; +int gia_484[1]; +bool gi_488; +bool gi_492; +int gi_496 = 0; +bool gi_500 = FALSE; +int gi_504 = 0; +double gda_508[52] = {0}; +string gs_512 = ""; +string gs_520 = ""; +string gs_528 = ""; +bool gi_536 = FALSE; + +int init() { + gi_492 = TRUE; + if (!IsDllsAllowed()) { + SetCommentPrint("WARNING: Set Parameter \"AllowDLL Imports\" ON in menu Tools -> Options -> ExpertAdvisors.", "comment"); + gi_492 = FALSE; + return (0); + } + if (StringSubstr(Symbol(), 0, 6) != "EURUSD") { + SetCommentPrint("WARNING: Use GPS Forex Robot EURUSD only on EURUSD pair.", "comment"); + gi_492 = FALSE; + return (0); + } + if (IsTesting()) { + if (AutoGMTOffset) { + SetCommentPrint("WARNING: Automatic GMT offset calculation works only on live/demo trading " + "and should be set as FALSE for backtests - strategy testing.", "comment"); + gi_492 = FALSE; + return (0); + } + } + if (WriteDebugLog) { + WriteLog = TRUE; + Print("*************************** Initialization ***************************"); + } + g_symbol_416 = Symbol(); + g_maxlot_368 = MarketInfo(g_symbol_416, MODE_MAXLOT); + g_minlot_376 = MarketInfo(g_symbol_416, MODE_MINLOT); + g_lotstep_400 = MarketInfo(g_symbol_416, MODE_LOTSTEP); + if (g_lotstep_400 == 0.01) gi_348 = 2; + else { + if (g_lotstep_400 == 0.1) gi_348 = 1; + else { + if (g_lotstep_400 == 1.0) gi_348 = 0; + else { + if (g_lotstep_400 == 0.001) gi_348 = 3; + else gi_348 = 4; + } + } + } + double l_leverage_0 = AccountLeverage(); + gd_408 = NormalizeDouble(LotsRiskReductor * (100 / l_leverage_0), 2); + gs_424 = AccountCurrency(); + g_bool_344 = IsTesting(); + if (Digits < 4) { + gd_360 = 0.01; + gi_352 = 2; + } else { + gd_360 = 0.0001; + gi_352 = 4; + } + int li_8 = MathPow(10, Digits - gi_352); + g_slippage_356 = gi_164 * li_8; + gd_384 = MarketInfo(Symbol(), MODE_SPREAD) / MathPow(10, Digits - gi_352); + gd_392 = gd_384; + if (IsTesting()) { + Authentication(); + if (gi_496 != 1) { + PrintInformation(); + gi_492 = FALSE; + return (0); + } + } + gi_488 = TRUE; + return (0); +} + +int deinit() { + Comment(""); + if (WriteDebugLog) Print("*************************** Deinitialization ***************************"); + return (0); +} + +int start() { + double ld_24; + if (!gi_492) return (0); + int l_datetime_0 = TimeCurrent(); + if (!IsTesting()) { + if (gi_488) { + if (AutoGMTOffset) { + if (AutoGMTOffset(GMTOffset)) gs_512 = GMTOffset + " (automatic)"; + else gs_512 = "Error"; + } else gs_512 = GMTOffset + " (manual)"; + Authentication(); + gi_500 = TRUE; + gi_504 = l_datetime_0; + gi_488 = FALSE; + } + if (gi_500 == TRUE && gi_504 < l_datetime_0 - 60) { + gi_500 = FALSE; + gi_504 = l_datetime_0 + 60 * (780 - Rand(120)); + } + if (gi_500 == FALSE && l_datetime_0 >= gi_504) { + gi_500 = TRUE; + Authentication(); + } + PrintInformation(); + } + if (gi_496 != 1) return (0); + gd_384 = MarketInfo(Symbol(), MODE_SPREAD) / MathPow(10, Digits - gi_352); + if (gd_384 > gd_392) gd_392 = gd_384; + int l_datetime_4 = TimeCurrent(); + int li_8 = l_datetime_4 - 3600 * GMTOffset; + int l_day_of_week_12 = TimeDayOfWeek(l_datetime_4); + int l_datetime_16 = iTime(NULL, PERIOD_D1, 0); + for (int l_index_20 = 0; l_index_20 < 1; l_index_20++) { + if (gba_432[l_index_20]) { + if (!gi_160) SetOrderLevels(gda_440[l_index_20], gda_436[l_index_20], gia_460[l_index_20]); + WatchOrderLevels(gda_440[l_index_20], gda_436[l_index_20], gia_460[l_index_20]); + if (gba_468[l_index_20]) { + if (!gi_160) SetOrderLevels(gda_476[l_index_20], gda_472[l_index_20], gia_484[l_index_20]); + WatchOrderLevels(gda_476[l_index_20], gda_472[l_index_20], gia_484[l_index_20]); + if (HaveOrdersInDay(-2, gia_484[l_index_20], l_datetime_16) == 0) WatchReverseAfterSL(l_index_20); + } + if (l_day_of_week_12 <= 0 || l_day_of_week_12 > 5) continue; + if ((gba_452[l_index_20][l_day_of_week_12 - 1])) { + if (gia_444[l_index_20] != TimeHour(l_datetime_4) || gia_448[l_index_20] != TimeMinute(l_datetime_4)) continue; + if (HaveOrdersInDay(-2, gia_460[l_index_20], l_datetime_16) <= 0) { + ld_24 = LotsOptimized(gia_464[l_index_20]); + if (gia_456[l_index_20] >= 0) + if (l_day_of_week_12 == gia_456[l_index_20]) ld_24 = NormalizeDouble(2.0 * ld_24, gi_348); + OpenOrder(gia_464[l_index_20], gia_460[l_index_20], ExpertComment, ld_24); + } + } + } + } + return (0); +} + +string ErrorDescription(int ai_0) { + string ls_ret_8; + switch (ai_0) { + case 0: + case 1: + ls_ret_8 = "no error"; + break; + case 2: + ls_ret_8 = "common error"; + break; + case 3: + ls_ret_8 = "invalid trade parameters"; + break; + case 4: + ls_ret_8 = "trade server is busy"; + break; + case 5: + ls_ret_8 = "old version of the client terminal"; + break; + case 6: + ls_ret_8 = "no connection with trade server"; + break; + case 7: + ls_ret_8 = "not enough rights"; + break; + case 8: + ls_ret_8 = "too frequent requests"; + break; + case 9: + ls_ret_8 = "malfunctional trade operation (never returned error)"; + break; + case 64: + ls_ret_8 = "account disabled"; + break; + case 65: + ls_ret_8 = "invalid account"; + break; + case 128: + ls_ret_8 = "trade timeout"; + break; + case 129: + ls_ret_8 = "invalid price"; + break; + case 130: + ls_ret_8 = "invalid stops"; + break; + case 131: + ls_ret_8 = "invalid trade volume"; + break; + case 132: + ls_ret_8 = "market is closed"; + break; + case 133: + ls_ret_8 = "trade is disabled"; + break; + case 134: + ls_ret_8 = "not enough money"; + break; + case 135: + ls_ret_8 = "price changed"; + break; + case 136: + ls_ret_8 = "off quotes"; + break; + case 137: + ls_ret_8 = "broker is busy (never returned error)"; + break; + case 138: + ls_ret_8 = "requote"; + break; + case 139: + ls_ret_8 = "order is locked"; + break; + case 140: + ls_ret_8 = "long positions only allowed"; + break; + case 141: + ls_ret_8 = "too many requests"; + break; + case 145: + ls_ret_8 = "modification denied because order too close to market"; + break; + case 146: + ls_ret_8 = "trade context is busy"; + break; + case 147: + ls_ret_8 = "expirations are denied by broker"; + break; + case 148: + ls_ret_8 = "amount of open and pending orders has reached the limit"; + break; + case 149: + ls_ret_8 = "hedging is prohibited"; + break; + case 150: + ls_ret_8 = "prohibited by FIFO rules"; + break; + case 4000: + ls_ret_8 = "no error (never generated code)"; + break; + case 4001: + ls_ret_8 = "wrong function pointer"; + break; + case 4002: + ls_ret_8 = "array index is out of range"; + break; + case 4003: + ls_ret_8 = "no memory for function call stack"; + break; + case 4004: + ls_ret_8 = "recursive stack overflow"; + break; + case 4005: + ls_ret_8 = "not enough stack for parameter"; + break; + case 4006: + ls_ret_8 = "no memory for parameter string"; + break; + case 4007: + ls_ret_8 = "no memory for temp string"; + break; + case 4008: + ls_ret_8 = "not initialized string"; + break; + case 4009: + ls_ret_8 = "not initialized string in array"; + break; + case 4010: + ls_ret_8 = "no memory for array\' string"; + break; + case 4011: + ls_ret_8 = "too long string"; + break; + case 4012: + ls_ret_8 = "remainder from zero divide"; + break; + case 4013: + ls_ret_8 = "zero divide"; + break; + case 4014: + ls_ret_8 = "unknown command"; + break; + case 4015: + ls_ret_8 = "wrong jump (never generated error)"; + break; + case 4016: + ls_ret_8 = "not initialized array"; + break; + case 4017: + ls_ret_8 = "dll calls are not allowed"; + break; + case 4018: + ls_ret_8 = "cannot load library"; + break; + case 4019: + ls_ret_8 = "cannot call function"; + break; + case 4020: + ls_ret_8 = "expert function calls are not allowed"; + break; + case 4021: + ls_ret_8 = "not enough memory for temp string returned from function"; + break; + case 4022: + ls_ret_8 = "system is busy (never generated error)"; + break; + case 4050: + ls_ret_8 = "invalid function parameters count"; + break; + case 4051: + ls_ret_8 = "invalid function parameter value"; + break; + case 4052: + ls_ret_8 = "string function internal error"; + break; + case 4053: + ls_ret_8 = "some array error"; + break; + case 4054: + ls_ret_8 = "incorrect series array using"; + break; + case 4055: + ls_ret_8 = "custom indicator error"; + break; + case 4056: + ls_ret_8 = "arrays are incompatible"; + break; + case 4057: + ls_ret_8 = "global variables processing error"; + break; + case 4058: + ls_ret_8 = "global variable not found"; + break; + case 4059: + ls_ret_8 = "function is not allowed in testing mode"; + break; + case 4060: + ls_ret_8 = "function is not confirmed"; + break; + case 4061: + ls_ret_8 = "send mail error"; + break; + case 4062: + ls_ret_8 = "string parameter expected"; + break; + case 4063: + ls_ret_8 = "integer parameter expected"; + break; + case 4064: + ls_ret_8 = "double parameter expected"; + break; + case 4065: + ls_ret_8 = "array as parameter expected"; + break; + case 4066: + ls_ret_8 = "requested history data in update state"; + break; + case 4099: + ls_ret_8 = "end of file"; + break; + case 4100: + ls_ret_8 = "some file error"; + break; + case 4101: + ls_ret_8 = "wrong file name"; + break; + case 4102: + ls_ret_8 = "too many opened files"; + break; + case 4103: + ls_ret_8 = "cannot open file"; + break; + case 4104: + ls_ret_8 = "incompatible access to a file"; + break; + case 4105: + ls_ret_8 = "no order selected"; + break; + case 4106: + ls_ret_8 = "unknown symbol"; + break; + case 4107: + ls_ret_8 = "invalid price parameter for trade function"; + break; + case 4108: + ls_ret_8 = "invalid ticket"; + break; + case 4109: + ls_ret_8 = "trade is not allowed in the expert properties"; + break; + case 4110: + ls_ret_8 = "longs are not allowed in the expert properties"; + break; + case 4111: + ls_ret_8 = "shorts are not allowed in the expert properties"; + break; + case 4200: + ls_ret_8 = "object is already exist"; + break; + case 4201: + ls_ret_8 = "unknown object property"; + break; + case 4202: + ls_ret_8 = "object is not exist"; + break; + case 4203: + ls_ret_8 = "unknown object type"; + break; + case 4204: + ls_ret_8 = "no object name"; + break; + case 4205: + ls_ret_8 = "object coordinates error"; + break; + case 4206: + ls_ret_8 = "no specified subwindow"; + break; + default: + ls_ret_8 = "unknown error"; + } + return (ls_ret_8); +} + +string OrderTypeToStr(int ai_0) { + string ls_ret_8; + switch (ai_0) { + case 0: + ls_ret_8 = "Buy"; + break; + case 1: + ls_ret_8 = "Sell"; + break; + case 2: + ls_ret_8 = "BuyLimit"; + break; + case 3: + ls_ret_8 = "SellLimit"; + break; + case 4: + ls_ret_8 = "BuyStop"; + break; + case 5: + ls_ret_8 = "SellStop"; + break; + default: + ls_ret_8 = "Unknown"; + } + return (ls_ret_8); +} + +int GetGMTCorrection(int ai_0) { + ai_0 += GMTOffset; + while (true) { + if (ai_0 >= 24) { + ai_0 -= 24; + continue; + } + if (ai_0 >= 0) break; + ai_0 += 24; + } + return (ai_0); +} + +void SetOrderLevels(double ad_0, double ad_8, int a_magic_16) { + int l_cmd_36; + double ld_40; + double l_price_48; + double ld_56; + double ld_64; + bool li_72; + double l_price_76; + bool li_84; + double l_price_88; + bool l_bool_96; + double ld_20 = NormalizeDouble(MarketInfo(g_symbol_416, MODE_STOPLEVEL) * Point, Digits); + int li_28 = OrdersTotal() - 1; + for (int l_pos_32 = li_28; l_pos_32 >= 0; l_pos_32--) { + if (!OrderSelect(l_pos_32, SELECT_BY_POS, MODE_TRADES)) { + if (WriteLog) Print(StringConcatenate("SetOrderLevels: OrderSelect() error = ", ErrorDescription(GetLastError()))); + } else { + if (OrderMagicNumber() == a_magic_16) { + if (OrderSymbol() == g_symbol_416) { + l_cmd_36 = OrderType(); + ld_40 = NormalizeDouble(OrderClosePrice(), Digits); + l_price_48 = NormalizeDouble(OrderOpenPrice(), Digits); + if (l_cmd_36 > OP_SELL) + if (NormalizeDouble(MathAbs(l_price_48 - ld_40), Digits) <= ld_20) continue; + ld_56 = NormalizeDouble(OrderStopLoss(), Digits); + ld_64 = NormalizeDouble(OrderTakeProfit(), Digits); + li_72 = FALSE; + if (ld_56 == 0.0) { + if (ad_8 < 0.0) { + if (l_cmd_36 % 2 == 0) { + l_price_76 = NormalizeDouble(l_price_48 + ad_8, Digits); + if (NormalizeDouble(ld_40 - l_price_76, Digits) > ld_20) li_72 = TRUE; + else l_price_76 = ld_56; + } else { + l_price_76 = NormalizeDouble(l_price_48 - ad_8, Digits); + if (NormalizeDouble(l_price_76 - ld_40, Digits) > ld_20) li_72 = TRUE; + else l_price_76 = ld_56; + } + } else l_price_76 = ld_56; + } else l_price_76 = ld_56; + li_84 = FALSE; + if (ld_64 == 0.0) { + if (ad_0 > 0.0) { + if (l_cmd_36 % 2 == 0) { + l_price_88 = NormalizeDouble(l_price_48 + ad_0, Digits); + if (NormalizeDouble(l_price_88 - ld_40, Digits) > ld_20) li_84 = TRUE; + else l_price_88 = ld_64; + } else { + l_price_88 = NormalizeDouble(l_price_48 - ad_0, Digits); + if (NormalizeDouble(ld_40 - l_price_88, Digits) > ld_20) li_84 = TRUE; + else l_price_88 = ld_64; + } + } else l_price_88 = ld_64; + } else l_price_88 = ld_64; + if (li_72 || li_84) { + while (!IsTradeAllowed()) Sleep(1000); + l_bool_96 = OrderModify(OrderTicket(), l_price_48, l_price_76, l_price_88, 0, CLR_NONE); + if (!l_bool_96) + if (WriteLog) Print(StringConcatenate("SetOrderLevels: OrderModify(", OrderTypeToStr(OrderType()), ") error = ", ErrorDescription(GetLastError()))); + } + } + } + } + } +} + +void WatchOrderLevels(double ad_0, double ad_8, int a_magic_16) { + double ld_28; + double ld_36; + double ld_44; + if (ad_0 <= 0.0 && ad_8 >= 0.0) return; + int li_20 = OrdersTotal() - 1; + for (int l_pos_24 = li_20; l_pos_24 >= 0; l_pos_24--) { + if (!OrderSelect(l_pos_24, SELECT_BY_POS, MODE_TRADES)) { + if (WriteLog) Print(StringConcatenate("WatchOrderLevels: OrderSelect() error = ", ErrorDescription(GetLastError()))); + } else { + if (OrderMagicNumber() == a_magic_16) { + if (OrderType() <= OP_SELL) { + if (OrderSymbol() == g_symbol_416) { + ld_28 = NormalizeDouble(OrderClosePrice(), Digits); + ld_36 = NormalizeDouble(OrderOpenPrice(), Digits); + if (OrderType() == OP_BUY) { + ld_44 = NormalizeDouble(ld_28 - ld_36, Digits); + if ((ad_0 > 0.0 && ld_44 >= ad_0) || (ad_8 < 0.0 && ld_44 <= ad_8)) { + if (WriteLog) Print("WatchOrderLevels: level for close BUY"); + CloseOrder(OrderTicket(), OrderLots(), 0, g_slippage_356); + } + } else { + ld_44 = NormalizeDouble(ld_36 - ld_28, Digits); + if ((ad_0 > 0.0 && ld_44 >= ad_0) || (ad_8 < 0.0 && ld_44 <= ad_8)) { + if (WriteLog) Print("WatchOrderLevels: level for close SELL"); + CloseOrder(OrderTicket(), OrderLots(), 1, g_slippage_356); + } + } + } + } + } + } + } +} + +double LotsOptimized(int ai_unused_0) { + double ld_ret_4; + double ld_12; + double ld_20; + if (!UseMM) ld_ret_4 = Lots; + else { + ld_12 = AccountFreeMargin() * gd_408 / 100.0; + ld_20 = MarketInfo(g_symbol_416, MODE_MARGINREQUIRED) * g_lotstep_400; + ld_ret_4 = NormalizeDouble(MathFloor(ld_12 / ld_20) * g_lotstep_400, gi_348); + } + if (ld_ret_4 > MaxLots) ld_ret_4 = MaxLots; + if (ld_ret_4 < g_minlot_376) ld_ret_4 = g_minlot_376; + if (ld_ret_4 > g_maxlot_368) ld_ret_4 = g_maxlot_368; + return (ld_ret_4); +} + +int OpenOrder(int a_cmd_0, int a_magic_4, string a_comment_8, double ad_16, double a_price_24 = 0.0) { + color l_color_36; + int l_ticket_72; + int l_error_76; + double ld_80; + if (a_cmd_0 > OP_SELL && a_price_24 == 0.0) return (-1); + int l_cmd_32 = a_cmd_0 % 2; + if (ad_16 < g_minlot_376) ad_16 = g_minlot_376; + else + if (ad_16 > g_maxlot_368) ad_16 = g_maxlot_368; + if (AccountFreeMarginCheck(g_symbol_416, l_cmd_32, ad_16) <= 0.0 || GetLastError() == 134/* NOT_ENOUGH_MONEY */) { + if (WriteLog) Print("OpenOrder: you don\'t have free margin."); + return (-1); + } + if (l_cmd_32 == OP_BUY) l_color_36 = ColorBuy; + else l_color_36 = ColorSell; + RefreshRates(); + double ld_40 = NormalizeDouble(MarketInfo(g_symbol_416, MODE_STOPLEVEL) * Point, Digits); + double ld_48 = NormalizeDouble(Ask, Digits); + double ld_56 = NormalizeDouble(Bid, Digits); + switch (a_cmd_0) { + case OP_BUY: + a_price_24 = ld_48; + break; + case OP_SELL: + a_price_24 = ld_56; + break; + case OP_BUYLIMIT: + if (a_price_24 >= ld_48) { + a_price_24 = ld_48; + a_cmd_0 = 0; + } else + if (NormalizeDouble(ld_48 - a_price_24, Digits) < ld_40) return (-1); + break; + case OP_SELLLIMIT: + if (a_price_24 <= ld_56) { + a_price_24 = ld_56; + a_cmd_0 = 1; + } else + if (NormalizeDouble(a_price_24 - ld_56, Digits) < ld_40) return (-1); + break; + case OP_BUYSTOP: + if (a_price_24 <= ld_48) { + a_price_24 = ld_48; + a_cmd_0 = 0; + } else + if (NormalizeDouble(a_price_24 - ld_48, Digits) < ld_40) return (-1); + break; + case OP_SELLSTOP: + if (a_price_24 >= ld_56) { + a_price_24 = ld_56; + a_cmd_0 = 1; + } else + if (NormalizeDouble(ld_56 - a_price_24, Digits) < ld_40) return (-1); + break; + default: + return (-1); + } + int li_68 = gi_320; + while (li_68 > 0) { + while (!IsTradeAllowed()) Sleep(1000); + l_ticket_72 = OrderSend(g_symbol_416, a_cmd_0, ad_16, a_price_24, g_slippage_356, 0, 0, a_comment_8, a_magic_4, 0, l_color_36); + Sleep(MathRand() / 1000); + if (l_ticket_72 < 0) { + l_error_76 = GetLastError(); + if (WriteLog) { + Print("OpenOrder: OrderSend(", OrderTypeToStr(a_cmd_0), ") error = ", ErrorDescription(l_error_76)); + Print("OpenOrder: order ", g_symbol_416, " ", OrderTypeToStr(a_cmd_0), " lot = ", DoubleToStr(ad_16, 8), " op = ", DoubleToStr(a_price_24, 8), " slippage = ", g_slippage_356); + } + if (l_error_76 != 136/* OFF_QUOTES */) break; + if (!(gi_316)) break; + Sleep(6000); + RefreshRates(); + if (a_cmd_0 == OP_BUY) ld_80 = NormalizeDouble(Ask, Digits); + else ld_80 = NormalizeDouble(Bid, Digits); + if (NormalizeDouble(MathAbs((ld_80 - a_price_24) / gd_360), 0) > gi_324) break; + a_price_24 = ld_80; + li_68--; + if (li_68 > 0) + if (WriteLog) Print("... Possible to open order."); + ad_16 = NormalizeDouble(ad_16 / 2.0, gi_348); + if (ad_16 < g_minlot_376) ad_16 = g_minlot_376; + } else { + if (OrderSelect(l_ticket_72, SELECT_BY_TICKET)) a_price_24 = OrderOpenPrice(); + if (SendEmail) { + SendMail(gs_336, StringConcatenate("GPS Forex Robot trade Information\nCurrency Pair: ", StringSubstr(g_symbol_416, 0, 6), + "\nTime: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS), + "\nOrder Type: ", OrderTypeToStr(a_cmd_0), + "\nPrice: ", DoubleToStr(a_price_24, Digits), + "\nLot size: ", DoubleToStr(ad_16, gi_348), + "\nEvent: Trade Opened", + "\n\nCurrent Balance: ", DoubleToStr(AccountBalance(), 2), " ", gs_424, + "\nCurrent Equity: ", DoubleToStr(AccountEquity(), 2), " ", gs_424)); + } + if (!(SoundAlert)) break; + PlaySound(SoundFileAtOpen); + break; + } + } + return (l_ticket_72); +} + +int CloseOrder(int a_ticket_0, double a_lots_4, int ai_12, int a_slippage_16) { + color l_color_20; + double l_price_40; + bool l_ord_close_48; + int l_error_52; + bool li_56; + if (ai_12 == 0) l_color_20 = ColorBuy; + else l_color_20 = ColorSell; + int l_count_24 = 0; + int l_count_28 = 0; + int l_count_32 = 0; + int l_count_36 = 0; + while (true) { + while (!IsTradeAllowed()) Sleep(1000); + RefreshRates(); + if (ai_12 == 0) l_price_40 = NormalizeDouble(Bid, Digits); + else l_price_40 = NormalizeDouble(Ask, Digits); + l_ord_close_48 = OrderClose(a_ticket_0, a_lots_4, l_price_40, a_slippage_16, l_color_20); + if (!l_ord_close_48) { + l_error_52 = GetLastError(); + if (WriteLog) Print(StringConcatenate("OrderClose(", OrderTypeToStr(ai_12), ",", DoubleToStr(a_ticket_0, 0), ") error = ", ErrorDescription(l_error_52))); + li_56 = FALSE; + switch (l_error_52) { + case 0/* NO_ERROR */: + Sleep(10000); + if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) + if (OrderCloseTime() == 0) li_56 = TRUE; + break; + case 1/* NO_RESULT */: break; + case 2/* COMMON_ERROR */: break; + case 3/* INVALID_TRADE_PARAMETERS */: break; + case 4/* SERVER_BUSY */: break; + case 5/* OLD_VERSION */: break; + case 6/* NO_CONNECTION */: + Sleep(10000); + if (IsConnected()) li_56 = TRUE; + break; + case 7/* NOT_ENOUGH_RIGHTS */: break; + case 8/* TOO_FREQUENT_REQUESTS */: break; + case 9/* MALFUNCTIONAL_TRADE */: break; + case 64/* ACCOUNT_DISABLED */: break; + case 65/* INVALID_ACCOUNT */: break; + case 128/* TRADE_TIMEOUT */: + Sleep(70000); + if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) + if (OrderCloseTime() == 0) li_56 = TRUE; + break; + case 129/* INVALID_PRICE */: + Sleep(6000); + l_count_24++; + if (l_count_24 <= 3) li_56 = TRUE; + break; + case 130/* INVALID_STOPS */: + Sleep(6000); + l_count_28++; + if (l_count_28 <= 3) li_56 = TRUE; + break; + case 131/* INVALID_TRADE_VOLUME */: break; + case 132/* MARKET_CLOSED */: break; + case 133/* TRADE_DISABLED */: break; + case 134/* NOT_ENOUGH_MONEY */: break; + case 135/* PRICE_CHANGED */: + li_56 = TRUE; + break; + case 136/* OFF_QUOTES */: + Sleep(6000); + li_56 = TRUE; + break; + case 137/* BROKER_BUSY */: + Sleep(20000); + l_count_32++; + if (l_count_32 <= 3) li_56 = TRUE; + break; + case 138/* REQUOTE */: + l_count_36++; + if (l_count_36 <= 3) li_56 = TRUE; + break; + case 139/* ORDER_LOCKED */: break; + case 140/* LONG_POSITIONS_ONLY_ALLOWED */: break; + case 141/* TOO_MANY_REQUESTS */: break; + case 142: + Sleep(70000); + if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) + if (OrderCloseTime() == 0) li_56 = TRUE; + break; + case 143: + Sleep(70000); + if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) + if (OrderCloseTime() == 0) li_56 = TRUE; + break; + case 144: break; + case 145/* TRADE_MODIFY_DENIED */: + Sleep(20000); + li_56 = TRUE; + break; + case 146/* TRADE_CONTEXT_BUSY */: + while (IsTradeContextBusy()) Sleep(1000); + li_56 = TRUE; + break; + case 147/* ERR_TRADE_EXPIRATION_DENIED */: break; + case 148/* ERR_TRADE_TOO_MANY_ORDERS */: break; + case 149/* ? */: break; + case 150: break; + case 4000/* NO_MQLERROR */: + Sleep(10000); + if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) + if (OrderCloseTime() == 0) li_56 = TRUE; + case 4051/* INVALID_FUNCTION_PARAMETER_VALUE */: break; + case 4062/* STRING_PARAMETER_EXPECTED */: break; + case 4063/* INTEGER_PARAMETER_EXPECTED */: break; + case 4064/* DOUBLE_PARAMETER_EXPECTED */: break; + case 4105/* NO_ORDER_SELECTED */: break; + case 4106/* UNKNOWN_SYMBOL */: break; + case 4107/* INVALID_PRICE_PARAM */: break; + case 4108/* INVALID_TICKET */: break; + case 4109/* TRADE_NOT_ALLOWED */: break; + case 4110/* LONGS__NOT_ALLOWED */: break; + case 4111/* SHORTS_NOT_ALLOWED */: break; + } + if (!(li_56)) break; + continue; + } + if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) l_price_40 = OrderClosePrice(); + if (SendEmail) { + SendMail(gs_336, StringConcatenate("GPS Forex Robot trade Information\nCurrency Pair: ", StringSubstr(g_symbol_416, 0, 6), + "\nTime: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS), + "\nOrder Type: ", OrderTypeToStr(ai_12), + "\nPrice: ", DoubleToStr(l_price_40, Digits), + "\nLot size: ", DoubleToStr(a_lots_4, gi_348), + "\nEvent: Trade Closed", + "\n\nCurrent Balance: ", DoubleToStr(AccountBalance(), 2), " ", gs_424, + "\nCurrent Equity: ", DoubleToStr(AccountEquity(), 2), " ", gs_424)); + } + if (!(SoundAlert)) break; + PlaySound(SoundFileAtClose); + break; + } + return (l_ord_close_48); +} + +int HaveOrdersInDay(int a_cmd_0, int a_magic_4, int ai_8) { + int l_cmd_24; + int l_count_12 = 0; + int li_16 = OrdersTotal() - 1; + for (int l_pos_20 = li_16; l_pos_20 >= 0; l_pos_20--) { + if (!OrderSelect(l_pos_20, SELECT_BY_POS, MODE_TRADES)) { + if (WriteLog) Print(StringConcatenate("HaveOrdersInDay: OrderSelect() error = ", ErrorDescription(GetLastError()))); + } else { + if (OrderMagicNumber() == a_magic_4) { + if (OrderSymbol() == g_symbol_416) { + l_cmd_24 = OrderType(); + if (a_cmd_0 == -4) { + if (l_cmd_24 % 2 != 0) continue; + } else { + if (a_cmd_0 == -5) { + if (l_cmd_24 % 2 != 1) continue; + } else { + if (a_cmd_0 == -3) { + if (l_cmd_24 <= OP_SELL) continue; + } else { + if (a_cmd_0 == -2) { + if (l_cmd_24 > OP_SELL) continue; + } else { + if (a_cmd_0 >= OP_BUY) + if (l_cmd_24 != a_cmd_0) continue; + } + } + } + } + if (OrderOpenTime() >= ai_8) l_count_12++; + } + } + } + } + if (l_count_12 == 0) { + li_16 = OrdersHistoryTotal() - 1; + for (l_pos_20 = li_16; l_pos_20 >= 0; l_pos_20--) { + if (!OrderSelect(l_pos_20, SELECT_BY_POS, MODE_HISTORY)) { + if (WriteLog) Print(StringConcatenate("HaveOrdersInDay: OrderSelect_2() error = ", ErrorDescription(GetLastError()))); + } else { + if (OrderMagicNumber() == a_magic_4) { + if (OrderSymbol() == g_symbol_416) { + l_cmd_24 = OrderType(); + if (a_cmd_0 == -4) { + if (l_cmd_24 % 2 != 0) continue; + } else { + if (a_cmd_0 == -5) { + if (l_cmd_24 % 2 != 1) continue; + } else { + if (a_cmd_0 == -3) { + if (l_cmd_24 <= OP_SELL) continue; + } else { + if (a_cmd_0 == -2) { + if (l_cmd_24 > OP_SELL) continue; + } else { + if (a_cmd_0 >= OP_BUY) + if (l_cmd_24 != a_cmd_0) continue; + } + } + } + } + if (OrderOpenTime() < ai_8) break; + l_count_12++; + } + } + } + } + } + return (l_count_12); +} + +void WatchReverseAfterSL(int ai_0) { + int l_magic_12; + int l_datetime_16; + double ld_20; + int li_4 = OrdersHistoryTotal() - 1; + for (int l_pos_8 = li_4; l_pos_8 >= 0; l_pos_8--) { + if (!OrderSelect(l_pos_8, SELECT_BY_POS, MODE_HISTORY)) { + if (WriteLog) Print(StringConcatenate("WatchReverseAfterSL: OrderSelect() error = ", ErrorDescription(GetLastError()))); + } else { + l_magic_12 = OrderMagicNumber(); + if (l_magic_12 == gia_484[ai_0]) break; + if (l_magic_12 == gia_460[ai_0]) { + if (OrderSymbol() == g_symbol_416) { + if (OrderProfit() >= 0.0) break; + l_datetime_16 = OrderCloseTime(); + if (TimeHour(l_datetime_16) != Hour()) break; + if (TimeMinute(l_datetime_16) != Minute()) break; + if (TimeDay(l_datetime_16) != Day()) break; + if (TimeMonth(l_datetime_16) != Month()) break; + ld_20 = NormalizeDouble(OrderLots() * gda_480[ai_0], gi_348); + if (ld_20 > MaxLots) ld_20 = MaxLots; + if (ld_20 < g_minlot_376) ld_20 = g_minlot_376; + if (ld_20 > g_maxlot_368) ld_20 = g_maxlot_368; + OpenOrder(MathAbs(gia_464[ai_0] - 1), gia_484[ai_0], ExpertComment, ld_20); + return; + } + } + } + } +} + +bool AutoGMTOffset(int &ai_0) { + int li_4 = GetGMT(); + if (li_4 < 0) return (FALSE); + int li_8 = TimeCurrent() - li_4; + ai_0 = MathFloor((li_8 + 1800) / 3600); + return (TRUE); +} + +int SetCommentPrint(string as_0, string as_8 = "") { + Comment("\n\n" + "GPS FOREX ROBOT" + + "\n" + + "www.gpsforexrobot.com" + + "\n\n" + as_0); + if (as_8 != "") { + if (as_8 == "comment") Print(as_0); + else Print(as_8); + } + return (1); +} + +int PrintInformation() { + string ls_0; + if (gi_496 == 1) { + if (IsDemo()) ls_0 = "Demo"; + else ls_0 = "Real"; + SetCommentPrint("AUTHENTICATION STATUS: " + + "\n" + + gs_520 + + "\n" + + "---------------------------------------------------" + + "\n" + + "GENERAL INFORMATION:" + + "\n" + + "Broker Company: " + AccountCompany() + + "\n" + + "Terminal Company: " + TerminalCompany() + + "\n" + + "Server Name: " + AccountServer() + + "\n" + + "Current Server Time: " + TimeToStr(TimeCurrent(), TIME_SECONDS) + + "\n" + + "---------------------------------------------------" + + "\n" + + "ACCOUNT INFORMATION:" + + "\n" + + "Account Name: " + AccountName() + + "\n" + + "Account Number: " + AccountNumber() + + "\n" + + "Account Type: " + ls_0 + + "\n" + + "Account Leverage: 1:" + DoubleToStr(AccountLeverage(), 0) + + "\n" + + "Account Balance: " + DoubleToStr(AccountBalance(), 2) + + "\n" + + "Account Equity: " + DoubleToStr(AccountEquity(), 2) + + "\n" + + "Account Floating P/L: " + DoubleToStr(AccountProfit(), 2) + + "\n" + + "Account Currency: " + AccountCurrency() + + "\n" + + "---------------------------------------------------" + + "\n" + + "ADDITIONAL INFORMATION:" + + "\n" + + "Current Spread: " + DoubleToStr(gd_384, Digits - gi_352) + + "\n" + + "Maximum Spread: " + DoubleToStr(gd_392, Digits - gi_352) + + "\n" + + "Free Margin: " + DoubleToStr(AccountFreeMargin(), 2) + + "\n" + + "Used Margin: " + DoubleToStr(AccountMargin(), 2) + + "\n" + + "---------------------------------------------------" + + "\n" + + "GMT SETTINGS:" + + "\n" + + "GMT Offset: " + gs_512); + } else { + if (!gi_536) { + SetCommentPrint("AUTHENTICATION STATUS: " + + "\n" + + gs_520, gs_528); + gi_536 = TRUE; + } + } + return (0); +} + +int SetVariables() { + gda_508[0] = 1.00000000; + gda_508[1] = 2.00000000; + gda_508[2] = 88.00000000; + gda_508[3] = 5.00000000; + gda_508[4] = 23.00000000; + gda_508[5] = 0.00000000; + gda_508[6] = 1.00000000; + gda_508[7] = 1.00000000; + gda_508[8] = 1.00000000; + gda_508[9] = 1.00000000; + gda_508[10] = 1.00000000; + gda_508[11] = -2.00000000; + gda_508[12] = 0.00000000; + gda_508[13] = 220.00000000; + gda_508[14] = 18.00000000; + gda_508[15] = 5.30000000; + + if (gda_508[0] == 1.0) gi_160 = TRUE; + else gi_160 = FALSE; + gi_164 = gda_508[1]; + gd_172 = gda_508[2]; + gd_180 = gda_508[3]; + gi_188 = gda_508[4]; + gi_192 = gda_508[5]; + if (gda_508[6] == 1.0) gi_196 = TRUE; + else gi_196 = FALSE; + if (gda_508[7] == 1.0) gi_200 = TRUE; + else gi_200 = FALSE; + if (gda_508[8] == 1.0) gi_204 = TRUE; + else gi_204 = FALSE; + if (gda_508[9] == 1.0) gi_208 = TRUE; + else gi_208 = FALSE; + if (gda_508[10] == 1.0) gi_212 = TRUE; + else gi_212 = FALSE; + gi_216 = gda_508[11]; + if (gda_508[12] == 1.0) gi_220 = TRUE; + else gi_220 = FALSE; + gd_232 = gda_508[13]; + gd_240 = gda_508[14]; + gd_248 = gda_508[15]; + gba_432[0] = gi_168; + gda_436[0] = NormalizeDouble((-1.0 * gd_172) * gd_360, Digits); + gda_440[0] = NormalizeDouble(gd_180 * gd_360, Digits); + gia_444[0] = GetGMTCorrection(gi_188); + gia_448[0] = gi_192; + gba_452[0][0] = gi_196; + gba_452[0][1] = gi_200; + gba_452[0][2] = gi_204; + gba_452[0][3] = gi_208; + gba_452[0][4] = gi_212; + gia_456[0] = gi_216; + gia_464[0] = gi_220; + gia_460[0] = gi_224; + gba_468[0] = gi_228; + gda_472[0] = NormalizeDouble((-1.0 * gd_232) * gd_360, Digits); + gda_476[0] = NormalizeDouble(gd_240 * gd_360, Digits); + gda_480[0] = gd_248; + gia_484[0] = gi_256; + return (1); +} + +int Authentication() { +/* + gi_496 = GPSForexRobot(gda_508, EMail, CBReceipt, IsDemo(), AccountNumber()); + if (gi_496 == -1) { + gs_520 = "Authentication Failed [Invalid Internet Connection]\n[Trades are not available]"; + gs_528 = "Authentication Failed: [Invalid Internet Connection] [Trades are not available]"; + return (-1); + } + if (gi_496 == -2) { + gs_520 = "Authentication Failed [Invalid Internet Connection]\n[Trades are not available]"; + gs_528 = "Authentication Failed: [Invalid Internet Connection] [Trades are not available]"; + return (-2); + } + if (gi_496 == -3) { + gs_520 = "Authentication Failed [Wrong E-Mail or CBReceipt]\n[Trades are not available]"; + gs_528 = "Authentication Failed: [Wrong E-Mail or CBReceipt] [Trades are not available]"; + return (-2); + } + if (gi_496 == -4) { + gs_520 = "Authentication Failed [Invalid Real Money Account Number]\n[Trades are not available]"; + gs_528 = "Authentication Failed: [Invalid Real Money Account Number] [Trades are not available]"; + return (-2); + } + if (*/gi_496 = 1;/*) {*/ + SetVariables(); + gs_520 = "Authenticated [Trades are available]\nThank you for joining the GPS Robot Team!"; + gs_528 = "Authenticatd: [Trades are available]"; + return (1); +/* + } + return (0); +*/ +} + +int Rand(int ai_0) { + MathSrand(TimeLocal()); + return (MathRand() % ai_0); +} \ No newline at end of file diff --git a/GPSForexRobotUSDCHF_edu.mq4 b/GPSForexRobotUSDCHF_edu.mq4 new file mode 100644 index 0000000..67d3f17 --- /dev/null +++ b/GPSForexRobotUSDCHF_edu.mq4 @@ -0,0 +1,1210 @@ +/* + Generated by EX4-TO-MQ4 decompiler V4.0.224.1 [] + Website: http://purebeam.biz + E-mail : purebeam@gmail.com +*/ +#property copyright "Copyright © 2010, GPSForexRobot.com" +#property link "http://gpsforexrobot.com/" + +#import "GPSForexRobotUSDCHF.dll" +// int GPSForexRobot(double& a0[], string a1, string a2, int a3, int a4); + int GetGMT(); +#import + +extern string GPS_Forex_Robot_USDCHF = " "; +/* +extern string ____Authentication________ = "---------------------------------------------"; +extern string EMail = ""; +extern string CBReceipt = ""; +*/ +extern string ____Size_of_lots________ = "---------------------------------------------"; +extern bool UseMM = FALSE; +extern double Lots = 0.01; +extern double LotsRiskReductor = 10.0; +extern double MaxLots = 1000.0; +extern string ____General_Options_____ = "---------------------------------------------"; +extern bool AutoGMTOffset = TRUE; +extern int GMTOffset = 1; +bool gi_160 = FALSE; +int gi_164 = 2; +bool gi_168 = TRUE; +double gd_172 = 32.0; +double gd_180 = 8.0; +int gi_188 = 16; +int gi_192 = 0; +bool gi_196 = TRUE; +bool gi_200 = FALSE; +bool gi_204 = FALSE; +bool gi_208 = TRUE; +bool gi_212 = TRUE; +int gi_216 = -4; +int gi_220 = 1; +int gi_224 = 20100109; +bool gi_228 = TRUE; +double gd_232 = 45.0; +double gd_240 = 14.0; +double gd_248 = 4.0; +int gi_256 = 20100129; +extern string ____Others______________ = "---------------------------------------------"; +extern string ExpertComment = "GPS Forex Robot"; +extern color ColorBuy = Blue; +extern color ColorSell = Red; +extern bool SendEmail = FALSE; +extern bool SoundAlert = FALSE; +extern string SoundFileAtOpen = "alert.wav"; +extern string SoundFileAtClose = "alert.wav"; +extern bool WriteLog = FALSE; +extern bool WriteDebugLog = FALSE; +bool gi_316 = TRUE; +int gi_320 = 2; +int gi_324 = 1; +string gs_unused_328 = "New Trade Information"; +string gs_336 = "New Trade Information"; +int g_bool_344; +int gi_348; +int gi_352; +int g_slippage_356; +double gd_360; +double g_maxlot_368; +double g_minlot_376; +double gd_384; +double gd_392; +double g_lotstep_400; +double gd_408; +string g_symbol_416; +string gs_424; +bool gba_432[4]; +double gda_436[4]; +double gda_440[4]; +int gia_444[4]; +int gia_448[4]; +bool gba_452[4][5]; +int gia_456[4]; +int gia_460[4]; +int gia_464[4]; +bool gba_468[4]; +double gda_472[4]; +double gda_476[4]; +double gda_480[4]; +int gia_484[4]; +bool gi_488; +bool gi_492; +int gi_496 = 0; +bool gi_500 = FALSE; +int gi_504 = 0; +double gda_508[52] = {0}; +string gs_512 = ""; +string gs_520 = ""; +string gs_528 = ""; +bool gi_536 = FALSE; + +int init() { + gi_492 = TRUE; + if (!IsDllsAllowed()) { + SetCommentPrint("WARNING: Set Parameter \"AllowDLL Imports\" ON in menu Tools -> Options -> ExpertAdvisors.", "comment"); + gi_492 = FALSE; + return (0); + } + if (StringSubstr(Symbol(), 0, 6) != "USDCHF") { + SetCommentPrint("WARNING: Use GPS Forex Robot USDCHF only on USDCHF pair.", "comment"); + gi_492 = FALSE; + return (0); + } + if (IsTesting()) { + if (AutoGMTOffset) { + SetCommentPrint("WARNING: Automatic GMT offset calculation works only on live/demo trading " + "and should be set as FALSE for backtests - strategy testing.", "comment"); + gi_492 = FALSE; + return (0); + } + } + if (WriteDebugLog) { + WriteLog = TRUE; + Print("*************************** Initialization ***************************"); + } + g_symbol_416 = Symbol(); + g_maxlot_368 = MarketInfo(g_symbol_416, MODE_MAXLOT); + g_minlot_376 = MarketInfo(g_symbol_416, MODE_MINLOT); + g_lotstep_400 = MarketInfo(g_symbol_416, MODE_LOTSTEP); + if (g_lotstep_400 == 0.01) gi_348 = 2; + else { + if (g_lotstep_400 == 0.1) gi_348 = 1; + else { + if (g_lotstep_400 == 1.0) gi_348 = 0; + else { + if (g_lotstep_400 == 0.001) gi_348 = 3; + else gi_348 = 4; + } + } + } + double l_leverage_0 = AccountLeverage(); + gd_408 = NormalizeDouble(LotsRiskReductor * (100 / l_leverage_0), 2); + gs_424 = AccountCurrency(); + g_bool_344 = IsTesting(); + if (Digits < 4) { + gd_360 = 0.01; + gi_352 = 2; + } else { + gd_360 = 0.0001; + gi_352 = 4; + } + int li_8 = MathPow(10, Digits - gi_352); + g_slippage_356 = gi_164 * li_8; + gd_384 = MarketInfo(Symbol(), MODE_SPREAD) / MathPow(10, Digits - gi_352); + gd_392 = gd_384; + if (IsTesting()) { + Authentication(); + if (gi_496 != 1) { + PrintInformation(); + gi_492 = FALSE; + return (0); + } + } + gi_488 = TRUE; + return (0); +} + +int deinit() { + Comment(""); + if (WriteDebugLog) Print("*************************** Deinitialization ***************************"); + return (0); +} + +int start() { + double ld_24; + if (!gi_492) return (0); + int l_datetime_0 = TimeCurrent(); + if (!IsTesting()) { + if (gi_488) { + if (AutoGMTOffset) { + if (AutoGMTOffset(GMTOffset)) gs_512 = GMTOffset + " (automatic)"; + else gs_512 = "Error"; + } else gs_512 = GMTOffset + " (manual)"; + Authentication(); + gi_500 = TRUE; + gi_504 = l_datetime_0; + gi_488 = FALSE; + } + if (gi_500 == TRUE && gi_504 < l_datetime_0 - 60) { + gi_500 = FALSE; + gi_504 = l_datetime_0 + 60 * (780 - Rand(120)); + } + if (gi_500 == FALSE && l_datetime_0 >= gi_504) { + gi_500 = TRUE; + Authentication(); + } + PrintInformation(); + } + if (gi_496 != 1) return (0); + gd_384 = MarketInfo(Symbol(), MODE_SPREAD) / MathPow(10, Digits - gi_352); + if (gd_384 > gd_392) gd_392 = gd_384; + int l_datetime_4 = TimeCurrent(); + int li_8 = l_datetime_4 - 3600 * GMTOffset; + int l_day_of_week_12 = TimeDayOfWeek(l_datetime_4); + int l_datetime_16 = iTime(NULL, PERIOD_D1, 0); + for (int l_index_20 = 0; l_index_20 < 4; l_index_20++) { + if (gba_432[l_index_20]) { + if (!gi_160) SetOrderLevels(gda_440[l_index_20], gda_436[l_index_20], gia_460[l_index_20]); + WatchOrderLevels(gda_440[l_index_20], gda_436[l_index_20], gia_460[l_index_20]); + if (gba_468[l_index_20]) { + if (!gi_160) SetOrderLevels(gda_476[l_index_20], gda_472[l_index_20], gia_484[l_index_20]); + WatchOrderLevels(gda_476[l_index_20], gda_472[l_index_20], gia_484[l_index_20]); + if (HaveOrdersInDay(-2, gia_484[l_index_20], l_datetime_16) == 0) WatchReverseAfterSL(l_index_20); + } + if (l_day_of_week_12 <= 0 || l_day_of_week_12 > 5) continue; + if ((gba_452[l_index_20][l_day_of_week_12 - 1])) { + if (gia_444[l_index_20] != TimeHour(l_datetime_4) || gia_448[l_index_20] != TimeMinute(l_datetime_4)) continue; + if (HaveOrdersInDay(-2, gia_460[l_index_20], l_datetime_16) <= 0) { + ld_24 = LotsOptimized(gia_464[l_index_20]); + if (gia_456[l_index_20] >= 0) + if (l_day_of_week_12 == gia_456[l_index_20]) ld_24 = NormalizeDouble(2.0 * ld_24, gi_348); + OpenOrder(gia_464[l_index_20], gia_460[l_index_20], ExpertComment, ld_24); + } + } + } + } + return (0); +} + +string ErrorDescription(int ai_0) { + string ls_ret_8; + switch (ai_0) { + case 0: + case 1: + ls_ret_8 = "no error"; + break; + case 2: + ls_ret_8 = "common error"; + break; + case 3: + ls_ret_8 = "invalid trade parameters"; + break; + case 4: + ls_ret_8 = "trade server is busy"; + break; + case 5: + ls_ret_8 = "old version of the client terminal"; + break; + case 6: + ls_ret_8 = "no connection with trade server"; + break; + case 7: + ls_ret_8 = "not enough rights"; + break; + case 8: + ls_ret_8 = "too frequent requests"; + break; + case 9: + ls_ret_8 = "malfunctional trade operation (never returned error)"; + break; + case 64: + ls_ret_8 = "account disabled"; + break; + case 65: + ls_ret_8 = "invalid account"; + break; + case 128: + ls_ret_8 = "trade timeout"; + break; + case 129: + ls_ret_8 = "invalid price"; + break; + case 130: + ls_ret_8 = "invalid stops"; + break; + case 131: + ls_ret_8 = "invalid trade volume"; + break; + case 132: + ls_ret_8 = "market is closed"; + break; + case 133: + ls_ret_8 = "trade is disabled"; + break; + case 134: + ls_ret_8 = "not enough money"; + break; + case 135: + ls_ret_8 = "price changed"; + break; + case 136: + ls_ret_8 = "off quotes"; + break; + case 137: + ls_ret_8 = "broker is busy (never returned error)"; + break; + case 138: + ls_ret_8 = "requote"; + break; + case 139: + ls_ret_8 = "order is locked"; + break; + case 140: + ls_ret_8 = "long positions only allowed"; + break; + case 141: + ls_ret_8 = "too many requests"; + break; + case 145: + ls_ret_8 = "modification denied because order too close to market"; + break; + case 146: + ls_ret_8 = "trade context is busy"; + break; + case 147: + ls_ret_8 = "expirations are denied by broker"; + break; + case 148: + ls_ret_8 = "amount of open and pending orders has reached the limit"; + break; + case 149: + ls_ret_8 = "hedging is prohibited"; + break; + case 150: + ls_ret_8 = "prohibited by FIFO rules"; + break; + case 4000: + ls_ret_8 = "no error (never generated code)"; + break; + case 4001: + ls_ret_8 = "wrong function pointer"; + break; + case 4002: + ls_ret_8 = "array index is out of range"; + break; + case 4003: + ls_ret_8 = "no memory for function call stack"; + break; + case 4004: + ls_ret_8 = "recursive stack overflow"; + break; + case 4005: + ls_ret_8 = "not enough stack for parameter"; + break; + case 4006: + ls_ret_8 = "no memory for parameter string"; + break; + case 4007: + ls_ret_8 = "no memory for temp string"; + break; + case 4008: + ls_ret_8 = "not initialized string"; + break; + case 4009: + ls_ret_8 = "not initialized string in array"; + break; + case 4010: + ls_ret_8 = "no memory for array\' string"; + break; + case 4011: + ls_ret_8 = "too long string"; + break; + case 4012: + ls_ret_8 = "remainder from zero divide"; + break; + case 4013: + ls_ret_8 = "zero divide"; + break; + case 4014: + ls_ret_8 = "unknown command"; + break; + case 4015: + ls_ret_8 = "wrong jump (never generated error)"; + break; + case 4016: + ls_ret_8 = "not initialized array"; + break; + case 4017: + ls_ret_8 = "dll calls are not allowed"; + break; + case 4018: + ls_ret_8 = "cannot load library"; + break; + case 4019: + ls_ret_8 = "cannot call function"; + break; + case 4020: + ls_ret_8 = "expert function calls are not allowed"; + break; + case 4021: + ls_ret_8 = "not enough memory for temp string returned from function"; + break; + case 4022: + ls_ret_8 = "system is busy (never generated error)"; + break; + case 4050: + ls_ret_8 = "invalid function parameters count"; + break; + case 4051: + ls_ret_8 = "invalid function parameter value"; + break; + case 4052: + ls_ret_8 = "string function internal error"; + break; + case 4053: + ls_ret_8 = "some array error"; + break; + case 4054: + ls_ret_8 = "incorrect series array using"; + break; + case 4055: + ls_ret_8 = "custom indicator error"; + break; + case 4056: + ls_ret_8 = "arrays are incompatible"; + break; + case 4057: + ls_ret_8 = "global variables processing error"; + break; + case 4058: + ls_ret_8 = "global variable not found"; + break; + case 4059: + ls_ret_8 = "function is not allowed in testing mode"; + break; + case 4060: + ls_ret_8 = "function is not confirmed"; + break; + case 4061: + ls_ret_8 = "send mail error"; + break; + case 4062: + ls_ret_8 = "string parameter expected"; + break; + case 4063: + ls_ret_8 = "integer parameter expected"; + break; + case 4064: + ls_ret_8 = "double parameter expected"; + break; + case 4065: + ls_ret_8 = "array as parameter expected"; + break; + case 4066: + ls_ret_8 = "requested history data in update state"; + break; + case 4099: + ls_ret_8 = "end of file"; + break; + case 4100: + ls_ret_8 = "some file error"; + break; + case 4101: + ls_ret_8 = "wrong file name"; + break; + case 4102: + ls_ret_8 = "too many opened files"; + break; + case 4103: + ls_ret_8 = "cannot open file"; + break; + case 4104: + ls_ret_8 = "incompatible access to a file"; + break; + case 4105: + ls_ret_8 = "no order selected"; + break; + case 4106: + ls_ret_8 = "unknown symbol"; + break; + case 4107: + ls_ret_8 = "invalid price parameter for trade function"; + break; + case 4108: + ls_ret_8 = "invalid ticket"; + break; + case 4109: + ls_ret_8 = "trade is not allowed in the expert properties"; + break; + case 4110: + ls_ret_8 = "longs are not allowed in the expert properties"; + break; + case 4111: + ls_ret_8 = "shorts are not allowed in the expert properties"; + break; + case 4200: + ls_ret_8 = "object is already exist"; + break; + case 4201: + ls_ret_8 = "unknown object property"; + break; + case 4202: + ls_ret_8 = "object is not exist"; + break; + case 4203: + ls_ret_8 = "unknown object type"; + break; + case 4204: + ls_ret_8 = "no object name"; + break; + case 4205: + ls_ret_8 = "object coordinates error"; + break; + case 4206: + ls_ret_8 = "no specified subwindow"; + break; + default: + ls_ret_8 = "unknown error"; + } + return (ls_ret_8); +} + +string OrderTypeToStr(int ai_0) { + string ls_ret_8; + switch (ai_0) { + case 0: + ls_ret_8 = "Buy"; + break; + case 1: + ls_ret_8 = "Sell"; + break; + case 2: + ls_ret_8 = "BuyLimit"; + break; + case 3: + ls_ret_8 = "SellLimit"; + break; + case 4: + ls_ret_8 = "BuyStop"; + break; + case 5: + ls_ret_8 = "SellStop"; + break; + default: + ls_ret_8 = "Unknown"; + } + return (ls_ret_8); +} + +int GetGMTCorrection(int ai_0) { + ai_0 += GMTOffset; + while (true) { + if (ai_0 >= 24) { + ai_0 -= 24; + continue; + } + if (ai_0 >= 0) break; + ai_0 += 24; + } + return (ai_0); +} + +void SetOrderLevels(double ad_0, double ad_8, int a_magic_16) { + int l_cmd_36; + double ld_40; + double l_price_48; + double ld_56; + double ld_64; + bool li_72; + double l_price_76; + bool li_84; + double l_price_88; + bool l_bool_96; + double ld_20 = NormalizeDouble(MarketInfo(g_symbol_416, MODE_STOPLEVEL) * Point, Digits); + int li_28 = OrdersTotal() - 1; + for (int l_pos_32 = li_28; l_pos_32 >= 0; l_pos_32--) { + if (!OrderSelect(l_pos_32, SELECT_BY_POS, MODE_TRADES)) { + if (WriteLog) Print(StringConcatenate("SetOrderLevels: OrderSelect() error = ", ErrorDescription(GetLastError()))); + } else { + if (OrderMagicNumber() == a_magic_16) { + if (OrderSymbol() == g_symbol_416) { + l_cmd_36 = OrderType(); + ld_40 = NormalizeDouble(OrderClosePrice(), Digits); + l_price_48 = NormalizeDouble(OrderOpenPrice(), Digits); + if (l_cmd_36 > OP_SELL) + if (NormalizeDouble(MathAbs(l_price_48 - ld_40), Digits) <= ld_20) continue; + ld_56 = NormalizeDouble(OrderStopLoss(), Digits); + ld_64 = NormalizeDouble(OrderTakeProfit(), Digits); + li_72 = FALSE; + if (ld_56 == 0.0) { + if (ad_8 < 0.0) { + if (l_cmd_36 % 2 == 0) { + l_price_76 = NormalizeDouble(l_price_48 + ad_8, Digits); + if (NormalizeDouble(ld_40 - l_price_76, Digits) > ld_20) li_72 = TRUE; + else l_price_76 = ld_56; + } else { + l_price_76 = NormalizeDouble(l_price_48 - ad_8, Digits); + if (NormalizeDouble(l_price_76 - ld_40, Digits) > ld_20) li_72 = TRUE; + else l_price_76 = ld_56; + } + } else l_price_76 = ld_56; + } else l_price_76 = ld_56; + li_84 = FALSE; + if (ld_64 == 0.0) { + if (ad_0 > 0.0) { + if (l_cmd_36 % 2 == 0) { + l_price_88 = NormalizeDouble(l_price_48 + ad_0, Digits); + if (NormalizeDouble(l_price_88 - ld_40, Digits) > ld_20) li_84 = TRUE; + else l_price_88 = ld_64; + } else { + l_price_88 = NormalizeDouble(l_price_48 - ad_0, Digits); + if (NormalizeDouble(ld_40 - l_price_88, Digits) > ld_20) li_84 = TRUE; + else l_price_88 = ld_64; + } + } else l_price_88 = ld_64; + } else l_price_88 = ld_64; + if (li_72 || li_84) { + while (!IsTradeAllowed()) Sleep(1000); + l_bool_96 = OrderModify(OrderTicket(), l_price_48, l_price_76, l_price_88, 0, CLR_NONE); + if (!l_bool_96) + if (WriteLog) Print(StringConcatenate("SetOrderLevels: OrderModify(", OrderTypeToStr(OrderType()), ") error = ", ErrorDescription(GetLastError()))); + } + } + } + } + } +} + +void WatchOrderLevels(double ad_0, double ad_8, int a_magic_16) { + double ld_28; + double ld_36; + double ld_44; + if (ad_0 <= 0.0 && ad_8 >= 0.0) return; + int li_20 = OrdersTotal() - 1; + for (int l_pos_24 = li_20; l_pos_24 >= 0; l_pos_24--) { + if (!OrderSelect(l_pos_24, SELECT_BY_POS, MODE_TRADES)) { + if (WriteLog) Print(StringConcatenate("WatchOrderLevels: OrderSelect() error = ", ErrorDescription(GetLastError()))); + } else { + if (OrderMagicNumber() == a_magic_16) { + if (OrderType() <= OP_SELL) { + if (OrderSymbol() == g_symbol_416) { + ld_28 = NormalizeDouble(OrderClosePrice(), Digits); + ld_36 = NormalizeDouble(OrderOpenPrice(), Digits); + if (OrderType() == OP_BUY) { + ld_44 = NormalizeDouble(ld_28 - ld_36, Digits); + if ((ad_0 > 0.0 && ld_44 >= ad_0) || (ad_8 < 0.0 && ld_44 <= ad_8)) { + if (WriteLog) Print("WatchOrderLevels: level for close BUY"); + CloseOrder(OrderTicket(), OrderLots(), 0, g_slippage_356); + } + } else { + ld_44 = NormalizeDouble(ld_36 - ld_28, Digits); + if ((ad_0 > 0.0 && ld_44 >= ad_0) || (ad_8 < 0.0 && ld_44 <= ad_8)) { + if (WriteLog) Print("WatchOrderLevels: level for close SELL"); + CloseOrder(OrderTicket(), OrderLots(), 1, g_slippage_356); + } + } + } + } + } + } + } +} + +double LotsOptimized(int ai_unused_0) { + double ld_ret_4; + double ld_12; + double ld_20; + if (!UseMM) ld_ret_4 = Lots; + else { + ld_12 = AccountFreeMargin() * gd_408 / 100.0; + ld_20 = MarketInfo(g_symbol_416, MODE_MARGINREQUIRED) * g_lotstep_400; + ld_ret_4 = NormalizeDouble(MathFloor(ld_12 / ld_20) * g_lotstep_400, gi_348); + } + if (ld_ret_4 > MaxLots) ld_ret_4 = MaxLots; + if (ld_ret_4 < g_minlot_376) ld_ret_4 = g_minlot_376; + if (ld_ret_4 > g_maxlot_368) ld_ret_4 = g_maxlot_368; + return (ld_ret_4); +} + +int OpenOrder(int a_cmd_0, int a_magic_4, string a_comment_8, double ad_16, double a_price_24 = 0.0) { + color l_color_36; + int l_ticket_72; + int l_error_76; + double ld_80; + if (a_cmd_0 > OP_SELL && a_price_24 == 0.0) return (-1); + int l_cmd_32 = a_cmd_0 % 2; + if (ad_16 < g_minlot_376) ad_16 = g_minlot_376; + else + if (ad_16 > g_maxlot_368) ad_16 = g_maxlot_368; + if (AccountFreeMarginCheck(g_symbol_416, l_cmd_32, ad_16) <= 0.0 || GetLastError() == 134/* NOT_ENOUGH_MONEY */) { + if (WriteLog) Print("OpenOrder: you don\'t have free margin."); + return (-1); + } + if (l_cmd_32 == OP_BUY) l_color_36 = ColorBuy; + else l_color_36 = ColorSell; + RefreshRates(); + double ld_40 = NormalizeDouble(MarketInfo(g_symbol_416, MODE_STOPLEVEL) * Point, Digits); + double ld_48 = NormalizeDouble(Ask, Digits); + double ld_56 = NormalizeDouble(Bid, Digits); + switch (a_cmd_0) { + case OP_BUY: + a_price_24 = ld_48; + break; + case OP_SELL: + a_price_24 = ld_56; + break; + case OP_BUYLIMIT: + if (a_price_24 >= ld_48) { + a_price_24 = ld_48; + a_cmd_0 = 0; + } else + if (NormalizeDouble(ld_48 - a_price_24, Digits) < ld_40) return (-1); + break; + case OP_SELLLIMIT: + if (a_price_24 <= ld_56) { + a_price_24 = ld_56; + a_cmd_0 = 1; + } else + if (NormalizeDouble(a_price_24 - ld_56, Digits) < ld_40) return (-1); + break; + case OP_BUYSTOP: + if (a_price_24 <= ld_48) { + a_price_24 = ld_48; + a_cmd_0 = 0; + } else + if (NormalizeDouble(a_price_24 - ld_48, Digits) < ld_40) return (-1); + break; + case OP_SELLSTOP: + if (a_price_24 >= ld_56) { + a_price_24 = ld_56; + a_cmd_0 = 1; + } else + if (NormalizeDouble(ld_56 - a_price_24, Digits) < ld_40) return (-1); + break; + default: + return (-1); + } + int li_68 = gi_320; + while (li_68 > 0) { + while (!IsTradeAllowed()) Sleep(1000); + l_ticket_72 = OrderSend(g_symbol_416, a_cmd_0, ad_16, a_price_24, g_slippage_356, 0, 0, a_comment_8, a_magic_4, 0, l_color_36); + Sleep(MathRand() / 1000); + if (l_ticket_72 < 0) { + l_error_76 = GetLastError(); + if (WriteLog) { + Print("OpenOrder: OrderSend(", OrderTypeToStr(a_cmd_0), ") error = ", ErrorDescription(l_error_76)); + Print("OpenOrder: order ", g_symbol_416, " ", OrderTypeToStr(a_cmd_0), " lot = ", DoubleToStr(ad_16, 8), " op = ", DoubleToStr(a_price_24, 8), " slippage = ", g_slippage_356); + } + if (l_error_76 != 136/* OFF_QUOTES */) break; + if (!(gi_316)) break; + Sleep(6000); + RefreshRates(); + if (a_cmd_0 == OP_BUY) ld_80 = NormalizeDouble(Ask, Digits); + else ld_80 = NormalizeDouble(Bid, Digits); + if (NormalizeDouble(MathAbs((ld_80 - a_price_24) / gd_360), 0) > gi_324) break; + a_price_24 = ld_80; + li_68--; + if (li_68 > 0) + if (WriteLog) Print("... Possible to open order."); + ad_16 = NormalizeDouble(ad_16 / 2.0, gi_348); + if (ad_16 < g_minlot_376) ad_16 = g_minlot_376; + } else { + if (OrderSelect(l_ticket_72, SELECT_BY_TICKET)) a_price_24 = OrderOpenPrice(); + if (SendEmail) { + SendMail(gs_336, StringConcatenate("GPS Forex Robot trade Information\nCurrency Pair: ", StringSubstr(g_symbol_416, 0, 6), + "\nTime: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS), + "\nOrder Type: ", OrderTypeToStr(a_cmd_0), + "\nPrice: ", DoubleToStr(a_price_24, Digits), + "\nLot size: ", DoubleToStr(ad_16, gi_348), + "\nEvent: Trade Opened", + "\n\nCurrent Balance: ", DoubleToStr(AccountBalance(), 2), " ", gs_424, + "\nCurrent Equity: ", DoubleToStr(AccountEquity(), 2), " ", gs_424)); + } + if (!(SoundAlert)) break; + PlaySound(SoundFileAtOpen); + break; + } + } + return (l_ticket_72); +} + +int CloseOrder(int a_ticket_0, double a_lots_4, int ai_12, int a_slippage_16) { + color l_color_20; + double l_price_40; + bool l_ord_close_48; + int l_error_52; + bool li_56; + if (ai_12 == 0) l_color_20 = ColorBuy; + else l_color_20 = ColorSell; + int l_count_24 = 0; + int l_count_28 = 0; + int l_count_32 = 0; + int l_count_36 = 0; + while (true) { + while (!IsTradeAllowed()) Sleep(1000); + RefreshRates(); + if (ai_12 == 0) l_price_40 = NormalizeDouble(Bid, Digits); + else l_price_40 = NormalizeDouble(Ask, Digits); + l_ord_close_48 = OrderClose(a_ticket_0, a_lots_4, l_price_40, a_slippage_16, l_color_20); + if (!l_ord_close_48) { + l_error_52 = GetLastError(); + if (WriteLog) Print(StringConcatenate("OrderClose(", OrderTypeToStr(ai_12), ",", DoubleToStr(a_ticket_0, 0), ") error = ", ErrorDescription(l_error_52))); + li_56 = FALSE; + switch (l_error_52) { + case 0/* NO_ERROR */: + Sleep(10000); + if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) + if (OrderCloseTime() == 0) li_56 = TRUE; + break; + case 1/* NO_RESULT */: break; + case 2/* COMMON_ERROR */: break; + case 3/* INVALID_TRADE_PARAMETERS */: break; + case 4/* SERVER_BUSY */: break; + case 5/* OLD_VERSION */: break; + case 6/* NO_CONNECTION */: + Sleep(10000); + if (IsConnected()) li_56 = TRUE; + break; + case 7/* NOT_ENOUGH_RIGHTS */: break; + case 8/* TOO_FREQUENT_REQUESTS */: break; + case 9/* MALFUNCTIONAL_TRADE */: break; + case 64/* ACCOUNT_DISABLED */: break; + case 65/* INVALID_ACCOUNT */: break; + case 128/* TRADE_TIMEOUT */: + Sleep(70000); + if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) + if (OrderCloseTime() == 0) li_56 = TRUE; + break; + case 129/* INVALID_PRICE */: + Sleep(6000); + l_count_24++; + if (l_count_24 <= 3) li_56 = TRUE; + break; + case 130/* INVALID_STOPS */: + Sleep(6000); + l_count_28++; + if (l_count_28 <= 3) li_56 = TRUE; + break; + case 131/* INVALID_TRADE_VOLUME */: break; + case 132/* MARKET_CLOSED */: break; + case 133/* TRADE_DISABLED */: break; + case 134/* NOT_ENOUGH_MONEY */: break; + case 135/* PRICE_CHANGED */: + li_56 = TRUE; + break; + case 136/* OFF_QUOTES */: + Sleep(6000); + li_56 = TRUE; + break; + case 137/* BROKER_BUSY */: + Sleep(20000); + l_count_32++; + if (l_count_32 <= 3) li_56 = TRUE; + break; + case 138/* REQUOTE */: + l_count_36++; + if (l_count_36 <= 3) li_56 = TRUE; + break; + case 139/* ORDER_LOCKED */: break; + case 140/* LONG_POSITIONS_ONLY_ALLOWED */: break; + case 141/* TOO_MANY_REQUESTS */: break; + case 142: + Sleep(70000); + if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) + if (OrderCloseTime() == 0) li_56 = TRUE; + break; + case 143: + Sleep(70000); + if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) + if (OrderCloseTime() == 0) li_56 = TRUE; + break; + case 144: break; + case 145/* TRADE_MODIFY_DENIED */: + Sleep(20000); + li_56 = TRUE; + break; + case 146/* TRADE_CONTEXT_BUSY */: + while (IsTradeContextBusy()) Sleep(1000); + li_56 = TRUE; + break; + case 147/* ERR_TRADE_EXPIRATION_DENIED */: break; + case 148/* ERR_TRADE_TOO_MANY_ORDERS */: break; + case 149/* ? */: break; + case 150: break; + case 4000/* NO_MQLERROR */: + Sleep(10000); + if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) + if (OrderCloseTime() == 0) li_56 = TRUE; + case 4051/* INVALID_FUNCTION_PARAMETER_VALUE */: break; + case 4062/* STRING_PARAMETER_EXPECTED */: break; + case 4063/* INTEGER_PARAMETER_EXPECTED */: break; + case 4064/* DOUBLE_PARAMETER_EXPECTED */: break; + case 4105/* NO_ORDER_SELECTED */: break; + case 4106/* UNKNOWN_SYMBOL */: break; + case 4107/* INVALID_PRICE_PARAM */: break; + case 4108/* INVALID_TICKET */: break; + case 4109/* TRADE_NOT_ALLOWED */: break; + case 4110/* LONGS__NOT_ALLOWED */: break; + case 4111/* SHORTS_NOT_ALLOWED */: break; + } + if (!(li_56)) break; + continue; + } + if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) l_price_40 = OrderClosePrice(); + if (SendEmail) { + SendMail(gs_336, StringConcatenate("GPS Forex Robot trade Information\nCurrency Pair: ", StringSubstr(g_symbol_416, 0, 6), + "\nTime: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS), + "\nOrder Type: ", OrderTypeToStr(ai_12), + "\nPrice: ", DoubleToStr(l_price_40, Digits), + "\nLot size: ", DoubleToStr(a_lots_4, gi_348), + "\nEvent: Trade Closed", + "\n\nCurrent Balance: ", DoubleToStr(AccountBalance(), 2), " ", gs_424, + "\nCurrent Equity: ", DoubleToStr(AccountEquity(), 2), " ", gs_424)); + } + if (!(SoundAlert)) break; + PlaySound(SoundFileAtClose); + break; + } + return (l_ord_close_48); +} + +int HaveOrdersInDay(int a_cmd_0, int a_magic_4, int ai_8) { + int l_cmd_24; + int l_count_12 = 0; + int li_16 = OrdersTotal() - 1; + for (int l_pos_20 = li_16; l_pos_20 >= 0; l_pos_20--) { + if (!OrderSelect(l_pos_20, SELECT_BY_POS, MODE_TRADES)) { + if (WriteLog) Print(StringConcatenate("HaveOrdersInDay: OrderSelect() error = ", ErrorDescription(GetLastError()))); + } else { + if (OrderMagicNumber() == a_magic_4) { + if (OrderSymbol() == g_symbol_416) { + l_cmd_24 = OrderType(); + if (a_cmd_0 == -4) { + if (l_cmd_24 % 2 != 0) continue; + } else { + if (a_cmd_0 == -5) { + if (l_cmd_24 % 2 != 1) continue; + } else { + if (a_cmd_0 == -3) { + if (l_cmd_24 <= OP_SELL) continue; + } else { + if (a_cmd_0 == -2) { + if (l_cmd_24 > OP_SELL) continue; + } else { + if (a_cmd_0 >= OP_BUY) + if (l_cmd_24 != a_cmd_0) continue; + } + } + } + } + if (OrderOpenTime() >= ai_8) l_count_12++; + } + } + } + } + if (l_count_12 == 0) { + li_16 = OrdersHistoryTotal() - 1; + for (l_pos_20 = li_16; l_pos_20 >= 0; l_pos_20--) { + if (!OrderSelect(l_pos_20, SELECT_BY_POS, MODE_HISTORY)) { + if (WriteLog) Print(StringConcatenate("HaveOrdersInDay: OrderSelect_2() error = ", ErrorDescription(GetLastError()))); + } else { + if (OrderMagicNumber() == a_magic_4) { + if (OrderSymbol() == g_symbol_416) { + l_cmd_24 = OrderType(); + if (a_cmd_0 == -4) { + if (l_cmd_24 % 2 != 0) continue; + } else { + if (a_cmd_0 == -5) { + if (l_cmd_24 % 2 != 1) continue; + } else { + if (a_cmd_0 == -3) { + if (l_cmd_24 <= OP_SELL) continue; + } else { + if (a_cmd_0 == -2) { + if (l_cmd_24 > OP_SELL) continue; + } else { + if (a_cmd_0 >= OP_BUY) + if (l_cmd_24 != a_cmd_0) continue; + } + } + } + } + if (OrderOpenTime() < ai_8) break; + l_count_12++; + } + } + } + } + } + return (l_count_12); +} + +void WatchReverseAfterSL(int ai_0) { + int l_magic_12; + int l_datetime_16; + double ld_20; + int li_4 = OrdersHistoryTotal() - 1; + for (int l_pos_8 = li_4; l_pos_8 >= 0; l_pos_8--) { + if (!OrderSelect(l_pos_8, SELECT_BY_POS, MODE_HISTORY)) { + if (WriteLog) Print(StringConcatenate("WatchReverseAfterSL: OrderSelect() error = ", ErrorDescription(GetLastError()))); + } else { + l_magic_12 = OrderMagicNumber(); + if (l_magic_12 == gia_484[ai_0]) break; + if (l_magic_12 == gia_460[ai_0]) { + if (OrderSymbol() == g_symbol_416) { + if (OrderProfit() >= 0.0) break; + l_datetime_16 = OrderCloseTime(); + if (TimeHour(l_datetime_16) != Hour()) break; + if (TimeMinute(l_datetime_16) != Minute()) break; + if (TimeDay(l_datetime_16) != Day()) break; + if (TimeMonth(l_datetime_16) != Month()) break; + ld_20 = NormalizeDouble(OrderLots() * gda_480[ai_0], gi_348); + if (ld_20 > MaxLots) ld_20 = MaxLots; + if (ld_20 < g_minlot_376) ld_20 = g_minlot_376; + if (ld_20 > g_maxlot_368) ld_20 = g_maxlot_368; + OpenOrder(MathAbs(gia_464[ai_0] - 1), gia_484[ai_0], ExpertComment, ld_20); + return; + } + } + } + } +} + +bool AutoGMTOffset(int &ai_0) { + int li_4 = GetGMT(); + if (li_4 < 0) return (FALSE); + int li_8 = TimeCurrent() - li_4; + ai_0 = MathFloor((li_8 + 1800) / 3600); + return (TRUE); +} + +int SetCommentPrint(string as_0, string as_8 = "") { + Comment("\n\n" + "GPS FOREX ROBOT" + + "\n" + + "www.gpsforexrobot.com" + + "\n\n" + as_0); + if (as_8 != "") { + if (as_8 == "comment") Print(as_0); + else Print(as_8); + } + return (1); +} + +int PrintInformation() { + string ls_0; + if (gi_496 == 1) { + if (IsDemo()) ls_0 = "Demo"; + else ls_0 = "Real"; + SetCommentPrint("AUTHENTICATION STATUS: " + + "\n" + + gs_520 + + "\n" + + "---------------------------------------------------" + + "\n" + + "GENERAL INFORMATION:" + + "\n" + + "Broker Company: " + AccountCompany() + + "\n" + + "Terminal Company: " + TerminalCompany() + + "\n" + + "Server Name: " + AccountServer() + + "\n" + + "Current Server Time: " + TimeToStr(TimeCurrent(), TIME_SECONDS) + + "\n" + + "---------------------------------------------------" + + "\n" + + "ACCOUNT INFORMATION:" + + "\n" + + "Account Name: " + AccountName() + + "\n" + + "Account Number: " + AccountNumber() + + "\n" + + "Account Type: " + ls_0 + + "\n" + + "Account Leverage: 1:" + DoubleToStr(AccountLeverage(), 0) + + "\n" + + "Account Balance: " + DoubleToStr(AccountBalance(), 2) + + "\n" + + "Account Equity: " + DoubleToStr(AccountEquity(), 2) + + "\n" + + "Account Floating P/L: " + DoubleToStr(AccountProfit(), 2) + + "\n" + + "Account Currency: " + AccountCurrency() + + "\n" + + "---------------------------------------------------" + + "\n" + + "ADDITIONAL INFORMATION:" + + "\n" + + "Current Spread: " + DoubleToStr(gd_384, Digits - gi_352) + + "\n" + + "Maximum Spread: " + DoubleToStr(gd_392, Digits - gi_352) + + "\n" + + "Free Margin: " + DoubleToStr(AccountFreeMargin(), 2) + + "\n" + + "Used Margin: " + DoubleToStr(AccountMargin(), 2) + + "\n" + + "---------------------------------------------------" + + "\n" + + "GMT SETTINGS:" + + "\n" + + "GMT Offset: " + gs_512); + } else { + if (!gi_536) { + SetCommentPrint("AUTHENTICATION STATUS: " + + "\n" + + gs_520, gs_528); + gi_536 = TRUE; + } + } + return (0); +} + +int SetVariables() { + gda_508[34] = 1.00000000; + gda_508[35] = 2.00000000; + gda_508[36] = 88.00000000; + gda_508[37] = 4.00000000; + gda_508[38] = 23.00000000; + gda_508[39] = 0.00000000; + gda_508[40] = 0.00000000; + gda_508[41] = 0.00000000; + gda_508[42] = 1.00000000; + gda_508[43] = 1.00000000; + gda_508[44] = 1.00000000; + gda_508[45] = 1.00000000; + gda_508[46] = 0.00000000; + gda_508[47] = -2.00000000; + gda_508[48] = 1.00000000; + gda_508[49] = 220.00000000; + gda_508[50] = 18.00000000; + gda_508[51] = 5.00000000; + + if (gda_508[34] == 1.0) gi_160 = TRUE; + else gi_160 = FALSE; + gi_164 = gda_508[35]; + gd_172 = gda_508[36]; + gd_180 = gda_508[37]; + gi_188 = gda_508[38]; + gi_192 = gda_508[39]; + if (gda_508[40] == 1.0) gi_196 = TRUE; + else gi_196 = FALSE; + if (gda_508[41] == 1.0) gi_200 = TRUE; + else gi_200 = FALSE; + if (GMTOffset <= 0) { + if (gda_508[42] == 1.0) gi_200 = TRUE; + else gi_200 = FALSE; + } + if (gda_508[43] == 1.0) gi_204 = TRUE; + else gi_204 = FALSE; + if (gda_508[44] == 1.0) gi_208 = TRUE; + else gi_208 = FALSE; + if (gda_508[45] == 1.0) gi_212 = TRUE; + else gi_212 = FALSE; + if (GMTOffset <= 0) { + if (gda_508[46] == 1.0) gi_212 = TRUE; + else gi_212 = FALSE; + } + gi_216 = gda_508[47]; + if (gda_508[48] == 1.0) gi_220 = TRUE; + else gi_220 = FALSE; + gd_232 = gda_508[49]; + gd_240 = gda_508[50]; + gd_248 = gda_508[51]; + gba_432[0] = gi_168; + gda_436[0] = NormalizeDouble((-1.0 * gd_172) * gd_360, Digits); + gda_440[0] = NormalizeDouble(gd_180 * gd_360, Digits); + gia_444[0] = GetGMTCorrection(gi_188); + gia_448[0] = gi_192; + gba_452[0][0] = gi_196; + gba_452[0][1] = gi_200; + gba_452[0][2] = gi_204; + gba_452[0][3] = gi_208; + gba_452[0][4] = gi_212; + gia_456[0] = gi_216; + gia_464[0] = gi_220; + gia_460[0] = gi_224; + gba_468[0] = gi_228; + gda_472[0] = NormalizeDouble((-1.0 * gd_232) * gd_360, Digits); + gda_476[0] = NormalizeDouble(gd_240 * gd_360, Digits); + gda_480[0] = gd_248; + gia_484[0] = gi_256; + return (1); +} + +int Authentication() { +/* + gi_496 = GPSForexRobot(gda_508, EMail, CBReceipt, IsDemo(), AccountNumber()); + if (gi_496 == -1) { + gs_520 = "Authentication Failed [Invalid Internet Connection]\n[Trades are not available]"; + gs_528 = "Authentication Failed: [Invalid Internet Connection] [Trades are not available]"; + return (-1); + } + if (gi_496 == -2) { + gs_520 = "Authentication Failed [Invalid Internet Connection]\n[Trades are not available]"; + gs_528 = "Authentication Failed: [Invalid Internet Connection] [Trades are not available]"; + return (-2); + } + if (gi_496 == -3) { + gs_520 = "Authentication Failed [Wrong E-Mail or CBReceipt]\n[Trades are not available]"; + gs_528 = "Authentication Failed: [Wrong E-Mail or CBReceipt] [Trades are not available]"; + return (-2); + } + if (gi_496 == -4) { + gs_520 = "Authentication Failed [Invalid Real Money Account Number]\n[Trades are not available]"; + gs_528 = "Authentication Failed: [Invalid Real Money Account Number] [Trades are not available]"; + return (-2); + } + if (*/gi_496 = 1;/*) {*/ + SetVariables(); + gs_520 = "Authenticated [Trades are available]\nThank you for joining the GPS Robot Team!"; + gs_528 = "Authenticatd: [Trades are available]"; + return (1); +/* + } + return (0); +*/ +} + +int Rand(int ai_0) { + MathSrand(TimeLocal()); + return (MathRand() % ai_0); +} \ No newline at end of file diff --git a/Geo crossover_signal.mq4 b/Geo crossover_signal.mq4 new file mode 100644 index 0000000..b2ad19f Binary files /dev/null and b/Geo crossover_signal.mq4 differ diff --git a/Gmacd2.mq4 b/Gmacd2.mq4 new file mode 100644 index 0000000..f008fc9 --- /dev/null +++ b/Gmacd2.mq4 @@ -0,0 +1,328 @@ + +//+------------------------------------------------------------------+ +//| GMACD#2.mq4 | +//| Copyright © 2006, MetaQuotes Software Corp. | +//| http://www.metaquotes.net | +//+------------------------------------------------------------------+ +#property copyright "Copyright © 2006, MetaQuotes Software Corp." +#property link "http://www.metaquotes.net" + +/********************************************************************* +* Author: Muhammad Hamizi Jaminan (hymns) +* Original Author: CJA +* +* Date: December 14, 2006 +* Custom Indicator: GMACD2.mq4 +* Version: 1.0.1 +* Description: Multi TimeFrame MACD Signal & MACD Graph +* +* Change Logs +* Version 1.0.1 +* - Rewriting Code. Using less variable & ObjectCreate. Reduce CPU +* Usage. Solve multiple object label show on load. +* +* Version G#MACD#2 +* - Release by CJA +**********************************************************************/ + +#property indicator_separate_window +#property indicator_buffers 7 +#property indicator_color1 Black //DarkSlateGray // HISTO +#property indicator_color2 Black //Red // inside line +#property indicator_color3 Black //Blue // inside line +#property indicator_color4 Black //Red //middle line +#property indicator_color5 Black //Blue //middle line +#property indicator_color6 Black //DarkOrange // outside line +#property indicator_color7 Black //DodgerBlue //outside line +//#property indicator_width1 2 + +//---- input parameters +extern int FastEMA=8; +extern int FFastEMA=7; +extern int FFFastEMA=6; +extern int SlowEMA=17; +extern int SSlowEMA=16; +extern int SSSlowEMA=15; +extern int SignalSMA=9; +extern int SSignalSMA=8; +extern int SSSignalSMA=7; +extern bool Show_MAJOR_TREND = false; + +//---- buffers +double ExtMapBuffer1[]; +double ExtMapBuffer2[]; +double ExtMapBuffer3[]; +double ExtMapBuffer4[]; +double ExtMapBuffer5[]; +double ExtMapBuffer6[]; +double ExtMapBuffer7[]; + + + + +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +int init() + { + IndicatorShortName("GMACD2"); +//---- indicators + SetIndexStyle(0,DRAW_HISTOGRAM); + SetIndexBuffer(0,ExtMapBuffer1); + SetIndexStyle(1,DRAW_LINE); + SetIndexBuffer(1,ExtMapBuffer2); + SetIndexStyle(2,DRAW_LINE); + SetIndexBuffer(2,ExtMapBuffer3); + SetIndexStyle(3,DRAW_LINE); + SetIndexBuffer(3,ExtMapBuffer4); + SetIndexStyle(4,DRAW_LINE); + SetIndexBuffer(4,ExtMapBuffer5); + SetIndexStyle(5,DRAW_LINE); + SetIndexBuffer(5,ExtMapBuffer6); + SetIndexStyle(6,DRAW_LINE); + SetIndexBuffer(6,ExtMapBuffer7); + +//---- + return(0); + } +//+------------------------------------------------------------------+ +//| Custom indicator deinitialization function | +//+------------------------------------------------------------------+ +int deinit() + { +//---- + ObjectsDeleteAll(0,OBJ_LABEL); + ObjectDelete("Label1"); ObjectDelete("Label2"); ObjectDelete("Label3"); + ObjectDelete("DataM1"); ObjectDelete("DataM5"); ObjectDelete("DataM15"); + ObjectDelete("DataM30"); ObjectDelete("DataH1"); ObjectDelete("DataH4"); + ObjectDelete("DataD1"); ObjectDelete("DataW1"); ObjectDelete("DataMN"); + ObjectDelete("Trend1"); ObjectDelete("Trend2"); ObjectDelete("Level1"); +//---- + return(0); + } +//+------------------------------------------------------------------+ +//| Custom indicator iteration function | +//+------------------------------------------------------------------+ +int start() + { + int counted_bars=IndicatorCounted(); + +//---- + for(int i=Bars;i>=0;i--){ + ExtMapBuffer2[i]=iMACD(NULL,0,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,i); + ExtMapBuffer3[i]=iMACD(NULL,0,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,i); + ExtMapBuffer4[i]=iMACD(NULL,0,FFastEMA,SSlowEMA,SSignalSMA,PRICE_CLOSE,MODE_MAIN,i); + ExtMapBuffer5[i]=iMACD(NULL,0,FFastEMA,SSlowEMA,SSignalSMA,PRICE_CLOSE,MODE_SIGNAL,i); + ExtMapBuffer6[i]=iMACD(NULL,0,FFFastEMA,SSSlowEMA,SSSignalSMA,PRICE_CLOSE,MODE_MAIN,i); + ExtMapBuffer7[i]=iMACD(NULL,0,FFFastEMA,SSSlowEMA,SSSignalSMA,PRICE_CLOSE,MODE_SIGNAL,i); + + ExtMapBuffer1[i]=ExtMapBuffer2[i] - ExtMapBuffer3[i]; + } + + double macd_M1=iMACD(NULL,PERIOD_M1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0); + double macd_MM1=iMACD(NULL,PERIOD_M1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0); + double macd_M5=iMACD(NULL,PERIOD_M5,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0); + double macd_MM5=iMACD(NULL,PERIOD_M5,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0); + double macd_M15=iMACD(NULL,PERIOD_M15,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0); + double macd_MM15=iMACD(NULL,PERIOD_M15,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0); + double macd_M30=iMACD(NULL,PERIOD_M30,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0); + double macd_MM30=iMACD(NULL,PERIOD_M30,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0); + double macd_H1=iMACD(NULL,PERIOD_H1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0); + double macd_HH1=iMACD(NULL,PERIOD_H1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0); + double macd_H4=iMACD(NULL,PERIOD_H4,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0); + double macd_HH4=iMACD(NULL,PERIOD_H4,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0); + + if (Show_MAJOR_TREND == true) + { + double macd_D1=iMACD(NULL,PERIOD_D1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0); + double macd_DD1=iMACD(NULL,PERIOD_D1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0); + double macd_W1=iMACD(NULL,PERIOD_W1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0); + double macd_WW1=iMACD(NULL,PERIOD_W1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0); + double macd_MN1=iMACD(NULL,PERIOD_MN1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0); + double macd_MMN1=iMACD(NULL,PERIOD_MN1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0); + } + + string trend_signal = "", trend_main = "", trend_level = ""; + color color_m1, color_m5, color_m15, color_m30, color_h1, color_h4, color_d1, color_w1, color_mn, + color_signal, color_main, color_level; + + // UP Data + if ((macd_M5 > macd_MM5) && (macd_M1 > macd_MM1)) { trend_signal = "TREND/UP"; color_signal = Lime;} + //Down Data + if ((macd_M5 < macd_MM5) && (macd_M1 < macd_MM1)) { trend_signal = "TREND/DN"; color_signal = Red; } + + //Consolidation Data + if ((macd_M5 < macd_MM5) && (macd_M1 > macd_MM1)) { trend_signal = "SIDEWAY"; color_signal = Orange; } + if ((macd_M5 > macd_MM5) && (macd_M1 < macd_MM1)) { trend_signal = "SIDEWAY"; color_signal = Orange; } + + if ((macd_M15 < macd_MM15) && (macd_M30 > macd_MM30) && (macd_H1 > macd_HH1)&& (macd_H4 < macd_HH4)) { trend_level = "WEAK"; color_level = Tomato; } + if ((macd_M15 > macd_MM15) && (macd_M30 < macd_MM30) && (macd_H1 < macd_HH1)&& (macd_H4 > macd_HH4)) { trend_level = "WEAK"; color_level = Tomato; } + + if ((macd_M15 < macd_MM15) && (macd_M30 > macd_MM30) && (macd_H1 < macd_HH1) && (macd_H4 < macd_HH4)) { trend_level = "MEDIUM"; color_level = Orange; } + if ((macd_M15 > macd_MM15) && (macd_M30 < macd_MM30) && (macd_H1 > macd_HH1) && (macd_H4 > macd_HH4)) { trend_level = "MEDIUM"; color_level = Orange; } + + + if ((macd_M5 > macd_MM5) && (macd_M15 > macd_MM15) && (macd_M30 > macd_MM30) && (macd_H1 < macd_HH1) && (macd_H4 > macd_HH4)) { trend_level = "MEDIUM"; color_level = Orange; } + if ((macd_M5 < macd_MM5) && (macd_M15 < macd_MM15) && (macd_M30 < macd_MM30) && (macd_H1 >macd_HH1) && (macd_H4 < macd_HH4)) { trend_level = "MEDIUM"; color_level = Orange; } + + if ((macd_M15 < macd_MM15) && (macd_M30 > macd_MM30) && (macd_H1 > macd_HH1)) { trend_main = "TREND/UP"; color_main = YellowGreen; } + if ((macd_M15 > macd_MM15) && (macd_M30 < macd_MM30) && (macd_H1 < macd_HH1)) { trend_main = "TREND/DN"; color_main = Tomato; } + + if ((macd_M15 < macd_MM15) && (macd_M30 < macd_MM30) && (macd_H1 > macd_HH1)) { trend_main = "TREND/DN"; color_main = Tomato; } + if ((macd_M15 > macd_MM15) && (macd_M30 > macd_MM30) && (macd_H1 < macd_HH1)) { trend_main = "TREND/UP"; color_main = YellowGreen; } + + if ((macd_M15 < macd_MM15) && (macd_M30 > macd_MM30) && (macd_H1 < macd_HH1)) { trend_main = "TREND/DN"; color_main = Red; } + if ((macd_M15 > macd_MM15) && (macd_M30 < macd_MM30) && (macd_H1 > macd_HH1)) { trend_main = "TREND/UP"; color_main = Lime; } + + if ((macd_M5 < macd_MM5) && (macd_M15 < macd_MM15) && (macd_H1 > macd_HH1) && (macd_H4 > macd_HH4)) { trend_level = "WEAK"; color_level = Tomato; } + if ((macd_M5 > macd_MM5) && (macd_M15 > macd_MM15) && (macd_H1 < macd_HH1) && (macd_H4 < macd_HH4)) { trend_level = "WEAK"; color_level = Tomato; } + + if ((macd_M15 > macd_MM15) && (macd_H1 > macd_HH1) && (macd_M30 > macd_MM30) && (macd_H4 < macd_HH4)) { trend_level = "MEDIUM"; color_level = Orange; } + if ((macd_M15 < macd_MM15) && (macd_H1 < macd_HH1) && (macd_M30 < macd_MM30) && (macd_H4 > macd_HH4)) { trend_level = "MEDIUM"; color_level = Orange; } + + if ((macd_M15 > macd_MM15) && (macd_H1 > macd_HH1) && (macd_M30 > macd_MM30) && (macd_H4 > macd_HH4)) { trend_level = "STRONG"; color_level = Yellow; } + if ((macd_M15 < macd_MM15) && (macd_H1 < macd_HH1) && (macd_M30 < macd_MM30) && (macd_H4 < macd_HH4)) { trend_level = "STRONG"; color_level = Yellow; } + + if ((macd_M15 > macd_MM15) && (macd_H1 > macd_HH1) && (macd_M30 > macd_MM30) && (macd_H4 > macd_HH4)) { trend_main = "TREND/UP"; color_main = Lime; } + if ((macd_M15 < macd_MM15) && (macd_H1 < macd_HH1) && (macd_M30 < macd_MM30) && (macd_H4 < macd_HH4)) { trend_main = "TREND/DN"; color_main = Red; } + + + if ((macd_M15 > macd_MM15) && (macd_H1 > macd_HH1) && (macd_M30 > macd_MM30) && (macd_H4 < macd_HH4)) { trend_main = "TREND/UP"; color_main = Lime; } + if ((macd_M15 < macd_MM15) && (macd_H1 < macd_HH1) && (macd_M30 < macd_MM30) && (macd_H4 > macd_HH4)) { trend_main = "TREND/DN"; color_main = Red; } + + //MACD Direction + if ((macd_M1 > macd_MM1)) { color_m1 = Lime; } + if ((macd_M1 < macd_MM1)) { color_m1 = Red; } + + if ((macd_M5 > macd_MM5)) { color_m5 = Lime; } + if ((macd_M5 < macd_MM5)) { color_m5 = Red; } + + if ((macd_M15 > macd_MM15)) { color_m15 = Lime; } + if ((macd_M15 < macd_MM15)) { color_m15 = Red; } + + if ((macd_M30 > macd_MM30)) { color_m30 = Lime; } + if ((macd_M30 < macd_MM30)) { color_m30 = Red; } + + if ((macd_H1 > macd_HH1)) { color_h1 = Lime; } + if ((macd_H1 < macd_HH1)) { color_h1 = Red; } + + if ((macd_H4 > macd_HH4)) { color_h4 = Lime; } + if ((macd_H4 < macd_HH4)) { color_h4 = Red; } + + if (Show_MAJOR_TREND == true) + { + if ((macd_D1 > macd_DD1)) { color_d1 = Lime; } + if ((macd_D1 < macd_DD1)) { color_d1 = Red; } + + if ((macd_W1 > macd_WW1)) { color_w1 = Lime; } + if ((macd_W1 < macd_WW1)) { color_w1 = Red; } + + if ((macd_MN1 > macd_MMN1)) { color_mn = Lime; } + if ((macd_MN1 < macd_MMN1)) { color_mn = Red; } + } + + //Signal Labels + ObjectCreate("Label1", OBJ_LABEL, WindowFind("GMACD2"), 0, 0); + ObjectSetText("Label1","SIGNAL",8, "Arial Bold", Silver); + ObjectSet("Label1", OBJPROP_CORNER, 0); + ObjectSet("Label1", OBJPROP_XDISTANCE, 5); + ObjectSet("Label1", OBJPROP_YDISTANCE, 15); + + //MACD Direction M1-M5 + ObjectCreate("DataM1", OBJ_LABEL, WindowFind("GMACD2"), 0, 0);//M1 SIGNAL + ObjectSetText("DataM1","M1",9, "Arial Bold", color_m1); + ObjectSet("DataM1", OBJPROP_CORNER, 0); + ObjectSet("DataM1", OBJPROP_XDISTANCE, 50); + ObjectSet("DataM1", OBJPROP_YDISTANCE, 15); + + ObjectCreate("DataM5", OBJ_LABEL, WindowFind("GMACD2"), 0, 0);//M5 SIGNAL + ObjectSetText("DataM5","M5",9, "Arial Bold", color_m5); + ObjectSet("DataM5", OBJPROP_CORNER, 0); + ObjectSet("DataM5", OBJPROP_XDISTANCE, 75); + ObjectSet("DataM5", OBJPROP_YDISTANCE, 15); + + //M1 & M5 TREND Data + ObjectCreate("Trend1", OBJ_LABEL, WindowFind("GMACD2"), 0, 0); + ObjectSetText("Trend1",trend_signal,12, "Arial Bold", color_signal); + ObjectSet("Trend1", OBJPROP_CORNER, 0); + ObjectSet("Trend1", OBJPROP_XDISTANCE, 100); + ObjectSet("Trend1", OBJPROP_YDISTANCE, 15); + + //Main Trend Label + ObjectCreate("Label2", OBJ_LABEL, WindowFind("GMACD2"), 0, 0); + ObjectSetText("Label2","MAIN TREND", 8, "Arial Bold", Silver); + ObjectSet("Label2", OBJPROP_CORNER, 0); + ObjectSet("Label2", OBJPROP_XDISTANCE, 190); + ObjectSet("Label2", OBJPROP_YDISTANCE, 15); + + //MACD Direction M15-H4 + ObjectCreate("DataM15", OBJ_LABEL, WindowFind("GMACD2"), 0, 0);//M15 SIGNAL + ObjectSetText("DataM15","M15",9, "Arial Bold", color_m15); + ObjectSet("DataM15", OBJPROP_CORNER, 0); + ObjectSet("DataM15", OBJPROP_XDISTANCE,260); + ObjectSet("DataM15", OBJPROP_YDISTANCE, 15); + + ObjectCreate("DataM30", OBJ_LABEL, WindowFind("GMACD2"), 0, 0);//M30 SIGNAL + ObjectSetText("DataM30","M30",9, "Arial Bold", color_m30); + ObjectSet("DataM30", OBJPROP_CORNER, 0); + ObjectSet("DataM30", OBJPROP_XDISTANCE, 290); + ObjectSet("DataM30", OBJPROP_YDISTANCE, 15); + + ObjectCreate("DataH1", OBJ_LABEL, WindowFind("GMACD2"), 0, 0);//H1 SIGNAL + ObjectSetText("DataH1","H1",9, "Arial Bold", color_h1); + ObjectSet("DataH1", OBJPROP_CORNER, 0); + ObjectSet("DataH1", OBJPROP_XDISTANCE, 320); + ObjectSet("DataH1", OBJPROP_YDISTANCE, 15); + + ObjectCreate("DataH4", OBJ_LABEL, WindowFind("GMACD2"), 0, 0);//H4 SIGNAL + ObjectSetText("DataH4","H4",9, "Arial Bold", color_h4); + ObjectSet("DataH4", OBJPROP_CORNER, 0); + ObjectSet("DataH4", OBJPROP_XDISTANCE, 340); + ObjectSet("DataH4", OBJPROP_YDISTANCE, 15); + + //M15 - H4 TREND Data + ObjectCreate("Trend2", OBJ_LABEL, WindowFind("GMACD2"), 0, 0); + ObjectSetText("Trend2",trend_main,12, "Arial Bold", color_main); + ObjectSet("Trend2", OBJPROP_CORNER, 0); + ObjectSet("Trend2", OBJPROP_XDISTANCE, 365); + ObjectSet("Trend2", OBJPROP_YDISTANCE, 15); + + //Level Data + ObjectCreate("Level1", OBJ_LABEL, WindowFind("GMACD2"), 0, 0); + ObjectSetText("Level1",trend_level,8, "Arial Bold", color_level); + ObjectSet("Level1", OBJPROP_CORNER, 0); + ObjectSet("Level1", OBJPROP_XDISTANCE,455); + ObjectSet("Level1", OBJPROP_YDISTANCE, 15); + + if (Show_MAJOR_TREND == true) + { + ObjectCreate("Label3", OBJ_LABEL, WindowFind("GMACD2"), 0, 0); + ObjectSetText("Label3","MAJOR TREND", 8, "Arial Bold", Silver); + ObjectSet("Label3", OBJPROP_CORNER, 0); + ObjectSet("Label3", OBJPROP_XDISTANCE, 805); + ObjectSet("Label3", OBJPROP_YDISTANCE, 4); + + ObjectCreate("DataD1", OBJ_LABEL, WindowFind("GMACD2"), 0, 0);//D1 SIGNAL + ObjectSetText("DataD1","D1",9, "Arial Bold", color_d1); + ObjectSet("DataD1", OBJPROP_CORNER, 0); + ObjectSet("DataD1", OBJPROP_XDISTANCE, 885); + ObjectSet("DataD1", OBJPROP_YDISTANCE, 4); + + ObjectCreate("DataW1", OBJ_LABEL, WindowFind("GMACD2"), 0, 0);//W1 SIGNAL + ObjectSetText("DataW1","W1",9, "Arial Bold", color_w1); + ObjectSet("DataW1", OBJPROP_CORNER, 0); + ObjectSet("DataW1", OBJPROP_XDISTANCE, 905); + ObjectSet("DataW1", OBJPROP_YDISTANCE, 4); + + ObjectCreate("DataMN", OBJ_LABEL, WindowFind("GMACD2"), 0, 0);//MN SIGNAL + ObjectSetText("DataMN","MN",9, "Arial Bold", color_mn); + ObjectSet("DataMN", OBJPROP_CORNER, 0); + ObjectSet("DataMN", OBJPROP_XDISTANCE, 930); + ObjectSet("DataMN", OBJPROP_YDISTANCE, 4); + } + +} +//---- + return(0); + +//+------------------------------------------------------------------+ \ No newline at end of file diff --git a/HMA Trend Arrows TT.mq4 b/HMA Trend Arrows TT.mq4 new file mode 100644 index 0000000..4c10eac Binary files /dev/null and b/HMA Trend Arrows TT.mq4 differ diff --git a/HalfTrend-1.02.mq4 b/HalfTrend-1.02.mq4 new file mode 100644 index 0000000..4970693 --- /dev/null +++ b/HalfTrend-1.02.mq4 @@ -0,0 +1,219 @@ +//+----------------------------------------------------------------------+ +//| HalfTrend.mq4 | +//| Copyright 2014, FxProSystems.com | +//| http://fxprosystems.com/ | +//+----------------------------------------------------------------------+ +#property copyright "Copyright © 2015 FXProSystems.com" +#property link "http://fxprosystems.com/" +#property indicator_chart_window +#property indicator_buffers 6 +#property indicator_color1 DodgerBlue // up[] +#property indicator_width1 2 +#property indicator_color2 Red // down[] +#property indicator_width2 2 +#property indicator_color3 DodgerBlue // atrlo[] +#property indicator_width3 1 +#property indicator_color4 Red // atrhi[] +#property indicator_width4 1 +#property indicator_color5 DodgerBlue // arrup[] +#property indicator_width5 1 +#property indicator_color6 Red // arrdwn[] +#property indicator_width6 1 + + +extern int Amplitude = 2; +extern bool ShowBars = true; +extern bool ShowArrows = true; +extern bool alertsOn = true; +extern bool alertsOnCurrent = false; +extern bool alertsMessage = true; +extern bool alertsSound = true; +extern bool alertsEmail = false; + +bool nexttrend; +double minhighprice,maxlowprice; +double up[],down[],atrlo[],atrhi[],trend[]; +double arrup[],arrdwn[]; +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +int init() + { + Comment(" Copyright © 2015 | FXProSystems.com"); + IndicatorBuffers(7); // +1 buffer - trend[] + + SetIndexBuffer(0,up); + SetIndexStyle(0,DRAW_LINE); + SetIndexBuffer(1,down); + SetIndexStyle(1,DRAW_LINE); + SetIndexBuffer(2,atrlo); + SetIndexBuffer(3,atrhi); + SetIndexBuffer(6,trend); + SetIndexBuffer(4,arrup); + SetIndexBuffer(5,arrdwn); + SetIndexEmptyValue(0,0.0); + SetIndexEmptyValue(1,0.0); + SetIndexEmptyValue(6,0.0); + + if(ShowBars) + { + SetIndexStyle(2,DRAW_HISTOGRAM, STYLE_SOLID); + SetIndexStyle(3,DRAW_HISTOGRAM, STYLE_SOLID); + } + else + { + SetIndexStyle(2,DRAW_NONE); + SetIndexStyle(3,DRAW_NONE); + } + if(ShowArrows) + { + SetIndexStyle(4,DRAW_ARROW,STYLE_SOLID); SetIndexArrow(4,233); + SetIndexStyle(5,DRAW_ARROW,STYLE_SOLID); SetIndexArrow(5,234); + } + else + { + SetIndexStyle(4,DRAW_NONE); + SetIndexStyle(5,DRAW_NONE); + } + + + nexttrend=0; + minhighprice= High[Bars-1]; + maxlowprice = Low[Bars-1]; + return (0); + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +class CFix { } ExtFix; +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +int start() + { + double atr,lowprice_i,highprice_i,lowma,highma; + int workbar=0; + int counted_bars=IndicatorCounted(); + if(counted_bars<0) return(-1); + if(counted_bars>0) counted_bars--; + int limit = MathMin(Bars-counted_bars,Bars-1); + + for(int i=Bars-1; i>=0; i--) + { + lowprice_i=iLow(Symbol(),Period(),iLowest(Symbol(),Period(),MODE_LOW,Amplitude,i)); + highprice_i=iHigh(Symbol(),Period(),iHighest(Symbol(),Period(),MODE_HIGH,Amplitude,i)); + lowma=NormalizeDouble(iMA(NULL,0,Amplitude,0,MODE_SMA,PRICE_LOW,i),Digits()); + highma=NormalizeDouble(iMA(NULL,0,Amplitude,0,MODE_SMA,PRICE_HIGH,i),Digits()); + trend[i]=trend[i+1]; + atr=iATR(Symbol(),0,100,i)/2; + + arrup[i] = EMPTY_VALUE; + arrdwn[i] = EMPTY_VALUE; + if(nexttrend==1) + { + maxlowprice=MathMax(lowprice_i,maxlowprice); + + if(highmaminhighprice && Close[i]>High[i+1]) + { + trend[i]=0.0; + nexttrend=1; + maxlowprice=lowprice_i; + } + } + if(trend[i]==0.0) + { + if(trend[i+1]!=0.0) + { + up[i]=down[i+1]; + up[i+1]=up[i]; + arrup[i] = up[i] - 2*atr; + } + else + { + up[i]=MathMax(maxlowprice,up[i+1]); + } + atrhi[i] = up[i] - atr; + atrlo[i] = up[i]; + down[i]=0.0; + } + else + { + if(trend[i+1]!=1.0) + { + down[i]=up[i+1]; + down[i+1]=down[i]; + arrdwn[i] = down[i] + 2*atr; + } + else + { + down[i]=MathMin(minhighprice,down[i+1]); + } + atrhi[i] = down[i] + atr; + atrlo[i] = down[i]; + up[i]=0.0; + } + } + manageAlerts(); + return (0); + } +//+------------------------------------------------------------------+ +//+------------------------------------------------------------------- +//| +//+------------------------------------------------------------------- +// +// +// +// +// + +void manageAlerts() +{ + if (alertsOn) + { + if (alertsOnCurrent) + int whichBar = 0; + else whichBar = 1; + if (arrup[whichBar] != EMPTY_VALUE) doAlert(whichBar,"up"); + if (arrdwn[whichBar] != EMPTY_VALUE) doAlert(whichBar,"down"); + } +} + +// +// +// +// +// + +void doAlert(int forBar, string doWhat) +{ + static string previousAlert="nothing"; + static datetime previousTime; + string message; + + if (previousAlert != doWhat || previousTime != Time[forBar]) { + previousAlert = doWhat; + previousTime = Time[forBar]; + + // + // + // + // + // + + message = StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," HalfTrend signal ",doWhat); + if (alertsMessage) Alert(message); + if (alertsEmail) SendMail(StringConcatenate(Symbol(),"HalfTrend "),message); + if (alertsSound) PlaySound("alert2.wav"); + } +} \ No newline at end of file diff --git a/HamaSystem.mq4 b/HamaSystem.mq4 new file mode 100644 index 0000000..9f1c832 --- /dev/null +++ b/HamaSystem.mq4 @@ -0,0 +1,93 @@ +#property copyright "Personalized for HAMA PAD Approach - Copyright © 2009" +#property link "http://www.forex-tsd.com" +// modified by keekkenen 2009-02-15 +#property indicator_chart_window +#property indicator_buffers 6 +#property indicator_color1 Red +#property indicator_color2 RoyalBlue +#property indicator_color3 Red +#property indicator_color4 RoyalBlue +#property indicator_color5 RoyalBlue +#property indicator_color6 Red + +int MaPeriod = 20; +double buf0[], buf1[], buf2[], buf3[], buf4[], buf5[]; +string Copyright = ""; +//+------------------------------------------------------------------+ +int init(){ + SetIndexStyle(0,DRAW_HISTOGRAM, 0, 3); + SetIndexBuffer(0, buf0); + SetIndexStyle(1,DRAW_HISTOGRAM, 0, 3); + SetIndexBuffer(1, buf1); + SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID, 1); + SetIndexBuffer(2, buf2); + SetIndexStyle(3, DRAW_HISTOGRAM, STYLE_SOLID, 1); + SetIndexBuffer(3, buf3); + SetIndexStyle(4, DRAW_LINE, STYLE_SOLID, 0); + SetIndexBuffer(4, buf4); + SetIndexStyle(5, DRAW_LINE, STYLE_SOLID, 0); + SetIndexBuffer(5, buf5); + + setLabel(Copyright,Copyright,RoyalBlue,2,5,10,false,9,"Lucida Handwriting"); + return(0); +} +//+------------------------------------------------------------------+ +int deinit(){ObjectDelete(Copyright);} +//+------------------------------------------------------------------+ +int start() { + int ExtCountedBars = 0; + double maOpen, maClose, maLow, maHigh; + double haOpen, haHigh, haLow, haClose; + if(Bars<=10) return(0); + ExtCountedBars=IndicatorCounted(); + if (ExtCountedBars<0) return(-1); + if (ExtCountedBars>0) ExtCountedBars--; + int pos=Bars-ExtCountedBars-1; + while(pos>=0){ + maOpen=iMA(NULL,0,MaPeriod,0,MODE_EMA,MODE_OPEN,pos); + maClose=iMA(NULL,0,MaPeriod,0,MODE_EMA,MODE_CLOSE,pos); + maLow=iMA(NULL,0,MaPeriod,0,MODE_EMA,MODE_LOW,pos); + maHigh=iMA(NULL,0,MaPeriod,0,MODE_EMA,MODE_HIGH,pos); + + haOpen=(buf0[pos+1]+buf1[pos+1])/2.; + haClose=(maOpen+maHigh+maLow+maClose)/4.; + + buf0[pos]=haOpen; + buf1[pos]=haClose; + + if (buf0[pos] < buf1[pos]) { + buf2[pos] = Low[pos]; + buf3[pos] = High[pos]; + }else{ + buf2[pos] = High[pos]; + buf3[pos] = Low[pos]; + } + pos--; + } + for (int i = Bars-ExtCountedBars-1; i >= 0; i--) { + buf4[i] = iMA(NULL, 0, MaPeriod, 0, MODE_EMA, PRICE_HIGH, i); + buf5[i] = iMA(NULL, 0, MaPeriod, 0, MODE_EMA, PRICE_LOW, i); + } + return(0); +} +//+------------------------------------------------------------------+ +void setLabel(string name, string text, color col, int corner, + int x, int y, bool back = false, int fontsize = 9, + string fontname = "MS Sans Serif") { + if (ObjectFind(name)==-1){ + // ñîçäàíèå îáúåêòà, åñëè íå ñîçäàâàëñÿ èëè áûë óäàëåí + ObjectCreate(name, OBJ_LABEL, 0, 0, 0); + ObjectSetText(name, text, fontsize, fontname, col); + ObjectSet(name, OBJPROP_CORNER, corner); + ObjectSet(name, OBJPROP_BACK,back); + ObjectSet(name, OBJPROP_XDISTANCE, x); + ObjectSet(name, OBJPROP_YDISTANCE, y); + }else{ + ObjectSetText(name, text, fontsize, fontname, col); + ObjectSet(name, OBJPROP_CORNER, corner); + ObjectSet(name, OBJPROP_BACK,back); + ObjectSet(name, OBJPROP_XDISTANCE, x); + ObjectSet(name, OBJPROP_YDISTANCE, y); + } +} + diff --git a/MACD_Histogram.mq4 b/MACD_Histogram.mq4 new file mode 100644 index 0000000..5b920b8 --- /dev/null +++ b/MACD_Histogram.mq4 @@ -0,0 +1,349 @@ +//+------------------------------------------------------------------+ +//| MACD_Histogram.mq4 | +//| Copyright © 2008, MetaQuotes Software Corp. | +//| http://www.frankie-prasetio.blogspot.com | +//+------------------------------------------------------------------+ +#property copyright "Copyright © 2008, MetaQuotes Software Corp." +#property link "http://www.frankie-prasetio.blogspot.com" + +#property indicator_separate_window +#property indicator_buffers 5 +#property indicator_color1 DodgerBlue +#property indicator_color2 Red +#property indicator_color3 Silver +#property indicator_color4 Lime +#property indicator_color5 Red +#property indicator_level1 0 +//---- +#define arrowsDisplacement 0.0001 +//---- input parameters +extern string separator1 = "*** MACD Settings ***"; +extern int FastMAPeriod = 12; +extern int SlowMAPeriod = 26; +extern int SignalMAPeriod = 9; +extern string separator2 = "*** Indicator Settings ***"; +extern bool drawIndicatorTrendLines = true; +extern bool drawPriceTrendLines = true; +extern bool displayAlert = true; +//---- buffers +double MACDLineBuffer[]; +double SignalLineBuffer[]; +double HistogramBuffer[]; +double bullishDivergence[]; +double bearishDivergence[]; +//---- variables +double alpha = 0; +double alpha_1 = 0; +//---- +static datetime lastAlertTime; +static string indicatorName; +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +int init() +{ + IndicatorDigits(Digits + 1); + //---- indicators + SetIndexStyle(0, DRAW_LINE); + SetIndexBuffer(0, MACDLineBuffer); + SetIndexDrawBegin(0, SlowMAPeriod); + SetIndexStyle(1, DRAW_LINE); + SetIndexBuffer(1, SignalLineBuffer); + SetIndexDrawBegin(1, SlowMAPeriod + SignalMAPeriod); + SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID,2); + SetIndexBuffer(2, HistogramBuffer); + SetIndexDrawBegin(2, SlowMAPeriod + SignalMAPeriod); + SetIndexStyle(3, DRAW_ARROW); + SetIndexArrow(3, 233); + SetIndexBuffer(3, bullishDivergence); + SetIndexStyle(4, DRAW_ARROW); + SetIndexArrow(4, 234); + SetIndexBuffer(4, bearishDivergence); + //---- name for DataWindow and indicator subwindow label + indicatorName =("MACD(" + FastMAPeriod+"," + SlowMAPeriod + "," + SignalMAPeriod + ")"); + SetIndexLabel(2, "MACD"); + SetIndexLabel(3, "Signal"); + SetIndexLabel(4, "Histogr"); + IndicatorShortName(indicatorName); + //---- + alpha = 2.0 / (SignalMAPeriod + 1.0); + alpha_1 = 1.0 - alpha; + //---- + return(0); +} +//+------------------------------------------------------------------+ +//| Custor indicator deinitialization function | +//+------------------------------------------------------------------+ +int deinit() + { + for(int i = ObjectsTotal() - 1; i >= 0; i--) + { + string label = ObjectName(i); + if(StringSubstr(label, 0, 19) != "MACD_DivergenceLine") + continue; + ObjectDelete(label); + } + return(0); + } +//+------------------------------------------------------------------+ +//| Custom indicator iteration function | +//+------------------------------------------------------------------+ +int start() + { + int limit; + int counted_bars = IndicatorCounted(); + //---- check for possible errors + if(counted_bars < 0) + return(-1); + //---- last counted bar will be recounted + if(counted_bars > 0) + counted_bars--; + limit = Bars - counted_bars; + CalculateIndicator(counted_bars); +//---- + for(int i = limit; i >= 0; i--) + { + MACDLineBuffer[i] = iMA(NULL, 0, FastMAPeriod, 0, MODE_EMA, PRICE_CLOSE, i) - + iMA(NULL, 0, SlowMAPeriod, 0, MODE_EMA, PRICE_CLOSE, i); + SignalLineBuffer[i] = alpha*MACDLineBuffer[i] + alpha_1*SignalLineBuffer[i+1]; + HistogramBuffer[i] = MACDLineBuffer[i] - SignalLineBuffer[i]; + } +//---- + return(0); + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +void CalculateIndicator(int countedBars) + { + for(int i = Bars - countedBars; i >= 0; i--) + { + CalculateMACD(i); + CatchBullishDivergence(i + 2); + CatchBearishDivergence(i + 2); + } + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +void CalculateMACD(int i) + { + MACDLineBuffer[i] = iMA(NULL, 0, FastMAPeriod, 0, MODE_EMA, PRICE_CLOSE, i) - + iMA(NULL, 0, SlowMAPeriod, 0, MODE_EMA, PRICE_CLOSE, i); + SignalLineBuffer[i] = alpha*MACDLineBuffer[i] + alpha_1*SignalLineBuffer[i+1]; + HistogramBuffer[i] = MACDLineBuffer[i] - SignalLineBuffer[i]; + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +void CatchBullishDivergence(int shift) + { + if(IsIndicatorTrough(shift) == false) + return; + int currentTrough = shift; + int lastTrough = GetIndicatorLastTrough(shift); +//---- + if(MACDLineBuffer[currentTrough] > MACDLineBuffer[lastTrough] && + Low[currentTrough] < Low[lastTrough]) + { + bullishDivergence[currentTrough] = MACDLineBuffer[currentTrough] - + arrowsDisplacement; + //---- + if(drawPriceTrendLines == true) + DrawPriceTrendLine(Time[currentTrough], Time[lastTrough], + Low[currentTrough], + Low[lastTrough], Lime, STYLE_SOLID); + //---- + if(drawIndicatorTrendLines == true) + DrawIndicatorTrendLine(Time[currentTrough], + Time[lastTrough], + MACDLineBuffer[currentTrough], + MACDLineBuffer[lastTrough], + Lime, STYLE_SOLID); + //---- + if(displayAlert == true) + DisplayAlert("Classical bullish divergence on: ", + currentTrough); + } +//---- + if(MACDLineBuffer[currentTrough] < MACDLineBuffer[lastTrough] && + Low[currentTrough] > Low[lastTrough]) + { + bullishDivergence[currentTrough] = MACDLineBuffer[currentTrough] - + arrowsDisplacement; + //---- + if(drawPriceTrendLines == true) + DrawPriceTrendLine(Time[currentTrough], Time[lastTrough], + Low[currentTrough], + Low[lastTrough], Lime, STYLE_DOT); + //---- + if(drawIndicatorTrendLines == true) + DrawIndicatorTrendLine(Time[currentTrough], + Time[lastTrough], + MACDLineBuffer[currentTrough], + MACDLineBuffer[lastTrough], + Lime, STYLE_DOT); + //---- + if(displayAlert == true) + DisplayAlert("Reverse bullish divergence on: ", + currentTrough); + } + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +void CatchBearishDivergence(int shift) + { + if(IsIndicatorPeak(shift) == false) + return; + int currentPeak = shift; + int lastPeak = GetIndicatorLastPeak(shift); +//---- + if(MACDLineBuffer[currentPeak] < MACDLineBuffer[lastPeak] && + High[currentPeak] > High[lastPeak]) + { + bearishDivergence[currentPeak] = MACDLineBuffer[currentPeak] + + arrowsDisplacement; + + if(drawPriceTrendLines == true) + DrawPriceTrendLine(Time[currentPeak], Time[lastPeak], + High[currentPeak], + High[lastPeak], Red, STYLE_SOLID); + + if(drawIndicatorTrendLines == true) + DrawIndicatorTrendLine(Time[currentPeak], Time[lastPeak], + MACDLineBuffer[currentPeak], + MACDLineBuffer[lastPeak], Red, STYLE_SOLID); + + if(displayAlert == true) + DisplayAlert("Classical bearish divergence on: ", + currentPeak); + } + if(MACDLineBuffer[currentPeak] > MACDLineBuffer[lastPeak] && + High[currentPeak] < High[lastPeak]) + { + bearishDivergence[currentPeak] = MACDLineBuffer[currentPeak] + + arrowsDisplacement; + //---- + if(drawPriceTrendLines == true) + DrawPriceTrendLine(Time[currentPeak], Time[lastPeak], + High[currentPeak], + High[lastPeak], Red, STYLE_DOT); + //---- + if(drawIndicatorTrendLines == true) + DrawIndicatorTrendLine(Time[currentPeak], Time[lastPeak], + MACDLineBuffer[currentPeak], + MACDLineBuffer[lastPeak], Red, STYLE_DOT); + //---- + if(displayAlert == true) + DisplayAlert("Reverse bearish divergence on: ", + currentPeak); + } + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +bool IsIndicatorPeak(int shift) + { + if(MACDLineBuffer[shift] >= MACDLineBuffer[shift+1] && MACDLineBuffer[shift] > MACDLineBuffer[shift+2] && + MACDLineBuffer[shift] > MACDLineBuffer[shift-1]) + return(true); + else + return(false); + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +bool IsIndicatorTrough(int shift) + { + if(MACDLineBuffer[shift] <= MACDLineBuffer[shift+1] && MACDLineBuffer[shift] < MACDLineBuffer[shift+2] && + MACDLineBuffer[shift] < MACDLineBuffer[shift-1]) + return(true); + else + return(false); + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +int GetIndicatorLastPeak(int shift) + { + for(int i = shift + 5; i < Bars; i++) + { + if(SignalLineBuffer[i] >= SignalLineBuffer[i+1] && SignalLineBuffer[i] >= SignalLineBuffer[i+2] && + SignalLineBuffer[i] >= SignalLineBuffer[i-1] && SignalLineBuffer[i] >= SignalLineBuffer[i-2]) + { + for(int j = i; j < Bars; j++) + { + if(MACDLineBuffer[j] >= MACDLineBuffer[j+1] && MACDLineBuffer[j] > MACDLineBuffer[j+2] && + MACDLineBuffer[j] >= MACDLineBuffer[j-1] && MACDLineBuffer[j] > MACDLineBuffer[j-2]) + return(j); + } + } + } + return(-1); + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +int GetIndicatorLastTrough(int shift) + { + for(int i = shift + 5; i < Bars; i++) + { + if(SignalLineBuffer[i] <= SignalLineBuffer[i+1] && SignalLineBuffer[i] <= SignalLineBuffer[i+2] && + SignalLineBuffer[i] <= SignalLineBuffer[i-1] && SignalLineBuffer[i] <= SignalLineBuffer[i-2]) + { + for (int j = i; j < Bars; j++) + { + if(MACDLineBuffer[j] <= MACDLineBuffer[j+1] && MACDLineBuffer[j] < MACDLineBuffer[j+2] && + MACDLineBuffer[j] <= MACDLineBuffer[j-1] && MACDLineBuffer[j] < MACDLineBuffer[j-2]) + return(j); + } + } + } + return(-1); + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +void DisplayAlert(string message, int shift) + { + if(shift <= 2 && Time[shift] != lastAlertTime) + { + lastAlertTime = Time[shift]; + Alert(message, Symbol(), " , ", Period(), " minutes chart"); + } + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +void DrawPriceTrendLine(datetime x1, datetime x2, double y1, + double y2, color lineColor, double style) + { + string label = "MACD_DivergenceLine.0# " + DoubleToStr(x1, 0); + ObjectDelete(label); + ObjectCreate(label, OBJ_TREND, 0, x1, y1, x2, y2, 0, 0); + ObjectSet(label, OBJPROP_RAY, 0); + ObjectSet(label, OBJPROP_COLOR, lineColor); + ObjectSet(label, OBJPROP_STYLE, style); + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +void DrawIndicatorTrendLine(datetime x1, datetime x2, double y1, + double y2, color lineColor, double style) + { + int indicatorWindow = WindowFind(indicatorName); + if(indicatorWindow < 0) + return; + string label = "MACD_DivergenceLine.0$# " + DoubleToStr(x1, 0); + ObjectDelete(label); + ObjectCreate(label, OBJ_TREND, indicatorWindow, x1, y1, x2, y2, + 0, 0); + ObjectSet(label, OBJPROP_RAY, 0); + ObjectSet(label, OBJPROP_COLOR, lineColor); + ObjectSet(label, OBJPROP_STYLE, style); + } +//+------------------------------------------------------------------+ + + + diff --git a/MetaCOT2_CIT_Absolute_Changes.mq4 b/MetaCOT2_CIT_Absolute_Changes.mq4 new file mode 100644 index 0000000..e6757ff Binary files /dev/null and b/MetaCOT2_CIT_Absolute_Changes.mq4 differ diff --git a/MetaCOT2_CIT_Absolute_Position.mq4 b/MetaCOT2_CIT_Absolute_Position.mq4 new file mode 100644 index 0000000..34dcf68 Binary files /dev/null and b/MetaCOT2_CIT_Absolute_Position.mq4 differ diff --git a/MetaCOT2_CIT_Index.mq4 b/MetaCOT2_CIT_Index.mq4 new file mode 100644 index 0000000..c863649 Binary files /dev/null and b/MetaCOT2_CIT_Index.mq4 differ diff --git a/MetaCOT2_CIT_Movement_Index.mq4 b/MetaCOT2_CIT_Movement_Index.mq4 new file mode 100644 index 0000000..0212483 Binary files /dev/null and b/MetaCOT2_CIT_Movement_Index.mq4 differ diff --git a/MetaCOT2_CIT_Netto_Changes.mq4 b/MetaCOT2_CIT_Netto_Changes.mq4 new file mode 100644 index 0000000..eaa27e3 Binary files /dev/null and b/MetaCOT2_CIT_Netto_Changes.mq4 differ diff --git a/MetaCOT2_CIT_Netto_Position.mq4 b/MetaCOT2_CIT_Netto_Position.mq4 new file mode 100644 index 0000000..9801252 Binary files /dev/null and b/MetaCOT2_CIT_Netto_Position.mq4 differ diff --git a/MetaCOT2_CIT_Williams_Commercial_Index.mq4 b/MetaCOT2_CIT_Williams_Commercial_Index.mq4 new file mode 100644 index 0000000..3bc8bec Binary files /dev/null and b/MetaCOT2_CIT_Williams_Commercial_Index.mq4 differ diff --git a/MetaCOT2_COT_Absolute_Changes.mq4 b/MetaCOT2_COT_Absolute_Changes.mq4 new file mode 100644 index 0000000..3444637 Binary files /dev/null and b/MetaCOT2_COT_Absolute_Changes.mq4 differ diff --git a/MetaCOT2_COT_Absolute_Position.mq4 b/MetaCOT2_COT_Absolute_Position.mq4 new file mode 100644 index 0000000..d44f64c Binary files /dev/null and b/MetaCOT2_COT_Absolute_Position.mq4 differ diff --git a/MetaCOT2_COT_Index.mq4 b/MetaCOT2_COT_Index.mq4 new file mode 100644 index 0000000..0d99dfb Binary files /dev/null and b/MetaCOT2_COT_Index.mq4 differ diff --git a/MetaCOT2_COT_Movement_Index.mq4 b/MetaCOT2_COT_Movement_Index.mq4 new file mode 100644 index 0000000..83615bb Binary files /dev/null and b/MetaCOT2_COT_Movement_Index.mq4 differ diff --git a/MetaCOT2_COT_Netto_Changes.mq4 b/MetaCOT2_COT_Netto_Changes.mq4 new file mode 100644 index 0000000..cca10f5 Binary files /dev/null and b/MetaCOT2_COT_Netto_Changes.mq4 differ diff --git a/MetaCOT2_COT_Netto_Position.mq4 b/MetaCOT2_COT_Netto_Position.mq4 new file mode 100644 index 0000000..f6ef6f5 Binary files /dev/null and b/MetaCOT2_COT_Netto_Position.mq4 differ diff --git a/MetaCOT2_COT_Williams_Commercial_Index.mq4 b/MetaCOT2_COT_Williams_Commercial_Index.mq4 new file mode 100644 index 0000000..d4085c4 Binary files /dev/null and b/MetaCOT2_COT_Williams_Commercial_Index.mq4 differ diff --git a/MetaCOT2_D-COT_Absolute_Changes.mq4 b/MetaCOT2_D-COT_Absolute_Changes.mq4 new file mode 100644 index 0000000..b49ddc5 Binary files /dev/null and b/MetaCOT2_D-COT_Absolute_Changes.mq4 differ diff --git a/MetaCOT2_D-COT_Absolute_Position.mq4 b/MetaCOT2_D-COT_Absolute_Position.mq4 new file mode 100644 index 0000000..5ec2d58 Binary files /dev/null and b/MetaCOT2_D-COT_Absolute_Position.mq4 differ diff --git a/MetaCOT2_D-COT_Index.mq4 b/MetaCOT2_D-COT_Index.mq4 new file mode 100644 index 0000000..aeb2c87 Binary files /dev/null and b/MetaCOT2_D-COT_Index.mq4 differ diff --git a/MetaCOT2_D-COT_Movement_Index.mq4 b/MetaCOT2_D-COT_Movement_Index.mq4 new file mode 100644 index 0000000..2aa20e1 Binary files /dev/null and b/MetaCOT2_D-COT_Movement_Index.mq4 differ diff --git a/MetaCOT2_D-COT_Netto_Changes.mq4 b/MetaCOT2_D-COT_Netto_Changes.mq4 new file mode 100644 index 0000000..9a9ddc7 Binary files /dev/null and b/MetaCOT2_D-COT_Netto_Changes.mq4 differ diff --git a/MetaCOT2_D-COT_Netto_Position.mq4 b/MetaCOT2_D-COT_Netto_Position.mq4 new file mode 100644 index 0000000..f93b066 Binary files /dev/null and b/MetaCOT2_D-COT_Netto_Position.mq4 differ diff --git a/MetaCOT2_D-COT_Williams_Commercial_Index.mq4 b/MetaCOT2_D-COT_Williams_Commercial_Index.mq4 new file mode 100644 index 0000000..d0888b4 Binary files /dev/null and b/MetaCOT2_D-COT_Williams_Commercial_Index.mq4 differ diff --git a/MetaCOT2_L-COT_Largest_Changes.mq4 b/MetaCOT2_L-COT_Largest_Changes.mq4 new file mode 100644 index 0000000..015dc3c Binary files /dev/null and b/MetaCOT2_L-COT_Largest_Changes.mq4 differ diff --git a/MetaCOT2_L-COT_Largest_Position.mq4 b/MetaCOT2_L-COT_Largest_Position.mq4 new file mode 100644 index 0000000..67f825d Binary files /dev/null and b/MetaCOT2_L-COT_Largest_Position.mq4 differ diff --git a/MetaCOT2_L-COT_Movement_Index.mq4 b/MetaCOT2_L-COT_Movement_Index.mq4 new file mode 100644 index 0000000..265a920 Binary files /dev/null and b/MetaCOT2_L-COT_Movement_Index.mq4 differ diff --git a/MetaCOT2_L-COT_Netto_Changes.mq4 b/MetaCOT2_L-COT_Netto_Changes.mq4 new file mode 100644 index 0000000..436fac8 Binary files /dev/null and b/MetaCOT2_L-COT_Netto_Changes.mq4 differ diff --git a/MetaCOT2_L-COT_Netto_Largest_Position.mq4 b/MetaCOT2_L-COT_Netto_Largest_Position.mq4 new file mode 100644 index 0000000..dc8418c Binary files /dev/null and b/MetaCOT2_L-COT_Netto_Largest_Position.mq4 differ diff --git a/MetaCOT2_L-COT_Williams_Commercial_Index.mq4 b/MetaCOT2_L-COT_Williams_Commercial_Index.mq4 new file mode 100644 index 0000000..7870e7f Binary files /dev/null and b/MetaCOT2_L-COT_Williams_Commercial_Index.mq4 differ diff --git a/MetaCOT2_SaveIndicatorValuesInFile.mq4 b/MetaCOT2_SaveIndicatorValuesInFile.mq4 new file mode 100644 index 0000000..9753b4c Binary files /dev/null and b/MetaCOT2_SaveIndicatorValuesInFile.mq4 differ diff --git a/MetaCOT2_TFF_Absolute_Changes.mq4 b/MetaCOT2_TFF_Absolute_Changes.mq4 new file mode 100644 index 0000000..901370b Binary files /dev/null and b/MetaCOT2_TFF_Absolute_Changes.mq4 differ diff --git a/MetaCOT2_TFF_Absolute_Position.mq4 b/MetaCOT2_TFF_Absolute_Position.mq4 new file mode 100644 index 0000000..32ab6d0 Binary files /dev/null and b/MetaCOT2_TFF_Absolute_Position.mq4 differ diff --git a/MetaCOT2_TFF_Index.mq4 b/MetaCOT2_TFF_Index.mq4 new file mode 100644 index 0000000..6dc26e8 Binary files /dev/null and b/MetaCOT2_TFF_Index.mq4 differ diff --git a/MetaCOT2_TFF_Movement_Index.mq4 b/MetaCOT2_TFF_Movement_Index.mq4 new file mode 100644 index 0000000..501b894 Binary files /dev/null and b/MetaCOT2_TFF_Movement_Index.mq4 differ diff --git a/MetaCOT2_TFF_Netto_Changes.mq4 b/MetaCOT2_TFF_Netto_Changes.mq4 new file mode 100644 index 0000000..c8308d0 Binary files /dev/null and b/MetaCOT2_TFF_Netto_Changes.mq4 differ diff --git a/MetaCOT2_TFF_Netto_Position.mq4 b/MetaCOT2_TFF_Netto_Position.mq4 new file mode 100644 index 0000000..8a6468a Binary files /dev/null and b/MetaCOT2_TFF_Netto_Position.mq4 differ diff --git a/MetaCOT2_TFF_Williams_Commercial_Index.mq4 b/MetaCOT2_TFF_Williams_Commercial_Index.mq4 new file mode 100644 index 0000000..e8b736c Binary files /dev/null and b/MetaCOT2_TFF_Williams_Commercial_Index.mq4 differ diff --git a/Momentum.mq4 b/Momentum.mq4 new file mode 100644 index 0000000..1fc14ae --- /dev/null +++ b/Momentum.mq4 @@ -0,0 +1,78 @@ +//+------------------------------------------------------------------+ +//| Momentum.mq4 | +//| Copyright 2005-2014, MetaQuotes Software Corp. | +//| http://www.mql4.com | +//+------------------------------------------------------------------+ +#property copyright "2005-2014, MetaQuotes Software Corp." +#property link "http://www.mql4.com" +#property description "Momentum" +#property strict + +#property indicator_separate_window +#property indicator_buffers 1 +#property indicator_color1 DodgerBlue +//--- input parameter +input int InpMomPeriod=14; // Momentum Period +//--- buffers +double ExtMomBuffer[]; +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +int OnInit(void) + { + string short_name; +//--- indicator line + SetIndexStyle(0,DRAW_LINE); + SetIndexBuffer(0,ExtMomBuffer); +//--- name for DataWindow and indicator subwindow label + short_name="Mom("+IntegerToString(InpMomPeriod)+")"; + IndicatorShortName(short_name); + SetIndexLabel(0,short_name); +//--- check for input parameter + if(InpMomPeriod<=0) + { + Print("Wrong input parameter Momentum Period=",InpMomPeriod); + return(INIT_FAILED); + } +//--- + SetIndexDrawBegin(0,InpMomPeriod); +//--- initialization done + return(INIT_SUCCEEDED); + } +//+------------------------------------------------------------------+ +//| Momentum | +//+------------------------------------------------------------------+ +int OnCalculate(const int rates_total, + const int prev_calculated, + const datetime &time[], + const double &open[], + const double &high[], + const double &low[], + const double &close[], + const long &tick_volume[], + const long &volume[], + const int &spread[]) + { + int i,limit; +//--- check for bars count and input parameter + if(rates_total<=InpMomPeriod || InpMomPeriod<=0) + return(0); +//--- counting from 0 to rates_total + ArraySetAsSeries(ExtMomBuffer,false); + ArraySetAsSeries(close,false); +//--- initial zero + if(prev_calculated<=0) + { + for(i=0; i + +//--- indicator settings +#property indicator_separate_window +#property indicator_buffers 1 +#property indicator_color1 Silver +#property indicator_width1 2 +//--- indicator parameters +input int InpFastEMA=12; // Fast EMA Period +input int InpSlowEMA=26; // Slow EMA Period +input int InpSignalSMA=9; // Signal SMA Period +//--- indicator buffers +double ExtOsmaBuffer[]; +double ExtMacdBuffer[]; +double ExtSignalBuffer[]; +//--- right input parameters flag +bool ExtParameters=false; +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +int OnInit(void) + { +//--- 2 additional buffers are used for counting. + IndicatorBuffers(3); +//--- drawing settings + SetIndexStyle(0,DRAW_HISTOGRAM); + SetIndexDrawBegin(0,InpSignalSMA); + IndicatorDigits(Digits+2); +//--- 3 indicator buffers mapping + SetIndexBuffer(0,ExtOsmaBuffer); + SetIndexBuffer(1,ExtMacdBuffer); + SetIndexBuffer(2,ExtSignalBuffer); +//--- name for DataWindow and indicator subwindow label + IndicatorShortName("OsMA("+IntegerToString(InpFastEMA)+","+IntegerToString(InpSlowEMA)+","+IntegerToString(InpSignalSMA)+")"); +//--- check for input parameters + if(InpFastEMA<=1 || InpSlowEMA<=1 || InpSignalSMA<=1 || InpFastEMA>=InpSlowEMA) + { + Print("Wrong input parameters"); + ExtParameters=false; + return(INIT_FAILED); + } + else + ExtParameters=true; +//--- initialization done + return(INIT_SUCCEEDED); + } +//+------------------------------------------------------------------+ +//| Moving Average of Oscillator | +//+------------------------------------------------------------------+ +int OnCalculate (const int rates_total, + const int prev_calculated, + const datetime& time[], + const double& open[], + const double& high[], + const double& low[], + const double& close[], + const long& tick_volume[], + const long& volume[], + const int& spread[]) + { + int i,limit; +//--- + if(rates_total<=InpSignalSMA || !ExtParameters) + return(0); +//--- last counted bar will be recounted + limit=rates_total-prev_calculated; + if(prev_calculated>0) + limit++; +//--- macd counted in the 1-st buffer + for(i=0; ilow[i]) + last_low=low[i]; + if(last_highhigh[i-1] && low[i]>low[i-1]) + break; + if(high[i]ExtSARBuffer[i-1]) + { + SaveLastReverse(i,false,step,last_low,high[i],ep,sar); + step=ExtSarStep; + dir_long=true; + ep=high[i]; + last_high=high[i]; + ExtSARBuffer[i++]=last_low; + continue; + } + //--- + sar=ExtSARBuffer[i-1]+step*(ep-ExtSARBuffer[i-1]); + //--- LONG? + if(dir_long) + { + if(eplow[i-1]) + sar=low[i-1]; + if(sar>low[i-2]) + sar=low[i-2]; + if(sar>low[i]) + { + SaveLastReverse(i,true,step,low[i],last_high,ep,sar); + step=ExtSarStep; dir_long=false; ep=low[i]; + last_low=low[i]; + ExtSARBuffer[i++]=last_high; + continue; + } + if(eplow[i]) + { + if((step+ExtSarStep)<=ExtSarMaximum) + step+=ExtSarStep; + } + if(low[i]low[i]) + ep=last_low=low[i]; + } + ExtSARBuffer[i++]=sar; + } +//---- OnCalculate done. Return new prev_calculated. + return(rates_total); + } +//+------------------------------------------------------------------+ +//| save last values to continue further calculations | +//+------------------------------------------------------------------+ +void SaveLastReverse(int reverse,bool dir,double step,double last_low,double last_high,double ep,double sar) + { + ExtLastReverse=reverse; + if(ExtLastReverse<2) + ExtLastReverse=2; + ExtDirectionLong=dir; + ExtLastStep=step; + ExtLastLow=last_low; + ExtLastHigh=last_high; + ExtLastEP=ep; + ExtLastSAR=sar; + } +//+------------------------------------------------------------------+ diff --git a/Pivot Points - Daily (Shifted).mq4 b/Pivot Points - Daily (Shifted).mq4 new file mode 100644 index 0000000..97d2c89 --- /dev/null +++ b/Pivot Points - Daily (Shifted).mq4 @@ -0,0 +1,288 @@ +//-------------------------------------------------------------------- +// Pivot Points - Daily (Shifted).mq4 +// Copyright © 2009, SwingTree Ltd +// +// This indicator plots horizontal lines at daily pivot levels R3, R2, +// R1, Pivot, S1, S2 & S3, using a day that is advanced (or retarded) +// from the server time (called Pivot Day). +// +// The only input is the integer "ShiftHrs", which gives the number of +// hours to advance the pivot day. A negative value delays the day for +// pivot calculation. For example, if your server is on New York time +// (GMT-5) and you want pivot points in London time (GMT), then +// ShiftHrs is set to +5 (the default in the code). +// +// Saturday and Sunday trading is not ignored (after all it was real +// trading). If the pivot day shift results in data appearing on +// Saturday, it was really Friday where it occured, so the indicator +// treats it as part of Friday. If the pivot day shift results in data +// appearing on Sunday, it was really Monday where it occured, so the +// indicator treats it as Monday. +// +// It uses an indicator buffer for each line, so pivot levels of +// previous days remain visible. (This has a negative consequence: +// it is not possible to use the same technique to draw intermediate +// levels (S0.5, S1.5, etc.) because of the limit of 8 buffers.) +// +// Labels are shown for the most recent day's levels. +// +// This indicator can be applied to any chart period, although daily +// pivots on charts with long periods are meaningless. +// +// 2009.07.02 +// There was an error in the calculation of R3 & S3, +// which is now corrected. +// +//-------------------------------------------------------------------- + +#property copyright "Copyright © 2009, SwingTree Ltd" + +#define R3_NAME "Daily R3" +#define R2_NAME "Daily R2" +#define R1_NAME "Daily R1" +#define PIVOT_NAME "Daily PP" +#define S1_NAME "Daily S1" +#define S2_NAME "Daily S2" +#define S3_NAME "Daily S3" + +#define FONT "Arial" + +#define R3_COL Red +#define R2_COL Red +#define R1_COL Red +#define PIVOT_COL DimGray +#define S1_COL LimeGreen +#define S2_COL LimeGreen +#define S3_COL LimeGreen + +#property indicator_chart_window +#property indicator_buffers 7 +#property indicator_color1 R3_COL +#property indicator_color2 R2_COL +#property indicator_color3 R1_COL +#property indicator_color4 PIVOT_COL +#property indicator_color5 S1_COL +#property indicator_color6 S2_COL +#property indicator_color7 S3_COL + +// Input(s) +extern int ShiftHrs = 5; // Pivot day shift + // positive value moves pivot day earlier + +// Buffers for levels +double Res3[], Res2[], Res1[], Pivot[], Sup1[], Sup2[], Sup3[]; + +double PDayHigh, PDayLow; +string ThisSymbol; +datetime BarTime, PivotDayStartTime; +int VisibleBars, DayStartBar, LeftMostBar, RightMostBar; + + +//-------------------------------------------------------------------- +// Initialization +//-------------------------------------------------------------------- +int init() +{ + // Attach indicator arrays to buffers + SetIndexBuffer( 0, Res3); + SetIndexBuffer( 1, Res2); + SetIndexBuffer( 2, Res1); + SetIndexBuffer( 3, Pivot); + SetIndexBuffer( 4, Sup1); + SetIndexBuffer( 5, Sup2); + SetIndexBuffer( 6, Sup3); + + // Set styles + SetIndexStyle( 0, DRAW_LINE, STYLE_DOT, 1); + SetIndexStyle( 1, DRAW_LINE, STYLE_DOT, 1); + SetIndexStyle( 2, DRAW_LINE, STYLE_DOT, 1); + SetIndexStyle( 3, DRAW_LINE, STYLE_DOT, 1); + SetIndexStyle( 4, DRAW_LINE, STYLE_DOT, 1); + SetIndexStyle( 5, DRAW_LINE, STYLE_DOT, 1); + SetIndexStyle( 6, DRAW_LINE, STYLE_DOT, 1); + + // Set empty values + SetIndexEmptyValue( 0, EMPTY_VALUE ); + SetIndexEmptyValue( 1, EMPTY_VALUE ); + SetIndexEmptyValue( 2, EMPTY_VALUE ); + SetIndexEmptyValue( 3, EMPTY_VALUE ); + SetIndexEmptyValue( 4, EMPTY_VALUE ); + SetIndexEmptyValue( 5, EMPTY_VALUE ); + SetIndexEmptyValue( 6, EMPTY_VALUE ); + + // Set labels + SetIndexLabel( 0, R3_NAME ); + SetIndexLabel( 1, R2_NAME ); + SetIndexLabel( 2, R1_NAME ); + SetIndexLabel( 3, PIVOT_NAME ); + SetIndexLabel( 4, S1_NAME ); + SetIndexLabel( 5, S2_NAME ); + SetIndexLabel( 6, S3_NAME ); + + // Put text on the chart + ObjectCreate( R3_NAME, OBJ_TEXT, 0, 0, 0 ); + ObjectCreate( R2_NAME, OBJ_TEXT, 0, 0, 0 ); + ObjectCreate( R1_NAME, OBJ_TEXT, 0, 0, 0 ); + ObjectCreate( PIVOT_NAME, OBJ_TEXT, 0, 0, 0 ); + ObjectCreate( S1_NAME, OBJ_TEXT, 0, 0, 0 ); + ObjectCreate( S2_NAME, OBJ_TEXT, 0, 0, 0 ); + ObjectCreate( S3_NAME, OBJ_TEXT, 0, 0, 0 ); + + // Set the text characteristics + ObjectSetText( R3_NAME, R3_NAME, 8, FONT, R3_COL ); + ObjectSetText( R2_NAME, R2_NAME, 8, FONT, R2_COL ); + ObjectSetText( R1_NAME, R1_NAME, 8, FONT, R1_COL ); + ObjectSetText( PIVOT_NAME, PIVOT_NAME, 8, FONT, PIVOT_COL ); + ObjectSetText( S1_NAME, S1_NAME, 8, FONT, S1_COL ); + ObjectSetText( S2_NAME, S2_NAME, 8, FONT, S2_COL ); + ObjectSetText( S3_NAME, S3_NAME, 8, FONT, S3_COL ); + + // Catch bad input + if( MathAbs( ShiftHrs ) > 23 ) + { + Alert( "ShiftHrs is too large. Reset to 0 hrs. "); + ShiftHrs = 0; + } + + ThisSymbol = Symbol(); + PivotDayStartTime = Time[Bars-1]; // the first bar + + return(0); +} + +//-------------------------------------------------------------------- +//| De-initialization | +//-------------------------------------------------------------------- +int deinit() +{ + // Remove texts + ObjectDelete( R3_NAME ); + ObjectDelete( R2_NAME ); + ObjectDelete( R1_NAME ); + ObjectDelete( PIVOT_NAME ); + ObjectDelete( S1_NAME ); + ObjectDelete( S2_NAME ); + ObjectDelete( S3_NAME ); + + return(0); +} + +//-------------------------------------------------------------------- +//| Main iteration | +//-------------------------------------------------------------------- +int start() +{ + int i, Count; + double Range; + + i = Bars - IndicatorCounted() - 1; + + while(i >= 0) + { + // If the pivot day changes... + if( PivotDay( Time[i+1], ShiftHrs ) != PivotDay( Time[i], ShiftHrs ) ) + { + // Determine High & Low for the previous Pivot Day + Count = iBarShift( NULL, 0, PivotDayStartTime ) - i; // number of bars in the day + PDayHigh = High[ iHighest( NULL, 0, MODE_HIGH, Count, i+1 ) ]; // Pivot Day high + PDayLow = Low[ iLowest( NULL, 0, MODE_LOW, Count, i+1 ) ]; // Pivot Day low + + // Pivot calculations + Pivot[i] = ( PDayHigh + PDayLow + Close[i+1] ) / 3; // Pivot point + Range = PDayHigh - PDayLow; + Res1[i] = 2 * Pivot[i] - PDayLow; // R1 + Res2[i] = Pivot[i] + Range; // R2 + Res3[i] = Res1[i] + Range; // R3 + Sup1[i] = 2 * Pivot[i] - PDayHigh; // S1 + Sup2[i] = Pivot[i] - Range; // S2 + Sup3[i] = Sup1[i] - Range; // S3 + + // Don't draw the transition between levels + Res3[i+1] = EMPTY_VALUE; + Res2[i+1] = EMPTY_VALUE; + Res1[i+1] = EMPTY_VALUE; + Pivot[i+1] = EMPTY_VALUE; + Sup1[i+1] = EMPTY_VALUE; + Sup2[i+1] = EMPTY_VALUE; + Sup3[i+1] = EMPTY_VALUE; + + // Remember when the Day changed over + PivotDayStartTime = Time[i]; + } + else // no change to pivot levels + { + Res3[i] = Res3[i+1]; + Res2[i] = Res2[i+1]; + Res1[i] = Res1[i+1]; + Pivot[i] = Pivot[i+1]; + Sup1[i] = Sup1[i+1]; + Sup2[i] = Sup2[i+1]; + Sup3[i] = Sup3[i+1]; + } + + // Move the labels to sensible places + // If this is the last bar and (it's a new bar or time scale has changed)... + if( i == 0 && ( BarTime != Time[i] || VisibleBars != WindowBarsPerChart() ) ) + { + DayStartBar = iBarShift( ThisSymbol, Period(), PivotDayStartTime ); + LeftMostBar = WindowFirstVisibleBar()-7; + RightMostBar = 15; + if( DayStartBar < RightMostBar ) // label too close to the right + { + ObjectMove( R3_NAME, 0, Time[RightMostBar], Res3[i] ); + ObjectMove( R2_NAME, 0, Time[RightMostBar], Res2[i] ); + ObjectMove( R1_NAME, 0, Time[RightMostBar], Res1[i] ); + ObjectMove( PIVOT_NAME, 0, Time[RightMostBar], Pivot[i] ); + ObjectMove( S1_NAME, 0, Time[RightMostBar], Sup1[i] ); + ObjectMove( S2_NAME, 0, Time[RightMostBar], Sup2[i] ); + ObjectMove( S3_NAME, 0, Time[RightMostBar], Sup3[i] ); + } + else if ( DayStartBar > LeftMostBar ) // label too close to the left + { + ObjectMove( R3_NAME, 0, Time[LeftMostBar], Res3[i] ); + ObjectMove( R2_NAME, 0, Time[LeftMostBar], Res2[i] ); + ObjectMove( R1_NAME, 0, Time[LeftMostBar], Res1[i] ); + ObjectMove( PIVOT_NAME, 0, Time[LeftMostBar], Pivot[i] ); + ObjectMove( S1_NAME, 0, Time[LeftMostBar], Sup1[i] ); + ObjectMove( S2_NAME, 0, Time[LeftMostBar], Sup2[i] ); + ObjectMove( S3_NAME, 0, Time[LeftMostBar], Sup3[i] ); + } + else // move it with the bars + { + ObjectMove( R3_NAME, 0, PivotDayStartTime, Res3[i] ); + ObjectMove( R2_NAME, 0, PivotDayStartTime, Res2[i] ); + ObjectMove( R1_NAME, 0, PivotDayStartTime, Res1[i] ); + ObjectMove( PIVOT_NAME, 0, PivotDayStartTime, Pivot[i] ); + ObjectMove( S1_NAME, 0, PivotDayStartTime, Sup1[i] ); + ObjectMove( S2_NAME, 0, PivotDayStartTime, Sup2[i] ); + ObjectMove( S3_NAME, 0, PivotDayStartTime, Sup3[i] ); + } + } + + VisibleBars = WindowBarsPerChart(); + BarTime = Time[i]; + i--; + } + + return(0); +} + + +//-------------------------------------------------------------------- +// int PivotDay( datetime BarTime, datetime ShiftHrs ) +// Returns the day of the week for pivot point calculations. +// datetime BarTime: time stamp of the bar of interest +// datetime Shift: the pivot time - server time shift +// i.e. if the time for pivot calculation is ahead +// of server time, the shift is positive. +//-------------------------------------------------------------------- +int PivotDay( datetime BarTime, datetime ShiftHrs ) +{ + int PDay = TimeDayOfWeek( BarTime + ShiftHrs * 3600 ); + + if( PDay == 0 ) PDay = 1; // Count Sunday as Monday + if( PDay == 6 ) PDay = 5; // Count Saturday as Friday + + return( PDay ); +} + diff --git a/RSI.mq4 b/RSI.mq4 new file mode 100644 index 0000000..79cd6da --- /dev/null +++ b/RSI.mq4 @@ -0,0 +1,133 @@ +//+------------------------------------------------------------------+ +//| RSI.mq4 | +//| Copyright 2005-2014, MetaQuotes Software Corp. | +//| http://www.mql4.com | +//+------------------------------------------------------------------+ +#property copyright "2005-2014, MetaQuotes Software Corp." +#property link "http://www.mql4.com" +#property description "Relative Strength Index" +#property strict + +#property indicator_separate_window +#property indicator_minimum 0 +#property indicator_maximum 100 +#property indicator_buffers 1 +#property indicator_color1 DodgerBlue +#property indicator_level1 30.0 +#property indicator_level2 70.0 +#property indicator_levelcolor clrSilver +#property indicator_levelstyle STYLE_DOT +//--- input parameters +input int InpRSIPeriod=14; // RSI Period +//--- buffers +double ExtRSIBuffer[]; +double ExtPosBuffer[]; +double ExtNegBuffer[]; +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +int OnInit(void) + { + string short_name; +//--- 2 additional buffers are used for counting. + IndicatorBuffers(3); + SetIndexBuffer(1,ExtPosBuffer); + SetIndexBuffer(2,ExtNegBuffer); +//--- indicator line + SetIndexStyle(0,DRAW_LINE); + SetIndexBuffer(0,ExtRSIBuffer); +//--- name for DataWindow and indicator subwindow label + short_name="RSI("+string(InpRSIPeriod)+")"; + IndicatorShortName(short_name); + SetIndexLabel(0,short_name); +//--- check for input + if(InpRSIPeriod<2) + { + Print("Incorrect value for input variable InpRSIPeriod = ",InpRSIPeriod); + return(INIT_FAILED); + } +//--- + SetIndexDrawBegin(0,InpRSIPeriod); +//--- initialization done + return(INIT_SUCCEEDED); + } +//+------------------------------------------------------------------+ +//| Relative Strength Index | +//+------------------------------------------------------------------+ +int OnCalculate(const int rates_total, + const int prev_calculated, + const datetime &time[], + const double &open[], + const double &high[], + const double &low[], + const double &close[], + const long &tick_volume[], + const long &volume[], + const int &spread[]) + { + int i,pos; + double diff; +//--- + if(Bars<=InpRSIPeriod || InpRSIPeriod<2) + return(0); +//--- counting from 0 to rates_total + ArraySetAsSeries(ExtRSIBuffer,false); + ArraySetAsSeries(ExtPosBuffer,false); + ArraySetAsSeries(ExtNegBuffer,false); + ArraySetAsSeries(close,false); +//--- preliminary calculations + pos=prev_calculated-1; + if(pos<=InpRSIPeriod) + { + //--- first RSIPeriod values of the indicator are not calculated + ExtRSIBuffer[0]=0.0; + ExtPosBuffer[0]=0.0; + ExtNegBuffer[0]=0.0; + double sump=0.0; + double sumn=0.0; + for(i=1; i<=InpRSIPeriod; i++) + { + ExtRSIBuffer[i]=0.0; + ExtPosBuffer[i]=0.0; + ExtNegBuffer[i]=0.0; + diff=close[i]-close[i-1]; + if(diff>0) + sump+=diff; + else + sumn-=diff; + } + //--- calculate first visible value + ExtPosBuffer[InpRSIPeriod]=sump/InpRSIPeriod; + ExtNegBuffer[InpRSIPeriod]=sumn/InpRSIPeriod; + if(ExtNegBuffer[InpRSIPeriod]!=0.0) + ExtRSIBuffer[InpRSIPeriod]=100.0-(100.0/(1.0+ExtPosBuffer[InpRSIPeriod]/ExtNegBuffer[InpRSIPeriod])); + else + { + if(ExtPosBuffer[InpRSIPeriod]!=0.0) + ExtRSIBuffer[InpRSIPeriod]=100.0; + else + ExtRSIBuffer[InpRSIPeriod]=50.0; + } + //--- prepare the position value for main calculation + pos=InpRSIPeriod+1; + } +//--- the main loop of calculations + for(i=pos; i0.0?diff:0.0))/InpRSIPeriod; + ExtNegBuffer[i]=(ExtNegBuffer[i-1]*(InpRSIPeriod-1)+(diff<0.0?-diff:0.0))/InpRSIPeriod; + if(ExtNegBuffer[i]!=0.0) + ExtRSIBuffer[i]=100.0-100.0/(1+ExtPosBuffer[i]/ExtNegBuffer[i]); + else + { + if(ExtPosBuffer[i]!=0.0) + ExtRSIBuffer[i]=100.0; + else + ExtRSIBuffer[i]=50.0; + } + } +//--- + return(rates_total); + } +//+------------------------------------------------------------------+ diff --git a/Stochastic X.mq4 b/Stochastic X.mq4 new file mode 100644 index 0000000..beee1dd --- /dev/null +++ b/Stochastic X.mq4 @@ -0,0 +1,187 @@ +//+------------------------------------------------------------------+ +//| Color Stochastic.mq4 | +//| mladen | +//| | +//+------------------------------------------------------------------+ +#property copyright "mladen" +#property link "" +#property description "Mod by Teamcashflow," +#property description "Draws signals based on the cross of the stochastic above 80(blue) below 20(red) default" +#property description" K Period and D Period / Main Line & signal line." +#property description "User can set the level the signal is drawn on the inputs tab." + + +//---- +#property indicator_separate_window +#property indicator_buffers 6 +//---- +#property indicator_minimum 0 +#property indicator_maximum 100 +#property indicator_color1 Yellow +#property indicator_style1 STYLE_DOT +#property indicator_color2 White +#property indicator_color3 DodgerBlue +#property indicator_color4 Red +#property indicator_width3 2 +#property indicator_width4 2 +#property indicator_level1 80 +#property indicator_level2 20 +//---- input parameters +//nice setings for trend = 35,10,1 +extern string note1="Stochastic settings"; +extern int KPeriod =5; +extern int KPeriod2 = 5; +extern int Slowing =3; +extern int DPeriod =3; +extern int DPeriod2 = 3; +extern string note4="0=sma, 1=ema, 2=smma, 3=lwma"; +extern int MAMethod =0; +extern string note5="0=high/low, 1=close/close"; +extern int PriceField= 1; +extern string note6="overbought level"; +extern int overBought=80; +extern string note7="oversold level"; +extern int overSold =20; +//--- Inputs for stochastic cross level +input color Buy_Dot_Color = clrDodgerBlue; +input color Sell_Dot_Color = clrRed; +double input Cross_From_Below_Level = 10; +double input Cross_From_Above_Level = 90; + +//---- buffers +double KFull[]; +double DFull[]; +double Upper[]; +double Lower[]; +double Buy_Point[]; +double Sell_Point[]; +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +int init() + { + SetIndexBuffer(0,DFull); + SetIndexBuffer(1,KFull); + SetIndexBuffer(2,Upper); + SetIndexBuffer(3,Lower); + SetIndexBuffer(4,Buy_Point); + SetIndexBuffer(5,Sell_Point); + SetIndexStyle(4,DRAW_ARROW,EMPTY,3,Buy_Dot_Color); + SetIndexStyle(5,DRAW_ARROW,EMPTY,3,Sell_Dot_Color); + SetIndexArrow(4,159); + SetIndexArrow(5,159); + SetIndexLabel(1,"Fast"); + SetIndexLabel(2,NULL); + SetIndexLabel(3,NULL); +//---- + DPeriod=MathMax(DPeriod,1); + if (DPeriod==1) + { + SetIndexStyle(0,DRAW_NONE); + SetIndexLabel(0,NULL); + } + else + { + SetIndexStyle(0,DRAW_LINE); + SetIndexLabel(0,"Slow"); + } + string shortName="Stochastic X ("+KPeriod+","+Slowing+","+DPeriod+","+maDescription(MAMethod)+","+priceDescription(PriceField); + if (overBought < overSold) overBought=overSold; + if (overBought < 100) shortName =shortName+","+overBought; + if (overSold > 0) shortName =shortName+","+overSold; + IndicatorShortName(shortName+")"); + return(0); + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +int deinit() + { + return(0); + } +//+------------------------------------------------------------------+ +//| Custom indicator iteration function | +//+------------------------------------------------------------------+ +int start() + { + int limit; + int i; +//---- + int counted_bars = IndicatorCounted(); + if(counted_bars < 0) return(-1); + if(counted_bars > 0) counted_bars--; + limit = Bars - counted_bars; + double Rsi_rule = iRSI(Symbol(),0,14,0,i); + + if(counted_bars==0) limit-=1+MathMax(2,MathMax(KPeriod,DPeriod)); + + for(i=limit; i>=0; i--) + { + KFull[i]=iStochastic(NULL,0,KPeriod,DPeriod,Slowing,MAMethod,PriceField,MODE_MAIN,i); + DFull[i]=iStochastic(NULL,0,KPeriod2,DPeriod2,Slowing,MAMethod,PriceField,MODE_SIGNAL,i); +//---- + if (KFull[i] > overBought) { Upper[i]=KFull[i]; Upper[i+1]=KFull[i+1]; } + else + { + Upper[i]=EMPTY_VALUE; + if (Upper[i+2]==EMPTY_VALUE) + Upper[i+1] =EMPTY_VALUE; + } + if (KFull[i] < overSold) { Lower[i]=KFull[i]; Lower[i+1]=KFull[i+1]; } + else + { + Lower[i]=EMPTY_VALUE; + if (Lower[i+2]==EMPTY_VALUE) + Lower[i+1] =EMPTY_VALUE; + } + + //--- Stochastic Crossing Up Below 10 Signal + + if( KFull[i] < Cross_From_Below_Level && KFull[i] >DFull[i] ) + + { + Buy_Point[i] = KFull[i]; + + } + //--- Stochastic Crossing Down Above 80 Signal + + if ( KFull[i] > Cross_From_Above_Level && KFull[i] < DFull[i]) + { + Sell_Point[i] =KFull[i]; + } + + } +//---- + return(0); + } +//+------------------------------------------------------------------+ +string priceDescription(int mode) + { + string answer; + switch(mode) + { + case 0: answer="Low/High" ;break; + case 1: answer="Close/Close";break; + default: answer="Invalid price field requested"; + Alert(answer); + } + return(answer); + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +string maDescription(int mode) + { + string answer; + switch(mode) + { + case MODE_SMA: answer="SMA" ;break; + case MODE_EMA: answer="EMA" ;break; + case MODE_SMMA: answer="SMMA";break; + case MODE_LWMA: answer="LWMA";break; + default: answer="Invalid MA mode requested"; + Alert(answer); + } + return(answer); + } +//+------------------------------------------------------------------+ \ No newline at end of file diff --git a/TARGET BANDS.mq4 b/TARGET BANDS.mq4 new file mode 100644 index 0000000..94adaac --- /dev/null +++ b/TARGET BANDS.mq4 @@ -0,0 +1,335 @@ +//+------------------------------------------------------------------+ +//| TMA+CG.mq4 | +//| mladen | +//| arrowse coded acording to idea presented by rajiv | +//+------------------------------------------------------------------+ +#property copyright "rajivxxx" +#property link "rajivxxx@gmail.com" + +#property indicator_chart_window +#property indicator_buffers 5 +#property indicator_color1 White +#property indicator_color2 OrangeRed +#property indicator_color3 OrangeRed +#property indicator_color4 White +#property indicator_color5 White +#property indicator_style1 STYLE_SOLID +#property indicator_width1 1 +#property indicator_width2 6 +#property indicator_width3 6 +#property indicator_width4 8 +#property indicator_width5 8 +// +// +// +// +// + +extern string TimeFrame = "current time frame"; +extern int HalfLength = 55; +extern int Price = PRICE_WEIGHTED; +extern double BandsDeviations = 2.5; +extern bool Interpolate = true; +extern bool alertsOn = false; +extern bool alertsOnCurrent = false; +extern bool alertsOnHighLow = false; +extern bool alertsMessage = false; +extern bool alertsSound = false; +extern bool alertsEmail = false; + +// +// +// +// +// + +double tmBuffer[]; +double upBuffer[]; +double dnBuffer[]; +double wuBuffer[]; +double wdBuffer[]; +double upArrow[]; +double dnArrow[]; + +// +// +// +// +// + +string IndicatorFileName; +bool calculatingTma = false; +bool returningBars = false; +int timeFrame; + +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +// +// +// +// + +int init() +{ + timeFrame = stringToTimeFrame(TimeFrame); + HalfLength = MathMax(HalfLength,1); + IndicatorBuffers(7); + SetIndexBuffer(0,tmBuffer); SetIndexDrawBegin(0,HalfLength); + SetIndexBuffer(1,upBuffer); SetIndexDrawBegin(1,HalfLength); + SetIndexBuffer(2,dnBuffer); SetIndexDrawBegin(2,HalfLength); + SetIndexBuffer(3,dnArrow); SetIndexStyle(3,DRAW_ARROW); SetIndexArrow(3,82); + SetIndexBuffer(4,upArrow); SetIndexStyle(4,DRAW_ARROW); SetIndexArrow(4,82); + SetIndexBuffer(5,wuBuffer); + SetIndexBuffer(6,wdBuffer); + + if (TimeFrame=="calculateTma") { calculatingTma=true; return(0); } + if (TimeFrame=="returnBars") { returningBars=true; return(0); } + + + IndicatorFileName = WindowExpertName(); + return(0); +} +int deinit() { return(0); } + +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +// +// +// +// +// + +int start() +{ + int counted_bars=IndicatorCounted(); + int i,limit; + + if(counted_bars<0) return(-1); + if(counted_bars>0) counted_bars--; + limit=MathMin(Bars-1,Bars-counted_bars+HalfLength); + + if (returningBars) { tmBuffer[0] = limit; return(0); } + if (calculatingTma) { calculateTma(limit); return(0); } + if (timeFrame > Period()) limit = MathMax(limit,MathMin(Bars-1,iCustom(NULL,timeFrame,IndicatorFileName,"returnBars",0,0)*timeFrame/Period())); + + // + // + // + // + // + + for(i = limit; i >= 0; i--) + { + int shift1 = iBarShift(NULL,timeFrame,Time[i]); + datetime time1 = iTime (NULL,timeFrame,shift1); + + // + // + // + // + // + + tmBuffer[i] = iCustom(NULL,timeFrame,IndicatorFileName,"calculateTma",HalfLength,Price,BandsDeviations,0,shift1); + upBuffer[i] = iCustom(NULL,timeFrame,IndicatorFileName,"calculateTma",HalfLength,Price,BandsDeviations,1,shift1); + dnBuffer[i] = iCustom(NULL,timeFrame,IndicatorFileName,"calculateTma",HalfLength,Price,BandsDeviations,2,shift1); + + upArrow[i] = EMPTY_VALUE; + dnArrow[i] = EMPTY_VALUE; + if (High[i+1]>upBuffer[i+1] && Close[i+1]>Open[i+1] && Close[i]Open[i]) dnArrow[i] = Low[i]; + + if (timeFrame <= Period() || shift1==iBarShift(NULL,timeFrame,Time[i-1])) continue; + if (!Interpolate) continue; + + // + // + // + // + // + + for(int n = 1; i+n < Bars && Time[i+n] >= time1; n++) continue; + double factor = 1.0 / n; + for(int k = 1; k < n; k++) + { + tmBuffer[i+k] = k*factor*tmBuffer[i+n] + (1.0-k*factor)*tmBuffer[i]; + upBuffer[i+k] = k*factor*upBuffer[i+n] + (1.0-k*factor)*upBuffer[i]; + dnBuffer[i+k] = k*factor*dnBuffer[i+n] + (1.0-k*factor)*dnBuffer[i]; + } + } + + // + // + // + // + // + + if (alertsOn) + { + if (alertsOnCurrent) + int forBar = 0; + else forBar = 1; + if (alertsOnHighLow) + { + if (High[forBar] > upBuffer[forBar] && High[forBar+1] < upBuffer[forBar+1]) doAlert("high penetrated upper bar"); + if (Low[forBar] < dnBuffer[forBar] && Low[forBar+1] > dnBuffer[forBar+1]) doAlert("low penetrated lower bar"); + } + else + { + if (Close[forBar] > upBuffer[forBar] && Close[forBar+1] < upBuffer[forBar+1]) doAlert("close penetrated upper bar"); + if (Close[forBar] < dnBuffer[forBar] && Close[forBar+1] > dnBuffer[forBar+1]) doAlert("close penetrated lower bar"); + } + } + + return(0); +} + +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +// +// +// +// +// + +void calculateTma(int limit) +{ + int i,j,k; + double FullLength = 2.0*HalfLength+1.0; + + // + // + // + // + // + + for (i=limit; i>=0; i--) + { + double sum = (HalfLength+1)*iMA(NULL,0,1,0,MODE_SMA,Price,i); + double sumw = (HalfLength+1); + for(j=1, k=HalfLength; j<=HalfLength; j++, k--) + { + sum += k*iMA(NULL,0,1,0,MODE_SMA,Price,i+j); + sumw += k; + + if (j<=i) + { + sum += k*iMA(NULL,0,1,0,MODE_SMA,Price,i-j); + sumw += k; + } + } + tmBuffer[i] = sum/sumw; + + // + // + // + // + // + + double diff = iMA(NULL,0,1,0,MODE_SMA,Price,i)-tmBuffer[i]; + if (i> (Bars-HalfLength-1)) continue; + if (i==(Bars-HalfLength-1)) + { + upBuffer[i] = tmBuffer[i]; + dnBuffer[i] = tmBuffer[i]; + if (diff>=0) + { + wuBuffer[i] = MathPow(diff,2); + wdBuffer[i] = 0; + } + else + { + wdBuffer[i] = MathPow(diff,2); + wuBuffer[i] = 0; + } + continue; + } + + // + // + // + // + // + + if(diff>=0) + { + wuBuffer[i] = (wuBuffer[i+1]*(FullLength-1)+MathPow(diff,2))/FullLength; + wdBuffer[i] = wdBuffer[i+1]*(FullLength-1)/FullLength; + } + else + { + wdBuffer[i] = (wdBuffer[i+1]*(FullLength-1)+MathPow(diff,2))/FullLength; + wuBuffer[i] = wuBuffer[i+1]*(FullLength-1)/FullLength; + } + upBuffer[i] = tmBuffer[i] + BandsDeviations*MathSqrt(wuBuffer[i]); + dnBuffer[i] = tmBuffer[i] - BandsDeviations*MathSqrt(wdBuffer[i]); + } +} + + + +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +// +// +// +// +// + +void doAlert(string doWhat) +{ + static string previousAlert=""; + static datetime previousTime; + string message; + + // + // + // + // + // + + if (previousAlert!=doWhat || previousTime!=Time[0]) + { + previousAlert = doWhat; + previousTime = Time[0]; + + message= StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," THA : ",doWhat); + if (alertsMessage) Alert(message); + if (alertsEmail) SendMail(StringConcatenate(Symbol(),"TMA "),message); + if (alertsSound) PlaySound("alert2.wav"); + } +} + +// +// +// +// +// + +int stringToTimeFrame(string tfs) +{ + for(int l = StringLen(tfs)-1; l >= 0; l--) + { + int char2 = StringGetChar(tfs,l); + if((char2 > 96 && char2 < 123) || (char2 > 223 && char2 < 256)) + tfs = StringSetChar(tfs, 1, char2 - 32); + else + if(char2 > -33 && char2 < 0) + tfs = StringSetChar(tfs, 1, char2 + 224); + } + int tf=0; + if (tfs=="M1" || tfs=="1") tf=PERIOD_M1; + if (tfs=="M5" || tfs=="5") tf=PERIOD_M5; + if (tfs=="M15"|| tfs=="15") tf=PERIOD_M15; + if (tfs=="M30"|| tfs=="30") tf=PERIOD_M30; + if (tfs=="H1" || tfs=="60") tf=PERIOD_H1; + if (tfs=="H4" || tfs=="240") tf=PERIOD_H4; + if (tfs=="D1" || tfs=="1440") tf=PERIOD_D1; + if (tfs=="W1" || tfs=="10080") tf=PERIOD_W1; + if (tfs=="MN" || tfs=="43200") tf=PERIOD_MN1; + if (tf==0 || tf0) counted_bars--; + limit=MathMin(Bars-1,Bars-counted_bars+HalfLength); + if (returnBars) { buffer1[0] = limit+1; return(0); } + + // + // + // + // + // + + if (calculateValue || timeFrame==Period()) + { + for (i=limit; i>=0; i--) + { + double sum = (HalfLength+1)*iMA(NULL,0,1,0,MODE_SMA,Price,i); + double sumw = (HalfLength+1); + + for(j=1, k=HalfLength; j<=HalfLength; j++, k--) + { + sum += k*iMA(NULL,0,1,0,MODE_SMA,Price,i+j); + sumw += k; + //now take a look in the future and change the past :) + /*if (j<=i) //here is the redraw + { + sum += k*iMA(NULL,0,1,0,MODE_SMA,Price,i-j); + sumw += k; + }*/ + } + + // + // + // + // + // + + double range = iATR(NULL,0,ATRPeriod,i+10)*ATRMultiplier; + buffer1[i] = sum/sumw; + buffer2[i] = buffer1[i]+range; + buffer3[i] = buffer1[i]-range; + + // + // + // + // + // + + trend[i] = 0; + if (alertsOnHighLow) + { + if (High[i] > buffer2[i]) trend[i] = 1; + if (Low[i] < buffer3[i]) trend[i] = -1; + } + else + { + if (Close[i] > buffer2[i]) trend[i] = 1; + if (Close[i] < buffer3[i]) trend[i] = -1; + } + } + if (!calculateValue) manageAlerts(); + return(0); + } + + // + // + // + // + // + + limit = MathMax(limit,MathMin(Bars-1,iCustom(NULL,timeFrame,indicatorFileName,"returnBars",0,0)*timeFrame/Period())); + for(i=limit; i>=0; i--) + { + int y = iBarShift(NULL,timeFrame,Time[i]); + buffer1[i] = iCustom(NULL,timeFrame,indicatorFileName,"calculateTma",HalfLength,Price,ATRMultiplier,ATRPeriod,0,y); + buffer2[i] = iCustom(NULL,timeFrame,indicatorFileName,"calculateTma",HalfLength,Price,ATRMultiplier,ATRPeriod,1,y); + buffer3[i] = iCustom(NULL,timeFrame,indicatorFileName,"calculateTma",HalfLength,Price,ATRMultiplier,ATRPeriod,2,y); + trend[i] = iCustom(NULL,timeFrame,indicatorFileName,"calculateTma",HalfLength,Price,ATRMultiplier,ATRPeriod,3,y); + + // + // + // + // + // + + if (timeFrame <= Period() || y==iBarShift(NULL,timeFrame,Time[i-1])) continue; + if (!Interpolate) continue; + + // + // + // + // + // + + datetime time = iTime(NULL,timeFrame,y); + for(int n = 1; i+n < Bars && Time[i+n] >= time; n++) continue; + for(k = 1; k < n; k++) + { + buffer1[i+k] = buffer1[i] +(buffer1[i+n]-buffer1[i])*k/n; + buffer2[i+k] = buffer2[i] +(buffer2[i+n]-buffer2[i])*k/n; + buffer3[i+k] = buffer3[i] +(buffer3[i+n]-buffer3[i])*k/n; + } + } + + // + // + // + // + // + + manageAlerts(); + return(0); +} + +//+------------------------------------------------------------------- +//| +//+------------------------------------------------------------------- +// +// +// +// +// + +void manageAlerts() +{ + if (alertsOn) + { + if (alertsOnCurrent) + int whichBar = 0; + else whichBar = 1; whichBar = iBarShift(NULL,0,iTime(NULL,timeFrame,whichBar)); + if (trend[whichBar] != trend[whichBar+1]) + { + if (trend[whichBar] == 1) doAlert(whichBar,"up"); + if (trend[whichBar] ==-1) doAlert(whichBar,"down"); + } + } +} + +// +// +// +// +// + +void doAlert(int forBar, string doWhat) +{ + static string previousAlert="nothing"; + static datetime previousTime; + string message; + + if (previousAlert != doWhat || previousTime != Time[forBar]) { + previousAlert = doWhat; + previousTime = Time[forBar]; + + // + // + // + // + // + + message = StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," "+timeFrameToString(timeFrame)+" TMA bands price penetrated ",doWhat," band"); + if (alertsMessage) Alert(message); + if (alertsEmail) SendMail(StringConcatenate(Symbol(),"TMA bands "),message); + if (alertsSound) PlaySound("alert2.wav"); + } +} + +//+------------------------------------------------------------------- +//| +//+------------------------------------------------------------------- +// +// +// +// +// + +string sTfTable[] = {"M1","M5","M15","M30","H1","H4","D1","W1","MN"}; +int iTfTable[] = {1,5,15,30,60,240,1440,10080,43200}; + +// +// +// +// +// + +int stringToTimeFrame(string tfs) +{ + tfs = StringUpperCase(tfs); + for (int i=ArraySize(iTfTable)-1; i>=0; i--) + if (tfs==sTfTable[i] || tfs==""+iTfTable[i]) return(MathMax(iTfTable[i],Period())); + return(Period()); +} +string timeFrameToString(int tf) +{ + for (int i=ArraySize(iTfTable)-1; i>=0; i--) + if (tf==iTfTable[i]) return(sTfTable[i]); + return(""); +} + +// +// +// +// +// + +string StringUpperCase(string str) +{ + string s = str; + + for (int length=StringLen(str)-1; length>=0; length--) + { + int char = StringGetChar(s, length); + if((char > 96 && char < 123) || (char > 223 && char < 256)) + s = StringSetChar(s, length, char - 32); + else if(char > -33 && char < 0) + s = StringSetChar(s, length, char + 224); + } + return(s); +} \ No newline at end of file diff --git a/TREND_alexcud_v_2MEn.mq4 b/TREND_alexcud_v_2MEn.mq4 new file mode 100644 index 0000000..64e54c4 --- /dev/null +++ b/TREND_alexcud_v_2MEn.mq4 @@ -0,0 +1,436 @@ +//+------------------------------------------------------------------+ +//| TREND_alexcud v_2MEn.mq4 | +//| Copyright © 2007, Aleksander Kudimov | +//| alexcud@rambler.ru ki | +//+------------------------------------------------------------------+ +#property copyright "Copyright © 2007, Aleksander Kudimov" +#property link "alexcud@rambler.ru" + +#property indicator_separate_window + +#property indicator_minimum 0 +#property indicator_maximum 1 + +#property indicator_buffers 2 +#property indicator_color1 Lime +#property indicator_color2 Red + +//---- buffers +double UPBuffer[]; +double DOWNBuffer[]; +extern int TF1 = 15; +extern int TF2 = 60; +extern int TF3 = 240; +extern int maTrendPeriodv_1 = 5; +extern int maTrendPeriodv_2 = 8; +extern int maTrendPeriodv_3 = 13; +extern int maTrendPeriodv_4 = 21; +extern int maTrendPeriodv_5 = 34; +extern string note__TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF"; + + + +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +double MaH11v, MaH41v, MaD11v, MaH1pr1v, MaH4pr1v, MaD1pr1v; +double MaH12v, MaH42v, MaD12v, MaH1pr2v, MaH4pr2v, MaD1pr2v; +double MaH13v, MaH43v, MaD13v, MaH1pr3v, MaH4pr3v, MaD1pr3v; +double MaH14v, MaH44v, MaD14v, MaH1pr4v, MaH4pr4v, MaD1pr4v; +double MaH15v, MaH45v, MaD15v, MaH1pr5v, MaH4pr5v, MaD1pr5v; + + + string H11v, H41v, D11v; + string H12v, H42v, D12v; + string H13v, H43v, D13v; + string H14v, H44v, D14v; + string H15v, H45v, D15v; + color co11v , co41v , co61v; + color co12v , co42v , co62v; + color co13v , co43v , co63v; + color co14v , co44v , co64v; + color co15v , co45v , co65v; + +double u1x5v, u1x8v, u1x13v, u1x21v, u1x34v; +double u2x5v, u2x8v, u2x13v, u2x21v, u2x34v; +double u3x5v, u3x8v, u3x13v, u3x21v, u3x34v; +double u1acv, u2acv, u3acv; + +double d1x5v, d1x8v, d1x13v, d1x21v, d1x34v; +double d2x5v, d2x8v, d2x13v, d2x21v, d2x34v; +double d3x5v, d3x8v, d3x13v, d3x21v, d3x34v; +double d1acv, d2acv, d3acv; + + string short_name="TREND_alex"; +int init() + { + +//---- name for indicator window + + string short_name="TREND_alex"; + IndicatorShortName(short_name); + + SetIndexBuffer(0,UPBuffer); + SetIndexBuffer(1,DOWNBuffer); + + + +//---- + return(0); + } + +//+------------------------------------------------------------------+ +//| Custom indicator deinitialization function | +//+------------------------------------------------------------------+ +int deinit() + { +//---- + +//---- + return(0); + } +//+------------------------------------------------------------------+ +//| Custom indicator iteration function | +//+------------------------------------------------------------------+ +int start() + { + ObjectCreate("MAv", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSetText("MAv", "Moving Averages",9, "Verdana", Lime ); + ObjectSet("MAv", OBJPROP_XDISTANCE, 75); + ObjectSet("MAv", OBJPROP_YDISTANCE, 0); + + ObjectCreate("label_object1v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSet("label_object1v", OBJPROP_XDISTANCE, 5); + ObjectSet("label_object1v", OBJPROP_YDISTANCE, 17); + + ObjectCreate("label_object2v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSet("label_object2v", OBJPROP_XDISTANCE, 5); + ObjectSet("label_object2v", OBJPROP_YDISTANCE, 37); + + ObjectCreate("label_object3v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSet("label_object3v", OBJPROP_XDISTANCE, 5); + ObjectSet("label_object3v", OBJPROP_YDISTANCE, 57); + // ---------------------------------------------------------------------------- + ObjectCreate("H11v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSet("H11v", OBJPROP_XDISTANCE, 40); + ObjectSet("H11v", OBJPROP_YDISTANCE, 15); + + ObjectCreate("H12v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSet("H12v", OBJPROP_XDISTANCE, 70); + ObjectSet("H12v", OBJPROP_YDISTANCE, 15); + + ObjectCreate("H13v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSet("H13v", OBJPROP_XDISTANCE, 100); + ObjectSet("H13v", OBJPROP_YDISTANCE, 15); + + ObjectCreate("H14v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSet("H14v", OBJPROP_XDISTANCE, 130); + ObjectSet("H14v", OBJPROP_YDISTANCE, 15); + + ObjectCreate("H15v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSet("H15v", OBJPROP_XDISTANCE, 160); + ObjectSet("H15v", OBJPROP_YDISTANCE, 15); + //--------------------------------------------------------------------------- + ObjectCreate("H41v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSet("H41v", OBJPROP_XDISTANCE, 40); + ObjectSet("H41v", OBJPROP_YDISTANCE, 35); + + ObjectCreate("H42v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSet("H42v", OBJPROP_XDISTANCE, 70); + ObjectSet("H42v", OBJPROP_YDISTANCE, 35); + + ObjectCreate("H43v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSet("H43v", OBJPROP_XDISTANCE, 100); + ObjectSet("H43v", OBJPROP_YDISTANCE, 35); + + ObjectCreate("H44v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSet("H44v", OBJPROP_XDISTANCE, 130); + ObjectSet("H44v", OBJPROP_YDISTANCE, 35); + + ObjectCreate("H45v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSet("H45v", OBJPROP_XDISTANCE, 160); + ObjectSet("H45v", OBJPROP_YDISTANCE, 35); + //--------------------------------------------------------------------------- + ObjectCreate("D11v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSet("D11v", OBJPROP_XDISTANCE, 40); + ObjectSet("D11v", OBJPROP_YDISTANCE, 55); + + ObjectCreate("D12v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSet("D12v", OBJPROP_XDISTANCE, 70); + ObjectSet("D12v", OBJPROP_YDISTANCE, 55); + + ObjectCreate("D13v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSet("D13v", OBJPROP_XDISTANCE, 100); + ObjectSet("D13v", OBJPROP_YDISTANCE, 55); + + ObjectCreate("D14v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSet("D14v", OBJPROP_XDISTANCE, 130); + ObjectSet("D14v", OBJPROP_YDISTANCE, 55); + + ObjectCreate("D15v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSet("D15v", OBJPROP_XDISTANCE, 160); + ObjectSet("D15v", OBJPROP_YDISTANCE, 55); + + MaH11v=iMA(NULL,TF1,maTrendPeriodv_1,0,MODE_SMA,PRICE_CLOSE,0); MaH1pr1v=iMA(NULL,TF1,maTrendPeriodv_1,0,MODE_SMA,PRICE_CLOSE,1); + MaH12v=iMA(NULL,TF1,maTrendPeriodv_2,0,MODE_SMA,PRICE_CLOSE,0); MaH1pr2v=iMA(NULL,TF1,maTrendPeriodv_2,0,MODE_SMA,PRICE_CLOSE,1); + MaH13v=iMA(NULL,TF1,maTrendPeriodv_3,0,MODE_SMA,PRICE_CLOSE,0); MaH1pr3v=iMA(NULL,TF1,maTrendPeriodv_3,0,MODE_SMA,PRICE_CLOSE,1); + MaH14v=iMA(NULL,TF1,maTrendPeriodv_4,0,MODE_SMA,PRICE_CLOSE,0); MaH1pr4v=iMA(NULL,TF1,maTrendPeriodv_4,0,MODE_SMA,PRICE_CLOSE,1); + MaH15v=iMA(NULL,TF1,maTrendPeriodv_5,0,MODE_SMA,PRICE_CLOSE,0); MaH1pr5v=iMA(NULL,TF1,maTrendPeriodv_5,0,MODE_SMA,PRICE_CLOSE,1); + + MaH41v=iMA(NULL,TF2,maTrendPeriodv_1,0,MODE_SMA,PRICE_CLOSE,0); MaH4pr1v=iMA(NULL,TF2,maTrendPeriodv_1,0,MODE_SMA,PRICE_CLOSE,1); + MaH42v=iMA(NULL,TF2,maTrendPeriodv_2,0,MODE_SMA,PRICE_CLOSE,0); MaH4pr2v=iMA(NULL,TF2,maTrendPeriodv_2,0,MODE_SMA,PRICE_CLOSE,1); + MaH43v=iMA(NULL,TF2,maTrendPeriodv_3,0,MODE_SMA,PRICE_CLOSE,0); MaH4pr3v=iMA(NULL,TF2,maTrendPeriodv_3,0,MODE_SMA,PRICE_CLOSE,1); + MaH44v=iMA(NULL,TF2,maTrendPeriodv_4,0,MODE_SMA,PRICE_CLOSE,0); MaH4pr4v=iMA(NULL,TF2,maTrendPeriodv_4,0,MODE_SMA,PRICE_CLOSE,1); + MaH45v=iMA(NULL,TF2,maTrendPeriodv_5,0,MODE_SMA,PRICE_CLOSE,0); MaH4pr5v=iMA(NULL,TF2,maTrendPeriodv_5,0,MODE_SMA,PRICE_CLOSE,1); + + MaD11v=iMA(NULL,TF3,maTrendPeriodv_1,0,MODE_SMA,PRICE_CLOSE,0); MaD1pr1v=iMA(NULL,TF3,maTrendPeriodv_1,0,MODE_SMA,PRICE_CLOSE,1); + MaD12v=iMA(NULL,TF3,maTrendPeriodv_2,0,MODE_SMA,PRICE_CLOSE,0); MaD1pr2v=iMA(NULL,TF3,maTrendPeriodv_2,0,MODE_SMA,PRICE_CLOSE,1); + MaD13v=iMA(NULL,TF3,maTrendPeriodv_3,0,MODE_SMA,PRICE_CLOSE,0); MaD1pr3v=iMA(NULL,TF3,maTrendPeriodv_3,0,MODE_SMA,PRICE_CLOSE,1); + MaD14v=iMA(NULL,TF3,maTrendPeriodv_4,0,MODE_SMA,PRICE_CLOSE,0); MaD1pr4v=iMA(NULL,TF3,maTrendPeriodv_4,0,MODE_SMA,PRICE_CLOSE,1); + MaD15v=iMA(NULL,TF3,maTrendPeriodv_5,0,MODE_SMA,PRICE_CLOSE,0); MaD1pr5v=iMA(NULL,TF3,maTrendPeriodv_5,0,MODE_SMA,PRICE_CLOSE,1); + + // MaH4=iMA(NULL,PERIOD_M30,34,0,MODE_SMA,PRICE_CLOSE,0); + if (MaH11v < MaH1pr1v){H11v = " V "; co11v = Red; u1x5v = 0; d1x5v = 1;} + if (MaH11v > MaH1pr1v){H11v = " /\\ "; co11v = Blue; u1x5v = 1; d1x5v = 0;} + if (MaH11v == MaH1pr1v){H11v = " 0 "; co11v = Green; u1x5v = 0; d1x5v = 0;} + if (MaH41v < MaH4pr1v){H41v = " V "; co41v = Red; u2x5v = 0; d2x5v = 1;} + if (MaH41v > MaH4pr1v){H41v = " /\\ "; co41v = Blue; u2x5v = 1; d2x5v = 0;} + if (MaH41v == MaH4pr1v){H41v = " 0 "; co41v = Green; u2x5v = 0; d2x5v = 0;} + if (MaD11v < MaD1pr1v){D11v = " V "; co61v = Red; u3x5v = 0; d3x5v = 1;} + if (MaD11v > MaD1pr1v){D11v = " /\\ "; co61v = Blue; u3x5v = 1; d3x5v = 0;} + if (MaD11v == MaD1pr1v){D11v = " 0 "; co61v = Green; u3x5v = 0; d3x5v = 0;} + + if (MaH12v < MaH1pr2v){H12v = " V "; co12v = Red; u1x8v = 0; d1x8v = 1;} + if (MaH12v > MaH1pr2v){H12v = " /\\ "; co12v = Blue; u1x8v = 1; d1x8v = 0;} + if (MaH12v == MaH1pr2v){H12v = " 0 "; co12v = Green; u1x8v = 0; d1x8v = 0;} + if (MaH42v < MaH4pr2v){H42v = " V "; co42v = Red; u2x8v = 0; d2x8v = 1;} + if (MaH42v > MaH4pr2v){H42v = " /\\ "; co42v = Blue; u2x8v = 1; d2x8v = 0;} + if (MaH42v == MaH4pr2v){H42v = " 0 "; co42v = Green; u2x8v = 0; d2x8v = 0;} + if (MaD12v < MaD1pr2v){D12v = " V "; co62v = Red; u3x8v = 0; d3x8v = 1;} + if (MaD12v > MaD1pr2v){D12v = " /\\ "; co62v = Blue; u3x8v = 1; d3x8v = 0;} + if (MaD12v == MaD1pr2v){D12v = " 0 "; co62v = Green; u3x8v = 0; d3x8v = 0;} + + if (MaH13v < MaH1pr3v){H13v = " V "; co13v = Red; u1x13v = 0; d1x13v = 1;} + if (MaH13v > MaH1pr3v){H13v = " /\\ "; co13v = Blue; u1x13v = 1; d1x13v = 0;} + if (MaH13v ==MaH1pr3v){H13v = " 0 "; co13v = Green; u1x13v = 0; d1x13v = 0;} + if (MaH43v < MaH4pr3v){H43v = " V "; co43v = Red; u2x13v = 0; d2x13v = 1;} + if (MaH43v > MaH4pr3v){H43v = " /\\ "; co43v = Blue; u2x13v = 1; d2x13v = 0;} + if (MaH43v ==MaH4pr3v){H43v = " 0 "; co43v = Green; u2x13v = 0; d2x13v = 0;} + if (MaD13v < MaD1pr3v){D13v = " V "; co63v = Red; u3x13v = 0; d3x13v = 1;} + if (MaD13v > MaD1pr3v){D13v = " /\\ "; co63v = Blue; u3x13v = 1; d3x13v = 0;} + if (MaD13v ==MaD1pr3v){D13v = " 0 "; co63v = Green; u3x13v = 0; d3x13v = 0;} + + if (MaH14v < MaH1pr4v){H14v = " V "; co14v = Red; u1x21v = 0; d1x21v = 1;} + if (MaH14v > MaH1pr4v){H14v = " /\\ "; co14v = Blue; u1x21v = 1; d1x21v = 0;} + if (MaH14v == MaH1pr4v){H14v = " 0 "; co14v = Green; u1x21v = 0; d1x21v = 0;} + if (MaH44v < MaH4pr4v){H44v = " V "; co44v = Red; u2x21v = 0; d2x21v = 1;} + if (MaH44v > MaH4pr4v){H44v = " /\\ "; co44v = Blue; u2x21v = 1; d2x21v = 0;} + if (MaH44v == MaH4pr4v){H44v = " 0 "; co44v = Green; u2x21v = 0; d2x21v = 0;} + if (MaD14v < MaD1pr4v){D14v = " V "; co64v = Red; u3x21v = 0; d3x21v = 1;} + if (MaD14v > MaD1pr4v){D14v = " /\\ "; co64v = Blue; u3x21v = 1; d3x21v = 0;} + if (MaD14v == MaD1pr4v){D14v = " 0 "; co64v = Green; u3x21v = 0; d3x21v = 0;} + + if (MaH15v < MaH1pr5v){H15v = " V "; co15v = Red; u1x34v = 0; d1x34v = 1;} + if (MaH15v > MaH1pr5v){H15v = " /\\ "; co15v = Blue; u1x34v = 1; d1x34v = 0;} + if (MaH15v == MaH1pr5v){H15v = " 0 "; co15v = Green; u1x34v = 0; d1x34v = 0;} + if (MaH45v < MaH4pr5v){H45v = " V "; co45v = Red; u2x34v = 0; d2x34v = 1;} + if (MaH45v > MaH4pr5v){H45v = " /\\ "; co45v = Blue; u2x34v = 1; d2x34v = 0;} + if (MaH45v == MaH4pr5v){H45v = " 0 "; co45v = Green; u2x34v = 0; d2x34v = 0;} + if (MaD15v < MaD1pr5v){D15v = " V "; co65v = Red; u3x34v = 0; d3x34v = 1;} + if (MaD15v > MaD1pr5v){D15v = " /\\ "; co65v = Blue; u3x34v = 1; d3x34v = 0;} + if (MaD15v == MaD1pr5v){D15v = " 0 "; co65v = Green; u3x34v = 0; d3x34v = 0;} + + // Comment(";JGF:"); + // "\n", "H4 - ", H41 , + // "\n", "D1 - ", D11 ); + + ObjectSetText("label_object1v", "M"+TF1+": ",9, "Verdana", Lime ); + ObjectSetText("label_object2v", "M"+TF2+": ",9, "Verdana", Lime ); + ObjectSetText("label_object3v", "M"+TF3+": ",9, "Verdana", Lime ); + + + +// ObjectSetText("label_object1v", "TF1 - ",11, "Verdana", Lime ); +// ObjectSetText("label_object2v", "TF2 - ",11, "Verdana", Lime ); +// ObjectSetText("label_object3v", "TF3 - ",11, "Verdana", Lime ); + + ObjectSetText("H11v", H11v ,11, "Verdana", co11v ); + ObjectSetText("H12v", H12v ,11, "Verdana", co12v ); + ObjectSetText("H13v", H13v ,11, "Verdana", co13v ); + ObjectSetText("H14v", H14v ,11, "Verdana", co14v ); + ObjectSetText("H15v", H15v ,11, "Verdana", co15v ); + + ObjectSetText("H41v", H41v ,11, "Verdana", co41v ); + ObjectSetText("H42v", H42v ,11, "Verdana", co42v ); + ObjectSetText("H43v", H43v ,11, "Verdana", co43v ); + ObjectSetText("H44v", H44v ,11, "Verdana", co44v ); + ObjectSetText("H45v", H45v ,11, "Verdana", co45v ); + + ObjectSetText("D11v", D11v ,11, "Verdana", co61v ); + ObjectSetText("D12v", D12v ,11, "Verdana", co62v ); + ObjectSetText("D13v", D13v ,11, "Verdana", co63v ); + ObjectSetText("D14v", D14v ,11, "Verdana", co64v ); + ObjectSetText("D15v", D15v ,11, "Verdana", co65v ); + +//---------------------------------------------------------------------------- +// AC Bil Vil +ObjectCreate("ACv", OBJ_LABEL, WindowFind(short_name), 0, 0); +ObjectSetText("ACv", "AC",9, "Verdana", Lime ); +ObjectSet("ACv", OBJPROP_XDISTANCE, 200); +ObjectSet("ACv", OBJPROP_YDISTANCE, 0); + +double acv = iAC(NULL, TF1, 0); +double ac1v = iAC(NULL, TF1, 1); +double ac2v = iAC(NULL, TF1, 2); +double ac3v = iAC(NULL, TF1, 3); +//double ac4 = iAO(NULL, 0, 4); +string ach11v; +color acco11v; + +if ((ac1v>ac2v && ac2v>ac3v && acv<0 && acv>ac1v) || (acv>ac1v && ac1v>ac2v && acv>0)) +{ach11v = "/\\ " ; acco11v = Blue; u1acv = 3; d1acv = 0;} +if ((ac1v0 && acvac1v) || (acv>ac1v && ac1v0))|| +(((ac1v>ac2v || ac2v>ac3v) && acv>0 && acvac2v && acv<0))) +{ach11v = "0 " ; acco11v = Green; u1acv = 0; d1acv = 0;} + +ObjectCreate("AC11v", OBJ_LABEL, WindowFind(short_name), 0, 0); +ObjectSetText("AC11v", ach11v,11, "Verdana", acco11v ); +ObjectSet("AC11v", OBJPROP_XDISTANCE, 200); +ObjectSet("AC11v", OBJPROP_YDISTANCE, 15); + +double ac03v = iAC(NULL, TF3, 0); +double ac13v = iAC(NULL, TF3, 1); +double ac23v = iAC(NULL, TF3, 2); +double ac33v = iAC(NULL, TF3, 3); +//double ac4 = iAO(NULL, 0, 4); +string ach13v; +color acco13v; + +if ((ac13v>ac23v && ac23v>ac33v && ac03v<0 && ac03v>ac13v) || (ac03v>ac13v && ac13v>ac23v && ac03v>0)) +{ach13v = "/\\ " ; acco13v = Blue; u3acv = 3; d3acv = 0;} +if ((ac13v0 && ac03vac13v) || (ac03v>ac13v && ac13v0))|| +(((ac13v>ac23v || ac23v>ac33v) && ac03v>0 && ac03vac23v && ac03v<0))) +{ach13v = "0 " ; acco13v = Green; u3acv = 0; d3acv = 0;} +ObjectCreate("AC13v", OBJ_LABEL, WindowFind(short_name), 0, 0); +ObjectSetText("AC13v", ach13v,11, "Verdana", acco13v ); +ObjectSet("AC13v", OBJPROP_XDISTANCE, 200); +ObjectSet("AC13v", OBJPROP_YDISTANCE, 55); + +double ac02v = iAC(NULL, TF2, 0); +double ac12v = iAC(NULL, TF2, 1); +double ac22v = iAC(NULL, TF2, 2); +double ac32v = iAC(NULL, TF2, 3); +//double ac4 = iAO(NULL, 0, 4); +string ach12v; +color acco12v; + +if ((ac12v>ac22v && ac22v>ac32v && ac02v<0 && ac02v>ac12v) || (ac02v>ac12v && ac12v>ac22v && ac02v>0)) +{ach12v = "/\\ " ; acco12v = Blue; u2acv = 3; d2acv = 0;} +if ((ac12v0 && ac02vac12v) || (ac02v>ac12v && ac12v0))|| +(((ac12v>ac22v || ac22v>ac32v) && ac02v>0 && ac02vac22v && ac02v<0))) +{ach12v = "0 " ; acco12v = Green; u2acv = 0; d2acv = 0;} +ObjectCreate("AC12v", OBJ_LABEL, WindowFind(short_name), 0, 0); +ObjectSetText("AC12v", ach12v,11, "Verdana", acco12v ); +ObjectSet("AC12v", OBJPROP_XDISTANCE, 200); +ObjectSet("AC12v", OBJPROP_YDISTANCE, 35); + + + +ObjectCreate("rezv", OBJ_LABEL, WindowFind(short_name), 0, 0); +ObjectSetText("rezv", "RESULTS",9, "Verdana", Lime ); +ObjectSet("rezv", OBJPROP_XDISTANCE, 240); +ObjectSet("rezv", OBJPROP_YDISTANCE, 0); + + + double uitog1v = (u1x5v + u1x8v + u1x13v + u1x21v + u1x34v + u1acv) * 12.5; + double uitog2v = (u2x5v + u2x8v + u2x13v + u2x21v + u2x34v + u2acv) * 12.5; + double uitog3v = (u3x5v + u3x8v + u3x13v + u3x21v + u3x34v + u3acv) * 12.5; + + double ditog1v = (d1x5v + d1x8v + d1x13v + d1x21v + d1x34v + d1acv) * 12.5; + double ditog2v = (d2x5v + d2x8v + d2x13v + d2x21v + d2x34v + d2acv) * 12.5; + double ditog3v = (d3x5v + d3x8v + d3x13v + d3x21v + d3x34v + d3acv) * 12.5; + + string hr1v, hr2v, hr3v, hr4v, hr5v,hr6v; + string dhr1v, dhr2v, dhr3v, dhr4v, dhr5v, dhr6v; + if (uitog1v> ditog1v) {hr1v = "Arial Black"; dhr1v = "Arial";} + if (uitog1v< ditog1v) {hr1v = "Arial"; dhr1v = "Arial Black";} + if (uitog1v == ditog1v) {hr1v = "Arial"; dhr1v = "Arial";} + + if (uitog2v> ditog2v) {hr2v = "Arial Black"; dhr2v = "Arial";} + if (uitog2v< ditog2v) {hr2v = "Arial"; dhr2v = "Arial Black";} + if (uitog2v == ditog2v) {hr2v = "Arial"; dhr2v = "Arial";} + + if (uitog3v> ditog3v) {hr3v = "Arial Black"; dhr3v = "Arial";} + if (uitog3v< ditog3v) {hr3v = "Arial"; dhr3v = "Arial Black";} + if (uitog3v == ditog3v) {hr3v = "Arial"; dhr3v = "Arial";} + + ObjectCreate("uitog1v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSetText("uitog1v", StringConcatenate("/\\ ", uitog1v, "%"),12, hr1v, DodgerBlue ); + ObjectSet("uitog1v", OBJPROP_XDISTANCE, 235); + ObjectSet("uitog1v", OBJPROP_YDISTANCE, 15); + + ObjectCreate("uitog2v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSetText("uitog2v", StringConcatenate("/\\ ",uitog2v, "%"),12, hr2v, DodgerBlue ); + ObjectSet("uitog2v", OBJPROP_XDISTANCE, 235); + ObjectSet("uitog2v", OBJPROP_YDISTANCE, 35); + + ObjectCreate("uitog3v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSetText("uitog3v", StringConcatenate("/\\ ",uitog3v, "%"),12, hr3v, DodgerBlue ); + ObjectSet("uitog3v", OBJPROP_XDISTANCE, 235); + ObjectSet("uitog3v", OBJPROP_YDISTANCE, 55); + + ObjectCreate("ditog1v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSetText("ditog1v", StringConcatenate("\\/ ", ditog1v, "%"),12, dhr1v, Red ); + ObjectSet("ditog1v", OBJPROP_XDISTANCE, 310); + ObjectSet("ditog1v", OBJPROP_YDISTANCE, 15); + + ObjectCreate("ditog2v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSetText("ditog2v", StringConcatenate("\\/ ",ditog2v, "%"),12, dhr2v, Red ); + ObjectSet("ditog2v", OBJPROP_XDISTANCE, 310); + ObjectSet("ditog2v", OBJPROP_YDISTANCE, 35); + + ObjectCreate("ditog3v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSetText("ditog3v", StringConcatenate("\\/ ",ditog3v, "%"),12, dhr3v, Red ); + ObjectSet("ditog3v", OBJPROP_XDISTANCE, 310); + ObjectSet("ditog3v", OBJPROP_YDISTANCE, 55); + + + string txtv; + if (uitog1v > 50 && uitog2v > 50 && uitog3v > 50) + + {txtv = "Not bad moment to open position BUY";} + else + {txtv = "Not recommended to open position. WAIT.";} + + if (ditog1v > 50 && ditog2v > 50 && ditog3v > 50) + {txtv = "Not bad moment to open position SELL";} + + if (uitog1v >= 75 && uitog2v >= 75 && uitog3v >= 75) + {txtv = "GOOD moment to open position BUY";} + if (ditog1v >= 75 && ditog2v >= 75 && ditog3v >= 75) + {txtv = "GOOD moment to open position SELL";} + + + ObjectCreate("txtv", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSetText("txtv", txtv,14, "Verdana", Lime ); + ObjectSet("txtv", OBJPROP_XDISTANCE, 410); + ObjectSet("txtv", OBJPROP_YDISTANCE, 35); + + ObjectCreate("txt2v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSetText("txt2v","multitimeframe indicator \TREND_ALEXCUD v2",7, "Verdana", DarkSlateGray ); + ObjectSet("txt2v", OBJPROP_XDISTANCE, 11); + ObjectSet("txt2v", OBJPROP_YDISTANCE, 80); + ObjectCreate("txt3v", OBJ_LABEL, WindowFind(short_name), 0, 0); + ObjectSetText("txt3v","Copyright © 2007 ALEXCUD v_2",7, "Verdana", DarkSlateGray ); + ObjectSet("txt3v", OBJPROP_XDISTANCE, 410); + ObjectSet("txt3v", OBJPROP_YDISTANCE, 80); + + return(0); + } +//+------------------------------------------------------------------+ \ No newline at end of file diff --git a/TRO_HOLO.mq4 b/TRO_HOLO.mq4 new file mode 100644 index 0000000..31f7d49 --- /dev/null +++ b/TRO_HOLO.mq4 @@ -0,0 +1,530 @@ +//+------------------------------------------------------------------+ +//| TRO_HOLO | +//| | +//| Copyright © 2009, Avery T. Horton, Jr. aka TheRumpledOne | +//| | +//| PO BOX 43575, TUCSON, AZ 85733 | +//| | +//| GIFTS AND DONATIONS ACCEPTED | +//| ALO my indicators should be considered donationware. That is | +//| you are free to use them for your personal use, and are | +//| under no obligation to pay for them. However, if you do find | +//| this or any of my other indicators help you with your trading | +//| then any Gift or Donation as a show of appreciation is | +//| gratefuLOy accepted. | +//| | +//| Gifts or Donations also keep me motivated in producing more | +//| great free indicators. :-) | +//| | +//| PayPal - THERUMPLEDONE@GMAIL.COM | +//+------------------------------------------------------------------+ +//| Use http://therumpledone.mbtrading.com/fx/ as your forex broker | +//| ...teLO them therumpledone sent you! | +//+------------------------------------------------------------------+ + + +#property copyright "Copyright © 2009, Avery T. Horton, Jr. aka TRO" +#property link "http://www.therumpledone.com/" + +#property indicator_chart_window + + + +extern int myChartX = 10 ; +extern int myChartY = 300 ; + +extern int myCorner = 1 ; +extern string myFont = "Courier New" ; +extern int myFontSize = 12 ; + +extern bool Show_Gauge = false ; +extern bool Show_Lines = true ; +extern bool Show_Labels = true ; +extern bool ShowBackground = True; + +extern int ShiftLabel = 5 ; +extern int LineStyle = 0 ; +extern int Line_Width = 1 ; + +extern int myPeriod = 0 ; + +extern int myBars = 34 ; +extern int myShift = 1 ; +extern double myThreshold = 10 ; + +extern color colorHigh = Red ; +extern color colorLow = Blue ; + +extern color UpColor = Lime; +extern color DownColor = Red; +extern color Line_Color_Open = Orange ; + +extern color BackgroundColor = C'30,33,36'; + +//+------------------------------------------------------------------+ + +double Hi, Li, C; + +double prev_high, prev_low, prev_close, D, p, value ; +int h ; +string lbl[15], lbl2[15], name; +int n, j, i ; + +color pColor = Blue, VolColor = Magenta ; + +string symbol, tChartPeriod, ShortName, TAG ; +int digits, period, win ; +double point, open, high, low, close, mid, range, pClose, pOpen, pHigh, pLow, pMid, pRange, cRange, PipDiff ; + + +int FiLOAmt = 11 , x001, x002, x003, x004, x005, x006, x007 ; + +int plotbars = 0 ; + + +double HO, LH, HL, LO, OH, OL, CH, CL; + +int limit,nHO, nLO, nHL, nLH; + + +double D1_Open, W1_Open, HO1, LH1, HL1, LO1, OH1, OL1, CH1, CL1; + +int BarShift, nHO1, nLO1, nHL1, nLH1; + +datetime DateTime ; + +//+------------------------------------------------------------------+ + +int init() + { + if(myPeriod == 0) { period = Period() ; } else { period = myPeriod ; } + tChartPeriod = TimeFrameToString(period) ; + symbol = Symbol() ; + digits = Digits ; + point = Point ; + TAG = "HoLo" ; + ShortName = TAG+symbol+period ; + win = 0 ; + + if(digits == 5 || digits == 3) { digits = digits - 1 ; point = point * 10 ; } + + +if( myCorner == 0 || myCorner == 2 ) +{ + x001 = 0 ; + x002 = 0 ; + x003 = 90 ; + x004 = 150; + x005 = 100 ; + x006 = 90 ; + x007 = 90 ; + FiLOAmt = 20 ; +} +else +{ + x001 = 0 ; + x002 = 130 ; // + x003 = 50 ; // + x004 = 0 ; // + x005 = 10 ; + x006 = 10 ; + x007 = 10 ; + FiLOAmt = 20 ; +} + + + deinit(); + + return(0); + } + + +//+------------------------------------------------------------------+ + +void ObDeleteObjectsByPrefix(string Prefix) + { + int L = StringLen(Prefix); + int i = 0; + while(i < ObjectsTotal()) + { + string ObjName = ObjectName(i); + if(StringSubstr(ObjName, 0, L) != Prefix) + { + i++; + continue; + } + ObjectDelete(ObjName); + } + } + +//+------------------------------------------------------------------+ +int deinit() + { + + ObDeleteObjectsByPrefix(TAG); + TRO() ; + + return(0); + } + +//+------------------------------------------------------------------+ +int start() +{ + + + + if(myBars == 0) { limit = WindowBarsPerChart() ; } else { limit = myBars ; } + +n = 10; +j = 0 ; + +if(Show_Gauge) +{ +lbl[j] = ShortName+j; +lbl2[j] = fFILL(tChartPeriod + " HIGHs LOWs +/-", 19) ; +DoShowHead(j, SteelBlue); +} + +close = iClose( symbol, 0, 0) ; + + + nHO = Highest(symbol,period,MODE_OPEN,limit,myShift); + nLO = Lowest(symbol,period,MODE_OPEN,limit,myShift); + + HO = iHigh(symbol,period,nHO); + LO = iLow(symbol,period,nLO); + + OH = iOpen(symbol,period,nHO); + CH = iClose(symbol,period,nHO); + OL = iOpen(symbol,period,nLO); + CL = iClose(symbol,period,nLO); + + + +j = j + 1 ; +lbl[j] = ShortName+j; +lbl2[j] = "High(" + nHO + ")" ; +PipDiff = ( OH - close ) / point ; +DoColor( close, OH ) ; +if(Show_Gauge) { DoShow(j, colorHigh,OH ); } +if(Show_Lines) { drawLine(OH,TAG+"High(" , colorHigh, 2, Time[nHO], tChartPeriod+"["+nHO+"] Open High "+DoubleToStr(OH,digits) ) ; } + + +j = j + 1 ; +lbl[j] = ShortName+j; +lbl2[j] = "Low(" + nLO + ") " ; +PipDiff = ( close - OL ) / point ; +DoColor( close, OL ) ; +if(Show_Gauge) { DoShow(j, colorLow, OL); } +if(Show_Lines) { drawLine(OL,TAG+"Low(" , colorLow, 2, Time[nLO], tChartPeriod+"["+nLO+"] Open Low "+DoubleToStr(OL,digits) ) ; } + + + + + + nHO1 = Highest(symbol,period,MODE_OPEN,limit,nHO+1); + nLO1 = Lowest(symbol,period,MODE_OPEN,limit,nLO+1); + + HO1 = iHigh(symbol,period,nHO1); + LO1 = iLow(symbol,period,nLO1); + + OH1 = iOpen(symbol,period,nHO1); + CH1 = iClose(symbol,period,nHO1); + OL1 = iOpen(symbol,period,nLO1); + CL1 = iClose(symbol,period,nLO1); + + + +j = j + 1 ; +lbl[j] = ShortName+j; +lbl2[j] = "High(" + nHO1 + ")" ; +PipDiff = ( OH1 - close ) / point ; +DoColor( close, OH1 ) ; +if(Show_Gauge) { DoShow(j, colorHigh,OH1 ); } +if(Show_Lines && OH1 != OH) { drawLine(OH1,TAG+"High1(" , colorHigh, 2, Time[nHO1], tChartPeriod+"["+nHO1+"] Open High "+DoubleToStr(OH1,digits) ) ; } + + +j = j + 1 ; +lbl[j] = ShortName+j; +lbl2[j] = "Low(" + nLO1 + ") " ; +PipDiff = ( close - OL1 ) / point ; +DoColor( close, OL1 ) ; +if(Show_Gauge) { DoShow(j, colorLow, OL1); } +if(Show_Lines && OL1 != OL) { drawLine(OL1,TAG+"Low1(" , colorLow, 2, Time[nLO1], tChartPeriod+"["+nLO1+"] Open Low "+DoubleToStr(OL1,digits) ) ; } + + +DateTime = iTime(symbol,PERIOD_D1,0) ; +D1_Open = iOpen(symbol,PERIOD_D1,0); + +j = j + 1 ; +lbl[j] = ShortName+j; +lbl2[j] = "D1 Open" ; +PipDiff = ( close - D1_Open ) / point ; +DoColor( close, D1_Open ) ; +if(Show_Gauge) { DoShow(j, Line_Color_Open, D1_Open); } +if(Show_Lines) { drawLine(D1_Open,TAG+"D1 OPEN" , Line_Color_Open, 2, DateTime , "D1 Open "+DoubleToStr(D1_Open,digits) ) ; } + + + +DateTime = iTime(symbol,PERIOD_W1,0) ; +BarShift = iBarShift(symbol,PERIOD_W1,Time[0],true); +W1_Open = iOpen(symbol,PERIOD_W1,BarShift); + + +j = j + 1 ; +lbl[j] = ShortName+j; +lbl2[j] = "W1 Open" ; +PipDiff = ( close - W1_Open ) / point ; +DoColor( close, W1_Open ) ; +if(Show_Gauge) { DoShow(j, Line_Color_Open, W1_Open); } +if(Show_Lines && W1_Open != D1_Open ) { drawLine(W1_Open,TAG+"W1 OPEN" , Line_Color_Open, 2, DateTime , "W1 Open "+DoubleToStr(W1_Open,digits) ) ; } + +/* + +j = j + 1 ; +lbl[j] = ShortName+j; +lbl2[j] = "CH(" + nHO + ")" ; +PipDiff = ( CH - close ) / point ; +DoColor( close, CH ) ; +if(Show_Gauge) { DoShow(j, colorHigh,CH ); } +if(Show_Lines) { drawLine(CH,TAG+"CHigh(" + nHO, nHO, colorHigh, 2,tChartPeriod+"["+nHO+"] Close High "+DoubleToStr(CH,digits) ) ; } + + + +j = j + 1 ; +lbl[j] = ShortName+j; +lbl2[j] = "CL(" + nLO + ") " ; +PipDiff = ( close - CL ) / point ; +DoColor( close, CL ) ; +if(Show_Gauge) { DoShow(j, colorLow, CL); } +if(Show_Lines) { drawLine(CL,TAG+"CLow(" + nLO, nLO, colorLow, 2,tChartPeriod+"["+nLO+"] Close Low "+DoubleToStr(CL,digits) ) ; } + +*/ + + +j = j + 1 ; +name = ShortName+j; + if (ShowBackground) + { + if (ObjectFind(name) == -1) + ObjectCreate(name,OBJ_RECTANGLE,0,0,0); + ObjectSet(name,OBJPROP_TIME1,Time[nHO]) ; //iTime(NULL,DataPeriod,DataBar)); + ObjectSet(name,OBJPROP_TIME2,Time[nLO]) ; //iTime(NULL, 0,0)); + ObjectSet(name,OBJPROP_PRICE1,OH); + ObjectSet(name,OBJPROP_PRICE2,OL); + ObjectSet(name,OBJPROP_COLOR,BackgroundColor); + } + + + return(0); + } +//+------------------------------------------------------------------+ + +void DoShowHead( int u, color dsColor ) +{ +string rlabelH = lbl[u] + "Head" ; +ObjectCreate(rlabelH,23,0,Time[0],PRICE_CLOSE); +ObjectSet(rlabelH, OBJPROP_CORNER, myCorner ); +ObjectSet(rlabelH,OBJPROP_XDISTANCE, x001+myChartX); +ObjectSet(rlabelH,OBJPROP_YDISTANCE,n+myChartY); +ObjectSetText(rlabelH,lbl2[u],myFontSize,myFont,dsColor); + +n = n+20; + + +} +//+------------------------------------------------------------------+ + +void DoShow( int u, color dsColor, double dsPrice ) +{ +ObjectCreate(lbl[u],23,0,Time[0],PRICE_CLOSE); +ObjectSet(lbl[u], OBJPROP_CORNER, myCorner ); +ObjectSet(lbl[u],OBJPROP_XDISTANCE,x002+myChartX); +ObjectSet(lbl[u],OBJPROP_YDISTANCE,n+myChartY); +ObjectSetText(lbl[u],lbl2[u],myFontSize,myFont,dsColor); + +string Obj001 = lbl[u] + "price" ; +string sVal = fFILL(DoubleToStr(dsPrice,digits), 7) ; +ObjectCreate(Obj001,23,0,Time[0],PRICE_CLOSE); +ObjectSet(Obj001, OBJPROP_CORNER, myCorner ); +ObjectSet(Obj001,OBJPROP_XDISTANCE, x003+myChartX); +ObjectSet(Obj001,OBJPROP_YDISTANCE,n+myChartY); +ObjectSetText(Obj001,sVal,myFontSize,myFont,dsColor); + + +string Obj002 = lbl[u] + "avg" ; +string sDif = rtadjust( DoubleToStr(PipDiff,0) ) ; +ObjectCreate(Obj002,23,0,Time[0],PRICE_CLOSE); +ObjectSet(Obj002, OBJPROP_CORNER, myCorner ); +ObjectSet(Obj002,OBJPROP_XDISTANCE, x004+myChartX); +ObjectSet(Obj002,OBJPROP_YDISTANCE,n+myChartY); +ObjectSetText(Obj002,sDif,myFontSize,myFont,pColor); + +n = n+20; + + } + + + +//+------------------------------------------------------------------+ + +void DoColor( double c1, double c2 ) +{ + +if(c1 > c2 ) { pColor = Lime ; } else { +if(c1 < c2 ) { pColor = Red ; } else { pColor = Yellow ; } } + +} + +//+------------------------------------------------------------------+ +void drawLine(double lvl,string name, color Col,int type, datetime StartTime, string text) +{ + + + + if(ObjectFind(name) != 0) + { + ObjectCreate(name, OBJ_TREND, 0, StartTime, lvl,Time[0],lvl); + + + ObjectSet(name, OBJPROP_STYLE, LineStyle); + + ObjectSet(name, OBJPROP_COLOR, Col); + ObjectSet(name,OBJPROP_WIDTH,1); + ObjectSet(name,OBJPROP_RAY,false); + + } + else + { + ObjectDelete(name); + ObjectCreate(name, OBJ_TREND, 0, StartTime, lvl,Time[0],lvl); + + ObjectSet(name, OBJPROP_STYLE, LineStyle); + + ObjectSet(name, OBJPROP_COLOR, Col); + ObjectSet(name,OBJPROP_WIDTH,1); + ObjectSet(name,OBJPROP_RAY,false); + + } + + if(Show_Labels) + { + string Obj0002 = name+"linelbl" ; + + datetime LabelTime = Time[0]+Period()*60*ShiftLabel ; + + ObjectDelete(Obj0002); + + if(ObjectFind(Obj0002) != 0) + { + ObjectCreate(Obj0002, OBJ_TEXT, 0, LabelTime, lvl); + ObjectSetText(Obj0002,text , 8, "Arial", Col); + } + else + { + ObjectMove(Obj0002, 0, LabelTime, lvl); + } // if + + } // if + +} +//+------------------------------------------------------------------+ +string TimeFrameToString(int tf) +{ + string tfs; + switch(tf) { + case PERIOD_M1: tfs="M1" ; break; + case PERIOD_M5: tfs="M5" ; break; + case PERIOD_M15: tfs="M15" ; break; + case PERIOD_M30: tfs="M30" ; break; + case PERIOD_H1: tfs="H1" ; break; + case PERIOD_H4: tfs="H4" ; break; + case PERIOD_D1: tfs="D1" ; break; + case PERIOD_W1: tfs="W1" ; break; + case PERIOD_MN1: tfs="MN"; + } + return(tfs); +} + +//+------------------------------------------------------------------+ + +string fFILL(string fiLOed, int f ) +{ + string FILOED ; + + FILOED = StringSubstr(fiLOed + " ",0,f) ; + +return(FILOED); +} + + + +//+------------------------------------------------------------------+ +string rtadjust( string rString ) +{ + + int sl = StringLen(rString) ; + + while(true) + { + + if( sl == 5) { break ; } + if( sl == 4) { rString = " " + rString ; break ; } + if( sl == 3) { rString = " " + rString ; break ; } + if( sl == 2) { rString = " " + rString ; break ; } + if( sl == 1) { rString = " " + rString ; break ; } + + break ; + } + +return(rString) ; +} + +//+------------------------------------------------------------------+ + +void TRO() +{ + + string tObjName03 = "TROTAG" ; + ObjectCreate(tObjName03, OBJ_LABEL, 0, 0, 0);//HiLow LABEL + ObjectSetText(tObjName03, CharToStr(78) , 12 , "Wingdings", DimGray ); + ObjectSet(tObjName03, OBJPROP_CORNER, 3); + ObjectSet(tObjName03, OBJPROP_XDISTANCE, 5 ); + ObjectSet(tObjName03, OBJPROP_YDISTANCE, 5 ); +} + + +//+------------------------------------------------------------------+ + +/* + + high = MathMax(iOpen(symbol,period,nHO),iClose(symbol,period,nHO)); + low = MathMax(iOpen(symbol,period,nLO),iClose(symbol,period,nLO)); + + +//+------------------------------------------------------------------+ +void drawLabel(string name,double lvl,color Color) +{ + if(ObjectFind(name) != 0) + { + ObjectCreate(name, OBJ_TEXT, 0, Time[10], lvl); + ObjectSetText(name, name, 14, "Arial", EMPTY); + ObjectSet(name, OBJPROP_COLOR, Color); + } + else + { + ObjectMove(name, 0, Time[10], lvl); + } +} + + +Comment( + +"MathAbs((close - high) / point " , DoubleToStr(MathAbs((close - high) / point),Digits) , "\n" , +"MathAbs((close - low) / point " , DoubleToStr(MathAbs((close - low) / point),Digits) , "\n" , + +"myThreshold " , DoubleToStr(myThreshold,Digits) , "\n" , +"TestVol " , TestVol , "\n" , +"") ; + +*/ \ No newline at end of file diff --git a/TRO_TRAININGWHEELS.mq4 b/TRO_TRAININGWHEELS.mq4 new file mode 100644 index 0000000..5f79d9f --- /dev/null +++ b/TRO_TRAININGWHEELS.mq4 @@ -0,0 +1,234 @@ +//+------------------------------------------------------------------+ +//| TRO_TRAININGWHEELS | +//| | +//| Copyright © 2008, Avery T. Horton, Jr. aka TheRumpledOne | +//| | +//| PO BOX 43575, TUCSON, AZ 85733 | +//| | +//| GIFTS AND DONATIONS ACCEPTED | +//| | +//| therumpledone@gmail.com | +//+------------------------------------------------------------------+ + + +#property copyright "Copyright © 2008, Avery T. Horton, Jr. aka TRO" +#property link "http://www.therumpledone.com/" + +//---- indicator settings +#property indicator_chart_window +#property indicator_buffers 0 +#property indicator_minimum 0 +#property indicator_maximum 1 + +//---- indicator parameters +extern bool TURN_OFF = false ; + +extern int win = 0; +extern int corner = 3; +extern int price_x_offset = 0 ; +extern int price_y_offset = 30 ; + +extern string myFont = "Arial Bold" ; +extern int myFontSize = 16; + + +extern string noteTimeNY = " 14:00 server time = 05:00 mst" ; +extern string noteTimeTY = " 23:00 server time = 14:00 mst" ; +extern string noteTimeAU = " 01:00 server time = 16:00 mst" ; +extern string noteTimeLD = " 09:00 server time = 00:00 mst" ; + + +extern string myHHMM = "00:00"; // 05:00 am pst = 14:00 server time +extern string myMessage = "NY" ; + + +extern string Buy_Message = "ONLY TRADE LONG " ; +extern string Wait_Message = "*** WAIT *** " ; +extern string Sell_Message = "ONLY TRADE SHORT" ; +extern string Rdy_Message = "*** GET READY *** " ; + +extern color Buy_color = Lime; +extern color Wait_color = Yellow; +extern color Sell_color = Red; +extern color Rdy_color = Orange; + +string tMessage , oldmsg = "" ; + +string symbol, tChartPeriod, tShortName ; +int digits, period ; + +datetime Trigger ; + +int OldBars = -1 ; + +color tColor = Yellow ; + +color ClOpColor; + +double H1_open, H1_close, open, close, diff, spread, DailyOpen ; + +string tObjName03 = "TROTW" ; + +//+------------------------------------------------------------------+ +int init() + { + period = Period() ; +// tChartPeriod = TimeFrameToString(period) ; + symbol = Symbol() ; + digits = Digits ; + + tShortName = "tw"+ symbol + tChartPeriod ; + deinit() ; + + return(0); + } +//+------------------------------------------------------------------+ + +int deinit() +{ + + ObjectDelete("TRAIN30"); + ObjectDelete("TRAIN29"); + ObjectDelete("TRAIN29B"); + ObjectDelete("TRAIN31"); + ObjectDelete("TRAIN32"); + ObjectDelete("TRAIN34"); + ObjectDelete(tObjName03); + TRO() ; + + return(0); +} + +//+------------------------------------------------------------------+ +int start() +{ + if( TURN_OFF ) { deinit(); return(0) ; } + + DoDailyOpen() ; + + open = iOpen(symbol,0,0); + close = iClose(symbol,0,0); + + H1_open = iOpen(symbol,PERIOD_H1,0); + + +while(true) +{ + +if( close > open && close > DailyOpen && close > H1_open ) { tMessage = Buy_Message ; ClOpColor = Buy_color ; break ; } + +if( close > DailyOpen && close > H1_open ) { tMessage = Rdy_Message ; ClOpColor = Buy_color ; break ; } + +if( close < open && close < DailyOpen && close < H1_open ) { tMessage = Sell_Message ; ClOpColor = Sell_color ; break ; } + +if( close < DailyOpen && close < H1_open ) { tMessage = Rdy_Message ; ClOpColor = Sell_color ; break ; } + + +tMessage = Wait_Message ; ClOpColor = Wait_color ; + +break; + +} // while + +tMessage = fFill(tMessage,20) ; + +oldmsg = tMessage ; + + + +//+------------------------------------------------------------------+ + + ObjectCreate("TRAIN31", OBJ_LABEL, win, 0, 0);//HiLow LABEL + ObjectSetText("TRAIN31",tMessage, myFontSize , myFont, ClOpColor ); + ObjectSet("TRAIN31", OBJPROP_CORNER, corner); + ObjectSet("TRAIN31", OBJPROP_XDISTANCE, price_x_offset); + ObjectSet("TRAIN31", OBJPROP_YDISTANCE, price_y_offset); + + + string note2 = "Default Font Color"; + color twFontColor = DimGray; + string note3 = "Font Size"; + int twFontSize = 8; + string note4 = "Font Type"; + string twFontType = "Verdana"; // Tahoma Courier + string RAN953 = "*** TRO TRAINING WHEELS ***" ; + + + ObjectCreate(tObjName03, OBJ_LABEL, 0, 0, 0);//HiLow LABEL + ObjectSetText(tObjName03, RAN953 , twFontSize , twFontType, twFontColor ); + ObjectSet(tObjName03, OBJPROP_CORNER, 3); + ObjectSet(tObjName03, OBJPROP_XDISTANCE, 15 ); + ObjectSet(tObjName03, OBJPROP_YDISTANCE, 10 ); +//+------------------------------------------------------------------+ + + WindowRedraw(); + + return(0); +} + +//+------------------------------------------------------------------+ + +void DoDailyOpen() +{ + +int yy = TimeYear(Time[0]); +int mm = TimeMonth(Time[0]); +int dd = TimeDay(Time[0]); + +string yymmddms = yy+"."+mm+"."+dd+" " + myHHMM ; + +datetime var1 = StrToTime(yymmddms); + +datetime day=24*60*60; +datetime r= var1 ; + +int cd=iBarShift(NULL,0,r,FALSE); +datetime r2=r-day; + +if(TimeDayOfWeek(r2)==0) r2=r2-day-day; +int cd2=iBarShift(NULL,0,r2,FALSE); + +if( var1 > Time[0] ) { r = r2 ;cd = cd2 ;} // if date/time is greater than current date/time go back 1 day + +DailyOpen = iOpen(symbol,0,cd); + + +} +//+------------------------------------------------------------------+ + +string fFill(string filled, int f ) +{ + string FILLED ; + + FILLED = StringSubstr(filled + " ",0,f) ; + +return(FILLED); +} + +//+------------------------------------------------------------------+ +void TRO() +{ + + string TRO_OBJ = "TROTAG" ; + ObjectCreate(TRO_OBJ, OBJ_LABEL, 0, 0, 0);//HiLow LABEL + ObjectSetText(TRO_OBJ, CharToStr(78) , 12 , "Wingdings", DimGray ); + ObjectSet(TRO_OBJ, OBJPROP_CORNER, 3); + ObjectSet(TRO_OBJ, OBJPROP_XDISTANCE, 5 ); + ObjectSet(TRO_OBJ, OBJPROP_YDISTANCE, 5 ); +} +//+------------------------------------------------------------------+ + + +/* + + +Comment( + + +"DailyOpen " , DoubleToStr(DailyOpen,Digits) , "\n" , + + +"") ; + + +*/ \ No newline at end of file diff --git a/Ultimate Arrows.mq4 b/Ultimate Arrows.mq4 new file mode 100644 index 0000000..3ba8619 --- /dev/null +++ b/Ultimate Arrows.mq4 @@ -0,0 +1,150 @@ +//+------------------------------------------------------------------+ +//| zigzag-pointer.mq4 | +//| zigzag modified by Dr. Gaines | +//| dr_richard_gaines@yahoo.com | +//| http://www.metaquotes.net | +//+------------------------------------------------------------------+ +#property copyright "dr_richard_gaines" +#property link "http://www.metaquotes.net/" + +#property indicator_chart_window +#property indicator_buffers 2 +#property indicator_color1 Lime +#property indicator_width1 5 +#property indicator_color2 Lime +#property indicator_width2 5 +//---- indicator parameters +extern int ExtDepth=115;//105;//21; +extern int ExtDeviation=130;//120;//24; +extern int ExtBackstep=80;//70;//14; +//---- indicator buffers +double ZigZagUp[]; +double ZigZagDown[]; +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +int init() + { + IndicatorBuffers(2); +//---- drawing settings + SetIndexStyle(0,DRAW_ARROW); + SetIndexArrow(0, 233); + SetIndexStyle(1,DRAW_ARROW); + SetIndexArrow(1, 234); +//---- indicator buffers mapping + SetIndexBuffer(0,ZigZagUp); + SetIndexBuffer(1,ZigZagDown); + SetIndexEmptyValue(0,0.0); + SetIndexEmptyValue(1,0.0); +//---- indicator short name + IndicatorShortName("ZigZag("+ExtDepth+","+ExtDeviation+","+ExtBackstep+")"); +//---- initialization done + return(0); + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +int start() + { + int shift, back,lasthighpos,lastlowpos; + double val,res; + double curlow,curhigh,lasthigh,lastlow; + + for(shift=Bars-ExtDepth; shift>=0; shift--) + { + val=Low[Lowest(NULL,0,MODE_LOW,ExtDepth,shift)]; + if(val==lastlow) val=0.0; + else + { + lastlow=val; + if((Low[shift]-val)>(ExtDeviation*Point)) val=0.0; + else + { + for(back=1; back<=ExtBackstep; back++) + { + res=ZigZagUp[shift+back]; + if((res!=0)&&(res>val)) { ZigZagUp[shift+back]=0.0; } + } + } + } + ZigZagUp[shift]=val; + //--- high + val=High[Highest(NULL,0,MODE_HIGH,ExtDepth,shift)]; + if(val==lasthigh) val=0.0; + else + { + lasthigh=val; + if((val-High[shift])>(ExtDeviation*Point)) val=0.0; + else + { + for(back=1; back<=ExtBackstep; back++) + { + res=ZigZagDown[shift+back]; + if((res!=0)&&(res=0; shift--) + { + curlow=ZigZagUp[shift]; + curhigh=ZigZagDown[shift]; + if((curlow==0)&&(curhigh==0)) continue; + //--- + if(curhigh!=0) + { + if(lasthigh>0) + { + if(lasthigh0) + { + if(lastlow>curlow) + { + ZigZagUp[lastlowpos]=0; + } + else ZigZagUp[shift]=0; + } + //--- + if((curlow=0; shift--) + { + if(shift>=Bars-ExtDepth) ZigZagUp[shift]=0.0; + else + { + res=ZigZagDown[shift]; + if(res!=0.0) ZigZagDown[shift]=res; + } + } + } + + //end// \ No newline at end of file diff --git a/VENOM A.mq4 b/VENOM A.mq4 new file mode 100644 index 0000000..33596d5 --- /dev/null +++ b/VENOM A.mq4 @@ -0,0 +1,426 @@ +#property copyright "Copyright © 2007 Third Wave FX" +#property link "http://www.thirdwavefx.com" + +#property indicator_chart_window + +extern string indi_name = "Third Wave FX VENOM - Window 2"; +int G_period_84 = 50; +int G_period_88 = 100; + +// E37F0136AA3FFAF149B351F6A4C948E9 +int init() { + return (0); +} + +// 52D46093050F38C27267BCE42543EF60 +int deinit() { + ObjectsDeleteAll(0, OBJ_LABEL); + ObjectDelete("Website"); + ObjectDelete("Expiry"); + ObjectDelete("Lock"); + ObjectDelete("BG1"); + ObjectDelete("BG2"); + ObjectDelete("BG3"); + ObjectDelete("BG4"); + ObjectDelete("BG5"); + ObjectDelete("BG6"); + ObjectDelete("BG7"); + ObjectDelete("BG8"); + ObjectDelete("BG9"); + ObjectDelete("BG10"); + ObjectDelete("BG11"); + ObjectDelete("BG12"); + ObjectDelete("BG13"); + ObjectDelete("BG14"); + ObjectDelete("BG15"); + ObjectDelete("BG16"); + ObjectDelete("BG17"); + ObjectDelete("BG18"); + ObjectDelete("Venom_Pair"); + ObjectDelete("Venom_Price"); + ObjectDelete("Venom_Spread"); + ObjectDelete("Buy_Signal"); + ObjectDelete("Buy_Signal1"); + ObjectDelete("Sell_Signal"); + ObjectDelete("Sell_Signal1"); + ObjectDelete("Buy_Price"); + ObjectDelete("Buy_Time"); + ObjectDelete("Sell_Price"); + ObjectDelete("Sell_Time"); + ObjectDelete("1_SR"); + ObjectDelete("2_SR"); + ObjectDelete("3_SR"); + ObjectDelete("4_SR"); + ObjectDelete("Top"); + ObjectDelete("Middle"); + ObjectDelete("Bottom"); + ObjectDelete("Data"); + return (0); +} + +// EA2B2676C28C0DB26D39331A336C6B92 +int start() { + double minute_0; + double hour_8; + double day_16; + double month_24; + double year_32; + string Ls_40; + string Ls_48; + string Ls_56; + string Ls_64; + string dbl2str_72; + double bid_80; + double digits_88; + double spread_96; + string dbl2str_104; + string dbl2str_112; + int minute_120; + int hour_124; + int day_128; + string var_name_132; + string var_name_140; + int global_var_148; + int global_var_152; + double digits_156; + double bid_164; + string var_name_172; + string var_name_180; + string var_name_188; + string var_name_196; + string dbl2str_204; + string Ls_212; + string Ls_220; + int global_var_228; + double global_var_232; + double global_var_240; + double global_var_248; + string var_name_256; + string var_name_264; + string var_name_272; + string var_name_280; + string dbl2str_288; + string Ls_296; + string Ls_304; + int global_var_312; + double global_var_316; + double global_var_324; + double global_var_332; + datetime time_340; + int Li_344; + double ima_348; + double ima_356; + double ima_364; + double ima_372; + double ima_380; + double ima_388; + double Ld_396; + double Ld_404; + double Ld_412; + double Ld_420; + double Ld_428; + double Ld_436; + double Ld_444; + double Ld_452; + double Ld_460; + double Ld_468; + int datetime_476; + int datetime_480; + double ima_484; + double ima_492; + int datetime_500; + int datetime_504; + double ima_508; + double ima_516; + int datetime_524; + int datetime_528; + ObjectCreate("Name", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("Name", "THIRDWAVEFX", 12, "Verdana", Red); + ObjectSet("Name", OBJPROP_CORNER, 1); + ObjectSet("Name", OBJPROP_XDISTANCE, 120); + ObjectSet("Name", OBJPROP_YDISTANCE, 31); + ObjectCreate("Name1", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("Name1", "VENOM", 20, "Arial Black", White); + ObjectSet("Name1", OBJPROP_CORNER, 1); + ObjectSet("Name1", OBJPROP_XDISTANCE, 4); + ObjectSet("Name1", OBJPROP_YDISTANCE, 19); + ObjectCreate("Website", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("Website", "www.thirdwavefx.com", 12, "Verdana", Red); + ObjectSet("Website", OBJPROP_CORNER, 1); + ObjectSet("Website", OBJPROP_XDISTANCE, 4); + ObjectSet("Website", OBJPROP_YDISTANCE, 5); + ObjectCreate("Expiry", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("Expiry", "Coded By ShahJB", 10, "Arial Narrow", Silver); + ObjectSet("Expiry", OBJPROP_CORNER, 1); + ObjectSet("Expiry", OBJPROP_XDISTANCE, 4); + ObjectSet("Expiry", OBJPROP_YDISTANCE, 53); + ObjectCreate("Lock", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("Lock", "sharishen@gmail.com", 10, "Arial Narrow", Silver); + ObjectSet("Lock", OBJPROP_CORNER, 1); + ObjectSet("Lock", OBJPROP_XDISTANCE, 4); + ObjectSet("Lock", OBJPROP_YDISTANCE, 70); + RefreshRates(); + int second_532 = TimeSeconds(TimeCurrent()); + int minute_536 = TimeMinute(TimeCurrent()); + int hour_540 = TimeHour(TimeCurrent()); + int day_544 = TimeDay(TimeCurrent()); + int month_548 = TimeMonth(TimeCurrent()); + int year_552 = TimeYear(TimeCurrent()); + if (year_552 < 2030) { + ObjectCreate("BG1", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("BG1", "nnnnn", 50, "Wingdings", Black); + ObjectSet("BG1", OBJPROP_CORNER, 0); + ObjectSet("BG1", OBJPROP_XDISTANCE, 0); + ObjectSet("BG1", OBJPROP_YDISTANCE, 0); + ObjectCreate("BG2", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("BG2", "nnnn", 50, "Wingdings", Black); + ObjectSet("BG2", OBJPROP_CORNER, 0); + ObjectSet("BG2", OBJPROP_XDISTANCE, 15); + ObjectSet("BG2", OBJPROP_YDISTANCE, 0); + ObjectCreate("BG3", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("BG3", "nnnnn", 50, "Wingdings", Black); + ObjectSet("BG3", OBJPROP_CORNER, 0); + ObjectSet("BG3", OBJPROP_XDISTANCE, 0); + ObjectSet("BG3", OBJPROP_YDISTANCE, 35); + ObjectCreate("BG4", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("BG4", "nnnn", 50, "Wingdings", Black); + ObjectSet("BG4", OBJPROP_CORNER, 0); + ObjectSet("BG4", OBJPROP_XDISTANCE, 15); + ObjectSet("BG4", OBJPROP_YDISTANCE, 35); + ObjectCreate("BG5", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("BG5", "nnnnn", 50, "Wingdings", Black); + ObjectSet("BG5", OBJPROP_CORNER, 0); + ObjectSet("BG5", OBJPROP_XDISTANCE, 0); + ObjectSet("BG5", OBJPROP_YDISTANCE, 70); + ObjectCreate("BG6", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("BG6", "nnnn", 50, "Wingdings", Black); + ObjectSet("BG6", OBJPROP_CORNER, 0); + ObjectSet("BG6", OBJPROP_XDISTANCE, 15); + ObjectSet("BG6", OBJPROP_YDISTANCE, 70); + ObjectCreate("BG7", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("BG7", "nnnnn", 50, "Wingdings", Black); + ObjectSet("BG7", OBJPROP_CORNER, 0); + ObjectSet("BG7", OBJPROP_XDISTANCE, 0); + ObjectSet("BG7", OBJPROP_YDISTANCE, 105); + ObjectCreate("BG8", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("BG8", "nnnn", 50, "Wingdings", Black); + ObjectSet("BG8", OBJPROP_CORNER, 0); + ObjectSet("BG8", OBJPROP_XDISTANCE, 15); + ObjectSet("BG8", OBJPROP_YDISTANCE, 105); + ObjectCreate("BG9", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("BG9", "nnnnn", 50, "Wingdings", Black); + ObjectSet("BG9", OBJPROP_CORNER, 0); + ObjectSet("BG9", OBJPROP_XDISTANCE, 0); + ObjectSet("BG9", OBJPROP_YDISTANCE, 128); + ObjectCreate("BG10", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("BG10", "nnnn", 50, "Wingdings", Black); + ObjectSet("BG10", OBJPROP_CORNER, 0); + ObjectSet("BG10", OBJPROP_XDISTANCE, 15); + ObjectSet("BG10", OBJPROP_YDISTANCE, 128); + minute_0 = minute_536; + hour_8 = hour_540; + day_16 = day_544; + month_24 = month_548; + year_32 = year_552; + if (minute_0 < 10.0) Ls_40 = "0" + DoubleToStr(minute_0, 0); + else Ls_40 = DoubleToStr(minute_0, 0); + if (hour_8 < 10.0) Ls_48 = "0" + DoubleToStr(hour_8, 0); + else Ls_48 = DoubleToStr(hour_8, 0); + if (day_16 < 10.0) Ls_56 = "0" + DoubleToStr(day_16, 0); + else Ls_56 = DoubleToStr(day_16, 0); + if (month_24 < 10.0) Ls_64 = "0" + DoubleToStr(month_24, 0); + else Ls_64 = DoubleToStr(month_24, 0); + dbl2str_72 = DoubleToStr(year_32, 0); + ObjectCreate("Venom_Date", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("Venom_Date", "DATE : " + Ls_56 + "/" + Ls_64 + "/" + dbl2str_72 + " TIME : " + Ls_48 + ":" + Ls_40, 10, "Arial Black", White); + ObjectSet("Venom_Date", OBJPROP_CORNER, 0); + ObjectSet("Venom_Date", OBJPROP_XDISTANCE, 8); + ObjectSet("Venom_Date", OBJPROP_YDISTANCE, 15); + ObjectCreate("Venom_Pair", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("Venom_Pair", Symbol(), 30, "Arial Black", Red); + ObjectSet("Venom_Pair", OBJPROP_CORNER, 0); + ObjectSet("Venom_Pair", OBJPROP_XDISTANCE, 10); + ObjectSet("Venom_Pair", OBJPROP_YDISTANCE, 25); + ObjectCreate("Venom_Pair1", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("Venom_Pair1", Symbol(), 30, "Arial Black", Gold); + ObjectSet("Venom_Pair1", OBJPROP_CORNER, 0); + ObjectSet("Venom_Pair1", OBJPROP_XDISTANCE, 8); + ObjectSet("Venom_Pair1", OBJPROP_YDISTANCE, 23); + RefreshRates(); + bid_80 = MarketInfo(Symbol(), MODE_BID); + digits_88 = MarketInfo(Symbol(), MODE_DIGITS); + spread_96 = MarketInfo(Symbol(), MODE_SPREAD); + dbl2str_104 = DoubleToStr(bid_80, digits_88); + dbl2str_112 = DoubleToStr(spread_96, 0); + ObjectCreate("Venom_Price", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("Venom_Price", "PRICE : " + dbl2str_104 + " SPREAD : " + dbl2str_112, 10, "Arial Black", White); + ObjectSet("Venom_Price", OBJPROP_CORNER, 0); + ObjectSet("Venom_Price", OBJPROP_XDISTANCE, 8); + ObjectSet("Venom_Price", OBJPROP_YDISTANCE, 72); + RefreshRates(); + minute_120 = TimeMinute(TimeCurrent()); + hour_124 = TimeHour(TimeCurrent()); + day_128 = TimeDay(TimeCurrent()); + ObjectCreate("Buy_Signal", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("Buy_Signal", "BUY SIGNAL", 12, "Arial Black", Silver); + ObjectSet("Buy_Signal", OBJPROP_CORNER, 0); + ObjectSet("Buy_Signal", OBJPROP_XDISTANCE, 9); + ObjectSet("Buy_Signal", OBJPROP_YDISTANCE, 97); + ObjectCreate("Buy_Signal1", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("Buy_Signal1", "BUY SIGNAL", 12, "Arial Black", Lime); + ObjectSet("Buy_Signal1", OBJPROP_CORNER, 0); + ObjectSet("Buy_Signal1", OBJPROP_XDISTANCE, 8); + ObjectSet("Buy_Signal1", OBJPROP_YDISTANCE, 96); + ObjectCreate("Sell_Signal", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("Sell_Signal", "SELL SIGNAL", 12, "Arial Black", Silver); + ObjectSet("Sell_Signal", OBJPROP_CORNER, 0); + ObjectSet("Sell_Signal", OBJPROP_XDISTANCE, 9); + ObjectSet("Sell_Signal", OBJPROP_YDISTANCE, 137); + ObjectCreate("Sell_Signal1", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("Sell_Signal1", "SELL SIGNAL", 12, "Arial Black", Red); + ObjectSet("Sell_Signal1", OBJPROP_CORNER, 0); + ObjectSet("Sell_Signal1", OBJPROP_XDISTANCE, 8); + ObjectSet("Sell_Signal1", OBJPROP_YDISTANCE, 136); + var_name_132 = "venom_signal_buy" + Symbol(); + var_name_140 = "venom_signal_sell" + Symbol(); + global_var_148 = GlobalVariableGet(var_name_132); + global_var_152 = GlobalVariableGet(var_name_140); + RefreshRates(); + digits_156 = MarketInfo(Symbol(), MODE_DIGITS); + bid_164 = Bid; + var_name_172 = "venom_b_day" + Symbol(); + var_name_180 = "venom_b_price" + Symbol(); + var_name_188 = "venom_b_hour" + Symbol(); + var_name_196 = "venom_b_minute" + Symbol(); + global_var_228 = GlobalVariableGet(var_name_172); + global_var_232 = GlobalVariableGet(var_name_180); + global_var_240 = GlobalVariableGet(var_name_188); + global_var_248 = GlobalVariableGet(var_name_196); + if (global_var_232 == 0.0 && global_var_228 != day_128 && global_var_148 == 6) { + GlobalVariableSet(var_name_180, bid_164); + GlobalVariableSet(var_name_188, hour_124); + GlobalVariableSet(var_name_196, minute_120); + GlobalVariableSet(var_name_172, day_128); + } + if (global_var_228 != day_128 && global_var_232 != 0.0) { + GlobalVariableSet(var_name_180, 0); + GlobalVariableSet(var_name_132, 0); + } + if (global_var_232 != 0.0) { + dbl2str_204 = DoubleToStr(global_var_232, digits_156); + if (global_var_240 < 10.0) Ls_212 = "0" + DoubleToStr(global_var_240, 0); + else Ls_212 = DoubleToStr(global_var_240, 0); + if (global_var_248 < 10.0) Ls_220 = "0" + DoubleToStr(global_var_248, 0); + else Ls_220 = DoubleToStr(global_var_248, 0); + ObjectCreate("Buy_Price", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("Buy_Price", "PRICE : " + dbl2str_204, 8, "Arial Black", Lime); + ObjectSet("Buy_Price", OBJPROP_CORNER, 0); + ObjectSet("Buy_Price", OBJPROP_XDISTANCE, 8); + ObjectSet("Buy_Price", OBJPROP_YDISTANCE, 118); + ObjectCreate("Buy_Time", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("Buy_Time", "TIME : " + Ls_212 + ":" + Ls_220, 8, "Arial Black", Lime); + ObjectSet("Buy_Time", OBJPROP_CORNER, 0); + ObjectSet("Buy_Time", OBJPROP_XDISTANCE, 102); + ObjectSet("Buy_Time", OBJPROP_YDISTANCE, 118); + } else { + ObjectDelete("Buy_Price"); + ObjectDelete("Buy_Time"); + } + var_name_256 = "venom_j_day" + Symbol(); + var_name_264 = "venom_j_price" + Symbol(); + var_name_272 = "venom_j_hour" + Symbol(); + var_name_280 = "venom_j_minute" + Symbol(); + global_var_312 = GlobalVariableGet(var_name_256); + global_var_316 = GlobalVariableGet(var_name_264); + global_var_324 = GlobalVariableGet(var_name_272); + global_var_332 = GlobalVariableGet(var_name_280); + if (global_var_316 == 0.0 && global_var_312 != day_128 && global_var_152 == -6) { + GlobalVariableSet(var_name_264, bid_164); + GlobalVariableSet(var_name_272, hour_124); + GlobalVariableSet(var_name_280, minute_120); + GlobalVariableSet(var_name_256, day_128); + } + if (global_var_312 != day_128 && global_var_316 != 0.0) { + GlobalVariableSet(var_name_264, 0); + GlobalVariableSet(var_name_140, 0); + } + if (global_var_316 != 0.0) { + dbl2str_288 = DoubleToStr(global_var_316, digits_156); + if (global_var_324 < 10.0) Ls_296 = "0" + DoubleToStr(global_var_324, 0); + else Ls_296 = DoubleToStr(global_var_324, 0); + if (global_var_332 < 10.0) Ls_304 = "0" + DoubleToStr(global_var_332, 0); + else Ls_304 = DoubleToStr(global_var_332, 0); + ObjectCreate("Sell_Price", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("Sell_Price", "PRICE : " + dbl2str_288, 8, "Arial Black", Red); + ObjectSet("Sell_Price", OBJPROP_CORNER, 0); + ObjectSet("Sell_Price", OBJPROP_XDISTANCE, 8); + ObjectSet("Sell_Price", OBJPROP_YDISTANCE, 158); + ObjectCreate("Sell_Time", OBJ_LABEL, 0, 0, 0, 0, 0); + ObjectSetText("Sell_Time", "TIME : " + Ls_296 + ":" + Ls_304, 8, "Arial Black", Red); + ObjectSet("Sell_Time", OBJPROP_CORNER, 0); + ObjectSet("Sell_Time", OBJPROP_XDISTANCE, 102); + ObjectSet("Sell_Time", OBJPROP_YDISTANCE, 158); + } else { + ObjectDelete("Sell_Price"); + ObjectDelete("Sell_Time"); + } + time_340 = Time[0]; + if (Period() == PERIOD_M1) Li_344 = 60; + if (Period() == PERIOD_M5) Li_344 = 300; + if (Period() == PERIOD_M15) Li_344 = 900; + if (Period() == PERIOD_M30) Li_344 = 1800; + if (Period() == PERIOD_H1) Li_344 = 3600; + if (Period() == PERIOD_H4) Li_344 = 14400; + if (Period() == PERIOD_D1) Li_344 = 86400; + if (Period() == PERIOD_W1) Li_344 = 604800; + if (Period() == PERIOD_MN1) Li_344 = 2592000; + ima_348 = iMA(NULL, PERIOD_M15, G_period_84, 0, MODE_EMA, PRICE_CLOSE, 0); + ima_356 = iMA(NULL, PERIOD_M15, G_period_88, 0, MODE_SMA, PRICE_CLOSE, 0); + ima_364 = iMA(NULL, PERIOD_M30, G_period_84, 0, MODE_EMA, PRICE_CLOSE, 0); + ima_372 = iMA(NULL, PERIOD_M30, G_period_88, 0, MODE_SMA, PRICE_CLOSE, 0); + ima_380 = iMA(NULL, PERIOD_H1, G_period_84, 0, MODE_EMA, PRICE_CLOSE, 0); + ima_388 = iMA(NULL, PERIOD_H1, G_period_88, 0, MODE_SMA, PRICE_CLOSE, 0); + Ld_396 = MathMax(ima_348, ima_356); + Ld_404 = MathMax(ima_364, ima_372); + Ld_412 = MathMax(ima_380, ima_388); + Ld_420 = MathMax(Ld_396, Ld_404); + Ld_428 = MathMax(Ld_412, Ld_420); + Ld_436 = MathMin(ima_348, ima_356); + Ld_444 = MathMin(ima_364, ima_372); + Ld_452 = MathMin(ima_380, ima_388); + Ld_460 = MathMin(Ld_436, Ld_444); + Ld_468 = MathMin(Ld_452, Ld_460); + datetime_476 = time_340 + 1 * Li_344; + datetime_480 = time_340 + 3 * Li_344; + ima_484 = iMA(NULL, PERIOD_H4, G_period_84, 0, MODE_EMA, PRICE_CLOSE, 0); + ima_492 = iMA(NULL, PERIOD_H4, G_period_88, 0, MODE_SMA, PRICE_CLOSE, 0); + datetime_500 = time_340 + Li_344 * 4; + datetime_504 = time_340 + 6 * Li_344; + ima_508 = iMA(NULL, PERIOD_D1, G_period_84, 0, MODE_EMA, PRICE_CLOSE, 0); + ima_516 = iMA(NULL, PERIOD_D1, G_period_88, 0, MODE_SMA, PRICE_CLOSE, 0); + datetime_524 = time_340 + 7 * Li_344; + datetime_528 = time_340 + 9 * Li_344; + ObjectCreate("2_SR", OBJ_RECTANGLE, 0, 0, 0, 0, 0); + ObjectSet("2_SR", OBJPROP_TIME1, datetime_476); + ObjectSet("2_SR", OBJPROP_PRICE1, ima_380); + ObjectSet("2_SR", OBJPROP_TIME2, datetime_480); + ObjectSet("2_SR", OBJPROP_PRICE2, ima_388); + ObjectSet("2_SR", OBJPROP_COLOR, DarkBlue); + ObjectSet("2_SR", OBJPROP_BACK, TRUE); + ObjectCreate("3_SR", OBJ_RECTANGLE, 0, 0, 0, 0, 0); + ObjectSet("3_SR", OBJPROP_TIME1, datetime_500); + ObjectSet("3_SR", OBJPROP_PRICE1, ima_484); + ObjectSet("3_SR", OBJPROP_TIME2, datetime_504); + ObjectSet("3_SR", OBJPROP_PRICE2, ima_492); + ObjectSet("3_SR", OBJPROP_COLOR, Blue); + ObjectSet("3_SR", OBJPROP_BACK, TRUE); + ObjectCreate("4_SR", OBJ_RECTANGLE, 0, 0, 0, 0, 0); + ObjectSet("4_SR", OBJPROP_TIME1, datetime_524); + ObjectSet("4_SR", OBJPROP_PRICE1, ima_508); + ObjectSet("4_SR", OBJPROP_TIME2, datetime_528); + ObjectSet("4_SR", OBJPROP_PRICE2, ima_516); + ObjectSet("4_SR", OBJPROP_COLOR, DeepSkyBlue); + ObjectSet("4_SR", OBJPROP_BACK, TRUE); + } + return (0); +} \ No newline at end of file diff --git a/VENOM B.mq4 b/VENOM B.mq4 new file mode 100644 index 0000000..d5b96a1 --- /dev/null +++ b/VENOM B.mq4 @@ -0,0 +1,1972 @@ +#property copyright "Copyright © 2007 Third Wave FX" +#property link "http://www.thirdwavefx.com" + +#property indicator_separate_window + +extern string indi_name = "Third Wave FX VENOM - Window 1"; +extern bool Venom_Alert = TRUE; +double Gd_88 = 25.0; +int G_period_96 = 50; +int G_period_100 = 100; +double G_pips_104 = 5.0; +double G_pips_112 = 5.0; + +// E37F0136AA3FFAF149B351F6A4C948E9 +int init() { + IndicatorShortName("Third Wave FX VENOM (" + Symbol() + ")"); + string var_name_0 = "start_saat" + Symbol(); + int second_8 = TimeSeconds(TimeCurrent()); + GlobalVariableSet(var_name_0, second_8); + return (0); +} + +// 52D46093050F38C27267BCE42543EF60 +int deinit() { + string var_name_0 = "start_saat" + Symbol(); + ObjectsDeleteAll(0, OBJ_LABEL); + ObjectDelete("Cover"); + ObjectDelete("Cover1"); + ObjectDelete("Vectorial_Bias"); + ObjectDelete("Sup_Res_1"); + ObjectDelete("Sup_Res_2"); + ObjectDelete("Venom_1_Text_BG"); + GlobalVariableDel(var_name_0); + ObjectDelete("Venom_1_Text"); + ObjectDelete("Venom_1_Sig"); + ObjectDelete("Venom_1_Eyesig"); + ObjectDelete("Venom_1_Eyeprice"); + ObjectDelete("Venom_1_Eyehi"); + ObjectDelete("Venom_1_Eyelo"); + ObjectDelete("Venom_2_Text"); + ObjectDelete("Venom_2_Sig"); + ObjectDelete("Venom_2_Eyesig"); + ObjectDelete("Venom_2_Eyeprice"); + ObjectDelete("Venom_2_Eyehi"); + ObjectDelete("Venom_2_Eyelo"); + ObjectDelete("Venom_3_Text"); + ObjectDelete("Venom_3_Sig"); + ObjectDelete("Venom_3_Eyesig"); + ObjectDelete("Venom_3_Eyeprice"); + ObjectDelete("Venom_3_Eyehi"); + ObjectDelete("Venom_3_Eyelo"); + ObjectDelete("Venom_4_Text"); + ObjectDelete("Venom_4_Sig"); + ObjectDelete("Venom_4_Eyesig"); + ObjectDelete("Venom_4_Eyeprice"); + ObjectDelete("Venom_4_Eyehi"); + ObjectDelete("Venom_4_Eyelo"); + ObjectDelete("Venom_5_Text"); + ObjectDelete("Venom_5_Sig"); + ObjectDelete("Venom_5_Eyesig"); + ObjectDelete("Venom_5_Eyeprice"); + ObjectDelete("Venom_5_Eyehi"); + ObjectDelete("Venom_5_Eyelo"); + ObjectDelete("Venom_6_Text"); + ObjectDelete("Venom_6_Sig"); + ObjectDelete("Venom_6_Eyesig"); + ObjectDelete("Venom_6_Eyeprice"); + ObjectDelete("Venom_6_Eyehi"); + ObjectDelete("Venom_6_Eyelo"); + return (0); +} + +// EA2B2676C28C0DB26D39331A336C6B92 +int start() { + double ima_0; + double ima_8; + double istochastic_16; + double istochastic_24; + double ima_32; + double ima_40; + double istochastic_48; + double istochastic_56; + double ima_64; + double ima_72; + double istochastic_80; + double istochastic_88; + double ima_96; + double ima_104; + double istochastic_112; + double istochastic_120; + double ima_128; + double ima_136; + double istochastic_144; + double istochastic_152; + double ima_160; + double ima_168; + double istochastic_176; + double istochastic_184; + color color_192; + color color_196; + color color_200; + color color_204; + color color_208; + color color_212; + string text_216; + string text_224; + string text_232; + string text_240; + string text_248; + string text_256; + double Ld_264; + double Ld_272; + double point_280; + double Ld_288; + double Ld_296; + int Li_304; + int Li_308; + int Li_312; + int Li_316; + int Li_320; + int Li_324; + double Ld_328; + double Ld_336; + double Ld_344; + double Ld_352; + double Ld_360; + double Ld_368; + double Ld_376; + double Ld_384; + double Ld_392; + double Ld_400; + double Ld_408; + double Ld_416; + double Ld_424; + double Ld_432; + double Ld_440; + double Ld_448; + double Ld_456; + double Ld_464; + double Ld_472; + double Ld_480; + double Ld_488; + double Ld_496; + double Ld_504; + double Ld_512; + string Ls_520; + int y_528; + double Ld_532; + string dbl2str_540; + string dbl2str_548; + string dbl2str_556; + bool Li_564; + int y_568; + double Ld_572; + string dbl2str_580; + string dbl2str_588; + string dbl2str_596; + bool Li_604; + int y_608; + double Ld_612; + string dbl2str_620; + string dbl2str_628; + string dbl2str_636; + bool Li_644; + int y_648; + double Ld_652; + string dbl2str_660; + string dbl2str_668; + string dbl2str_676; + bool Li_684; + int y_688; + double Ld_692; + string dbl2str_700; + string dbl2str_708; + string dbl2str_716; + bool Li_724; + int y_728; + double Ld_732; + string dbl2str_740; + string dbl2str_748; + string dbl2str_756; + bool Li_764; + string var_name_768; + int Li_unused_776; + string var_name_780; + string var_name_788; + bool bool_796; + double digits_800; + double ima_808; + double ibands_816; + double ibands_824; + double ibands_832; + double ibands_840; + double ima_848; + double ibands_856; + double ibands_864; + double ibands_872; + double ibands_880; + double ima_888; + double ibands_896; + double ibands_904; + double ibands_912; + double ibands_920; + double ima_928; + double ibands_936; + double ibands_944; + double ibands_952; + double ibands_960; + double ima_968; + double ibands_976; + double ibands_984; + double ibands_992; + double ibands_1000; + double ima_1008; + double ibands_1016; + double ibands_1024; + double ibands_1032; + double ibands_1040; + color color_1048; + color color_1052; + color color_1056; + color color_1060; + color color_1064; + color color_1068; + string text_1072; + string text_1080; + string text_1088; + string text_1096; + string text_1104; + string text_1112; + ObjectCreate("Cover", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Cover", "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn", 15, "Wingdings", Black); + ObjectSet("Cover", OBJPROP_CORNER, 0); + ObjectSet("Cover", OBJPROP_XDISTANCE, 0); + ObjectSet("Cover", OBJPROP_YDISTANCE, 0); + ObjectCreate("Cover1", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Cover1", "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn", 15, "Wingdings", Black); + ObjectSet("Cover1", OBJPROP_CORNER, 0); + ObjectSet("Cover1", OBJPROP_XDISTANCE, 4); + ObjectSet("Cover1", OBJPROP_YDISTANCE, 0); + RefreshRates(); + int second_1120 = TimeSeconds(TimeCurrent()); + int minute_1124 = TimeMinute(TimeCurrent()); + int hour_1128 = TimeHour(TimeCurrent()); + int day_1132 = TimeDay(TimeCurrent()); + int month_1136 = TimeMonth(TimeCurrent()); + int year_1140 = TimeYear(TimeCurrent()); + if (year_1140 < 2030) { + RefreshRates(); + ima_0 = iMA(NULL, PERIOD_M1, G_period_96, 0, MODE_EMA, PRICE_CLOSE, 0); + ima_8 = iMA(NULL, PERIOD_M1, G_period_100, 0, MODE_SMA, PRICE_CLOSE, 0); + istochastic_16 = iStochastic(NULL, PERIOD_M1, 30, 3, 3, MODE_SMA, 0, MODE_MAIN, 0); + istochastic_24 = iStochastic(NULL, PERIOD_M1, 30, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 0); + ima_32 = iMA(NULL, PERIOD_M5, G_period_96, 0, MODE_EMA, PRICE_CLOSE, 0); + ima_40 = iMA(NULL, PERIOD_M5, G_period_100, 0, MODE_SMA, PRICE_CLOSE, 0); + istochastic_48 = iStochastic(NULL, PERIOD_M5, 30, 3, 3, MODE_SMA, 0, MODE_MAIN, 0); + istochastic_56 = iStochastic(NULL, PERIOD_M5, 30, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 0); + ima_64 = iMA(NULL, PERIOD_M15, G_period_96, 0, MODE_EMA, PRICE_CLOSE, 0); + ima_72 = iMA(NULL, PERIOD_M15, G_period_100, 0, MODE_SMA, PRICE_CLOSE, 0); + istochastic_80 = iStochastic(NULL, PERIOD_M15, 30, 3, 3, MODE_SMA, 0, MODE_MAIN, 0); + istochastic_88 = iStochastic(NULL, PERIOD_M15, 30, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 0); + ima_96 = iMA(NULL, PERIOD_M30, G_period_96, 0, MODE_EMA, PRICE_CLOSE, 0); + ima_104 = iMA(NULL, PERIOD_M30, G_period_100, 0, MODE_SMA, PRICE_CLOSE, 0); + istochastic_112 = iStochastic(NULL, PERIOD_M30, 30, 3, 3, MODE_SMA, 0, MODE_MAIN, 0); + istochastic_120 = iStochastic(NULL, PERIOD_M30, 30, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 0); + ima_128 = iMA(NULL, PERIOD_H1, G_period_96, 0, MODE_EMA, PRICE_CLOSE, 0); + ima_136 = iMA(NULL, PERIOD_H1, G_period_100, 0, MODE_SMA, PRICE_CLOSE, 0); + istochastic_144 = iStochastic(NULL, PERIOD_H1, 30, 3, 3, MODE_SMA, 0, MODE_MAIN, 0); + istochastic_152 = iStochastic(NULL, PERIOD_H1, 30, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 0); + ima_160 = iMA(NULL, PERIOD_H4, G_period_96, 0, MODE_EMA, PRICE_CLOSE, 0); + ima_168 = iMA(NULL, PERIOD_H4, G_period_100, 0, MODE_SMA, PRICE_CLOSE, 0); + istochastic_176 = iStochastic(NULL, PERIOD_H4, 30, 3, 3, MODE_SMA, 0, MODE_MAIN, 0); + istochastic_184 = iStochastic(NULL, PERIOD_H4, 30, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 0); + if (istochastic_24 == istochastic_16) color_192 = DarkSlateGray; + if (istochastic_56 == istochastic_48) color_196 = DarkSlateGray; + if (istochastic_88 == istochastic_80) color_200 = DarkSlateGray; + if (istochastic_120 == istochastic_112) color_204 = DarkSlateGray; + if (istochastic_152 == istochastic_144) color_208 = DarkSlateGray; + if (istochastic_184 == istochastic_176) color_212 = DarkSlateGray; + RefreshRates(); + Ld_264 = MarketInfo(Symbol(), MODE_SPREAD); + Ld_272 = NormalizeDouble(Ld_264 * Point, Digits); + point_280 = MarketInfo(Symbol(), MODE_POINT); + Ld_288 = NormalizeDouble(G_pips_104 * Point, Digits); + Ld_296 = NormalizeDouble(G_pips_112 * Point, Digits); + Ld_328 = (ima_0 - Bid - Ld_272) / point_280; + Ld_336 = (ima_8 - Bid - Ld_272) / point_280; + Ld_344 = (Ask - ima_0 - Ld_272) / point_280; + Ld_352 = (Ask - ima_8 - Ld_272) / point_280; + if (istochastic_24 < istochastic_16 && Ld_328 >= Gd_88 && Ld_336 >= Gd_88 && Bid < ima_0 && Bid < ima_8) { + text_216 = "é"; + color_192 = Lime; + Li_304 = 0; + } + if (istochastic_24 < istochastic_16 && Ld_328 < Gd_88 || Ld_336 < Gd_88 && Bid <= ima_0 && Bid <= ima_8) { + text_216 = "è"; + color_192 = LimeGreen; + Li_304 = 0; + } + if (istochastic_24 < istochastic_16 && Bid >= ima_0 + Ld_296 && Bid < ima_8 && Ld_336 >= Gd_88) { + text_216 = "é"; + color_192 = Lime; + Li_304 = 0; + } + if (istochastic_24 < istochastic_16 && Bid < ima_0 + Ld_296 && Bid > ima_0 && Bid < ima_8 && Ld_336 >= Gd_88) { + text_216 = "ì"; + color_192 = Lime; + Li_304 = 0; + } + if (istochastic_24 < istochastic_16 && Bid < ima_0 + Ld_296 && Bid > ima_0 && Bid < ima_8 && Ld_336 < Gd_88) { + text_216 = "è"; + color_192 = LimeGreen; + Li_304 = 0; + } + if (istochastic_24 < istochastic_16 && Bid >= ima_0 + Ld_296 && Bid < ima_8 && Ld_336 < Gd_88) { + text_216 = "è"; + color_192 = LimeGreen; + Li_304 = 0; + } + if (istochastic_24 < istochastic_16 && Bid >= ima_8 + Ld_296 && Bid < ima_0 && Ld_328 >= Gd_88) { + text_216 = "é"; + color_192 = Lime; + Li_304 = 0; + } + if (istochastic_24 < istochastic_16 && Bid < ima_8 + Ld_296 && Bid > ima_8 && Bid < ima_0 && Ld_328 >= Gd_88) { + text_216 = "ì"; + color_192 = Lime; + Li_304 = 0; + } + if (istochastic_24 < istochastic_16 && Bid < ima_8 + Ld_296 && Bid > ima_8 && Bid < ima_0 && Ld_328 < Gd_88) { + text_216 = "è"; + color_192 = LimeGreen; + Li_304 = 0; + } + if (istochastic_24 < istochastic_16 && Bid >= ima_8 + Ld_296 && Bid < ima_0 && Ld_328 < Gd_88) { + text_216 = "è"; + color_192 = LimeGreen; + Li_304 = 0; + } + if (istochastic_24 < istochastic_16 && Bid >= ima_0 + Ld_296 && Bid >= ima_8 + Ld_296) { + text_216 = "é"; + color_192 = Lime; + Li_304 = 6; + } + if (istochastic_24 < istochastic_16 && Bid > ima_0 && Bid < ima_0 + Ld_296 && Bid > ima_8 && Bid < ima_8 + Ld_296) { + text_216 = "ì"; + color_192 = Lime; + Li_304 = 0; + } + if (istochastic_24 < istochastic_16 && Bid >= ima_0 + Ld_296 && Bid >= ima_8 && Bid < ima_8 + Ld_296) { + text_216 = "ì"; + color_192 = Lime; + Li_304 = 0; + } + if (istochastic_24 < istochastic_16 && Bid >= ima_8 + Ld_296 && Bid >= ima_0 && Bid < ima_0 + Ld_296) { + text_216 = "ì"; + color_192 = Lime; + Li_304 = 0; + } + if (istochastic_24 > istochastic_16 && Ld_344 >= Gd_88 && Ld_352 >= Gd_88 && Bid > ima_0 && Bid > ima_8) { + text_216 = "ê"; + color_192 = Red; + Li_304 = 0; + } + if (istochastic_24 > istochastic_16 && Ld_344 < Gd_88 || Ld_352 < Gd_88 && Bid >= ima_0 && Bid >= ima_8) { + text_216 = "è"; + color_192 = OrangeRed; + Li_304 = 0; + } + if (istochastic_24 > istochastic_16 && Bid <= ima_0 - Ld_296 && Bid > ima_8 && Ld_352 >= Gd_88) { + text_216 = "ê"; + color_192 = Red; + Li_304 = 0; + } + if (istochastic_24 > istochastic_16 && Bid > ima_0 - Ld_296 && Bid < ima_0 && Bid > ima_8 && Ld_352 >= Gd_88) { + text_216 = "î"; + color_192 = Red; + Li_304 = 0; + } + if (istochastic_24 > istochastic_16 && Bid > ima_0 - Ld_296 && Bid < ima_0 && Bid > ima_8 && Ld_352 < Gd_88) { + text_216 = "è"; + color_192 = OrangeRed; + Li_304 = 0; + } + if (istochastic_24 > istochastic_16 && Bid <= ima_0 - Ld_296 && Bid > ima_8 && Ld_352 < Gd_88) { + text_216 = "è"; + color_192 = OrangeRed; + Li_304 = 0; + } + if (istochastic_24 > istochastic_16 && Bid <= ima_8 - Ld_296 && Bid > ima_0 && Ld_344 >= Gd_88) { + text_216 = "ê"; + color_192 = Red; + Li_304 = 0; + } + if (istochastic_24 > istochastic_16 && Bid > ima_8 - Ld_296 && Bid < ima_8 && Bid > ima_0 && Ld_344 >= Gd_88) { + text_216 = "î"; + color_192 = Red; + Li_304 = 0; + } + if (istochastic_24 > istochastic_16 && Bid > ima_8 - Ld_296 && Bid < ima_8 && Bid > ima_0 && Ld_344 < Gd_88) { + text_216 = "è"; + color_192 = OrangeRed; + Li_304 = 0; + } + if (istochastic_24 > istochastic_16 && Bid <= ima_8 - Ld_296 && Bid > ima_0 && Ld_344 < Gd_88) { + text_216 = "è"; + color_192 = OrangeRed; + Li_304 = 0; + } + if (istochastic_24 > istochastic_16 && Bid <= ima_0 - Ld_296 && Bid <= ima_8 - Ld_296) { + text_216 = "ê"; + color_192 = Red; + Li_304 = -6; + } + if (istochastic_24 > istochastic_16 && Bid < ima_0 && Bid > ima_0 - Ld_296 && Bid < ima_8 && Bid > ima_8 - Ld_296) { + text_216 = "î"; + color_192 = Red; + Li_304 = 0; + } + if (istochastic_24 > istochastic_16 && Bid <= ima_0 - Ld_296 && Bid <= ima_8 && Bid > ima_8 - Ld_296) { + text_216 = "î"; + color_192 = Red; + Li_304 = 0; + } + if (istochastic_24 > istochastic_16 && Bid <= ima_8 - Ld_296 && Bid <= ima_0 && Bid > ima_0 - Ld_296) { + text_216 = "î"; + color_192 = Red; + Li_304 = 0; + } + RefreshRates(); + Ld_360 = (ima_32 - Bid - Ld_272) / point_280; + Ld_368 = (ima_40 - Bid - Ld_272) / point_280; + Ld_376 = (Ask - ima_32 - Ld_272) / point_280; + Ld_384 = (Ask - ima_40 - Ld_272) / point_280; + if (istochastic_56 < istochastic_48 && Ld_360 >= Gd_88 && Ld_368 >= Gd_88 && Bid < ima_32 && Bid < ima_40) { + text_224 = "é"; + color_196 = Lime; + Li_308 = 0; + } + if (istochastic_56 < istochastic_48 && Ld_360 < Gd_88 || Ld_368 < Gd_88 && Bid <= ima_32 && Bid <= ima_40) { + text_224 = "è"; + color_196 = LimeGreen; + Li_308 = 0; + } + if (istochastic_56 < istochastic_48 && Bid >= ima_32 + Ld_296 && Bid < ima_40 && Ld_368 >= Gd_88) { + text_224 = "é"; + color_196 = Lime; + Li_308 = 0; + } + if (istochastic_56 < istochastic_48 && Bid < ima_32 + Ld_296 && Bid > ima_32 && Bid < ima_40 && Ld_368 >= Gd_88) { + text_224 = "ì"; + color_196 = Lime; + Li_308 = 0; + } + if (istochastic_56 < istochastic_48 && Bid < ima_32 + Ld_296 && Bid > ima_32 && Bid < ima_40 && Ld_368 < Gd_88) { + text_224 = "è"; + color_196 = LimeGreen; + Li_308 = 0; + } + if (istochastic_56 < istochastic_48 && Bid >= ima_32 + Ld_296 && Bid < ima_40 && Ld_368 < Gd_88) { + text_224 = "è"; + color_196 = LimeGreen; + Li_308 = 0; + } + if (istochastic_56 < istochastic_48 && Bid >= ima_40 + Ld_296 && Bid < ima_32 && Ld_360 >= Gd_88) { + text_224 = "é"; + color_196 = Lime; + Li_308 = 0; + } + if (istochastic_56 < istochastic_48 && Bid < ima_40 + Ld_296 && Bid > ima_40 && Bid < ima_32 && Ld_360 >= Gd_88) { + text_224 = "ì"; + color_196 = Lime; + Li_308 = 0; + } + if (istochastic_56 < istochastic_48 && Bid < ima_40 + Ld_296 && Bid > ima_40 && Bid < ima_32 && Ld_360 < Gd_88) { + text_224 = "è"; + color_196 = LimeGreen; + Li_308 = 0; + } + if (istochastic_56 < istochastic_48 && Bid >= ima_40 + Ld_296 && Bid < ima_32 && Ld_360 < Gd_88) { + text_224 = "è"; + color_196 = LimeGreen; + Li_308 = 0; + } + if (istochastic_56 < istochastic_48 && Bid >= ima_32 + Ld_296 && Bid >= ima_40 + Ld_296) { + text_224 = "é"; + color_196 = Lime; + Li_308 = 6; + } + if (istochastic_56 < istochastic_48 && Bid > ima_32 && Bid < ima_32 + Ld_296 && Bid > ima_40 && Bid < ima_40 + Ld_296) { + text_224 = "ì"; + color_196 = Lime; + Li_308 = 0; + } + if (istochastic_56 < istochastic_48 && Bid >= ima_32 + Ld_296 && Bid >= ima_40 && Bid < ima_40 + Ld_296) { + text_224 = "ì"; + color_196 = Lime; + Li_308 = 0; + } + if (istochastic_56 < istochastic_48 && Bid >= ima_40 + Ld_296 && Bid >= ima_32 && Bid < ima_32 + Ld_296) { + text_224 = "ì"; + color_196 = Lime; + Li_308 = 0; + } + if (istochastic_56 > istochastic_48 && Ld_376 >= Gd_88 && Ld_384 >= Gd_88 && Bid > ima_32 && Bid > ima_40) { + text_224 = "ê"; + color_196 = Red; + Li_308 = 0; + } + if (istochastic_56 > istochastic_48 && Ld_376 < Gd_88 || Ld_384 < Gd_88 && Bid >= ima_32 && Bid >= ima_40) { + text_224 = "è"; + color_196 = OrangeRed; + Li_308 = 0; + } + if (istochastic_56 > istochastic_48 && Bid <= ima_32 - Ld_296 && Bid > ima_40 && Ld_384 >= Gd_88) { + text_224 = "ê"; + color_196 = Red; + Li_308 = 0; + } + if (istochastic_56 > istochastic_48 && Bid > ima_32 - Ld_296 && Bid < ima_32 && Bid > ima_40 && Ld_384 >= Gd_88) { + text_224 = "î"; + color_196 = Red; + Li_308 = 0; + } + if (istochastic_56 > istochastic_48 && Bid > ima_32 - Ld_296 && Bid < ima_32 && Bid > ima_40 && Ld_384 < Gd_88) { + text_224 = "è"; + color_196 = OrangeRed; + Li_308 = 0; + } + if (istochastic_56 > istochastic_48 && Bid <= ima_32 - Ld_296 && Bid > ima_40 && Ld_384 < Gd_88) { + text_224 = "è"; + color_196 = OrangeRed; + Li_308 = 0; + } + if (istochastic_56 > istochastic_48 && Bid <= ima_40 - Ld_296 && Bid > ima_32 && Ld_376 >= Gd_88) { + text_224 = "ê"; + color_196 = Red; + Li_308 = 0; + } + if (istochastic_56 > istochastic_48 && Bid > ima_40 - Ld_296 && Bid < ima_40 && Bid > ima_32 && Ld_376 >= Gd_88) { + text_224 = "î"; + color_196 = Red; + Li_308 = 0; + } + if (istochastic_56 > istochastic_48 && Bid > ima_40 - Ld_296 && Bid < ima_40 && Bid > ima_32 && Ld_376 < Gd_88) { + text_224 = "è"; + color_196 = OrangeRed; + Li_308 = 0; + } + if (istochastic_56 > istochastic_48 && Bid <= ima_40 - Ld_296 && Bid > ima_32 && Ld_376 < Gd_88) { + text_224 = "è"; + color_196 = OrangeRed; + Li_308 = 0; + } + if (istochastic_56 > istochastic_48 && Bid <= ima_32 - Ld_296 && Bid <= ima_40 - Ld_296) { + text_224 = "ê"; + color_196 = Red; + Li_308 = -6; + } + if (istochastic_56 > istochastic_48 && Bid < ima_32 && Bid > ima_32 - Ld_296 && Bid < ima_40 && Bid > ima_40 - Ld_296) { + text_224 = "î"; + color_196 = Red; + Li_308 = 0; + } + if (istochastic_56 > istochastic_48 && Bid <= ima_32 - Ld_296 && Bid <= ima_40 && Bid > ima_40 - Ld_296) { + text_224 = "î"; + color_196 = Red; + Li_308 = 0; + } + if (istochastic_56 > istochastic_48 && Bid <= ima_40 - Ld_296 && Bid <= ima_32 && Bid > ima_32 - Ld_296) { + text_224 = "î"; + color_196 = Red; + Li_308 = 0; + } + RefreshRates(); + Ld_392 = (ima_64 - Bid - Ld_272) / point_280; + Ld_400 = (ima_72 - Bid - Ld_272) / point_280; + Ld_408 = (Ask - ima_64 - Ld_272) / point_280; + Ld_416 = (Ask - ima_72 - Ld_272) / point_280; + if (istochastic_88 < istochastic_80 && Ld_392 >= Gd_88 && Ld_400 >= Gd_88 && Bid < ima_64 && Bid < ima_72) { + text_232 = "é"; + color_200 = Lime; + Li_312 = 0; + } + if (istochastic_88 < istochastic_80 && Ld_392 < Gd_88 || Ld_400 < Gd_88 && Bid <= ima_64 && Bid <= ima_72) { + text_232 = "è"; + color_200 = LimeGreen; + Li_312 = 0; + } + if (istochastic_88 < istochastic_80 && Bid >= ima_64 + Ld_296 && Bid < ima_72 && Ld_400 >= Gd_88) { + text_232 = "é"; + color_200 = Lime; + Li_312 = 0; + } + if (istochastic_88 < istochastic_80 && Bid < ima_64 + Ld_296 && Bid > ima_64 && Bid < ima_72 && Ld_400 >= Gd_88) { + text_232 = "ì"; + color_200 = Lime; + Li_312 = 0; + } + if (istochastic_88 < istochastic_80 && Bid < ima_64 + Ld_296 && Bid > ima_64 && Bid < ima_72 && Ld_400 < Gd_88) { + text_232 = "è"; + color_200 = LimeGreen; + Li_312 = 0; + } + if (istochastic_88 < istochastic_80 && Bid >= ima_64 + Ld_296 && Bid < ima_72 && Ld_400 < Gd_88) { + text_232 = "è"; + color_200 = LimeGreen; + Li_312 = 0; + } + if (istochastic_88 < istochastic_80 && Bid >= ima_72 + Ld_296 && Bid < ima_64 && Ld_392 >= Gd_88) { + text_232 = "é"; + color_200 = Lime; + Li_312 = 0; + } + if (istochastic_88 < istochastic_80 && Bid < ima_72 + Ld_296 && Bid > ima_72 && Bid < ima_64 && Ld_392 >= Gd_88) { + text_232 = "ì"; + color_200 = Lime; + Li_312 = 0; + } + if (istochastic_88 < istochastic_80 && Bid < ima_72 + Ld_296 && Bid > ima_72 && Bid < ima_64 && Ld_392 < Gd_88) { + text_232 = "è"; + color_200 = LimeGreen; + Li_312 = 0; + } + if (istochastic_88 < istochastic_80 && Bid >= ima_72 + Ld_296 && Bid < ima_64 && Ld_392 < Gd_88) { + text_232 = "è"; + color_200 = LimeGreen; + Li_312 = 0; + } + if (istochastic_88 < istochastic_80 && Bid >= ima_64 + Ld_296 && Bid >= ima_72 + Ld_296) { + text_232 = "é"; + color_200 = Lime; + Li_312 = 6; + } + if (istochastic_88 < istochastic_80 && Bid > ima_64 && Bid < ima_64 + Ld_296 && Bid > ima_72 && Bid < ima_72 + Ld_296) { + text_232 = "ì"; + color_200 = Lime; + Li_312 = 0; + } + if (istochastic_88 < istochastic_80 && Bid >= ima_64 + Ld_296 && Bid >= ima_72 && Bid < ima_72 + Ld_296) { + text_232 = "ì"; + color_200 = Lime; + Li_312 = 0; + } + if (istochastic_88 < istochastic_80 && Bid >= ima_72 + Ld_296 && Bid >= ima_64 && Bid < ima_64 + Ld_296) { + text_232 = "ì"; + color_200 = Lime; + Li_312 = 0; + } + if (istochastic_88 > istochastic_80 && Ld_408 >= Gd_88 && Ld_416 >= Gd_88 && Bid > ima_64 && Bid > ima_72) { + text_232 = "ê"; + color_200 = Red; + Li_312 = 0; + } + if (istochastic_88 > istochastic_80 && Ld_408 < Gd_88 || Ld_416 < Gd_88 && Bid >= ima_64 && Bid >= ima_72) { + text_232 = "è"; + color_200 = OrangeRed; + Li_312 = 0; + } + if (istochastic_88 > istochastic_80 && Bid <= ima_64 - Ld_296 && Bid > ima_72 && Ld_416 >= Gd_88) { + text_232 = "ê"; + color_200 = Red; + Li_312 = 0; + } + if (istochastic_88 > istochastic_80 && Bid > ima_64 - Ld_296 && Bid < ima_64 && Bid > ima_72 && Ld_416 >= Gd_88) { + text_232 = "î"; + color_200 = Red; + Li_312 = 0; + } + if (istochastic_88 > istochastic_80 && Bid > ima_64 - Ld_296 && Bid < ima_64 && Bid > ima_72 && Ld_416 < Gd_88) { + text_232 = "è"; + color_200 = OrangeRed; + Li_312 = 0; + } + if (istochastic_88 > istochastic_80 && Bid <= ima_64 - Ld_296 && Bid > ima_72 && Ld_416 < Gd_88) { + text_232 = "è"; + color_200 = OrangeRed; + Li_312 = 0; + } + if (istochastic_88 > istochastic_80 && Bid <= ima_72 - Ld_296 && Bid > ima_64 && Ld_408 >= Gd_88) { + text_232 = "ê"; + color_200 = Red; + Li_312 = 0; + } + if (istochastic_88 > istochastic_80 && Bid > ima_72 - Ld_296 && Bid < ima_72 && Bid > ima_64 && Ld_408 >= Gd_88) { + text_232 = "î"; + color_200 = Red; + Li_312 = 0; + } + if (istochastic_88 > istochastic_80 && Bid > ima_72 - Ld_296 && Bid < ima_72 && Bid > ima_64 && Ld_408 < Gd_88) { + text_232 = "è"; + color_200 = OrangeRed; + Li_312 = 0; + } + if (istochastic_88 > istochastic_80 && Bid <= ima_72 - Ld_296 && Bid > ima_64 && Ld_408 < Gd_88) { + text_232 = "è"; + color_200 = OrangeRed; + Li_312 = 0; + } + if (istochastic_88 > istochastic_80 && Bid <= ima_64 - Ld_296 && Bid <= ima_72 - Ld_296) { + text_232 = "ê"; + color_200 = Red; + Li_312 = -6; + } + if (istochastic_88 > istochastic_80 && Bid < ima_64 && Bid > ima_64 - Ld_296 && Bid < ima_72 && Bid > ima_72 - Ld_296) { + text_232 = "î"; + color_200 = Red; + Li_312 = 0; + } + if (istochastic_88 > istochastic_80 && Bid <= ima_64 - Ld_296 && Bid <= ima_72 && Bid > ima_72 - Ld_296) { + text_232 = "î"; + color_200 = Red; + Li_312 = 0; + } + if (istochastic_88 > istochastic_80 && Bid <= ima_72 - Ld_296 && Bid <= ima_64 && Bid > ima_64 - Ld_296) { + text_232 = "î"; + color_200 = Red; + Li_312 = 0; + } + RefreshRates(); + Ld_424 = (ima_96 - Bid - Ld_272) / point_280; + Ld_432 = (ima_104 - Bid - Ld_272) / point_280; + Ld_440 = (Ask - ima_96 - Ld_272) / point_280; + Ld_448 = (Ask - ima_104 - Ld_272) / point_280; + if (istochastic_120 < istochastic_112 && Ld_424 >= Gd_88 && Ld_432 >= Gd_88 && Bid < ima_96 && Bid < ima_104) { + text_240 = "é"; + color_204 = Lime; + Li_316 = 0; + } + if (istochastic_120 < istochastic_112 && Ld_424 < Gd_88 || Ld_432 < Gd_88 && Bid <= ima_96 && Bid <= ima_104) { + text_240 = "è"; + color_204 = LimeGreen; + Li_316 = 0; + } + if (istochastic_120 < istochastic_112 && Bid >= ima_96 + Ld_296 && Bid < ima_104 && Ld_432 >= Gd_88) { + text_240 = "é"; + color_204 = Lime; + Li_316 = 0; + } + if (istochastic_120 < istochastic_112 && Bid < ima_96 + Ld_296 && Bid > ima_96 && Bid < ima_104 && Ld_432 >= Gd_88) { + text_240 = "ì"; + color_204 = Lime; + Li_316 = 0; + } + if (istochastic_120 < istochastic_112 && Bid < ima_96 + Ld_296 && Bid > ima_96 && Bid < ima_104 && Ld_432 < Gd_88) { + text_240 = "è"; + color_204 = LimeGreen; + Li_316 = 0; + } + if (istochastic_120 < istochastic_112 && Bid >= ima_96 + Ld_296 && Bid < ima_104 && Ld_432 < Gd_88) { + text_240 = "è"; + color_204 = LimeGreen; + Li_316 = 0; + } + if (istochastic_120 < istochastic_112 && Bid >= ima_104 + Ld_296 && Bid < ima_96 && Ld_424 >= Gd_88) { + text_240 = "é"; + color_204 = Lime; + Li_316 = 0; + } + if (istochastic_120 < istochastic_112 && Bid < ima_104 + Ld_296 && Bid > ima_104 && Bid < ima_96 && Ld_424 >= Gd_88) { + text_240 = "ì"; + color_204 = Lime; + Li_316 = 0; + } + if (istochastic_120 < istochastic_112 && Bid < ima_104 + Ld_296 && Bid > ima_104 && Bid < ima_96 && Ld_424 < Gd_88) { + text_240 = "è"; + color_204 = LimeGreen; + Li_316 = 0; + } + if (istochastic_120 < istochastic_112 && Bid >= ima_104 + Ld_296 && Bid < ima_96 && Ld_424 < Gd_88) { + text_240 = "è"; + color_204 = LimeGreen; + Li_316 = 0; + } + if (istochastic_120 < istochastic_112 && Bid >= ima_96 + Ld_296 && Bid >= ima_104 + Ld_296) { + text_240 = "é"; + color_204 = Lime; + Li_316 = 6; + } + if (istochastic_120 < istochastic_112 && Bid > ima_96 && Bid < ima_96 + Ld_296 && Bid > ima_104 && Bid < ima_104 + Ld_296) { + text_240 = "ì"; + color_204 = Lime; + Li_316 = 0; + } + if (istochastic_120 < istochastic_112 && Bid >= ima_96 + Ld_296 && Bid >= ima_104 && Bid < ima_104 + Ld_296) { + text_240 = "ì"; + color_204 = Lime; + Li_316 = 0; + } + if (istochastic_120 < istochastic_112 && Bid >= ima_104 + Ld_296 && Bid >= ima_96 && Bid < ima_96 + Ld_296) { + text_240 = "ì"; + color_204 = Lime; + Li_316 = 0; + } + if (istochastic_120 > istochastic_112 && Ld_440 >= Gd_88 && Ld_448 >= Gd_88 && Bid > ima_96 && Bid > ima_104) { + text_240 = "ê"; + color_204 = Red; + Li_316 = 0; + } + if (istochastic_120 > istochastic_112 && Ld_440 < Gd_88 || Ld_448 < Gd_88 && Bid >= ima_96 && Bid >= ima_104) { + text_240 = "è"; + color_204 = OrangeRed; + Li_316 = 0; + } + if (istochastic_120 > istochastic_112 && Bid <= ima_96 - Ld_296 && Bid > ima_104 && Ld_448 >= Gd_88) { + text_240 = "ê"; + color_204 = Red; + Li_316 = 0; + } + if (istochastic_120 > istochastic_112 && Bid > ima_96 - Ld_296 && Bid < ima_96 && Bid > ima_104 && Ld_448 >= Gd_88) { + text_240 = "î"; + color_204 = Red; + Li_316 = 0; + } + if (istochastic_120 > istochastic_112 && Bid > ima_96 - Ld_296 && Bid < ima_96 && Bid > ima_104 && Ld_448 < Gd_88) { + text_240 = "è"; + color_204 = OrangeRed; + Li_316 = 0; + } + if (istochastic_120 > istochastic_112 && Bid <= ima_96 - Ld_296 && Bid > ima_104 && Ld_448 < Gd_88) { + text_240 = "è"; + color_204 = OrangeRed; + Li_316 = 0; + } + if (istochastic_120 > istochastic_112 && Bid <= ima_104 - Ld_296 && Bid > ima_96 && Ld_440 >= Gd_88) { + text_240 = "ê"; + color_204 = Red; + Li_316 = 0; + } + if (istochastic_120 > istochastic_112 && Bid > ima_104 - Ld_296 && Bid < ima_104 && Bid > ima_96 && Ld_440 >= Gd_88) { + text_240 = "î"; + color_204 = Red; + Li_316 = 0; + } + if (istochastic_120 > istochastic_112 && Bid > ima_104 - Ld_296 && Bid < ima_104 && Bid > ima_96 && Ld_440 < Gd_88) { + text_240 = "è"; + color_204 = OrangeRed; + Li_316 = 0; + } + if (istochastic_120 > istochastic_112 && Bid <= ima_104 - Ld_296 && Bid > ima_96 && Ld_440 < Gd_88) { + text_240 = "è"; + color_204 = OrangeRed; + Li_316 = 0; + } + if (istochastic_120 > istochastic_112 && Bid <= ima_96 - Ld_296 && Bid <= ima_104 - Ld_296) { + text_240 = "ê"; + color_204 = Red; + Li_316 = -6; + } + if (istochastic_120 > istochastic_112 && Bid < ima_96 && Bid > ima_96 - Ld_296 && Bid < ima_104 && Bid > ima_104 - Ld_296) { + text_240 = "î"; + color_204 = Red; + Li_316 = 0; + } + if (istochastic_120 > istochastic_112 && Bid <= ima_96 - Ld_296 && Bid <= ima_104 && Bid > ima_104 - Ld_296) { + text_240 = "î"; + color_204 = Red; + Li_316 = 0; + } + if (istochastic_120 > istochastic_112 && Bid <= ima_104 - Ld_296 && Bid <= ima_96 && Bid > ima_96 - Ld_296) { + text_240 = "î"; + color_204 = Red; + Li_316 = 0; + } + RefreshRates(); + Ld_456 = (ima_128 - Bid - Ld_272) / point_280; + Ld_464 = (ima_136 - Bid - Ld_272) / point_280; + Ld_472 = (Ask - ima_128 - Ld_272) / point_280; + Ld_480 = (Ask - ima_136 - Ld_272) / point_280; + if (istochastic_152 < istochastic_144 && Ld_456 >= Gd_88 && Ld_464 >= Gd_88 && Bid < ima_128 && Bid < ima_136) { + text_248 = "é"; + color_208 = Lime; + Li_320 = 0; + } + if (istochastic_152 < istochastic_144 && Ld_456 < Gd_88 || Ld_464 < Gd_88 && Bid <= ima_128 && Bid <= ima_136) { + text_248 = "è"; + color_208 = LimeGreen; + Li_320 = 0; + } + if (istochastic_152 < istochastic_144 && Bid >= ima_128 + Ld_296 && Bid < ima_136 && Ld_464 >= Gd_88) { + text_248 = "é"; + color_208 = Lime; + Li_320 = 0; + } + if (istochastic_152 < istochastic_144 && Bid < ima_128 + Ld_296 && Bid > ima_128 && Bid < ima_136 && Ld_464 >= Gd_88) { + text_248 = "ì"; + color_208 = Lime; + Li_320 = 0; + } + if (istochastic_152 < istochastic_144 && Bid < ima_128 + Ld_296 && Bid > ima_128 && Bid < ima_136 && Ld_464 < Gd_88) { + text_248 = "è"; + color_208 = LimeGreen; + Li_320 = 0; + } + if (istochastic_152 < istochastic_144 && Bid >= ima_128 + Ld_296 && Bid < ima_136 && Ld_464 < Gd_88) { + text_248 = "è"; + color_208 = LimeGreen; + Li_320 = 0; + } + if (istochastic_152 < istochastic_144 && Bid >= ima_136 + Ld_296 && Bid < ima_128 && Ld_456 >= Gd_88) { + text_248 = "é"; + color_208 = Lime; + Li_320 = 0; + } + if (istochastic_152 < istochastic_144 && Bid < ima_136 + Ld_296 && Bid > ima_136 && Bid < ima_128 && Ld_456 >= Gd_88) { + text_248 = "ì"; + color_208 = Lime; + Li_320 = 0; + } + if (istochastic_152 < istochastic_144 && Bid < ima_136 + Ld_296 && Bid > ima_136 && Bid < ima_128 && Ld_456 < Gd_88) { + text_248 = "è"; + color_208 = LimeGreen; + Li_320 = 0; + } + if (istochastic_152 < istochastic_144 && Bid >= ima_136 + Ld_296 && Bid < ima_128 && Ld_456 < Gd_88) { + text_248 = "è"; + color_208 = LimeGreen; + Li_320 = 0; + } + if (istochastic_152 < istochastic_144 && Bid >= ima_128 + Ld_296 && Bid >= ima_136 + Ld_296) { + text_248 = "é"; + color_208 = Lime; + Li_320 = 6; + } + if (istochastic_152 < istochastic_144 && Bid > ima_128 && Bid < ima_128 + Ld_296 && Bid > ima_136 && Bid < ima_136 + Ld_296) { + text_248 = "ì"; + color_208 = Lime; + Li_320 = 0; + } + if (istochastic_152 < istochastic_144 && Bid >= ima_128 + Ld_296 && Bid >= ima_136 && Bid < ima_136 + Ld_296) { + text_248 = "ì"; + color_208 = Lime; + Li_320 = 0; + } + if (istochastic_152 < istochastic_144 && Bid >= ima_136 + Ld_296 && Bid >= ima_128 && Bid < ima_128 + Ld_296) { + text_248 = "ì"; + color_208 = Lime; + Li_320 = 0; + } + if (istochastic_152 > istochastic_144 && Ld_472 >= Gd_88 && Ld_480 >= Gd_88 && Bid > ima_128 && Bid > ima_136) { + text_248 = "ê"; + color_208 = Red; + Li_320 = 0; + } + if (istochastic_152 > istochastic_144 && Ld_472 < Gd_88 || Ld_480 < Gd_88 && Bid >= ima_128 && Bid >= ima_136) { + text_248 = "è"; + color_208 = OrangeRed; + Li_320 = 0; + } + if (istochastic_152 > istochastic_144 && Bid <= ima_128 - Ld_296 && Bid > ima_136 && Ld_480 >= Gd_88) { + text_248 = "ê"; + color_208 = Red; + Li_320 = 0; + } + if (istochastic_152 > istochastic_144 && Bid > ima_128 - Ld_296 && Bid < ima_128 && Bid > ima_136 && Ld_480 >= Gd_88) { + text_248 = "î"; + color_208 = Red; + Li_320 = 0; + } + if (istochastic_152 > istochastic_144 && Bid > ima_128 - Ld_296 && Bid < ima_128 && Bid > ima_136 && Ld_480 < Gd_88) { + text_248 = "è"; + color_208 = OrangeRed; + Li_320 = 0; + } + if (istochastic_152 > istochastic_144 && Bid <= ima_128 - Ld_296 && Bid > ima_136 && Ld_480 < Gd_88) { + text_248 = "è"; + color_208 = OrangeRed; + Li_320 = 0; + } + if (istochastic_152 > istochastic_144 && Bid <= ima_136 - Ld_296 && Bid > ima_128 && Ld_472 >= Gd_88) { + text_248 = "ê"; + color_208 = Red; + Li_320 = 0; + } + if (istochastic_152 > istochastic_144 && Bid > ima_136 - Ld_296 && Bid < ima_136 && Bid > ima_128 && Ld_472 >= Gd_88) { + text_248 = "î"; + color_208 = Red; + Li_320 = 0; + } + if (istochastic_152 > istochastic_144 && Bid > ima_136 - Ld_296 && Bid < ima_136 && Bid > ima_128 && Ld_472 < Gd_88) { + text_248 = "è"; + color_208 = OrangeRed; + Li_320 = 0; + } + if (istochastic_152 > istochastic_144 && Bid <= ima_136 - Ld_296 && Bid > ima_128 && Ld_472 < Gd_88) { + text_248 = "è"; + color_208 = OrangeRed; + Li_320 = 0; + } + if (istochastic_152 > istochastic_144 && Bid <= ima_128 - Ld_296 && Bid <= ima_136 - Ld_296) { + text_248 = "ê"; + color_208 = Red; + Li_320 = -6; + } + if (istochastic_152 > istochastic_144 && Bid < ima_128 && Bid > ima_128 - Ld_296 && Bid < ima_136 && Bid > ima_136 - Ld_296) { + text_248 = "î"; + color_208 = Red; + Li_320 = 0; + } + if (istochastic_152 > istochastic_144 && Bid <= ima_128 - Ld_296 && Bid <= ima_136 && Bid > ima_136 - Ld_296) { + text_248 = "î"; + color_208 = Red; + Li_320 = 0; + } + if (istochastic_152 > istochastic_144 && Bid <= ima_136 - Ld_296 && Bid <= ima_128 && Bid > ima_128 - Ld_296) { + text_248 = "î"; + color_208 = Red; + Li_320 = 0; + } + RefreshRates(); + Ld_488 = (ima_160 - Bid - Ld_272) / point_280; + Ld_496 = (ima_168 - Bid - Ld_272) / point_280; + Ld_504 = (Ask - ima_160 - Ld_272) / point_280; + Ld_512 = (Ask - ima_168 - Ld_272) / point_280; + Ls_520 = "new_value_m240_V11" + Symbol(); + if (istochastic_184 < istochastic_176 && Ld_488 >= Gd_88 && Ld_496 >= Gd_88 && Bid < ima_160 && Bid < ima_168) { + text_256 = "é"; + color_212 = Lime; + Li_324 = 0; + } + if (istochastic_184 < istochastic_176 && Ld_488 < Gd_88 || Ld_496 < Gd_88 && Bid <= ima_160 && Bid <= ima_168) { + text_256 = "è"; + color_212 = LimeGreen; + Li_324 = 0; + } + if (istochastic_184 < istochastic_176 && Bid >= ima_160 + Ld_296 && Bid < ima_168 && Ld_496 >= Gd_88) { + text_256 = "é"; + color_212 = Lime; + Li_324 = 0; + } + if (istochastic_184 < istochastic_176 && Bid < ima_160 + Ld_296 && Bid > ima_160 && Bid < ima_168 && Ld_496 >= Gd_88) { + text_256 = "ì"; + color_212 = Lime; + Li_324 = 0; + } + if (istochastic_184 < istochastic_176 && Bid < ima_160 + Ld_296 && Bid > ima_160 && Bid < ima_168 && Ld_496 < Gd_88) { + text_256 = "è"; + color_212 = LimeGreen; + Li_324 = 0; + } + if (istochastic_184 < istochastic_176 && Bid >= ima_160 + Ld_296 && Bid < ima_168 && Ld_496 < Gd_88) { + text_256 = "è"; + color_212 = LimeGreen; + Li_324 = 0; + } + if (istochastic_184 < istochastic_176 && Bid >= ima_168 + Ld_296 && Bid < ima_160 && Ld_488 >= Gd_88) { + text_256 = "é"; + color_212 = Lime; + Li_324 = 0; + } + if (istochastic_184 < istochastic_176 && Bid < ima_168 + Ld_296 && Bid > ima_168 && Bid < ima_160 && Ld_488 >= Gd_88) { + text_256 = "ì"; + color_212 = Lime; + Li_324 = 0; + } + if (istochastic_184 < istochastic_176 && Bid < ima_168 + Ld_296 && Bid > ima_168 && Bid < ima_160 && Ld_488 < Gd_88) { + text_256 = "è"; + color_212 = LimeGreen; + Li_324 = 0; + } + if (istochastic_184 < istochastic_176 && Bid >= ima_168 + Ld_296 && Bid < ima_160 && Ld_488 < Gd_88) { + text_256 = "è"; + color_212 = LimeGreen; + Li_324 = 0; + } + if (istochastic_184 < istochastic_176 && Bid >= ima_160 + Ld_296 && Bid >= ima_168 + Ld_296) { + text_256 = "é"; + color_212 = Lime; + Li_324 = 6; + } + if (istochastic_184 < istochastic_176 && Bid > ima_160 && Bid < ima_160 + Ld_296 && Bid > ima_168 && Bid < ima_168 + Ld_296) { + text_256 = "ì"; + color_212 = Lime; + Li_324 = 0; + } + if (istochastic_184 < istochastic_176 && Bid >= ima_160 + Ld_296 && Bid >= ima_168 && Bid < ima_168 + Ld_296) { + text_256 = "ì"; + color_212 = Lime; + Li_324 = 0; + } + if (istochastic_184 < istochastic_176 && Bid >= ima_168 + Ld_296 && Bid >= ima_160 && Bid < ima_160 + Ld_296) { + text_256 = "ì"; + color_212 = Lime; + Li_324 = 0; + } + if (istochastic_184 > istochastic_176 && Ld_504 >= Gd_88 && Ld_512 >= Gd_88 && Bid > ima_160 && Bid > ima_168) { + text_256 = "ê"; + color_212 = Red; + Li_324 = 0; + } + if (istochastic_184 > istochastic_176 && Ld_504 < Gd_88 || Ld_512 < Gd_88 && Bid >= ima_160 && Bid >= ima_168) { + text_256 = "è"; + color_212 = OrangeRed; + Li_324 = 0; + } + if (istochastic_184 > istochastic_176 && Bid <= ima_160 - Ld_296 && Bid > ima_168 && Ld_512 >= Gd_88) { + text_256 = "ê"; + color_212 = Red; + Li_324 = 0; + } + if (istochastic_184 > istochastic_176 && Bid > ima_160 - Ld_296 && Bid < ima_160 && Bid > ima_168 && Ld_512 >= Gd_88) { + text_256 = "î"; + color_212 = Red; + Li_324 = 0; + } + if (istochastic_184 > istochastic_176 && Bid > ima_160 - Ld_296 && Bid < ima_160 && Bid > ima_168 && Ld_512 < Gd_88) { + text_256 = "è"; + color_212 = OrangeRed; + Li_324 = 0; + } + if (istochastic_184 > istochastic_176 && Bid <= ima_160 - Ld_296 && Bid > ima_168 && Ld_512 < Gd_88) { + text_256 = "è"; + color_212 = OrangeRed; + Li_324 = 0; + } + if (istochastic_184 > istochastic_176 && Bid <= ima_168 - Ld_296 && Bid > ima_160 && Ld_504 >= Gd_88) { + text_256 = "ê"; + color_212 = Red; + Li_324 = 0; + } + if (istochastic_184 > istochastic_176 && Bid > ima_168 - Ld_296 && Bid < ima_168 && Bid > ima_160 && Ld_504 >= Gd_88) { + text_256 = "î"; + color_212 = Red; + Li_324 = 0; + } + if (istochastic_184 > istochastic_176 && Bid > ima_168 - Ld_296 && Bid < ima_168 && Bid > ima_160 && Ld_504 < Gd_88) { + text_256 = "è"; + color_212 = OrangeRed; + Li_324 = 0; + } + if (istochastic_184 > istochastic_176 && Bid <= ima_168 - Ld_296 && Bid > ima_160 && Ld_504 < Gd_88) { + text_256 = "è"; + color_212 = OrangeRed; + Li_324 = 0; + } + if (istochastic_184 > istochastic_176 && Bid <= ima_160 - Ld_296 && Bid <= ima_168 - Ld_296) { + text_256 = "ê"; + color_212 = Red; + Li_324 = -6; + } + if (istochastic_184 > istochastic_176 && Bid < ima_160 && Bid > ima_160 - Ld_296 && Bid < ima_168 && Bid > ima_168 - Ld_296) { + text_256 = "î"; + color_212 = Red; + Li_324 = 0; + } + if (istochastic_184 > istochastic_176 && Bid <= ima_160 - Ld_296 && Bid <= ima_168 && Bid > ima_168 - Ld_296) { + text_256 = "î"; + color_212 = Red; + Li_324 = 0; + } + if (istochastic_184 > istochastic_176 && Bid <= ima_168 - Ld_296 && Bid <= ima_160 && Bid > ima_160 - Ld_296) { + text_256 = "î"; + color_212 = Red; + Li_324 = 0; + } + ObjectCreate("Vectorial_Bias", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Vectorial_Bias", "VECTORIAL BIAS", 8, "Arial Black", Gold); + ObjectSet("Vectorial_Bias", OBJPROP_CORNER, 0); + ObjectSet("Vectorial_Bias", OBJPROP_XDISTANCE, 44); + ObjectSet("Vectorial_Bias", OBJPROP_YDISTANCE, 55); + ObjectCreate("Sup_Res_1", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Sup_Res_1", "S / R LEVEL 1", 8, "Arial Black", Gold); + ObjectSet("Sup_Res_1", OBJPROP_CORNER, 0); + ObjectSet("Sup_Res_1", OBJPROP_XDISTANCE, 53); + ObjectSet("Sup_Res_1", OBJPROP_YDISTANCE, 86); + ObjectCreate("Sup_Res_2", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Sup_Res_2", "S / R LEVEL 2", 8, "Arial Black", Gold); + ObjectSet("Sup_Res_2", OBJPROP_CORNER, 0); + ObjectSet("Sup_Res_2", OBJPROP_XDISTANCE, 53); + ObjectSet("Sup_Res_2", OBJPROP_YDISTANCE, 104); + ObjectCreate("Positional_Bias", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Positional_Bias", "POSITIONAL BIAS", 8, "Arial Black", Gold); + ObjectSet("Positional_Bias", OBJPROP_CORNER, 0); + ObjectSet("Positional_Bias", OBJPROP_XDISTANCE, 42); + ObjectSet("Positional_Bias", OBJPROP_YDISTANCE, 139); + ObjectCreate("Venom_1_Text", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_1_Text", "VENOM 1", 11, "Arial Black", color_192); + ObjectSet("Venom_1_Text", OBJPROP_CORNER, 0); + ObjectSet("Venom_1_Text", OBJPROP_XDISTANCE, 160); + ObjectSet("Venom_1_Text", OBJPROP_YDISTANCE, 23); + ObjectCreate("Venom_1_Sig", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_1_Sig", text_216, 20, "Wingdings", color_192); + ObjectSet("Venom_1_Sig", OBJPROP_CORNER, 0); + ObjectSet("Venom_1_Sig", OBJPROP_XDISTANCE, 185); + ObjectSet("Venom_1_Sig", OBJPROP_YDISTANCE, 50); + ObjectCreate("Venom_2_Text", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_2_Text", "VENOM 2", 11, "Arial Black", color_196); + ObjectSet("Venom_2_Text", OBJPROP_CORNER, 0); + ObjectSet("Venom_2_Text", OBJPROP_XDISTANCE, 260); + ObjectSet("Venom_2_Text", OBJPROP_YDISTANCE, 23); + ObjectCreate("Venom_2_Sig", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_2_Sig", text_224, 20, "Wingdings", color_196); + ObjectSet("Venom_2_Sig", OBJPROP_CORNER, 0); + ObjectSet("Venom_2_Sig", OBJPROP_XDISTANCE, 285); + ObjectSet("Venom_2_Sig", OBJPROP_YDISTANCE, 50); + ObjectCreate("Venom_3_Text", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_3_Text", "VENOM 3", 11, "Arial Black", color_200); + ObjectSet("Venom_3_Text", OBJPROP_CORNER, 0); + ObjectSet("Venom_3_Text", OBJPROP_XDISTANCE, 360); + ObjectSet("Venom_3_Text", OBJPROP_YDISTANCE, 23); + ObjectCreate("Venom_3_Sig", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_3_Sig", text_232, 20, "Wingdings", color_200); + ObjectSet("Venom_3_Sig", OBJPROP_CORNER, 0); + ObjectSet("Venom_3_Sig", OBJPROP_XDISTANCE, 385); + ObjectSet("Venom_3_Sig", OBJPROP_YDISTANCE, 50); + ObjectCreate("Venom_4_Text", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_4_Text", "VENOM 4", 11, "Arial Black", color_204); + ObjectSet("Venom_4_Text", OBJPROP_CORNER, 0); + ObjectSet("Venom_4_Text", OBJPROP_XDISTANCE, 460); + ObjectSet("Venom_4_Text", OBJPROP_YDISTANCE, 23); + ObjectCreate("Venom_4_Sig", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_4_Sig", text_240, 20, "Wingdings", color_204); + ObjectSet("Venom_4_Sig", OBJPROP_CORNER, 0); + ObjectSet("Venom_4_Sig", OBJPROP_XDISTANCE, 485); + ObjectSet("Venom_4_Sig", OBJPROP_YDISTANCE, 50); + ObjectCreate("Venom_5_Text", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_5_Text", "VENOM 5", 11, "Arial Black", color_208); + ObjectSet("Venom_5_Text", OBJPROP_CORNER, 0); + ObjectSet("Venom_5_Text", OBJPROP_XDISTANCE, 560); + ObjectSet("Venom_5_Text", OBJPROP_YDISTANCE, 23); + ObjectCreate("Venom_5_Sig", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_5_Sig", text_248, 20, "Wingdings", color_208); + ObjectSet("Venom_5_Sig", OBJPROP_CORNER, 0); + ObjectSet("Venom_5_Sig", OBJPROP_XDISTANCE, 585); + ObjectSet("Venom_5_Sig", OBJPROP_YDISTANCE, 50); + ObjectCreate("Venom_6_Text", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_6_Text", "VENOM 6", 11, "Arial Black", color_212); + ObjectSet("Venom_6_Text", OBJPROP_CORNER, 0); + ObjectSet("Venom_6_Text", OBJPROP_XDISTANCE, 660); + ObjectSet("Venom_6_Text", OBJPROP_YDISTANCE, 23); + ObjectCreate("Venom_6_Sig", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_6_Sig", text_256, 20, "Wingdings", color_212); + ObjectSet("Venom_6_Sig", OBJPROP_CORNER, 0); + ObjectSet("Venom_6_Sig", OBJPROP_XDISTANCE, 685); + ObjectSet("Venom_6_Sig", OBJPROP_YDISTANCE, 50); + if (Bid > ima_0 && Bid > ima_8 && ima_0 > ima_8) { + Ld_532 = (Bid - ima_0) / point_280; + dbl2str_540 = DoubleToStr(Ld_532, 0); + y_528 = 85; + Li_564 = TRUE; + } + if (Bid > ima_0 && Bid > ima_8 && ima_8 > ima_0) { + Ld_532 = (Bid - ima_8) / point_280; + dbl2str_540 = DoubleToStr(Ld_532, 0); + y_528 = 85; + Li_564 = TRUE; + } + if (Bid > ima_0 && Bid > ima_8 && ima_8 == ima_0) { + Ld_532 = (Bid - ima_8) / point_280; + dbl2str_540 = DoubleToStr(Ld_532, 0); + y_528 = 85; + Li_564 = TRUE; + } + if (Bid < ima_0 && Bid < ima_8 && ima_0 < ima_8) { + Ld_532 = (ima_0 - Bid) / point_280; + dbl2str_540 = DoubleToStr(Ld_532, 0); + y_528 = 102; + Li_564 = TRUE; + } + if (Bid < ima_0 && Bid < ima_8 && ima_8 < ima_0) { + Ld_532 = (ima_8 - Bid) / point_280; + dbl2str_540 = DoubleToStr(Ld_532, 0); + y_528 = 102; + Li_564 = TRUE; + } + if (Bid < ima_0 && Bid < ima_8 && ima_8 == ima_0) { + Ld_532 = (ima_8 - Bid) / point_280; + dbl2str_540 = DoubleToStr(Ld_532, 0); + y_528 = 102; + Li_564 = TRUE; + } + if (ima_0 > ima_8 && Bid < ima_0 && Bid > ima_8) { + dbl2str_548 = DoubleToStr((ima_0 - Bid) / point_280, 0); + dbl2str_556 = DoubleToStr((Bid - ima_8) / point_280, 0); + Li_564 = FALSE; + } + if (ima_0 < ima_8 && Bid > ima_0 && Bid < ima_8) { + dbl2str_548 = DoubleToStr((ima_8 - Bid) / point_280, 0); + dbl2str_556 = DoubleToStr((Bid - ima_0) / point_280, 0); + Li_564 = FALSE; + } + if (Li_564 == FALSE) { + ObjectCreate("Venom_1_Up_Range", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_1_Up_Range", "( " + dbl2str_548 + " )", 12, "Arial Narrow", Gray); + ObjectSet("Venom_1_Up_Range", OBJPROP_CORNER, 0); + ObjectSet("Venom_1_Up_Range", OBJPROP_XDISTANCE, 187); + ObjectSet("Venom_1_Up_Range", OBJPROP_YDISTANCE, 85); + ObjectCreate("Venom_1_Down_Range", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_1_Down_Range", "( " + dbl2str_556 + " )", 12, "Arial Narrow", Gray); + ObjectSet("Venom_1_Down_Range", OBJPROP_CORNER, 0); + ObjectSet("Venom_1_Down_Range", OBJPROP_XDISTANCE, 187); + ObjectSet("Venom_1_Down_Range", OBJPROP_YDISTANCE, 102); + } else { + ObjectDelete("Venom_1_Up_Range"); + ObjectDelete("Venom_1_Down_Range"); + } + if (Li_564 == TRUE && Ld_532 >= 0.5) { + ObjectCreate("Venom_1_Eyesig", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_1_Eyesig", "¥", 15, "Wingdings", color_192); + ObjectSet("Venom_1_Eyesig", OBJPROP_CORNER, 0); + ObjectSet("Venom_1_Eyesig", OBJPROP_XDISTANCE, 165); + ObjectSet("Venom_1_Eyesig", OBJPROP_YDISTANCE, y_528); + ObjectCreate("Venom_1_Eyeprice", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_1_Eyeprice", dbl2str_540, 12, "Arial Narrow", Gold); + ObjectSet("Venom_1_Eyeprice", OBJPROP_CORNER, 0); + ObjectSet("Venom_1_Eyeprice", OBJPROP_XDISTANCE, 187); + ObjectSet("Venom_1_Eyeprice", OBJPROP_YDISTANCE, y_528); + } else { + ObjectDelete("Venom_1_Eyesig"); + ObjectDelete("Venom_1_Eyeprice"); + } + ObjectCreate("Venom_1_Eyehi", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_1_Eyehi", "¥", 15, "Wingdings", DarkSlateGray); + ObjectSet("Venom_1_Eyehi", OBJPROP_CORNER, 0); + ObjectSet("Venom_1_Eyehi", OBJPROP_XDISTANCE, 165); + ObjectSet("Venom_1_Eyehi", OBJPROP_YDISTANCE, 85); + ObjectCreate("Venom_1_Eyelo", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_1_Eyelo", "¥", 15, "Wingdings", DarkSlateGray); + ObjectSet("Venom_1_Eyelo", OBJPROP_CORNER, 0); + ObjectSet("Venom_1_Eyelo", OBJPROP_XDISTANCE, 165); + ObjectSet("Venom_1_Eyelo", OBJPROP_YDISTANCE, 102); + if (Bid > ima_32 && Bid > ima_40 && ima_32 > ima_40) { + Ld_572 = (Bid - ima_32) / point_280; + dbl2str_580 = DoubleToStr(Ld_572, 0); + y_568 = 85; + Li_604 = TRUE; + } + if (Bid > ima_32 && Bid > ima_40 && ima_40 > ima_32) { + Ld_572 = (Bid - ima_40) / point_280; + dbl2str_580 = DoubleToStr(Ld_572, 0); + y_568 = 85; + Li_604 = TRUE; + } + if (Bid > ima_32 && Bid > ima_40 && ima_40 == ima_32) { + Ld_572 = (Bid - ima_40) / point_280; + dbl2str_580 = DoubleToStr(Ld_572, 0); + y_568 = 85; + Li_604 = TRUE; + } + if (Bid < ima_32 && Bid < ima_40 && ima_32 < ima_40) { + Ld_572 = (ima_32 - Bid) / point_280; + dbl2str_580 = DoubleToStr(Ld_572, 0); + y_568 = 102; + Li_604 = TRUE; + } + if (Bid < ima_32 && Bid < ima_40 && ima_40 < ima_32) { + Ld_572 = (ima_40 - Bid) / point_280; + dbl2str_580 = DoubleToStr(Ld_572, 0); + y_568 = 102; + Li_604 = TRUE; + } + if (Bid < ima_32 && Bid < ima_40 && ima_40 == ima_32) { + Ld_572 = (ima_40 - Bid) / point_280; + dbl2str_580 = DoubleToStr(Ld_572, 0); + y_568 = 102; + Li_604 = TRUE; + } + if (ima_32 > ima_40 && Bid < ima_32 && Bid > ima_40) { + dbl2str_588 = DoubleToStr((ima_32 - Bid) / point_280, 0); + dbl2str_596 = DoubleToStr((Bid - ima_40) / point_280, 0); + Li_604 = FALSE; + } + if (ima_32 < ima_40 && Bid > ima_32 && Bid < ima_40) { + dbl2str_588 = DoubleToStr((ima_40 - Bid) / point_280, 0); + dbl2str_596 = DoubleToStr((Bid - ima_32) / point_280, 0); + Li_604 = FALSE; + } + if (Li_604 == FALSE) { + ObjectCreate("Venom_2_Up_Range", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_2_Up_Range", "( " + dbl2str_588 + " )", 12, "Arial Narrow", Gray); + ObjectSet("Venom_2_Up_Range", OBJPROP_CORNER, 0); + ObjectSet("Venom_2_Up_Range", OBJPROP_XDISTANCE, 287); + ObjectSet("Venom_2_Up_Range", OBJPROP_YDISTANCE, 85); + ObjectCreate("Venom_2_Down_Range", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_2_Down_Range", "( " + dbl2str_596 + " )", 12, "Arial Narrow", Gray); + ObjectSet("Venom_2_Down_Range", OBJPROP_CORNER, 0); + ObjectSet("Venom_2_Down_Range", OBJPROP_XDISTANCE, 287); + ObjectSet("Venom_2_Down_Range", OBJPROP_YDISTANCE, 102); + } else { + ObjectDelete("Venom_2_Up_Range"); + ObjectDelete("Venom_2_Down_Range"); + } + if (Li_604 == TRUE && Ld_572 >= 0.5) { + ObjectCreate("Venom_2_Eyesig", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_2_Eyesig", "¥", 15, "Wingdings", color_196); + ObjectSet("Venom_2_Eyesig", OBJPROP_CORNER, 0); + ObjectSet("Venom_2_Eyesig", OBJPROP_XDISTANCE, 265); + ObjectSet("Venom_2_Eyesig", OBJPROP_YDISTANCE, y_568); + ObjectCreate("Venom_2_Eyeprice", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_2_Eyeprice", dbl2str_580, 12, "Arial Narrow", Gold); + ObjectSet("Venom_2_Eyeprice", OBJPROP_CORNER, 0); + ObjectSet("Venom_2_Eyeprice", OBJPROP_XDISTANCE, 287); + ObjectSet("Venom_2_Eyeprice", OBJPROP_YDISTANCE, y_568); + } else { + ObjectDelete("Venom_2_Eyesig"); + ObjectDelete("Venom_2_Eyeprice"); + } + ObjectCreate("Venom_2_Eyehi", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_2_Eyehi", "¥", 15, "Wingdings", DarkSlateGray); + ObjectSet("Venom_2_Eyehi", OBJPROP_CORNER, 0); + ObjectSet("Venom_2_Eyehi", OBJPROP_XDISTANCE, 265); + ObjectSet("Venom_2_Eyehi", OBJPROP_YDISTANCE, 85); + ObjectCreate("Venom_2_Eyelo", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_2_Eyelo", "¥", 15, "Wingdings", DarkSlateGray); + ObjectSet("Venom_2_Eyelo", OBJPROP_CORNER, 0); + ObjectSet("Venom_2_Eyelo", OBJPROP_XDISTANCE, 265); + ObjectSet("Venom_2_Eyelo", OBJPROP_YDISTANCE, 102); + if (Bid > ima_64 && Bid > ima_72 && ima_64 > ima_72) { + Ld_612 = (Bid - ima_64) / point_280; + dbl2str_620 = DoubleToStr(Ld_612, 0); + y_608 = 85; + Li_644 = TRUE; + } + if (Bid > ima_64 && Bid > ima_72 && ima_72 > ima_64) { + Ld_612 = (Bid - ima_72) / point_280; + dbl2str_620 = DoubleToStr(Ld_612, 0); + y_608 = 85; + Li_644 = TRUE; + } + if (Bid > ima_64 && Bid > ima_72 && ima_72 == ima_64) { + Ld_612 = (Bid - ima_72) / point_280; + dbl2str_620 = DoubleToStr(Ld_612, 0); + y_608 = 85; + Li_644 = TRUE; + } + if (Bid < ima_64 && Bid < ima_72 && ima_64 < ima_72) { + Ld_612 = (ima_64 - Bid) / point_280; + dbl2str_620 = DoubleToStr(Ld_612, 0); + y_608 = 102; + Li_644 = TRUE; + } + if (Bid < ima_64 && Bid < ima_72 && ima_72 < ima_64) { + Ld_612 = (ima_72 - Bid) / point_280; + dbl2str_620 = DoubleToStr(Ld_612, 0); + y_608 = 102; + Li_644 = TRUE; + } + if (Bid < ima_64 && Bid < ima_72 && ima_72 == ima_64) { + Ld_612 = (ima_72 - Bid) / point_280; + dbl2str_620 = DoubleToStr(Ld_612, 0); + y_608 = 102; + Li_644 = TRUE; + } + if (ima_64 > ima_72 && Bid < ima_64 && Bid > ima_72) { + dbl2str_628 = DoubleToStr((ima_64 - Bid) / point_280, 0); + dbl2str_636 = DoubleToStr((Bid - ima_72) / point_280, 0); + Li_644 = FALSE; + } + if (ima_64 < ima_72 && Bid > ima_64 && Bid < ima_72) { + dbl2str_628 = DoubleToStr((ima_72 - Bid) / point_280, 0); + dbl2str_636 = DoubleToStr((Bid - ima_64) / point_280, 0); + Li_644 = FALSE; + } + if (Li_644 == FALSE) { + ObjectCreate("Venom_3_Up_Range", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_3_Up_Range", "( " + dbl2str_628 + " )", 12, "Arial Narrow", Gray); + ObjectSet("Venom_3_Up_Range", OBJPROP_CORNER, 0); + ObjectSet("Venom_3_Up_Range", OBJPROP_XDISTANCE, 387); + ObjectSet("Venom_3_Up_Range", OBJPROP_YDISTANCE, 85); + ObjectCreate("Venom_3_Down_Range", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_3_Down_Range", "( " + dbl2str_636 + " )", 12, "Arial Narrow", Gray); + ObjectSet("Venom_3_Down_Range", OBJPROP_CORNER, 0); + ObjectSet("Venom_3_Down_Range", OBJPROP_XDISTANCE, 387); + ObjectSet("Venom_3_Down_Range", OBJPROP_YDISTANCE, 102); + } else { + ObjectDelete("Venom_3_Up_Range"); + ObjectDelete("Venom_3_Down_Range"); + } + if (Li_644 == TRUE && Ld_612 >= 0.5) { + ObjectCreate("Venom_3_Eyesig", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_3_Eyesig", "¥", 15, "Wingdings", color_200); + ObjectSet("Venom_3_Eyesig", OBJPROP_CORNER, 0); + ObjectSet("Venom_3_Eyesig", OBJPROP_XDISTANCE, 365); + ObjectSet("Venom_3_Eyesig", OBJPROP_YDISTANCE, y_608); + ObjectCreate("Venom_3_Eyeprice", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_3_Eyeprice", dbl2str_620, 12, "Arial Narrow", Gold); + ObjectSet("Venom_3_Eyeprice", OBJPROP_CORNER, 0); + ObjectSet("Venom_3_Eyeprice", OBJPROP_XDISTANCE, 387); + ObjectSet("Venom_3_Eyeprice", OBJPROP_YDISTANCE, y_608); + } else { + ObjectDelete("Venom_3_Eyesig"); + ObjectDelete("Venom_3_Eyeprice"); + } + ObjectCreate("Venom_3_Eyehi", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_3_Eyehi", "¥", 15, "Wingdings", DarkSlateGray); + ObjectSet("Venom_3_Eyehi", OBJPROP_CORNER, 0); + ObjectSet("Venom_3_Eyehi", OBJPROP_XDISTANCE, 365); + ObjectSet("Venom_3_Eyehi", OBJPROP_YDISTANCE, 85); + ObjectCreate("Venom_3_Eyelo", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_3_Eyelo", "¥", 15, "Wingdings", DarkSlateGray); + ObjectSet("Venom_3_Eyelo", OBJPROP_CORNER, 0); + ObjectSet("Venom_3_Eyelo", OBJPROP_XDISTANCE, 365); + ObjectSet("Venom_3_Eyelo", OBJPROP_YDISTANCE, 102); + if (Bid > ima_96 && Bid > ima_104 && ima_96 > ima_104) { + Ld_652 = (Bid - ima_96) / point_280; + dbl2str_660 = DoubleToStr(Ld_652, 0); + y_648 = 85; + Li_684 = TRUE; + } + if (Bid > ima_96 && Bid > ima_104 && ima_104 > ima_96) { + Ld_652 = (Bid - ima_104) / point_280; + dbl2str_660 = DoubleToStr(Ld_652, 0); + y_648 = 85; + Li_684 = TRUE; + } + if (Bid > ima_96 && Bid > ima_104 && ima_104 == ima_96) { + Ld_652 = (Bid - ima_104) / point_280; + dbl2str_660 = DoubleToStr(Ld_652, 0); + y_648 = 85; + Li_684 = TRUE; + } + if (Bid < ima_96 && Bid < ima_104 && ima_96 < ima_104) { + Ld_652 = (ima_96 - Bid) / point_280; + dbl2str_660 = DoubleToStr(Ld_652, 0); + y_648 = 102; + Li_684 = TRUE; + } + if (Bid < ima_96 && Bid < ima_104 && ima_104 < ima_96) { + Ld_652 = (ima_104 - Bid) / point_280; + dbl2str_660 = DoubleToStr(Ld_652, 0); + y_648 = 102; + Li_684 = TRUE; + } + if (Bid < ima_96 && Bid < ima_104 && ima_104 == ima_96) { + Ld_652 = (ima_104 - Bid) / point_280; + dbl2str_660 = DoubleToStr(Ld_652, 0); + y_648 = 102; + Li_684 = TRUE; + } + if (ima_96 > ima_104 && Bid < ima_96 && Bid > ima_104) { + dbl2str_668 = DoubleToStr((ima_96 - Bid) / point_280, 0); + dbl2str_676 = DoubleToStr((Bid - ima_104) / point_280, 0); + Li_684 = FALSE; + } + if (ima_96 < ima_104 && Bid > ima_96 && Bid < ima_104) { + dbl2str_668 = DoubleToStr((ima_104 - Bid) / point_280, 0); + dbl2str_676 = DoubleToStr((Bid - ima_96) / point_280, 0); + Li_684 = FALSE; + } + if (Li_684 == FALSE) { + ObjectCreate("Venom_4_Up_Range", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_4_Up_Range", "( " + dbl2str_668 + " )", 12, "Arial Narrow", Gray); + ObjectSet("Venom_4_Up_Range", OBJPROP_CORNER, 0); + ObjectSet("Venom_4_Up_Range", OBJPROP_XDISTANCE, 487); + ObjectSet("Venom_4_Up_Range", OBJPROP_YDISTANCE, 85); + ObjectCreate("Venom_4_Down_Range", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_4_Down_Range", "( " + dbl2str_676 + " )", 12, "Arial Narrow", Gray); + ObjectSet("Venom_4_Down_Range", OBJPROP_CORNER, 0); + ObjectSet("Venom_4_Down_Range", OBJPROP_XDISTANCE, 487); + ObjectSet("Venom_4_Down_Range", OBJPROP_YDISTANCE, 102); + } else { + ObjectDelete("Venom_4_Up_Range"); + ObjectDelete("Venom_4_Down_Range"); + } + if (Li_684 == TRUE && Ld_652 >= 0.5) { + ObjectCreate("Venom_4_Eyesig", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_4_Eyesig", "¥", 15, "Wingdings", color_204); + ObjectSet("Venom_4_Eyesig", OBJPROP_CORNER, 0); + ObjectSet("Venom_4_Eyesig", OBJPROP_XDISTANCE, 465); + ObjectSet("Venom_4_Eyesig", OBJPROP_YDISTANCE, y_648); + ObjectCreate("Venom_4_Eyeprice", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_4_Eyeprice", dbl2str_660, 12, "Arial Narrow", Gold); + ObjectSet("Venom_4_Eyeprice", OBJPROP_CORNER, 0); + ObjectSet("Venom_4_Eyeprice", OBJPROP_XDISTANCE, 487); + ObjectSet("Venom_4_Eyeprice", OBJPROP_YDISTANCE, y_648); + } else { + ObjectDelete("Venom_4_Eyesig"); + ObjectDelete("Venom_4_Eyeprice"); + } + ObjectCreate("Venom_4_Eyehi", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_4_Eyehi", "¥", 15, "Wingdings", DarkSlateGray); + ObjectSet("Venom_4_Eyehi", OBJPROP_CORNER, 0); + ObjectSet("Venom_4_Eyehi", OBJPROP_XDISTANCE, 465); + ObjectSet("Venom_4_Eyehi", OBJPROP_YDISTANCE, 85); + ObjectCreate("Venom_4_Eyelo", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_4_Eyelo", "¥", 15, "Wingdings", DarkSlateGray); + ObjectSet("Venom_4_Eyelo", OBJPROP_CORNER, 0); + ObjectSet("Venom_4_Eyelo", OBJPROP_XDISTANCE, 465); + ObjectSet("Venom_4_Eyelo", OBJPROP_YDISTANCE, 102); + if (Bid > ima_128 && Bid > ima_136 && ima_128 > ima_136) { + Ld_692 = (Bid - ima_128) / point_280; + dbl2str_700 = DoubleToStr(Ld_692, 0); + y_688 = 85; + Li_724 = TRUE; + } + if (Bid > ima_128 && Bid > ima_136 && ima_136 > ima_128) { + Ld_692 = (Bid - ima_136) / point_280; + dbl2str_700 = DoubleToStr(Ld_692, 0); + y_688 = 85; + Li_724 = TRUE; + } + if (Bid > ima_128 && Bid > ima_136 && ima_136 == ima_128) { + Ld_692 = (Bid - ima_136) / point_280; + dbl2str_700 = DoubleToStr(Ld_692, 0); + y_688 = 85; + Li_724 = TRUE; + } + if (Bid < ima_128 && Bid < ima_136 && ima_128 < ima_136) { + Ld_692 = (ima_128 - Bid) / point_280; + dbl2str_700 = DoubleToStr(Ld_692, 0); + y_688 = 102; + Li_724 = TRUE; + } + if (Bid < ima_128 && Bid < ima_136 && ima_136 < ima_128) { + Ld_692 = (ima_136 - Bid) / point_280; + dbl2str_700 = DoubleToStr(Ld_692, 0); + y_688 = 102; + Li_724 = TRUE; + } + if (Bid < ima_128 && Bid < ima_136 && ima_136 == ima_128) { + Ld_692 = (ima_136 - Bid) / point_280; + dbl2str_700 = DoubleToStr(Ld_692, 0); + y_688 = 102; + Li_724 = TRUE; + } + if (ima_128 > ima_136 && Bid < ima_128 && Bid > ima_136) { + dbl2str_708 = DoubleToStr((ima_128 - Bid) / point_280, 0); + dbl2str_716 = DoubleToStr((Bid - ima_136) / point_280, 0); + Li_724 = FALSE; + } + if (ima_128 < ima_136 && Bid > ima_128 && Bid < ima_136) { + dbl2str_708 = DoubleToStr((ima_136 - Bid) / point_280, 0); + dbl2str_716 = DoubleToStr((Bid - ima_128) / point_280, 0); + Li_724 = FALSE; + } + if (Li_724 == FALSE) { + ObjectCreate("Venom_5_Up_Range", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_5_Up_Range", "( " + dbl2str_708 + " )", 12, "Arial Narrow", Gray); + ObjectSet("Venom_5_Up_Range", OBJPROP_CORNER, 0); + ObjectSet("Venom_5_Up_Range", OBJPROP_XDISTANCE, 587); + ObjectSet("Venom_5_Up_Range", OBJPROP_YDISTANCE, 85); + ObjectCreate("Venom_5_Down_Range", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_5_Down_Range", "( " + dbl2str_716 + " )", 12, "Arial Narrow", Gray); + ObjectSet("Venom_5_Down_Range", OBJPROP_CORNER, 0); + ObjectSet("Venom_5_Down_Range", OBJPROP_XDISTANCE, 587); + ObjectSet("Venom_5_Down_Range", OBJPROP_YDISTANCE, 102); + } else { + ObjectDelete("Venom_5_Up_Range"); + ObjectDelete("Venom_5_Down_Range"); + } + if (Li_724 == TRUE && Ld_692 >= 0.5) { + ObjectCreate("Venom_5_Eyesig", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_5_Eyesig", "¥", 15, "Wingdings", color_208); + ObjectSet("Venom_5_Eyesig", OBJPROP_CORNER, 0); + ObjectSet("Venom_5_Eyesig", OBJPROP_XDISTANCE, 565); + ObjectSet("Venom_5_Eyesig", OBJPROP_YDISTANCE, y_688); + ObjectCreate("Venom_5_Eyeprice", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_5_Eyeprice", dbl2str_700, 12, "Arial Narrow", Gold); + ObjectSet("Venom_5_Eyeprice", OBJPROP_CORNER, 0); + ObjectSet("Venom_5_Eyeprice", OBJPROP_XDISTANCE, 587); + ObjectSet("Venom_5_Eyeprice", OBJPROP_YDISTANCE, y_688); + } else { + ObjectDelete("Venom_5_Eyesig"); + ObjectDelete("Venom_5_Eyeprice"); + } + ObjectCreate("Venom_5_Eyehi", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_5_Eyehi", "¥", 15, "Wingdings", DarkSlateGray); + ObjectSet("Venom_5_Eyehi", OBJPROP_CORNER, 0); + ObjectSet("Venom_5_Eyehi", OBJPROP_XDISTANCE, 565); + ObjectSet("Venom_5_Eyehi", OBJPROP_YDISTANCE, 85); + ObjectCreate("Venom_5_Eyelo", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_5_Eyelo", "¥", 15, "Wingdings", DarkSlateGray); + ObjectSet("Venom_5_Eyelo", OBJPROP_CORNER, 0); + ObjectSet("Venom_5_Eyelo", OBJPROP_XDISTANCE, 565); + ObjectSet("Venom_5_Eyelo", OBJPROP_YDISTANCE, 102); + if (Bid > ima_160 && Bid > ima_168 && ima_160 > ima_168) { + Ld_732 = (Bid - ima_160) / point_280; + dbl2str_740 = DoubleToStr(Ld_732, 0); + y_728 = 85; + Li_764 = TRUE; + } + if (Bid > ima_160 && Bid > ima_168 && ima_168 > ima_160) { + Ld_732 = (Bid - ima_168) / point_280; + dbl2str_740 = DoubleToStr(Ld_732, 0); + y_728 = 85; + Li_764 = TRUE; + } + if (Bid > ima_160 && Bid > ima_168 && ima_168 == ima_160) { + Ld_732 = (Bid - ima_168) / point_280; + dbl2str_740 = DoubleToStr(Ld_732, 0); + y_728 = 85; + Li_764 = TRUE; + } + if (Bid < ima_160 && Bid < ima_168 && ima_160 < ima_168) { + Ld_732 = (ima_160 - Bid) / point_280; + dbl2str_740 = DoubleToStr(Ld_732, 0); + y_728 = 102; + Li_764 = TRUE; + } + if (Bid < ima_160 && Bid < ima_168 && ima_168 < ima_160) { + Ld_732 = (ima_168 - Bid) / point_280; + dbl2str_740 = DoubleToStr(Ld_732, 0); + y_728 = 102; + Li_764 = TRUE; + } + if (Bid < ima_160 && Bid < ima_168 && ima_168 == ima_160) { + Ld_732 = (ima_168 - Bid) / point_280; + dbl2str_740 = DoubleToStr(Ld_732, 0); + y_728 = 102; + Li_764 = TRUE; + } + if (ima_160 > ima_168 && Bid < ima_160 && Bid > ima_168) { + dbl2str_748 = DoubleToStr((ima_160 - Bid) / point_280, 0); + dbl2str_756 = DoubleToStr((Bid - ima_168) / point_280, 0); + Li_764 = FALSE; + } + if (ima_160 < ima_168 && Bid > ima_160 && Bid < ima_168) { + dbl2str_748 = DoubleToStr((ima_168 - Bid) / point_280, 0); + dbl2str_756 = DoubleToStr((Bid - ima_160) / point_280, 0); + Li_764 = FALSE; + } + if (Li_764 == FALSE) { + ObjectCreate("Venom_6_Up_Range", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_6_Up_Range", "( " + dbl2str_748 + " )", 12, "Arial Narrow", Gray); + ObjectSet("Venom_6_Up_Range", OBJPROP_CORNER, 0); + ObjectSet("Venom_6_Up_Range", OBJPROP_XDISTANCE, 687); + ObjectSet("Venom_6_Up_Range", OBJPROP_YDISTANCE, 85); + ObjectCreate("Venom_6_Down_Range", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_6_Down_Range", "( " + dbl2str_756 + " )", 12, "Arial Narrow", Gray); + ObjectSet("Venom_6_Down_Range", OBJPROP_CORNER, 0); + ObjectSet("Venom_6_Down_Range", OBJPROP_XDISTANCE, 687); + ObjectSet("Venom_6_Down_Range", OBJPROP_YDISTANCE, 102); + } else { + ObjectDelete("Venom_6_Up_Range"); + ObjectDelete("Venom_6_Down_Range"); + } + if (Li_764 == TRUE && Ld_732 >= 0.5) { + ObjectCreate("Venom_6_Eyesig", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_6_Eyesig", "¥", 15, "Wingdings", color_212); + ObjectSet("Venom_6_Eyesig", OBJPROP_CORNER, 0); + ObjectSet("Venom_6_Eyesig", OBJPROP_XDISTANCE, 665); + ObjectSet("Venom_6_Eyesig", OBJPROP_YDISTANCE, y_728); + ObjectCreate("Venom_6_Eyeprice", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_6_Eyeprice", dbl2str_740, 12, "Arial Narrow", Gold); + ObjectSet("Venom_6_Eyeprice", OBJPROP_CORNER, 0); + ObjectSet("Venom_6_Eyeprice", OBJPROP_XDISTANCE, 687); + ObjectSet("Venom_6_Eyeprice", OBJPROP_YDISTANCE, y_728); + } else { + ObjectDelete("Venom_6_Eyesig"); + ObjectDelete("Venom_6_Eyeprice"); + } + ObjectCreate("Venom_6_Eyehi", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_6_Eyehi", "¥", 15, "Wingdings", DarkSlateGray); + ObjectSet("Venom_6_Eyehi", OBJPROP_CORNER, 0); + ObjectSet("Venom_6_Eyehi", OBJPROP_XDISTANCE, 665); + ObjectSet("Venom_6_Eyehi", OBJPROP_YDISTANCE, 85); + ObjectCreate("Venom_6_Eyelo", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_6_Eyelo", "¥", 15, "Wingdings", DarkSlateGray); + ObjectSet("Venom_6_Eyelo", OBJPROP_CORNER, 0); + ObjectSet("Venom_6_Eyelo", OBJPROP_XDISTANCE, 665); + ObjectSet("Venom_6_Eyelo", OBJPROP_YDISTANCE, 102); + var_name_768 = "start_saat" + Symbol(); + Li_unused_776 = GlobalVariableGet(var_name_768); + var_name_780 = "venom_signal_buy" + Symbol(); + var_name_788 = "venom_signal_sell" + Symbol(); + bool_796 = IsConnected(); + if (bool_796 == TRUE) { + if (Li_304 == 6 && Li_308 == 6 && Li_312 == 6 && Li_316 == 6 && Li_320 == 6 && Li_324 == 6 && hour_1128 > 6 && hour_1128 < 16) GlobalVariableSet(var_name_780, 6); + if (Li_304 == -6 && Li_308 == -6 && Li_312 == -6 && Li_316 == -6 && Li_320 == -6 && Li_324 == -6 && hour_1128 > 6 && hour_1128 < 16) GlobalVariableSet(var_name_788, -6); + } + if (Venom_Alert == TRUE && bool_796 == TRUE) { + digits_800 = MarketInfo(Symbol(), MODE_DIGITS); + if (Li_304 == 6 && Li_308 == 6 && Li_312 == 6 && Li_316 == 6 && Li_320 == 6 && Li_324 == 6 && hour_1128 > 6 && hour_1128 < 16) Alert(Symbol() + " BUY!!! " + DoubleToStr(Bid, digits_800)); + if (Li_304 == -6 && Li_308 == -6 && Li_312 == -6 && Li_316 == -6 && Li_320 == -6 && Li_324 == -6 && hour_1128 > 6 && hour_1128 < 16) Alert(Symbol() + " SELL!!! " + DoubleToStr(Bid, digits_800)); + } + ima_808 = iMA(NULL, PERIOD_M1, 16, 0, MODE_SMA, PRICE_CLOSE, 0); + ibands_816 = iBands(NULL, PERIOD_M1, 16, 1, 0, PRICE_CLOSE, MODE_UPPER, 0); + ibands_824 = iBands(NULL, PERIOD_M1, 16, 1, 0, PRICE_CLOSE, MODE_LOWER, 0); + ibands_832 = iBands(NULL, PERIOD_M1, 16, 3, 0, PRICE_CLOSE, MODE_UPPER, 0); + ibands_840 = iBands(NULL, PERIOD_M1, 16, 3, 0, PRICE_CLOSE, MODE_LOWER, 0); + ima_848 = iMA(NULL, PERIOD_M5, 16, 0, MODE_SMA, PRICE_CLOSE, 0); + ibands_856 = iBands(NULL, PERIOD_M5, 16, 1, 0, PRICE_CLOSE, MODE_UPPER, 0); + ibands_864 = iBands(NULL, PERIOD_M5, 16, 1, 0, PRICE_CLOSE, MODE_LOWER, 0); + ibands_872 = iBands(NULL, PERIOD_M5, 16, 3, 0, PRICE_CLOSE, MODE_UPPER, 0); + ibands_880 = iBands(NULL, PERIOD_M5, 16, 3, 0, PRICE_CLOSE, MODE_LOWER, 0); + ima_888 = iMA(NULL, PERIOD_M15, 16, 0, MODE_SMA, PRICE_CLOSE, 0); + ibands_896 = iBands(NULL, PERIOD_M15, 16, 1, 0, PRICE_CLOSE, MODE_UPPER, 0); + ibands_904 = iBands(NULL, PERIOD_M15, 16, 1, 0, PRICE_CLOSE, MODE_LOWER, 0); + ibands_912 = iBands(NULL, PERIOD_M15, 16, 3, 0, PRICE_CLOSE, MODE_UPPER, 0); + ibands_920 = iBands(NULL, PERIOD_M15, 16, 3, 0, PRICE_CLOSE, MODE_LOWER, 0); + ima_928 = iMA(NULL, PERIOD_M30, 16, 0, MODE_SMA, PRICE_CLOSE, 0); + ibands_936 = iBands(NULL, PERIOD_M30, 16, 1, 0, PRICE_CLOSE, MODE_UPPER, 0); + ibands_944 = iBands(NULL, PERIOD_M30, 16, 1, 0, PRICE_CLOSE, MODE_LOWER, 0); + ibands_952 = iBands(NULL, PERIOD_M30, 16, 3, 0, PRICE_CLOSE, MODE_UPPER, 0); + ibands_960 = iBands(NULL, PERIOD_M30, 16, 3, 0, PRICE_CLOSE, MODE_LOWER, 0); + ima_968 = iMA(NULL, PERIOD_H1, 16, 0, MODE_SMA, PRICE_CLOSE, 0); + ibands_976 = iBands(NULL, PERIOD_H1, 16, 1, 0, PRICE_CLOSE, MODE_UPPER, 0); + ibands_984 = iBands(NULL, PERIOD_H1, 16, 1, 0, PRICE_CLOSE, MODE_LOWER, 0); + ibands_992 = iBands(NULL, PERIOD_H1, 16, 3, 0, PRICE_CLOSE, MODE_UPPER, 0); + ibands_1000 = iBands(NULL, PERIOD_H1, 16, 3, 0, PRICE_CLOSE, MODE_LOWER, 0); + ima_1008 = iMA(NULL, PERIOD_H4, 16, 0, MODE_SMA, PRICE_CLOSE, 0); + ibands_1016 = iBands(NULL, PERIOD_H4, 16, 1, 0, PRICE_CLOSE, MODE_UPPER, 0); + ibands_1024 = iBands(NULL, PERIOD_H4, 16, 1, 0, PRICE_CLOSE, MODE_LOWER, 0); + ibands_1032 = iBands(NULL, PERIOD_H4, 16, 3, 0, PRICE_CLOSE, MODE_UPPER, 0); + ibands_1040 = iBands(NULL, PERIOD_H4, 16, 3, 0, PRICE_CLOSE, MODE_LOWER, 0); + if (Bid > ima_808 && Bid <= ibands_816) { + color_1048 = Lime; + text_1072 = "Ÿ"; + } + if (Bid > ibands_816 && Bid < ibands_832) { + color_1048 = Lime; + text_1072 = "l"; + } + if (Bid >= ibands_832) { + color_1048 = DarkGreen; + text_1072 = "l"; + } + if (Bid < ima_808 && Bid >= ibands_824) { + color_1048 = Red; + text_1072 = "Ÿ"; + } + if (Bid < ibands_824 && Bid > ibands_840) { + color_1048 = Red; + text_1072 = "l"; + } + if (Bid <= ibands_840) { + color_1048 = Maroon; + text_1072 = "l"; + } + if (Bid > ima_848 && Bid <= ibands_856) { + color_1052 = Lime; + text_1080 = "Ÿ"; + } + if (Bid > ibands_856 && Bid < ibands_872) { + color_1052 = Lime; + text_1080 = "l"; + } + if (Bid >= ibands_872) { + color_1052 = DarkGreen; + text_1080 = "l"; + } + if (Bid < ima_848 && Bid >= ibands_864) { + color_1052 = Red; + text_1080 = "Ÿ"; + } + if (Bid < ibands_864 && Bid > ibands_880) { + color_1052 = Red; + text_1080 = "l"; + } + if (Bid <= ibands_880) { + color_1052 = Maroon; + text_1080 = "l"; + } + if (Bid > ima_888 && Bid <= ibands_896) { + color_1056 = Lime; + text_1088 = "Ÿ"; + } + if (Bid > ibands_896 && Bid < ibands_912) { + color_1056 = Lime; + text_1088 = "l"; + } + if (Bid >= ibands_912) { + color_1056 = DarkGreen; + text_1088 = "l"; + } + if (Bid < ima_888 && Bid >= ibands_904) { + color_1056 = Red; + text_1088 = "Ÿ"; + } + if (Bid < ibands_904 && Bid > ibands_920) { + color_1056 = Red; + text_1088 = "l"; + } + if (Bid <= ibands_920) { + color_1056 = Maroon; + text_1088 = "l"; + } + if (Bid > ima_928 && Bid <= ibands_936) { + color_1060 = Lime; + text_1096 = "Ÿ"; + } + if (Bid > ibands_936 && Bid < ibands_952) { + color_1060 = Lime; + text_1096 = "l"; + } + if (Bid >= ibands_952) { + color_1060 = DarkGreen; + text_1096 = "l"; + } + if (Bid < ima_928 && Bid >= ibands_944) { + color_1060 = Red; + text_1096 = "Ÿ"; + } + if (Bid < ibands_944 && Bid > ibands_960) { + color_1060 = Red; + text_1096 = "l"; + } + if (Bid <= ibands_960) { + color_1060 = Maroon; + text_1096 = "l"; + } + if (Bid > ima_968 && Bid <= ibands_976) { + color_1064 = Lime; + text_1104 = "Ÿ"; + } + if (Bid > ibands_976 && Bid < ibands_992) { + color_1064 = Lime; + text_1104 = "l"; + } + if (Bid >= ibands_992) { + color_1064 = DarkGreen; + text_1104 = "l"; + } + if (Bid < ima_968 && Bid >= ibands_984) { + color_1064 = Red; + text_1104 = "Ÿ"; + } + if (Bid < ibands_984 && Bid > ibands_1000) { + color_1064 = Red; + text_1104 = "l"; + } + if (Bid <= ibands_1000) { + color_1064 = Maroon; + text_1104 = "l"; + } + if (Bid > ima_1008 && Bid <= ibands_1016) { + color_1068 = Lime; + text_1112 = "Ÿ"; + } + if (Bid > ibands_1016 && Bid < ibands_1032) { + color_1068 = Lime; + text_1112 = "l"; + } + if (Bid >= ibands_1032) { + color_1068 = DarkGreen; + text_1112 = "l"; + } + if (Bid < ima_1008 && Bid >= ibands_1024) { + color_1068 = Red; + text_1112 = "Ÿ"; + } + if (Bid < ibands_1024 && Bid > ibands_1040) { + color_1068 = Red; + text_1112 = "l"; + } + if (Bid <= ibands_1040) { + color_1068 = Maroon; + text_1112 = "l"; + } + ObjectCreate("Venom_1_Box", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_1_Box", text_1072, 30, "Wingdings", color_1048); + ObjectSet("Venom_1_Box", OBJPROP_CORNER, 0); + ObjectSet("Venom_1_Box", OBJPROP_XDISTANCE, 180); + ObjectSet("Venom_1_Box", OBJPROP_YDISTANCE, 126); + ObjectCreate("Venom_2_Box", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_2_Box", text_1080, 30, "Wingdings", color_1052); + ObjectSet("Venom_2_Box", OBJPROP_CORNER, 0); + ObjectSet("Venom_2_Box", OBJPROP_XDISTANCE, 280); + ObjectSet("Venom_2_Box", OBJPROP_YDISTANCE, 126); + ObjectCreate("Venom_3_Box", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_3_Box", text_1088, 30, "Wingdings", color_1056); + ObjectSet("Venom_3_Box", OBJPROP_CORNER, 0); + ObjectSet("Venom_3_Box", OBJPROP_XDISTANCE, 380); + ObjectSet("Venom_3_Box", OBJPROP_YDISTANCE, 126); + ObjectCreate("Venom_4_Box", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_4_Box", text_1096, 30, "Wingdings", color_1060); + ObjectSet("Venom_4_Box", OBJPROP_CORNER, 0); + ObjectSet("Venom_4_Box", OBJPROP_XDISTANCE, 480); + ObjectSet("Venom_4_Box", OBJPROP_YDISTANCE, 126); + ObjectCreate("Venom_5_Box", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_5_Box", text_1104, 30, "Wingdings", color_1064); + ObjectSet("Venom_5_Box", OBJPROP_CORNER, 0); + ObjectSet("Venom_5_Box", OBJPROP_XDISTANCE, 580); + ObjectSet("Venom_5_Box", OBJPROP_YDISTANCE, 126); + ObjectCreate("Venom_6_Box", OBJ_LABEL, WindowFind("Third Wave FX VENOM (" + Symbol() + ")"), 0, 0); + ObjectSetText("Venom_6_Box", text_1112, 30, "Wingdings", color_1068); + ObjectSet("Venom_6_Box", OBJPROP_CORNER, 0); + ObjectSet("Venom_6_Box", OBJPROP_XDISTANCE, 680); + ObjectSet("Venom_6_Box", OBJPROP_YDISTANCE, 126); + } + return (0); +} \ No newline at end of file diff --git a/Waddah_Attar_BUY_SELL_Vol.mq4 b/Waddah_Attar_BUY_SELL_Vol.mq4 new file mode 100644 index 0000000..bcd2d22 --- /dev/null +++ b/Waddah_Attar_BUY_SELL_Vol.mq4 @@ -0,0 +1,93 @@ +//+------------------------------------------------------------------+ +//| Waddah Attar Buy Sell Volume | +//| Copyright © 2007, ww.metaforex.net | +//| Waddah Attar www.metaforex.net | +//+------------------------------------------------------------------+ +#property copyright "Copyright © 2007, www.metaforex.net" +#property link "www.metaforex.net" +//---- +#property indicator_separate_window +#property indicator_buffers 3 +#property indicator_color1 Green +#property indicator_color2 Red +#property indicator_color3 Yellow +//---- buffers +double P1; +double P2; +double P1Buffer[]; +double P2Buffer[]; +double P3Buffer[]; +//---- +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +int init() + { + SetIndexBuffer(0, P1Buffer); + SetIndexBuffer(1, P2Buffer); + SetIndexBuffer(2, P3Buffer); +//---- + SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 2); + SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 2); + SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID, 2); +//---- + IndicatorDigits(0); + Comment("Waddah Attar Buy Sell Volume www.metaforex.net"); + return(0); + } +//+------------------------------------------------------------------+ +//| Custor indicator deinitialization function | +//+------------------------------------------------------------------+ +int deinit() + { + Comment(""); + return(0); + } +//+------------------------------------------------------------------+ +//| Custom indicator iteration function | +//+------------------------------------------------------------------+ +int start() + { + + int i,ii; + static int pii=-1; + + for(i = 0; i iClose(Symbol(),PERIOD_M1,i+1)) + { + P1 = P1+(iVolume(Symbol(),PERIOD_M1,i)); + } + if (iClose(Symbol(),PERIOD_M1,i)=0; i--) + { + pa[i] = (2*Close[i]+High[i]+Low[i])/4; + + scost5=0; + for(k=0; k < AVERAGE; k++) + scost5 += Volume[i+k]*pa[i+k]; + + svolume5=0; + for(k=0; k < AVERAGE; k++) + svolume5 += Volume[i+k]; + + if(svolume5==0)continue; + pa5[i] = scost5/svolume5; + + min = LLV(pa5,i,PERIOD); + max = HHV(pa5,i,PERIOD); + + rsv[i] = ((pa5[i] - min)/MathMax(max-min,Point))*100; + } + +//--- wma + for(i=limit; i>=0; i--) + pak[i] = iMAOnArray(rsv,0,AVERAGE,0,MODE_LWMA,i); + + for(i=limit; i>=0; i--) + pad[i] = iMAOnArray(pak,0,AVERAGE,0,MODE_LWMA,i); + +//--- histo + for(i=limit; i>=0; i--) + { + if(pak[i]>pad[i]) + { + BullHBuffer[i]=pak[i]; + ZeroBuffer[i]=pad[i]; + BearHBuffer[i]=0; + } + else + { + BearHBuffer[i]=pad[i]; + ZeroBuffer[i]=pak[i]; + BullHBuffer[i]=0; + } + } +//--- + return(0); + } +//+------------------------------------------------------------------+ +//| LLV | +//+------------------------------------------------------------------+ +double LLV(double &buffer[],int index, int period) +{ + int total = ArraySize(buffer); + double min = buffer[index]; + for(int i = index+1; i max) max = buffer[i]; + return(max); +} +//+------------------------------------------------------------------+ + diff --git a/arbitrage.mq4 b/arbitrage.mq4 new file mode 100644 index 0000000..2d4a705 --- /dev/null +++ b/arbitrage.mq4 @@ -0,0 +1,518 @@ +//+------------------------------------------------------------------+ +//| Arbitrage.mq4 | +//| Copyright 2015, MetaQuotes Software Corp. | +//| https://www.mql5.com | +//+------------------------------------------------------------------+ +#property copyright "Copyright 2015, MetaQuotes Software Corp." +#property link "https://www.mql5.com" +#property description"Arbitrage by pipPod" +#property version "1.00" +#property indicator_separate_window +#property indicator_buffers 2 +#property indicator_plots 2 +//--- plot Base +#property indicator_type1 DRAW_LINE +#property indicator_color1 clrLimeGreen +#property indicator_style1 STYLE_SOLID +#property indicator_width1 2 +//--- plot Quote +#property indicator_type2 DRAW_LINE +#property indicator_color2 clrFireBrick +#property indicator_style2 STYLE_SOLID +#property indicator_width2 2 +ushort indicator_width3; +//--- indicator levels +#property indicator_levelcolor clrLightSlateGray +//--- +double indicator_level1= 0; +double indicator_level2= .2; +double indicator_level3= -.2; +double indicator_level4= 20; +double indicator_level5= -20; +double indicator_level6= 30; +double indicator_level7= -30; +double indicator_level8= 100; +double indicator_level9=-100; +//--- +enum indicators + { + INDICATOR_MACD, //Moving Average Convergence/Divergence + INDICATOR_STOCHASTIC, //Stochastic Oscillator + INDICATOR_RSI, //Relative Strength Index + INDICATOR_CCI, //Commodity Channel Index + INDICATOR_RVI, //Relative Vigor Index + INDICATOR_DEMARK, //DeMarker Oscillator + }; +//--- indicator to show +input indicators Indicator=INDICATOR_MACD; +//--- index timeframe +input ENUM_TIMEFRAMES TimeFrame=0; +//--- indicator parameters +input string MACD; +input int FastEMA=12; //Fast EMA Period +input int SlowEMA=26; //Slow EMA Period +input int SignalSMA=9; //Signal SMA Period +input ENUM_APPLIED_PRICE MACDPrice=PRICE_CLOSE; //MACD Price +//--- +input string Stochastic; +input int Kperiod=7; //K Period +input int Dperiod=3; //D Period +input int Slowing=3; +input ENUM_STO_PRICE PriceField=STO_LOWHIGH; //Price Field +//--- +input string RSI; +input int RSIPeriod=14; //RSI Period +input ENUM_APPLIED_PRICE RSIPrice=PRICE_CLOSE; //RSI Price +//--- +input string CCI; +input int CCIPeriod=14; //CCI Period +input ENUM_APPLIED_PRICE CCIPrice=PRICE_CLOSE; //CCI Price +//--- +input string RVI; +input int RVIPeriod=14; //RVI Period +//--- +input string DeMarker; +input int DeMarkerPeriod=14; //DeMarker Period +input string _;//--- +input bool ColorBars=true; //Color Bars +input bool FillBuffers=true; //Fill Buffers +input string __;//--- +input bool AlertsOn=false; +//---index buffers for drawing +double BaseBuffer[]; +double QoteBuffer[]; +//---currency variables for calculation +#define USDJPY "USDJPY" +//--- +string base, + quote, + symbol1, + symbol2, + symbol3; +//--- +double index1, + index2, + index3, + baseIndex, + qoteIndex; +//--- +bool baseUSD=false, + quoteUSD=false, + quoteJPY=false, + quoteJPY1=false, + quoteJPY2=false, + quoteJPY3=false; +//---set index colors +color color1 = indicator_color1, + color2 = indicator_color2, + colorFill; +//--- +string shortName; +long chartID=ChartID(); +short window; +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +int OnInit() + { +//---currencies to show + base = StringSubstr(_Symbol,0,3); //Base currency name + quote= StringSubstr(_Symbol,3,3); //Quote currency name + if(_Symbol=="EURUSD") + { + color1 = clrRoyalBlue; + color2 = clrLimeGreen; + quoteUSD = true; + symbol1 = _Symbol; + symbol2 = "EURJPY"; + quoteJPY2 = true; + symbol3 = USDJPY; + quoteJPY3 = true; + } + if(_Symbol=="EURJPY") + { + color1 = clrRoyalBlue; + color2 = clrYellow; + quoteJPY = true; + symbol1 = _Symbol; + quoteJPY1 = true; + symbol2 = "EURUSD"; + symbol3 = USDJPY; + quoteJPY3 = true; + } + if(_Symbol=="GBPUSD") + { + color1 = clrSilver; + color2 = clrLimeGreen; + quoteUSD = true; + symbol1 = _Symbol; + symbol2 = "GBPJPY"; + quoteJPY2 = true; + symbol3 = USDJPY; + quoteJPY3 = true; + } + if(_Symbol=="GBPJPY") + { + color1 = clrSilver; + color2 = clrYellow; + quoteJPY = true; + symbol1 = _Symbol; + quoteJPY1 = true; + symbol2 = "GBPUSD"; + symbol3 = USDJPY; + quoteJPY3 = true; + } + if(_Symbol=="AUDUSD") + { + color1 = clrDarkOrange; + color2 = clrLimeGreen; + quoteUSD = true; + symbol1 = _Symbol; + symbol2 = "AUDJPY"; + quoteJPY2 = true; + symbol3 = USDJPY; + quoteJPY3 = true; + } + if(_Symbol=="USDCAD") + { + color1 = clrLimeGreen; + color2 = clrWhiteSmoke; + baseUSD = true; + symbol1 = _Symbol; + symbol2 = "CADJPY"; + quoteJPY2 = true; + symbol3 = USDJPY; + quoteJPY3 = true; + } + if(_Symbol=="USDCHF") + { + color1 = clrLimeGreen; + color2 = clrFireBrick; + baseUSD = true; + symbol1 = _Symbol; + symbol2 = "CHFJPY"; + quoteJPY2 = true; + symbol3 = USDJPY; + quoteJPY3 = true; + } + if(_Symbol==USDJPY) + { + color1 = clrLimeGreen; + color2 = clrYellow; + quoteJPY = true; + symbol1 = _Symbol; + quoteJPY1 = true; + symbol2 = "EURUSD"; + symbol3 = "EURJPY"; + quoteJPY3 = true; + } +//---set timeframes + string timeFrame = StringSubstr(EnumToString(TimeFrame),7); + if(timeFrame=="CURRENT") + timeFrame = ""; +//--- + switch(Indicator) + { + case INDICATOR_MACD: + shortName=StringFormat("Arbitrage MACD %s(%d,%d,%d)", + timeFrame,FastEMA,SlowEMA,SignalSMA); + IndicatorSetInteger(INDICATOR_DIGITS,5); + IndicatorSetInteger(INDICATOR_LEVELS,1); + IndicatorSetDouble(INDICATOR_LEVELVALUE,0,indicator_level1); + break; + case INDICATOR_STOCHASTIC: + shortName=StringFormat("Arbitrage Stochastic %s(%d,%d,%d)", + timeFrame,Kperiod,Dperiod,Slowing); + IndicatorSetInteger(INDICATOR_DIGITS,0); + IndicatorSetInteger(INDICATOR_LEVELS,3); + IndicatorSetDouble(INDICATOR_LEVELVALUE,0,indicator_level1); + IndicatorSetDouble(INDICATOR_LEVELVALUE,1,indicator_level6); + IndicatorSetDouble(INDICATOR_LEVELVALUE,2,indicator_level7); + break; + case INDICATOR_RSI: + shortName=StringFormat("Arbitrage RSI %s(%d)", + timeFrame,RSIPeriod); + IndicatorSetInteger(INDICATOR_DIGITS,0); + IndicatorSetInteger(INDICATOR_LEVELS,3); + IndicatorSetDouble(INDICATOR_LEVELVALUE,0,indicator_level1); + IndicatorSetDouble(INDICATOR_LEVELVALUE,1,indicator_level4); + IndicatorSetDouble(INDICATOR_LEVELVALUE,2,indicator_level5); + break; + case INDICATOR_CCI: + shortName=StringFormat("Arbitrage CCI %s(%d)", + timeFrame,CCIPeriod); + IndicatorSetInteger(INDICATOR_DIGITS,0); + IndicatorSetInteger(INDICATOR_LEVELS,3); + IndicatorSetDouble(INDICATOR_LEVELVALUE,0,indicator_level1); + IndicatorSetDouble(INDICATOR_LEVELVALUE,1,indicator_level8); + IndicatorSetDouble(INDICATOR_LEVELVALUE,2,indicator_level9); + break; + case INDICATOR_RVI: + shortName=StringFormat("Arbitrage RVI %s(%d)", + timeFrame,RVIPeriod); + IndicatorSetInteger(INDICATOR_DIGITS,3); + IndicatorSetInteger(INDICATOR_LEVELS,3); + IndicatorSetDouble(INDICATOR_LEVELVALUE,0,indicator_level1); + IndicatorSetDouble(INDICATOR_LEVELVALUE,1,indicator_level2); + IndicatorSetDouble(INDICATOR_LEVELVALUE,2,indicator_level3); + break; + case INDICATOR_DEMARK: + shortName=StringFormat("Arbitrage DeMarker %s(%d)", + timeFrame,DeMarkerPeriod); + IndicatorSetInteger(INDICATOR_DIGITS,3); + IndicatorSetInteger(INDICATOR_LEVELS,3); + IndicatorSetDouble(INDICATOR_LEVELVALUE,0,indicator_level1); + IndicatorSetDouble(INDICATOR_LEVELVALUE,1,indicator_level2); + IndicatorSetDouble(INDICATOR_LEVELVALUE,2,indicator_level3); + } + IndicatorSetString(INDICATOR_SHORTNAME,shortName); + window = ChartWindowFind(chartID,shortName); + int xStart = 4; //label coordinates + int xIncrement = 25; + int yStart = 16; + ObjectCreate(base,xStart,yStart,color1); + xStart += xIncrement; + ObjectCreate(quote,xStart,yStart,color2); +//---index buffers + SetIndexBuffer(0,BaseBuffer,INDICATOR_DATA); + SetIndexBuffer(1,QoteBuffer,INDICATOR_DATA); + SetIndexStyle(0,EMPTY,EMPTY,EMPTY,color1); + SetIndexStyle(1,EMPTY,EMPTY,EMPTY,color2); + SetIndexLabel(0,base); + SetIndexLabel(1,quote); +//---color bars + if(ColorBars) + { + if(ChartGetInteger(0,CHART_COLOR_CANDLE_BULL)!=color1) + { + ChartSetInteger(0,CHART_COLOR_CANDLE_BULL,color1); + ChartSetInteger(0,CHART_COLOR_CHART_UP,color1); + } + if(ChartGetInteger(0,CHART_COLOR_CANDLE_BEAR)!=color2) + { + ChartSetInteger(0,CHART_COLOR_CANDLE_BEAR,color2); + ChartSetInteger(0,CHART_COLOR_CHART_DOWN,color2); + } + } +//--- + return(INIT_SUCCEEDED); + } +//+------------------------------------------------------------------+ +//| Custom indicator iteration function | +//+------------------------------------------------------------------+ +#define INVERT -1 +#define BUY "BUY" +#define SELL "SELL" +int OnCalculate(const int rates_total, + const int prev_calculated, + const datetime &time[], + const double &open[], + const double &high[], + const double &low[], + const double &close[], + const long &tick_volume[], + const long &volume[], + const int &spread[]) + { +//--- + int limit = rates_total-prev_calculated; + if(prev_calculated>rates_total || prev_calculated<=0) + { + int barsWindow = (int)ChartGetInteger(chartID,CHART_VISIBLE_BARS)+100; + if(iBars(symbol1,TimeFrame)<=barsWindow || + iBars(symbol2,TimeFrame)<=barsWindow || + iBars(symbol3,TimeFrame)<=barsWindow) + return(0); + SetIndexDrawBegin(0,rates_total-barsWindow); + SetIndexDrawBegin(1,rates_total-barsWindow); + limit = barsWindow; +//--- + if(FillBuffers) + { + ushort scale = ChartGetInteger(chartID,CHART_SCALE); + switch(scale) + { + case 5: indicator_width3 = 24; break; + case 4: indicator_width3 = 12; break; + case 3: indicator_width3 = 6; break; + case 2: indicator_width3 = 3; break; + default: indicator_width3 = 1; + } + } + } + if(prev_calculated>0 && NewBar(time[0])) + limit++; +//--- + for(int i=limit;i>=0 && !IsStopped();i--) + { + int shift = iBarShift(NULL,TimeFrame,time[i]); + switch(Indicator) + { + case INDICATOR_MACD: + index1 = iMACD(symbol1,TimeFrame,FastEMA,SlowEMA,SignalSMA,MACDPrice,MODE_MAIN,shift); + index2 = iMACD(symbol2,TimeFrame,FastEMA,SlowEMA,SignalSMA,MACDPrice,MODE_MAIN,shift); + index3 = iMACD(symbol3,TimeFrame,FastEMA,SlowEMA,SignalSMA,MACDPrice,MODE_MAIN,shift); + if(quoteJPY1) + index1 /= 100; + if(quoteJPY2) + index2 /= 100; + if(quoteJPY3) + index3 /= 100; + break; + case INDICATOR_STOCHASTIC: + index1 = iStochastic(symbol1,TimeFrame,Kperiod,Dperiod,Slowing,MODE_SMA,PriceField,MODE_MAIN,shift)-50; + index2 = iStochastic(symbol2,TimeFrame,Kperiod,Dperiod,Slowing,MODE_SMA,PriceField,MODE_MAIN,shift)-50; + index3 = iStochastic(symbol3,TimeFrame,Kperiod,Dperiod,Slowing,MODE_SMA,PriceField,MODE_MAIN,shift)-50; + break; + case INDICATOR_RSI: + index1 = iRSI(symbol1,TimeFrame,RSIPeriod,RSIPrice,shift)-50; + index2 = iRSI(symbol2,TimeFrame,RSIPeriod,RSIPrice,shift)-50; + index3 = iRSI(symbol3,TimeFrame,RSIPeriod,RSIPrice,shift)-50; + break; + case INDICATOR_CCI: + index1 = iCCI(symbol1,TimeFrame,CCIPeriod,CCIPrice,shift); + index2 = iCCI(symbol2,TimeFrame,CCIPeriod,CCIPrice,shift); + index3 = iCCI(symbol3,TimeFrame,CCIPeriod,CCIPrice,shift); + break; + case INDICATOR_RVI: + index1 = iRVI(symbol1,TimeFrame,RVIPeriod,MODE_MAIN,shift); + index2 = iRVI(symbol2,TimeFrame,RVIPeriod,MODE_MAIN,shift); + index3 = iRVI(symbol3,TimeFrame,RVIPeriod,MODE_MAIN,shift); + break; + case INDICATOR_DEMARK: + index1 = iDeMarker(symbol1,TimeFrame,DeMarkerPeriod,shift)-.5; + index2 = iDeMarker(symbol2,TimeFrame,DeMarkerPeriod,shift)-.5; + index3 = iDeMarker(symbol3,TimeFrame,DeMarkerPeriod,shift)-.5; + } +//--- + if(quoteUSD) + { + baseIndex = (index1+index2)/2; + index1 *= INVERT; + qoteIndex = (index1+index3)/2; + } + if(quoteJPY) + { + if(_Symbol==USDJPY) + index2 *= INVERT; + baseIndex = (index1+index2)/2; + index1 *= INVERT; + index3 *= INVERT; + qoteIndex = (index1+index3)/2; + } + if(baseUSD) + { + baseIndex = (index1+index3)/2; + index1 *= INVERT; + qoteIndex = (index1+index2)/2; + } +//--- + BaseBuffer[i] = baseIndex; + QoteBuffer[i] = qoteIndex; +//--- + if(FillBuffers) + { + colorFill = (baseIndex>qoteIndex)?color1:color2; + ObjectCreate((string)(uint)time[i],time[i],BaseBuffer[i],QoteBuffer[i]); + } +//--- + if(AlertsOn && prev_calculated>0) + { + static datetime timePrev; + if(BaseBuffer[i]>QoteBuffer[i] && + BaseBuffer[i+1]QoteBuffer[i+1] && + timePrev!=time[0]) + { + Alert(SELL+_Symbol); + timePrev = time[0]; + } + } + } +//--- return value of prev_calculated for next call + return(rates_total); + } +//+------------------------------------------------------------------+ +//| Custom indicator deinitialization function | +//+------------------------------------------------------------------+ +void OnDeinit(const int reason) + { + // delete labels + ObjectDelete(chartID,base); + ObjectDelete(chartID,quote); + ObjectsDeleteAll(chartID,window,OBJ_TREND); + return; + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +void ObjectCreate(string currency, + int x, + int y, + color clr) + { + if(!ObjectCreate(chartID,currency,OBJ_LABEL,window,0,0)) + { + Print(__FUNCTION__,": error ",GetLastError()); + return; + } + ObjectSetString(chartID,currency,OBJPROP_TEXT,currency); + ObjectSetString(chartID,currency,OBJPROP_FONT,"Arial Bold"); + ObjectSetInteger(chartID,currency,OBJPROP_FONTSIZE,8); + ObjectSetInteger(chartID,currency,OBJPROP_COLOR,clr); + ObjectSetInteger(chartID,currency,OBJPROP_XDISTANCE,x); + ObjectSetInteger(chartID,currency,OBJPROP_YDISTANCE,y); + return; + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +#define OBJ_NONE -1 +void ObjectCreate(string object_name, + const datetime &time, + const double &high, + const double &low) + { + if(ObjectFind(chartID,object_name)!=OBJ_NONE) + ObjectDelete(chartID,object_name); + if(!ObjectCreate(chartID,object_name,OBJ_TREND,window,time,high,time,low)) + { + Print(__FUNCTION__,": error ",GetLastError()); + return; + } + ObjectSetInteger(chartID,object_name,OBJPROP_WIDTH,indicator_width3); + ObjectSetInteger(chartID,object_name,OBJPROP_COLOR,colorFill); + ObjectSetInteger(chartID,object_name,OBJPROP_RAY,false); + ObjectSetInteger(chartID,object_name,OBJPROP_HIDDEN,true); + ObjectSetInteger(chartID,object_name,OBJPROP_SELECTABLE,false); + return; + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +bool NewBar(const datetime &time) + { + static datetime currTime1[1], + currTime2[1], + currTime3[1], + prevTime; + if(CopyTime(symbol1,TimeFrame,time,1,currTime1)!=1 || + CopyTime(symbol2,TimeFrame,time,1,currTime2)!=1 || + CopyTime(symbol3,TimeFrame,time,1,currTime3)!=1) + return(false); + if(prevTime!=currTime1[0] && + prevTime!=currTime2[0] && + prevTime!=currTime3[0]) + { + prevTime = currTime1[0]; + return(true); + } + return(false); + } +//-------------------------------------------------------------------+ \ No newline at end of file diff --git a/closeatprofit.mq4 b/closeatprofit.mq4 new file mode 100644 index 0000000..4ba85f5 --- /dev/null +++ b/closeatprofit.mq4 @@ -0,0 +1,448 @@ +//+------------------------------------------------------------------+ +#property copyright "Copyright © 2011 Matus German www.MTexperts.net" + +extern bool useProfitToClose = true; +extern double profitToClose = 0.05; +extern bool useLossToClose = false; +extern double lossToClose = 100; +extern bool AllSymbols = true; +extern bool PendingOrders = true; +extern double MaxSlippage = 0; +extern bool showMenu = true; +extern color menuColor = White; +extern color variablesColor = Red; +extern int font = 14; + +double pips2dbl, pips2point, pipValue, maxSlippage, + profit; + +bool clear; + +int medzera = 8, + trades; + +double menulots; +//+------------------------------------------------------------------+ +//| expert initialization function | +//+------------------------------------------------------------------+ +int init() + { +//---- + + Comment("Copyright © 2011, Matus German"); + + if (Digits == 5 || Digits == 3) // Adjust for five (5) digit brokers. + { + pips2dbl = Point*10; pips2point = 10;pipValue = (MarketInfo(Symbol(),MODE_TICKVALUE))*10; + } + else + { + pips2dbl = Point; pips2point = 1;pipValue = (MarketInfo(Symbol(),MODE_TICKVALUE))*1; + } + + clear = true; + + if(showMenu) + { + DrawMenu(); + } +//---- + return(0); + } +//+------------------------------------------------------------------+ +//| expert deinitialization function | +//+------------------------------------------------------------------+ +int deinit() + { +//---- + if(showMenu) + { + ObjectDelete("name"); + ObjectDelete("Openl"); + ObjectDelete("Open"); + ObjectDelete("Lotsl"); + ObjectDelete("Lots"); + ObjectDelete("Profitl"); + ObjectDelete("Profit"); + } +//---- + return(0); + } +//+------------------------------------------------------------------+ +//| expert start function | +//+------------------------------------------------------------------+ +int start() +{ +//---- + if(showMenu) + { + ReDrawMenu(); + } + + if(!clear) + { + if(AllSymbols) + { + if(PendingOrders) + if(CloseDeleteAll()) + clear=true; + else + return; + if(!PendingOrders) + if(CloseDeleteAllNonPending()) + clear=true; + else + return; + } + if(!AllSymbols) + { + if(PendingOrders) + if(CloseDeleteAllCurrent()) + clear=true; + else + return; + if(!PendingOrders) + if(CloseDeleteAllCurrentNonPending()) + clear=true; + else + return; + } + } + + profit = ProfitCheck(); + if(useProfitToClose) + { + if(profit>profitToClose) + { + if(AllSymbols) + { + if(PendingOrders) + if(!CloseDeleteAll()) + clear=false; + if(!PendingOrders) + if(!CloseDeleteAllNonPending()) + clear=false; + } + if(!AllSymbols) + { + if(PendingOrders) + if(!CloseDeleteAllCurrent()) + clear=false; + if(!PendingOrders) + if(!CloseDeleteAllCurrentNonPending()) + clear=false; + } + } + } + + if(useLossToClose) + { + if(profit<-lossToClose) + { + if(AllSymbols) + { + if(PendingOrders) + if(!CloseDeleteAll()) + clear=false; + if(!PendingOrders) + if(!CloseDeleteAllNonPending()) + clear=false; + } + if(!AllSymbols) + { + if(PendingOrders) + if(!CloseDeleteAllCurrent()) + clear=false; + if(!PendingOrders) + if(!CloseDeleteAllCurrentNonPending()) + clear=false; + } + } + } +//---- + return(0); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////// +bool CloseDeleteAll() +{ + int total = OrdersTotal(); + for (int cnt = total-1 ; cnt >=0 ; cnt--) + { + OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES); + + if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) + { + switch(OrderType()) + { + case OP_BUY : + { + if(!OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),maxSlippage,Violet)) + return(false); + }break; + case OP_SELL : + { + if(!OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),maxSlippage,Violet)) + return(false); + }break; + } + + + if(OrderType()==OP_BUYSTOP || OrderType()==OP_SELLSTOP || OrderType()==OP_BUYLIMIT || OrderType()==OP_SELLLIMIT) + if(!OrderDelete(OrderTicket())) + { + Print("Error deleting " + OrderType() + " order : ",GetLastError()); + return (false); + } + } + } + return (true); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////// +// delete all on current chart +bool CloseDeleteAllCurrent() +{ + int total = OrdersTotal(); + for (int cnt = total-1 ; cnt >=0 ; cnt--) + { + OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES); + + if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) + { + if(OrderSymbol()==Symbol()) + { + switch(OrderType()) + { + case OP_BUY : + { + if(!OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),maxSlippage,Violet)) + return(false); + }break; + + case OP_SELL : + { + if(!OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),maxSlippage,Violet)) + return(false); + }break; + } + + + if(OrderType()==OP_BUYSTOP || OrderType()==OP_SELLSTOP || OrderType()==OP_BUYLIMIT || OrderType()==OP_SELLLIMIT) + if(!OrderDelete(OrderTicket())) + { + return (false); + } + } + } + } + return (true); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////// +// left pending orders +bool CloseDeleteAllNonPending() +{ + int total = OrdersTotal(); + for (int cnt = total-1 ; cnt >=0 ; cnt--) + { + OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES); + + if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) + { + switch(OrderType()) + { + case OP_BUY : + { + if(!OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),maxSlippage,Violet)) + return(false); + }break; + case OP_SELL : + { + if(!OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),maxSlippage,Violet)) + return(false); + }break; + } + } + } + return (true); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////// +// delete all on current chart left pending +bool CloseDeleteAllCurrentNonPending() +{ + int total = OrdersTotal(); + for (int cnt = total-1 ; cnt >=0 ; cnt--) + { + OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES); + + if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) + { + if(OrderSymbol()==Symbol()) + { + switch(OrderType()) + { + case OP_BUY : + { + if(!OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),maxSlippage,Violet)) + return(false); + }break; + + case OP_SELL : + { + if(!OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),maxSlippage,Violet)) + return(false); + }break; + } + } + } + } + return (true); +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +double ProfitCheck() +{ + double profit=0; + int total = OrdersTotal(); + for (int cnt = total-1 ; cnt >=0 ; cnt--) + { + OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); + if(AllSymbols) + profit+=OrderProfit(); + else if(OrderSymbol()==Symbol()) + profit+=OrderProfit(); + } + return(profit); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////// +bool DrawMenu() +{ + ObjectCreate("name",OBJ_LABEL,0,0,0,0,0); + ObjectCreate("Openl",OBJ_LABEL,0,0,0,0,0); + ObjectCreate("Open",OBJ_LABEL,0,0,0,0,0); + ObjectCreate("Lotsl",OBJ_LABEL,0,0,0,0,0); + ObjectCreate("Lots",OBJ_LABEL,0,0,0,0,0); + ObjectCreate("Profitl",OBJ_LABEL,0,0,0,0,0); + ObjectCreate("Profit",OBJ_LABEL,0,0,0,0,0); + + medzera = 8; + + trades = Opened(); + menulots = Lots(); + + ObjectSetText( "name", "CloseAtProfit", font+1, "Arial",menuColor); + ObjectSet("name",OBJPROP_XDISTANCE,medzera*font); + ObjectSet("name",OBJPROP_YDISTANCE,10+font); + ObjectSet("name",OBJPROP_CORNER,1); + + ObjectSetText("Openl", "Opened trades: ", font, "Arial",menuColor); + ObjectSet("Openl",OBJPROP_XDISTANCE,medzera*font); + ObjectSet("Openl",OBJPROP_YDISTANCE,10+2*(font+2)); + ObjectSet("Openl",OBJPROP_CORNER,1); + + ObjectSetText("Open", ""+trades, font, "Arial",variablesColor); + ObjectSet("Open",OBJPROP_XDISTANCE,3*font); + ObjectSet("Open",OBJPROP_YDISTANCE,10+2*(font+2)); + ObjectSet("Open",OBJPROP_CORNER,1); + + ObjectSetText("Lotsl", "Lots of opened positions: ", font, "Arial",menuColor); + ObjectSet("Lotsl",OBJPROP_XDISTANCE,medzera*font); + ObjectSet("Lotsl",OBJPROP_YDISTANCE,10+3*(font+2)); + ObjectSet("Lotsl",OBJPROP_CORNER,1); + + ObjectSetText("Lots", DoubleToStr(menulots,2), font, "Arial",variablesColor); + ObjectSet("Lots",OBJPROP_XDISTANCE,3*font); + ObjectSet("Lots",OBJPROP_YDISTANCE,10+3*(font+2)); + ObjectSet("Lots",OBJPROP_CORNER,1); + + ObjectSetText("Profitl", "Profit of opened positions: ", font, "Arial",menuColor); + ObjectSet("Profitl",OBJPROP_XDISTANCE,medzera*font); + ObjectSet("Profitl",OBJPROP_YDISTANCE,10+4*(font+2)); + ObjectSet("Profitl",OBJPROP_CORNER,1); + + ObjectSetText("Profit", DoubleToStr(profit,2), font, "Arial",variablesColor); + ObjectSet("Profit",OBJPROP_XDISTANCE,3*font); + ObjectSet("Profit",OBJPROP_YDISTANCE,10+4*(font+2)); + ObjectSet("Profit",OBJPROP_CORNER,1); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////// +bool ReDrawMenu() +{ + medzera = 8; + + trades = Opened(); + menulots = Lots(); + + ObjectSetText("Open", ""+trades, font, "Arial",variablesColor); + ObjectSetText("Lots", DoubleToStr(menulots,2), font, "Arial",variablesColor); + ObjectSetText("Profit", DoubleToStr(profit,2), font, "Arial",variablesColor); +} + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +int Opened() +{ + int total = OrdersTotal(); + int count = 0; + for (int cnt = total-1 ; cnt >=0 ; cnt--) + { + OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES); + if(AllSymbols) + { + if(PendingOrders) + count++; + if(!PendingOrders) + if(OrderType()==OP_BUY || OrderType()==OP_SELL) + count++; + } + if(!AllSymbols) + { + if(OrderSymbol()==Symbol()) + { + if(PendingOrders) + count++; + if(!PendingOrders) + if(OrderType()==OP_BUY || OrderType()==OP_SELL) + count++; + } + } + } + return (count); +} + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////// +double Lots() +{ + int total = OrdersTotal(); + double lots = 0; + for (int cnt = total-1 ; cnt >=0 ; cnt--) + { + OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES); + if(AllSymbols) + { + if(PendingOrders) + lots+=OrderLots(); + if(!PendingOrders) + if(OrderType()==OP_BUY || OrderType()==OP_SELL) + lots+=OrderLots(); + } + if(!AllSymbols) + { + if(OrderSymbol()==Symbol()) + { + if(PendingOrders) + lots+=OrderLots(); + if(!PendingOrders) + if(OrderType()==OP_BUY || OrderType()==OP_SELL) + lots+=OrderLots(); + } + } + } + return (lots); +} + + diff --git a/cracked_Mega_Fx.mq4 b/cracked_Mega_Fx.mq4 new file mode 100644 index 0000000..1f8541f --- /dev/null +++ b/cracked_Mega_Fx.mq4 @@ -0,0 +1,156 @@ +#property copyright "Cracked by Forex Winners" +#property link "Forex Winners" + +#property indicator_separate_window +#property indicator_buffers 6 +#property indicator_color1 Black +#property indicator_color2 Lime +#property indicator_color3 Red +#property indicator_color4 Yellow +#property indicator_color5 Lime +#property indicator_color6 Red + +extern bool ALERTS = TRUE; +extern bool SoundAlerts = TRUE; +extern string SoundAlertFile = "alert.wave"; +extern bool eMailAlerts = TRUE; +int G_bars_96; +int Gi_100 = 21; +double G_ibuf_104[]; +double G_ibuf_108[]; +double G_ibuf_112[]; +double G_ibuf_116[]; +double G_ibuf_120[]; +double G_ibuf_124[]; + +// E37F0136AA3FFAF149B351F6A4C948E9 +int init() { + SetIndexStyle(0, DRAW_NONE); + SetIndexStyle(1, DRAW_LINE, EMPTY, 3); + SetIndexStyle(2, DRAW_LINE, EMPTY, 3); + SetIndexStyle(3, DRAW_LINE, EMPTY, 3); + SetIndexStyle(4, DRAW_ARROW, EMPTY, 2); + SetIndexArrow(4, 225); + SetIndexStyle(5, DRAW_ARROW, EMPTY, 2); + SetIndexArrow(5, 226); + IndicatorDigits(Digits + 0); + SetIndexBuffer(0, G_ibuf_104); + SetIndexBuffer(1, G_ibuf_108); + SetIndexBuffer(2, G_ibuf_112); + SetIndexBuffer(3, G_ibuf_116); + SetIndexBuffer(4, G_ibuf_120); + SetIndexBuffer(5, G_ibuf_124); + IndicatorShortName("MEGAFXPROFIT © www.megafxprofit.com"); + SetIndexLabel(0, NULL); + SetIndexLabel(1, NULL); + SetIndexLabel(2, NULL); + SetIndexLabel(3, NULL); + SetIndexLabel(4, NULL); + return (0); +} + +// EA2B2676C28C0DB26D39331A336C6B92 +int start() { + double Ld_0; + double Ld_8; + double Ld_16; + string Ls_104; + string Ls_112; + string Ls_120; + int Li_24 = IndicatorCounted(); + double Ld_28 = 0; + double Ld_36 = 0; + double Ld_unused_44 = 0; + double Ld_unused_52 = 0; + double Ld_60 = 0; + double Ld_unused_68 = 0; + double low_76 = 0; + double high_84 = 0; + if (Li_24 > 0) Li_24--; + int Li_92 = Bars - Li_24; + for (int Li_96 = 0; Li_96 < Li_92; Li_96++) { + high_84 = High[iHighest(NULL, 0, MODE_HIGH, Gi_100, Li_96)]; + low_76 = Low[iLowest(NULL, 0, MODE_LOW, Gi_100, Li_96)]; + Ld_16 = (High[Li_96] + Low[Li_96]) / 2.0; + Ld_28 = 0.66 * ((Ld_16 - low_76) / (high_84 - low_76) - 0.5) + 0.67 * Ld_36; + Ld_28 = MathMin(MathMax(Ld_28, -0.999), 0.999); + G_ibuf_104[Li_96] = MathLog((Ld_28 + 1.0) / (1 - Ld_28)) / 2.0 + Ld_60 / 2.0; + Ld_36 = Ld_28; + Ld_60 = G_ibuf_104[Li_96]; + } + bool Li_100 = TRUE; + for (Li_96 = Li_92 - 2; Li_96 >= 0; Li_96--) { + G_ibuf_116[Li_96] = 0; + Ld_8 = G_ibuf_104[Li_96 + 1]; + Ld_0 = G_ibuf_104[Li_96 + 2]; + if ((Ld_8 < 0.0 && Ld_0 > 0.0) || Ld_8 < 0.0) { + Li_100 = FALSE; + if (Ld_8 < 0.0 && Ld_0 > 0.0) { + Ls_104 = Symbol() + ", TF:" + f0_0(Period()); + Ls_112 = Ls_104 + ", MEGAFXPROFIT SELL SIGNAL for Level: " + Ld_8; + Ls_120 = Ls_112 + " @ " + TimeToStr(TimeLocal(), TIME_SECONDS); + if (Bars > G_bars_96) { + G_bars_96 = Bars; + f0_1(Ls_120, Ls_112); + } + } + } + if ((Ld_8 > 0.0 && Ld_0 < 0.0) || Ld_8 > 0.0) { + Li_100 = TRUE; + if (Ld_8 > 0.0 && Ld_0 < 0.0) { + Ls_104 = Symbol() + ", TF:" + f0_0(Period()); + Ls_112 = Ls_104 + ", MEGAFXPROFIT BUY SIGNAL for Level: " + Ld_8; + Ls_120 = Ls_112 + " @ " + TimeToStr(TimeLocal(), TIME_SECONDS); + if (Bars > G_bars_96) { + G_bars_96 = Bars; + f0_1(Ls_120, Ls_112); + } + } + } + if (!Li_100) { + G_ibuf_112[Li_96] = Ld_8; + G_ibuf_108[Li_96] = 0.0; + } else { + G_ibuf_108[Li_96] = Ld_8; + G_ibuf_112[Li_96] = 0.0; + } + } + for (Li_96 = 0; Li_96 < Li_92; Li_96++) { + if (G_ibuf_108[Li_96] > 0.0 && G_ibuf_108[Li_96 + 1] == 0.0) G_ibuf_120[Li_96] = G_ibuf_108[Li_96]; + if (G_ibuf_112[Li_96] < 0.0 && G_ibuf_112[Li_96 + 1] == 0.0) G_ibuf_124[Li_96] = G_ibuf_112[Li_96]; + } + return (0); +} + +// FF3DED0DF4360E36577F1A7C4D36796A +void f0_1(string As_0, string As_8) { + if (ALERTS) Alert(As_0); + if (SoundAlerts) PlaySound(SoundAlertFile); + if (eMailAlerts) SendMail(As_8, As_0); +} + +// A9BA851E539886467D4ECFDDCA93F414 +string f0_0(int Ai_0) { + switch (Ai_0) { + case 1: + return ("M1"); + case 5: + return ("M5"); + case 15: + return ("M15"); + case 30: + return ("M30"); + case 60: + return ("H1"); + case 240: + return ("H4"); + case 1440: + return ("D1"); + case 10080: + return ("W1"); + case 43200: + return ("MN1"); + } + WindowRedraw(); + return (Period()); +} diff --git a/eXclusive_MTF_RSI.mq4 b/eXclusive_MTF_RSI.mq4 new file mode 100644 index 0000000..f8dd97e --- /dev/null +++ b/eXclusive_MTF_RSI.mq4 @@ -0,0 +1,275 @@ +//+------------------------------------------------------------------+ +//| eXclusive MTF RSI.mq4 | +//| Copyright © 2013, mt4exclusive.com | +//| http://www.mt4exclusive.com | +//+------------------------------------------------------------------+ +#property copyright "Copyright © 2013, mt4exclusive.com" +#property link "http://www.mt4exclusive.com" +#property indicator_color1 Red +#property indicator_color2 Lime +#property indicator_color3 Orange +#property indicator_color4 Blue +#property indicator_color5 White +#property indicator_color6 Green +#property indicator_color7 Yellow +#property indicator_color8 Moccasin + +#property indicator_separate_window +#property indicator_minimum 0 +#property indicator_maximum 100 +#property indicator_buffers 8 +#property indicator_level1 70 +#property indicator_level2 30 +#property indicator_level3 50 + +extern int RSIperiod=14; +extern int RSIprice =0; +extern string RSI_Price_note_1="CLOSE= 0, OPEN=1, HIGH=2, LOW=3"; +extern string RESI_Price_note2="MEDIAN=4, TYPICAL=5, WEIGHTED=6"; + +extern bool ShowRSI_M1 = true; +extern bool ShowRSI_M5 = true; +extern bool ShowRSI_M15 = true; +extern bool ShowRSI_M30 = true; +extern bool ShowRSI_M60 = true; +extern bool ShowRSI_M240= true; +extern bool ShowRSI_M1440=true; +extern bool ShowRSI_M10080=true; + +extern color M1_color=Red; +extern color M5_color=Lime; +extern color M15_color=Orange; +extern color M30_color=Blue; +extern color M60_color=White; +extern color M240_color=Green; +extern color M1440_color=Yellow; +extern color M10080_color=Moccasin; + +double M1Buffer[]; +double M5Buffer[]; +double M15Buffer[]; +double M30Buffer[]; +double M60Buffer[]; +double M240Buffer[]; +double M1440Buffer[]; +double M10080Buffer[]; + +int TF1=1; +int TF5=5; +int TF15=15; +int TF30=30; +int TF60=60; +int TF240=240; +int TF1440=1440; +int TF10080=10080; +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +int init() + { +//---- indicators +//============================================================================================ + + SetIndexBuffer(0,M1Buffer); + SetIndexLabel(0,"M1 RSI"); + SetIndexStyle(0,DRAW_LINE,0,1,M1_color); +//============================================================================================ + SetIndexBuffer(1,M5Buffer); + SetIndexLabel(1,"M5 RSI"); + SetIndexStyle(1,DRAW_LINE,0,1,M5_color); +//============================================================================================ + SetIndexBuffer(2,M15Buffer); + SetIndexLabel(2,"M15 RSI"); + SetIndexStyle(2,DRAW_LINE,0,1,M15_color); +//============================================================================================ + SetIndexBuffer(3,M30Buffer); + SetIndexLabel(3,"M30 RSI"); + SetIndexStyle(3,DRAW_LINE,0,1,M30_color); +//============================================================================================ + SetIndexBuffer(4,M60Buffer); + SetIndexLabel(4,"H1 RSI"); + SetIndexStyle(4,DRAW_LINE,0,1,M60_color); +//============================================================================================ + SetIndexBuffer(5,M240Buffer); + SetIndexLabel(5,"H4 RSI"); + SetIndexStyle(5,DRAW_LINE,0,1,M240_color); +//============================================================================================ + SetIndexBuffer(6,M1440Buffer); + SetIndexLabel(6,"D1 RSI"); + SetIndexStyle(6,DRAW_LINE,0,1,M1440_color); +//============================================================================================ + SetIndexBuffer(7,M10080Buffer); + SetIndexLabel(7,"W1 RSI"); + SetIndexStyle(7,DRAW_LINE,0,1,M10080_color); +//============================================================================================ + + IndicatorShortName("eXclusive MTF_RSI("+RSIperiod+")"); + + return(0); + } +//+------------------------------------------------------------------+ +//| Custom indicator deinitialization function | +//+------------------------------------------------------------------+ +int deinit() + { +//---- + ObjectDelete("M1RSI"); + ObjectDelete("M5RSI"); + ObjectDelete("M15RSI"); + ObjectDelete("M30RSI"); + ObjectDelete("H1RSI"); + ObjectDelete("H4RSI"); + ObjectDelete("D1RSI"); + ObjectDelete("W1RSI"); + ObjectDelete("M1ValueRSI"); + ObjectDelete("M5ValueRSI"); + ObjectDelete("M15ValueRSI"); + ObjectDelete("M30ValueRSI"); + ObjectDelete("H1ValueRSI"); + ObjectDelete("H4ValueRSI"); + ObjectDelete("D1ValueRSI"); + ObjectDelete("W1ValueRSI"); + +//---- + return(0); + } +//============================================================================================ +int start() + { + if(ShowRSI_M1 && Period()<=1) {start1();CreateLabel("M1_RSI",10,30,2,M1_color,"M1",10);CreateLabel("M1Value_RSI",10,10,2,M1_color,DoubleToStr(NormalizeDouble(iRSI(NULL,TF1,RSIperiod,0,0),1),1),10);} + if(ShowRSI_M5 && Period()<=5) {start2();CreateLabel("M5_RSI",50,30,2,M5_color,"M5",10);CreateLabel("M5Value_RSI",50,10,2,M5_color,DoubleToStr(NormalizeDouble(iRSI(NULL,TF5,RSIperiod,0,0),1),1),10);} + if(ShowRSI_M15 && Period()<=15) {start3();CreateLabel("M15_RSI",90,30,2,M15_color,"M15",10);CreateLabel("M15Value_RSI",90,10,2,M15_color,DoubleToStr(NormalizeDouble(iRSI(NULL,TF15,RSIperiod,0,0),1),1),10);} + if(ShowRSI_M30 && Period()<=30) {start4();CreateLabel("M30_RSI",130,30,2,M30_color,"M30",10);CreateLabel("M30Value_RSI",130,10,2,M30_color,DoubleToStr(NormalizeDouble(iRSI(NULL,TF30,RSIperiod,0,0),1),1),10);} + if(ShowRSI_M60 && Period()<=60) {start5();CreateLabel("H1_RSI",170,30,2,M60_color,"H1",10);CreateLabel("H1Value_RSI",170,10,2,M60_color,DoubleToStr(NormalizeDouble(iRSI(NULL,TF60,RSIperiod,0,0),1),1),10);} + if(ShowRSI_M240 && Period()<=240) {start6();CreateLabel("H4_RSI",210,30,2,M240_color,"H4",10);CreateLabel("H4Value_RSI",210,10,2,M240_color,DoubleToStr(NormalizeDouble(iRSI(NULL,TF240,RSIperiod,0,0),1),1),10);} + if(ShowRSI_M1440 && Period()<=1440) {start7();CreateLabel("D1_RSI",250,30,2,M1440_color,"D1",10);CreateLabel("D1Value_RSI",250,10,2,M1440_color,DoubleToStr(NormalizeDouble(iRSI(NULL,TF1440,RSIperiod,0,0),1),1),10);} + if(ShowRSI_M10080 && Period()<=10080) {start8();CreateLabel("W1_RSI",290,30,2,M10080_color,"W1",10);CreateLabel("W1Value_RSI",290,10,2,M10080_color,DoubleToStr(NormalizeDouble(iRSI(NULL,TF10080,RSIperiod,0,0),1),1),10);} + + return(0); + } +//============================================================================================ +//============================================================================================ +int start1() + { + datetime TimeArray1[]; + int i,limit,y=0,counted_bars=IndicatorCounted(); + ArrayCopySeries(TimeArray1,MODE_TIME,Symbol(),1); + limit=Bars-counted_bars; + for(i=0,y=0;i 0) limit=Bars-counted_bars; + if(counted_bars < 0) return(0); + if(counted_bars ==0) limit=Bars-MA_Length-1; + for(shift=limit;shift>=0;shift--) + { + if(useMA_HiLoEnvelope) + { + double bprice=iMA(NULL,0,MA_Length,0,MA_Mode,2,shift); + double sprice=iMA(NULL,0,MA_Length,0,MA_Mode,3,shift); + } + else + { + bprice=iMA(NULL,0,MA_Length,0,MA_Mode,MA_Price,shift); + sprice=iMA(NULL,0,MA_Length,0,MA_Mode,MA_Price,shift); + } + smax[shift]=bprice + Kv*iATR(NULL,0,ATR_Length,shift); + smin[shift]=sprice - Kv*iATR(NULL,0,ATR_Length,shift); + trend[shift]=trend[shift+1]; + if(usePrice_HiLoBreak) + { + if(High[shift] > smax[shift+1])trend[shift]= 1; + if(Low[shift] < smin[shift+1])trend[shift]=-1; + } + else + { + if(bprice > smax[shift+1])trend[shift]= 1; + if(sprice < smin[shift+1])trend[shift]=-1; + } + if(trend[shift] >0) + { + if(smin[shift] < smin[shift+1]) smin[shift]=smin[shift+1]; + UpBuffer[shift]=smin[shift] - (MoneyRisk - 1)*iATR(NULL,0,ATR_Length,shift); + if(UpBuffer[shift] < UpBuffer[shift+1] && UpBuffer[shift+1]!=EMPTY_VALUE) UpBuffer[shift]=UpBuffer[shift+1]; + if(trend[shift+1]!=trend[shift]) UpSignal[shift]=UpBuffer[shift]; + else UpSignal[shift]=EMPTY_VALUE; + DnBuffer[shift]=EMPTY_VALUE; + DnSignal[shift]=EMPTY_VALUE; + } + else + if(trend[shift] <0) + { + if(smax[shift]>smax[shift+1]) smax[shift]=smax[shift+1]; + DnBuffer[shift]=smax[shift] + (MoneyRisk - 1)*iATR(NULL,0,ATR_Length,shift); + if(DnBuffer[shift] > DnBuffer[shift+1]) DnBuffer[shift]=DnBuffer[shift+1]; + if(trend[shift+1]!=trend[shift]) DnSignal[shift]=DnBuffer[shift]; + else DnSignal[shift]=EMPTY_VALUE; + UpBuffer[shift]=EMPTY_VALUE; + UpSignal[shift]=EMPTY_VALUE; + } + } +//---- + string Message; + if(trend[2]<0 && trend[1]>0 && Volume[0]>1 && !UpTrendAlert) + { + Message=" "+Symbol()+" M"+Period()+": VCS Signal for BUY"; + if(AlertMode>0)Alert (Message); + UpTrendAlert=true; DownTrendAlert=false; + } + if(trend[2]>0 && trend[1]<0 && Volume[0]>1 && !DownTrendAlert) + { + Message=" "+Symbol()+" M"+Period()+": VCS Signal for SELL"; + if(AlertMode>0)Alert (Message); + DownTrendAlert=true; UpTrendAlert=false; + } +//---- + + +//+--------- TRO MODIFICATION ---------------------------------------+ + + if ( Trigger && Sound.Alert ) + { + if( Close[0] > UpBuffer[0] && UpBuffer[0]!= EMPTY_VALUE ) { Trigger = False ; Alert(symbol," ", tChartPeriod, " Fiji Trend - BUY "+ DoubleToStr(UpBuffer[0] ,digits)); } + if( Close[0] < DnBuffer[0] && DnBuffer[0]!= EMPTY_VALUE ) { Trigger = False ; Alert(symbol," ", tChartPeriod, " Fiji Trend - SELL "+ DoubleToStr(DnBuffer[0] ,digits)); } + + } + + if(Show.PriceBox) { DoBox() ; } + + OldBars = Bars ; + +//+--------- TRO MODIFICATION ---------------------------------------+ +//---- + return(0); + } +//+------------------------------------------------------------------+ + + +//+--------- TRO MODIFICATION ---------------------------------------+ +void DoBox() +{ + + + if (ObjectFind(tShortName+"01") != 0) + { + ObjectCreate(tShortName+"01",OBJ_ARROW,0,Time[0],UpBuffer[0]); + ObjectSet(tShortName+"01",OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE); + ObjectSet(tShortName+"01",OBJPROP_COLOR,indicator_color1); + ObjectSet(tShortName+"01",OBJPROP_WIDTH,myBoxWidth); + } + else + { + ObjectMove(tShortName+"01",0,Time[0],UpBuffer[0]); + ObjectSet(tShortName+"01",OBJPROP_COLOR,indicator_color1); + } + + if (ObjectFind(tShortName+"02") != 0) + { + ObjectCreate(tShortName+"02",OBJ_ARROW,0,Time[0],DnBuffer[0]); + ObjectSet(tShortName+"02",OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE); + ObjectSet(tShortName+"02",OBJPROP_COLOR,indicator_color2); + ObjectSet(tShortName+"02",OBJPROP_WIDTH,myBoxWidth); + } + else + { + ObjectMove(tShortName+"02",0,Time[0],DnBuffer[0]); + ObjectSet(tShortName+"02",OBJPROP_COLOR,indicator_color2); + } + + + + + return(0); +} + + +//+--------- TRO MODIFICATION ---------------------------------------+ + +string TimeFrameToString(int tf) +{ + string tfs; + switch(tf) { + case PERIOD_M1: tfs="M1" ; break; + case PERIOD_M5: tfs="M5" ; break; + case PERIOD_M15: tfs="M15" ; break; + case PERIOD_M30: tfs="M30" ; break; + case PERIOD_H1: tfs="H1" ; break; + case PERIOD_H4: tfs="H4" ; break; + case PERIOD_D1: tfs="D1" ; break; + case PERIOD_W1: tfs="W1" ; break; + case PERIOD_MN1: tfs="MN"; + } + return(tfs); +} + + + +//+--------- TRO MODIFICATION ---------------------------------------+ \ No newline at end of file diff --git a/holy grail EA.mq4 b/holy grail EA.mq4 new file mode 100644 index 0000000..93c9611 Binary files /dev/null and b/holy grail EA.mq4 differ diff --git a/ifibonacci.mq4 b/ifibonacci.mq4 new file mode 100644 index 0000000..d8a848a Binary files /dev/null and b/ifibonacci.mq4 differ diff --git a/ind_aMU.mq4 b/ind_aMU.mq4 new file mode 100644 index 0000000..ba1ccab --- /dev/null +++ b/ind_aMU.mq4 @@ -0,0 +1,109 @@ +//+------------------------------------------------------------------+ +//| ind_aMU.mq4 | +//| Yuriy Tokman (YTG) | +//| yuriytokman@gmail.com | +//+------------------------------------------------------------------+ +#property copyright "Yuriy Tokman (YTG)" +#property link "yuriytokman@gmail.com" + +#property indicator_chart_window + +#property indicator_buffers 2 +#property indicator_color1 Green +#property indicator_color2 Red +#property indicator_width1 2 +#property indicator_width2 2 + +extern int period_fast = 12; +extern int period_slow = 21; +extern int ma_shift = 0; +extern int ma_method = 0; +extern int applied_price = 0; + +extern string Advisers_free_of_charge = "ytg.com.ua";// EA FREE - ytg.com.ua + +double B0[]; +double B1[]; +//+------------------------------------------------------------------+ +//| Custom indicator initialization function | +//+------------------------------------------------------------------+ +int init() + { +//---- indicators + SetIndexStyle(0, 4); + SetIndexBuffer(0, B0); + SetIndexStyle(1, 4); + SetIndexBuffer(1, B1); + GetAvtor(); +//---- + return(0); + } +//+------------------------------------------------------------------+ +//| Custom indicator deinitialization function | +//+------------------------------------------------------------------+ +int deinit() + { +//---- + +//---- + return(0); + } +//+------------------------------------------------------------------+ +//| Custom indicator iteration function | +//+------------------------------------------------------------------+ +int start() + { +//---- + int limit , i;GetYTG(); + int counted_bars=IndicatorCounted(); + if(counted_bars<0) return(-1); + if(counted_bars>0) counted_bars--; + limit=Bars-counted_bars; + + for(i=0; i2)count = 0; + color color_Y = Red; + color color_T = Lime; + color color_G = Blue; + if(count==1){color_Y = Crimson;color_T = LimeGreen;color_G = DodgerBlue;} + if(count==2){color_Y = OrangeRed;color_T = ForestGreen;color_G = RoyalBlue;} + + Label("ytg_Y","Y" ,3,40,20,25,"Arial Black",color_Y); + Label("ytg_T","T" ,3,25,5,25,"Arial Black",color_T); + Label("ytg_G","G" ,3,13,32,25,"Arial Black",color_G); + } +//----+ \ No newline at end of file diff --git a/rsima_bands nmc 6 lines.mq4 b/rsima_bands nmc 6 lines.mq4 new file mode 100644 index 0000000..d7c46a2 --- /dev/null +++ b/rsima_bands nmc 6 lines.mq4 @@ -0,0 +1,515 @@ +//+------------------------------------------------------------------+ +//| rsimabands | +//| | +//+------------------------------------------------------------------+ + +#property copyright "www.forex-station.com" +#property link "www.forex-station.com" + +#property indicator_separate_window +#property indicator_buffers 7 +#property indicator_color1 clrNONE +#property indicator_color2 clrBlack +#property indicator_color3 clrNONE +#property indicator_color4 clrBlue +#property indicator_color5 clrRed +#property indicator_color6 clrMagenta +#property indicator_color7 clrNONE +#property indicator_width2 2 +#property indicator_width4 2 +#property indicator_width5 2 +#property indicator_width6 9 +#property indicator_width7 2 +#property indicator_levelcolor clrWhite + +// +// +// +// +// + +enum enPrices +{ + pr_close, // Close + pr_open, // Open + pr_high, // High + pr_low, // Low + pr_median, // Median + pr_typical, // Typical + pr_weighted, // Weighted + pr_average, // Average (high+low+open+close)/4 + pr_medianb, // Average median body (open+close)/2 + pr_tbiased, // Trend biased price + pr_haclose, // Heiken ashi close + pr_haopen , // Heiken ashi open + pr_hahigh, // Heiken ashi high + pr_halow, // Heiken ashi low + pr_hamedian, // Heiken ashi median + pr_hatypical, // Heiken ashi typical + pr_haweighted, // Heiken ashi weighted + pr_haaverage, // Heiken ashi average + pr_hamedianb, // Heiken ashi median body + pr_hatbiased // Heiken ashi trend biased price +}; +enum enRsiTypes +{ + rsi_rsi, // Regular RSI + rsi_wil, // Wilders RSI + rsi_rsx, // RSX2 + rsi_cut // Cuttlers RSI +}; + +extern double RsiPeriod = 21; +extern enRsiTypes RsiType = 2; +extern enPrices RsiPrice = 8; +extern int Depth = 2; +extern double Speed = 0.5; +extern int RsiPriceLinePeriod = 2; +extern ENUM_MA_METHOD RsiPriceLineMAMode = MODE_LWMA; +extern int RsiSignalLinePeriod = 7; +extern ENUM_MA_METHOD RsiSignalLineMAMode = MODE_LWMA; +extern int VolatilityBandPeriod = 34; +extern ENUM_MA_METHOD VolatilityBandMAMode = MODE_LWMA; +extern double VolatilityBandMultiplier = 2.00; +extern double LevelDn = 15; +extern double LevelDn1 = -11; +extern double LevelMid = 35; +extern double LevelMid1 = 65; +extern double LevelUp = 85; +extern double LevelUp1 = 115; +extern bool ColorOnSlope = true; +extern bool verticalLinesVisible = false; // Show vertical lines +extern bool linesOnNewest = true; // Lines on newest bar? +extern string verticalLinesID = "TDI Lines"; // Lines ID +extern color verticalLinesUpColor = clrDeepSkyBlue; // Lines up color +extern color verticalLinesDnColor = clrPaleVioletRed; // Lines down color +extern ENUM_LINE_STYLE verticalLinesStyle = STYLE_DOT; // Lines style +extern int verticalLinesWidth = 0; // lines width + +// +// +// +// +// + +double rsi[]; +double rsiPriceLine[]; +double buffer1[]; +double buffer2[]; +double rsiSignalLine[]; +double bandUp[]; +double bandMiddle[]; +double bandDown[]; +double slope[]; +double trend[]; + +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +// +// +// +// +// + +int init() +{ + IndicatorBuffers(10); + SetIndexBuffer(0,bandUp); + SetIndexBuffer(1,bandMiddle); + SetIndexBuffer(2,bandDown); + SetIndexBuffer(3,rsiPriceLine); + SetIndexBuffer(4,buffer1); + SetIndexBuffer(5,buffer2); + SetIndexBuffer(6,rsiSignalLine); + SetIndexBuffer(7,rsi); + SetIndexBuffer(8,slope); + SetIndexBuffer(9,trend); + SetLevelValue(0,LevelUp); + SetLevelValue(1,LevelUp1); + SetLevelValue(2,LevelMid); + SetLevelValue(3,LevelMid1); + SetLevelValue(4,LevelDn); + SetLevelValue(5,LevelDn1); + + Speed = MathMax(MathMin(1.5,Speed),0.1); + Depth = MathMax(MathMin(10 ,Depth),1); + + IndicatorShortName(getRsiName((int)RsiType)+ " Ma ("+DoubleToStr(RsiPeriod,2)+")"); + +return(0); +} +int deinit() +{ + string tlookFor = verticalLinesID+":"; + int tlookForLength = StringLen(tlookFor); + for (int i=ObjectsTotal()-1; i>=0; i--) + { + string objectName = ObjectName(i); + if (StringSubstr(objectName,0,tlookForLength) == tlookFor) ObjectDelete(objectName); + } +return(0); +} +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +// +// +// +// +// + +int start() +{ + int counted_bars=IndicatorCounted(); + int i,limit; + + if(counted_bars<0) return(-1); + if(counted_bars>0) counted_bars--; + limit = MathMin(Bars-counted_bars,Bars-1); + + // + // + // + // + // + + if (slope[limit]==-1) CleanPoint(limit,buffer1,buffer2); + for (i=limit; i >= 0; i--) rsi[i] = iRsi(getPrice(RsiPrice,Open,Close,High,Low,i),RsiPeriod,RsiType,i); + for (i=limit; i >= 0; i--) + { + rsiPriceLine[i] = iMAOnArray(rsi,0,RsiPriceLinePeriod,0,RsiPriceLineMAMode,i); + rsiSignalLine[i] = iMAOnArray(rsi,0,RsiSignalLinePeriod,0,RsiSignalLineMAMode,i); + double deviation = iStdDevOnArray(rsi,0,VolatilityBandPeriod,0,VolatilityBandMAMode,i); + double average = iMAOnArray(rsi,0,VolatilityBandPeriod,0,VolatilityBandMAMode,i); + bandUp[i] = average+VolatilityBandMultiplier*deviation; + bandDown[i] = average-VolatilityBandMultiplier*deviation; + bandMiddle[i] = average; + buffer1[i] = EMPTY_VALUE; + buffer2[i] = EMPTY_VALUE; + trend[i] = (i50) ? 1 : (rsiPriceLine[i]<50) ? -1 : trend[i+1] : 0; + slope[i] = slope[i+1]; + if (ColorOnSlope) + { + if (rsiPriceLine[i]>rsiPriceLine[i+1]) slope[i] = 1; + if (rsiPriceLine[i]rsiSignalLine[i]) slope[i] = 1; + if (rsiPriceLine[i]=pr_haclose && price<=pr_hatbiased) + { + if (ArrayRange(workHa,0)!= Bars) ArrayResize(workHa,Bars); + int r = Bars-i-1; + + // + // + // + // + // + + double haOpen; + if (r>0) + haOpen = (workHa[r-1][instanceNo+2] + workHa[r-1][instanceNo+3])/2.0; + else haOpen = (open[i]+close[i])/2; + double haClose = (open[i] + high[i] + low[i] + close[i]) / 4.0; + double haHigh = MathMax(high[i], MathMax(haOpen,haClose)); + double haLow = MathMin(low[i] , MathMin(haOpen,haClose)); + + if(haOpen haOpen) + return((haHigh+haClose)/2.0); + else return((haLow+haClose)/2.0); + } + } + + // + // + // + // + // + + switch (price) + { + case pr_close: return(close[i]); + case pr_open: return(open[i]); + case pr_high: return(high[i]); + case pr_low: return(low[i]); + case pr_median: return((high[i]+low[i])/2.0); + case pr_medianb: return((open[i]+close[i])/2.0); + case pr_typical: return((high[i]+low[i]+close[i])/3.0); + case pr_weighted: return((high[i]+low[i]+close[i]+close[i])/4.0); + case pr_average: return((high[i]+low[i]+close[i]+open[i])/4.0); + case pr_tbiased: + if (close[i]>open[i]) + return((high[i]+close[i])/2.0); + else return((low[i]+close[i])/2.0); + } + return(0); +} + +//------------------------------------------------------------------ +// +//------------------------------------------------------------------ +// +// +// +// +// +// + +string rsiMethodNames[] = {"rsi","Wilders rsi","rsx2","Cuttler RSI"}; +string getRsiName(int method) +{ + int max = ArraySize(rsiMethodNames)-1; + method=MathMax(MathMin(method,max),0); return(rsiMethodNames[method]); +} + + +// +// +// +// +// + +double workRsi[][13]; +#define _price 0 +#define _change 1 +#define _changa 2 + +double iRsi(double price, double period, int rsiMode, int i, int instanceNo=0) +{ + if (ArrayRange(workRsi,0)!=Bars) ArrayResize(workRsi,Bars); + int z = instanceNo*13; + int r = Bars-i-1; + + // + // + // + // + // + + workRsi[r][z+_price] = price; + switch (rsiMode) + { + case 0: + double alpha = 1.0/period; + if (r=0; k++) sum += MathAbs(workRsi[r-k][z+_price]-workRsi[r-k-1][z+_price]); + workRsi[r][z+_change] = (workRsi[r][z+_price]-workRsi[0][z+_price])/MathMax(k,1); + workRsi[r][z+_changa] = sum/MathMax(k,1); + } + else + { + double change = workRsi[r][z+_price]-workRsi[r-1][z+_price]; + workRsi[r][z+_change] = workRsi[r-1][z+_change] + alpha*( change - workRsi[r-1][z+_change]); + workRsi[r][z+_changa] = workRsi[r-1][z+_changa] + alpha*(MathAbs(change) - workRsi[r-1][z+_changa]); + } + if (workRsi[r][z+_changa] != 0) + return(50.0*(workRsi[r][z+_change]/workRsi[r][z+_changa]+1)); + else return(50.0); + + // + // + // + // + // + + case 1 : + workRsi[r][z+1] = iSmma(0.5*(MathAbs(workRsi[r][z+_price]-workRsi[r-1][z+_price])+(workRsi[r][z+_price]-workRsi[r-1][z+_price])),0.5*(period-1),Bars-i-1,instanceNo*2+0); + workRsi[r][z+2] = iSmma(0.5*(MathAbs(workRsi[r][z+_price]-workRsi[r-1][z+_price])-(workRsi[r][z+_price]-workRsi[r-1][z+_price])),0.5*(period-1),Bars-i-1,instanceNo*2+1); + if((workRsi[r][z+1] + workRsi[r][z+2]) != 0) + return(100.0 * workRsi[r][z+1]/(workRsi[r][z+1] + workRsi[r][z+2])); + else return(50); + + // + // + // + // + // + + case 2 : + double Kg = (3.0)/(2.0+period), Hg = 1.0-Kg; + if (r 0) sump += diff; + if (diff < 0) sumn -= diff; + } + if (sumn > 0) + return(100.0-100.0/(1.0+sump/sumn)); + else return(50); + } + return(50); +} + +// +// +// +// +// + +double workSmma[][2]; +double iSmma(double price, double period, int r, int instanceNo=0) +{ + if (ArrayRange(workSmma,0)!= Bars) ArrayResize(workSmma,Bars); + + // + // + // + // + // + + if (r