#property copyright "Copyright © 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[2]; int gi_80 = 0; double g_ibuf_84[]; double g_ibuf_88[]; extern double T_BUY_RCI_26 = 69.0; extern double T_BUY_RCI_52 = 69.0; extern double T_SELL_RCI_26 = -69.0; extern double T_SELL_RCI_52 = -69.0; extern bool T_Sign = FALSE; extern color T_BUY_DISP_COLOR = Blue; extern color T_SELL_DISP_COLOR = Red; extern bool ALERT_DISP = FALSE; double gd_140 = -69.0; double gd_148 = 69.0; extern double Sell_Shift = 0.0; extern double Buy_Shift = 0.0; extern bool Debug = FALSE; 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, ""); T_BUY_RCI_26 = Buy_def(T_BUY_RCI_26, gd_140); T_BUY_RCI_52 = Buy_def(T_BUY_RCI_52, gd_140); T_SELL_RCI_26 = Sell_def(T_SELL_RCI_26, gd_148); T_SELL_RCI_52 = Sell_def(T_SELL_RCI_52, gd_148); gia_76[0] = 26; gia_76[1] = 52; return (0); } int deinit() { for (int l_count_0 = 0; l_count_0 < gi_80; l_count_0++) ObjectDelete("MAXSystem_T_Pattern_RCI" + l_count_0); return (0); } int start() { if (T_Sign == FALSE) return (0); 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_T_Buy(li_8 + 1) == 1) { ObjectCreate("MAXSystem_T_Pattern_RCI" + gi_80, OBJ_TEXT, 0, Time[li_8], Low[li_8] + Buy_Shift); ObjectSetText("MAXSystem_T_Pattern_RCI" + gi_80, "T", 14, "Arial", T_BUY_DISP_COLOR); gi_80++; g_ibuf_84[li_8] = Low[li_8]; if (Chk_Alert(l_ind_counted_0, ALERT_DISP) == 1) Alert("T_Buy_Signal ", Symbol(), " at ", Low[li_8]); } g_ibuf_88[li_8] = EMPTY_VALUE; if (Chk_T_Sell(li_8 + 1) == 1) { ObjectCreate("MAXSystem_T_Pattern_RCI" + gi_80, OBJ_TEXT, 0, Time[li_8], High[li_8] + Sell_Shift); ObjectSetText("MAXSystem_T_Pattern_RCI" + gi_80, "T", 14, "Arial", T_SELL_DISP_COLOR); gi_80++; g_ibuf_88[li_8] = High[li_8]; if (Chk_Alert(l_ind_counted_0, ALERT_DISP) == 1) Alert("T_Sell_Signal ", Symbol(), " at ", High[li_8]); } } return (0); } int Chk_T_Buy(int ai_0) { double lda_4[2]; for (int li_8 = 1; li_8 >= 0; li_8--) lda_4[li_8] = iCustom(NULL, 0, "RCI", gia_76[li_8], 0, ai_0 - 1); int li_12 = 0; li_12 += Chk_Under(T_BUY_RCI_26, lda_4[0]); li_12 += Chk_Under(T_BUY_RCI_52, lda_4[1]); if (Debug == TRUE) Print("rci[0]", DoubleToStr(lda_4[0], 2), "rci[1]", DoubleToStr(lda_4[1], 2)); if (li_12 < 2) return (0); return (1); } int Chk_T_Sell(int ai_0) { double lda_4[2]; for (int li_8 = 1; li_8 >= 0; li_8--) lda_4[li_8] = iCustom(NULL, 0, "RCI", gia_76[li_8], 0, ai_0 - 1); int li_12 = 0; li_12 += Chk_Over(T_SELL_RCI_26, lda_4[0]); li_12 += Chk_Over(T_SELL_RCI_52, lda_4[1]); if (Debug == TRUE) Print("rci[0]", DoubleToStr(lda_4[0], 2), "rci[1]", DoubleToStr(lda_4[1], 2)); if (li_12 < 2) return (0); return (1); }