#property copyright "royston" #property link "" #property indicator_separate_window #property indicator_minimum 0.0 #property indicator_maximum 100.0 #property indicator_buffers 2 #property indicator_color1 OrangeRed #property indicator_color2 Green extern int TimeFrame1 = 15; extern int Line_ht = 80; extern int TRIX_Period = 3; extern int CountBars = 5000; extern int arrow = 110; extern string Notes = "next drag 3 times into SAME window"; extern string new_settings = "tf=30, ht=55, then 60,30, then 240,5,"; extern bool ShowNext = TRUE; extern int arrowdown = 234; extern int arrowup = 233; extern color colour_arrowdown = Red; extern color colour_arrowup = Green; extern int vertical_adjustment = 6; double g_ibuf_136[]; double g_ibuf_140[]; double g_color_144; string gs_152 = ""; string g_name_160 = ""; int init() { SetIndexStyle(0, DRAW_ARROW); SetIndexArrow(0, arrow); SetIndexBuffer(0, g_ibuf_136); SetIndexEmptyValue(0, EMPTY_VALUE); SetIndexLabel(0, NULL); SetIndexStyle(1, DRAW_ARROW); SetIndexArrow(1, arrow); SetIndexBuffer(1, g_ibuf_140); SetIndexEmptyValue(1, EMPTY_VALUE); SetIndexLabel(1, NULL); TimeFrame1 = MathMax(TimeFrame1, Period()); string ls_unused_0 = " "; string ls_unused_8 = " "; IndicatorShortName("."); switch (TimeFrame1) { case 1: gs_152 = "Period M1"; break; case 5: gs_152 = "Period M5"; break; case 15: gs_152 = "Period M15"; break; case 30: gs_152 = "Period M30"; break; case 60: gs_152 = "Period H1"; break; case 240: gs_152 = "Period H4"; break; case 1440: gs_152 = "Period D1"; break; case 10080: gs_152 = "Period W1"; break; case 43200: gs_152 = "Period MN1"; break; default: TimeFrame1 = Period(); init(); return (0); } gs_152 = gs_152 + " TRIX"; IndicatorDigits(1); return (0); } int deinit() { if (g_name_160 != "") if (ObjectFind(g_name_160) != -1) ObjectDelete(g_name_160); return (0); } int start() { int l_shift_12; double l_icustom_16; int l_shift_24; double l_icustom_28; double l_icustom_36; string l_text_44; int l_window_52; int li_8 = IndicatorCounted(); if (li_8 < 0) return (-1); if (li_8 > 0) li_8--; int li_4 = Bars - li_8; if (TimeFrame1 != Period()) li_4 = MathMax(li_4, TimeFrame1 / Period()); for (int li_0 = li_4; li_0 >= 0; li_0--) { l_shift_12 = iBarShift(NULL, TimeFrame1, Time[li_0 + TimeFrame1 / Period()]); l_icustom_16 = iCustom(NULL, TimeFrame1, "smSuper TRIX_v1", TRIX_Period, "", 1, 1, 1, "", 0, "", 0, 0, 0, CountBars, 0, l_shift_12); g_ibuf_136[li_0] = EMPTY_VALUE; g_ibuf_140[li_0] = EMPTY_VALUE; if (l_icustom_16 < 0.0 && l_shift_12 != 0) g_ibuf_136[li_0] = Line_ht; if (l_icustom_16 > 0.0 && l_shift_12 != 0) g_ibuf_140[li_0] = Line_ht; if (ShowNext) { l_shift_24 = iBarShift(NULL, TimeFrame1, Time[li_0]); l_icustom_28 = iCustom(NULL, TimeFrame1, "smSuper TRIX_v1", TRIX_Period, "", 1, 1, 1, "", 0, "", 0, 0, 0, CountBars, 0, l_shift_24); l_icustom_36 = iCustom(NULL, TimeFrame1, "smSuper TRIX_v1", TRIX_Period, "", 1, 1, 1, "", 0, "", 0, 0, 0, CountBars, 0, l_shift_24 + 1); if (l_icustom_28 > l_icustom_36) l_text_44 = " " + CharToStr(arrowup); if (l_icustom_28 > 0.0) g_color_144 = colour_arrowup; if (l_icustom_28 < l_icustom_36) l_text_44 = " " + CharToStr(arrowdown); if (l_icustom_28 < 0.0) g_color_144 = colour_arrowdown; l_window_52 = WindowFind(gs_152); if (l_window_52 == -1) l_window_52 = WindowOnDropped(); g_name_160 = gs_152 + " " + l_window_52; if (ObjectFind(g_name_160) == -1) ObjectCreate(g_name_160, OBJ_TEXT, l_window_52, Time[li_0], Line_ht + vertical_adjustment); else ObjectMove(g_name_160, 0, Time[li_0], Line_ht + vertical_adjustment); ObjectSetText(g_name_160, l_text_44, 8, "Wingdings", g_color_144); } } return (0); }