#property copyright "Copyright (c) 2008, TRC Holdings Co. Ltd." #property link "http://trc-hd.com/" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Black #property indicator_color2 Black int gia_76[4]; int gi_80 = 0; double g_ibuf_84[]; double g_ibuf_88[]; extern double R_BUY_RCI_9 = -79.0; extern double R_BUY_RCI_14 = -79.0; extern double R_BUY_RCI_26 = -79.0; extern double R_BUY_RCI_52 = -79.0; extern double R_SELL_RCI_9 = 79.0; extern double R_SELL_RCI_14 = 79.0; extern double R_SELL_RCI_26 = 79.0; extern double R_SELL_RCI_52 = 79.0; extern color R_BUY_DISP_COLOR = Blue; extern color R_SELL_DISP_COLOR = Red; extern bool ALERT_DISP = FALSE; double gd_168 = -79.0; double gd_176 = 79.0; extern bool Debug = FALSE; extern double Sell_Shift = 0.0; extern double Buy_Shift = 0.0; double Sell_def(double ad_0, double ad_8) { if (ad_0 > 99.9 || ad_0 < 0.0) return (ad_8); return (ad_0); } double Buy_def(double ad_0, double ad_8) { if (ad_0 < -99.9 || ad_0 > 0.0) return (ad_8); return (ad_0); } int Chk_Over(double ad_0, double ad_8) { if (ad_0 > ad_8) return (0); return (1); } int Chk_Under(double ad_0, double ad_8) { if (ad_0 < ad_8) return (0); return (1); } int Chk_Alert(int ai_0, int ai_4) { if (ai_0 != 0 && ai_4 == 1) return (1); return (0); } int init() { SetIndexBuffer(0, g_ibuf_84); SetIndexBuffer(1, g_ibuf_88); SetIndexLabel(0, ""); SetIndexLabel(1, ""); gia_76[0] = 9; gia_76[1] = 14; gia_76[2] = 26; gia_76[3] = 52; R_BUY_RCI_9 = Buy_def(R_BUY_RCI_9, gd_168); R_BUY_RCI_14 = Buy_def(R_BUY_RCI_14, gd_168); R_BUY_RCI_26 = Buy_def(R_BUY_RCI_26, gd_168); R_BUY_RCI_52 = Buy_def(R_BUY_RCI_52, gd_168); R_SELL_RCI_9 = Sell_def(R_SELL_RCI_9, gd_176); R_SELL_RCI_14 = Sell_def(R_SELL_RCI_14, gd_176); R_SELL_RCI_26 = Sell_def(R_SELL_RCI_26, gd_176); R_SELL_RCI_52 = Sell_def(R_SELL_RCI_52, gd_176); return (0); } int deinit() { for (int l_count_0 = 0; l_count_0 < gi_80; l_count_0++) ObjectDelete("MAXSystem_R_Pattern_RCI" + l_count_0); return (0); } int start() { int l_ind_counted_0 = IndicatorCounted(); int li_4 = Bars - l_ind_counted_0; if (l_ind_counted_0 == 0) li_4 = Bars - 53; if (Debug == TRUE) Print("calculaed_bar:", l_ind_counted_0, "Bars:", Bars); for (int li_8 = li_4 - 1; li_8 > 0; li_8--) { g_ibuf_84[li_8] = EMPTY_VALUE; if (Chk_R_Buy(li_8 + 1) == 1) { ObjectCreate("MAXSystem_R_Pattern_RCI" + gi_80, OBJ_TEXT, 0, Time[li_8], Low[li_8] + Buy_Shift); ObjectSetText("MAXSystem_R_Pattern_RCI" + gi_80, "R", 14, "Arial", R_BUY_DISP_COLOR); gi_80++; g_ibuf_84[li_8] = Low[li_8]; if (Chk_Alert(l_ind_counted_0, ALERT_DISP) == 1) Alert("R_Buy_Signal ", Symbol(), " at ", Low[li_8]); } g_ibuf_88[li_8] = EMPTY_VALUE; if (Chk_R_Sell(li_8 + 1) == 1) { ObjectCreate("MAXSystem_R_Pattern_RCI" + gi_80, OBJ_TEXT, 0, Time[li_8], High[li_8] + Sell_Shift); ObjectSetText("MAXSystem_R_Pattern_RCI" + gi_80, "R", 14, "Arial", R_SELL_DISP_COLOR); gi_80++; g_ibuf_88[li_8] = High[li_8]; if (Chk_Alert(l_ind_counted_0, ALERT_DISP) == 1) Alert("R_Sell_Signal ", Symbol(), " at ", High[li_8]); } } return (0); } int Chk_R_Buy(int ai_0) { double lda_4[4]; double lda_8[4]; for (int li_12 = 3; li_12 >= 0; li_12--) { lda_4[li_12] = iCustom(NULL, 0, "RCI", gia_76[li_12], 0, ai_0 - 1); lda_8[li_12] = iCustom(NULL, 0, "RCI", gia_76[li_12], 0, ai_0); } int li_16 = 0; li_16 += Chk_Under(R_BUY_RCI_9, lda_8[0]); li_16 += Chk_Under(R_BUY_RCI_14, lda_8[1]); li_16 += Chk_Under(R_BUY_RCI_26, lda_8[2]); li_16 += Chk_Under(R_BUY_RCI_52, lda_8[3]); if (li_16 < 2) return (0); int li_20 = 0; li_20 += Chk_Under(R_BUY_RCI_9, lda_4[0]); li_20 += Chk_Under(R_BUY_RCI_14, lda_4[1]); li_20 += Chk_Under(R_BUY_RCI_26, lda_4[2]); li_20 += Chk_Under(R_BUY_RCI_52, lda_4[3]); if (li_16 <= li_20) return (0); return (1); } int Chk_R_Sell(int ai_0) { double lda_4[4]; double lda_8[4]; for (int li_12 = 3; li_12 >= 0; li_12--) { lda_4[li_12] = iCustom(NULL, 0, "RCI", gia_76[li_12], 0, ai_0 - 1); lda_8[li_12] = iCustom(NULL, 0, "RCI", gia_76[li_12], 0, ai_0); } int li_16 = 0; li_16 += Chk_Over(R_SELL_RCI_9, lda_8[0]); li_16 += Chk_Over(R_SELL_RCI_14, lda_8[1]); li_16 += Chk_Over(R_SELL_RCI_26, lda_8[2]); li_16 += Chk_Over(R_SELL_RCI_52, lda_8[3]); if (li_16 < 2) return (0); int li_20 = 0; li_20 += Chk_Over(R_SELL_RCI_9, lda_4[0]); li_20 += Chk_Over(R_SELL_RCI_14, lda_4[1]); li_20 += Chk_Over(R_SELL_RCI_26, lda_4[2]); li_20 += Chk_Over(R_SELL_RCI_52, lda_4[3]); if (li_16 <= li_20) return (0); return (1); }