#property copyright "Copyright © 2008, Group Three LLC" #property link "" #property indicator_chart_window #property indicator_buffers 8 #property indicator_color1 Black #property indicator_color2 Blue #property indicator_color3 Green #property indicator_color4 Crimson #property indicator_color5 Black #property indicator_color6 DarkTurquoise #property indicator_color7 Green #property indicator_color8 Red int gi_76; int gi_80 = 0; double g_ibuf_84[]; double g_ibuf_88[]; double g_ibuf_92[]; double g_ibuf_96[]; double g_ibuf_100[]; double g_ibuf_104[]; double g_ibuf_108[]; double g_ibuf_112[]; double gd_116; int init() { int li_4; double ld_8; double ld_16; int li_24; if (IsDllsAllowed() == FALSE) { Alert("Allow for DLL calls in the \'properties-->common\' popup window"); ld_8 = 0; ld_16 = 1 / ld_8; return (0); } int li_0 = 8; if (Period() <= 10) li_4 = 20; if (Period() == PERIOD_M15) li_4 = 20; if (Period() == PERIOD_M30) li_4 = 20; if (Period() == PERIOD_H1) li_4 = 30; if (Period() == PERIOD_H4) li_4 = 45; if (Period() >= PERIOD_D1) li_4 = 90; gd_116 = li_4 * Point; IndicatorBuffers(8); SetIndexBuffer(0, g_ibuf_84); SetIndexBuffer(1, g_ibuf_88); SetIndexBuffer(2, g_ibuf_92); SetIndexBuffer(3, g_ibuf_96); SetIndexBuffer(4, g_ibuf_100); SetIndexBuffer(5, g_ibuf_104); SetIndexBuffer(6, g_ibuf_108); SetIndexBuffer(7, g_ibuf_112); SetIndexStyle(0, DRAW_NONE); SetIndexStyle(1, DRAW_NONE); SetIndexStyle(2, DRAW_LINE, EMPTY, 2); SetIndexStyle(3, DRAW_LINE, EMPTY, 2); SetIndexStyle(4, DRAW_LINE, EMPTY, 2); SetIndexStyle(5, DRAW_NONE); SetIndexStyle(5, DRAW_ARROW); SetIndexArrow(5, 116); SetIndexEmptyValue(5, 0.0); SetIndexStyle(6, DRAW_LINE, STYLE_DASHDOT, 1, DarkGreen); SetIndexStyle(7, DRAW_LINE, STYLE_DASHDOT, 1, Red); IndicatorDigits(Digits); SetIndexDrawBegin(0, li_0); SetIndexDrawBegin(1, li_0); SetIndexDrawBegin(2, li_0); SetIndexDrawBegin(3, li_0); SetIndexDrawBegin(4, li_0); SetIndexDrawBegin(5, li_0); SetIndexDrawBegin(6, li_0); SetIndexDrawBegin(7, li_0); SetIndexLabel(4, "Adaptive Filter"); SetIndexLabel(1, "Slow Filter"); SetIndexLabel(2, "Up Trend Bias"); SetIndexLabel(3, "Down Trend Bias"); SetIndexLabel(5, "End of Trend"); SetIndexLabel(6, "Trailer"); SetIndexLabel(7, "Trailer"); IndicatorShortName("Quantum Filters"); return (0); } int deinit() { ObjectsDeleteAll(); Comment(" "); return (0); } void IsLicenseValid() { int li_8; int li_0 = 0; int li_4 = 0; if (li_4 == -1) Comment("Connecting to the server..."); if (li_4 == 1) { Comment("Invalid License. Please contact Quantum"); li_8 = 1 / li_0; } } int start() { double ld_4; double l_ima_on_arr_12; double ld_unused_20; double ld_unused_28; double ld_36; double ld_52; bool li_68; bool li_72; int li_76; IsLicenseValid(); gi_80 = IndicatorCounted(); if (gi_80 < 0) return (-1); if (gi_80 > 0) gi_80--; gi_76 = Bars - 1; for (int li_0 = gi_76 - gi_80; li_0 >= 0; li_0--) { ld_4 = QFltr(li_0); g_ibuf_100[li_0] = ld_4; g_ibuf_84[li_0] = ld_4; li_68 = ld_4 < g_ibuf_84[li_0 + 1]; li_72 = ld_4 > g_ibuf_84[li_0 + 1]; g_ibuf_92[li_0] = g_ibuf_92[li_0 + 1]; g_ibuf_96[li_0] = g_ibuf_96[li_0 + 1]; if (li_68) g_ibuf_92[li_0] = ld_4; if (li_72) g_ibuf_96[li_0] = ld_4; ld_36 = 0.0; ld_52 = 10000.0; for (int li_96 = li_0; li_96 < li_0 + 13; li_96++) { ld_36 = MathMax(ld_36, Low[li_96 + 3]); ld_52 = MathMin(ld_52, High[li_96 + 3]); } g_ibuf_108[li_0] = ld_36 - gd_116; g_ibuf_112[li_0] = ld_52 + gd_116; } for (int li_100 = 0; li_100 < gi_76 - gi_80; li_100++) { l_ima_on_arr_12 = iMAOnArray(g_ibuf_84, 0, 4, 0, MODE_SMA, li_100); g_ibuf_88[li_100] = 10.0 * Point * MathRound(l_ima_on_arr_12 / 10.0 / Point); } for (li_100 = 0; li_100 < gi_76 - gi_80; li_100++) { ld_unused_20 = g_ibuf_108[li_100]; ld_unused_28 = g_ibuf_112[li_100]; g_ibuf_104[li_100] = li_76 * g_ibuf_84[li_100]; } return (0); } double OWMEstim(int ai_0) { double l_ima_12 = iMA(NULL, 0, 2, 0, MODE_SMA, PRICE_OPEN, ai_0); double ld_ret_4 = (l_ima_12 + Open[ai_0]) / 2.0; return (ld_ret_4); } double NASASc(int ai_0) { double l_icustom_4 = iCustom(NULL, 0, "QuantumFilterOsc", 0, ai_0); double ld_12 = l_icustom_4 * l_icustom_4; double ld_20 = ld_12 * ld_12; double ld_44 = MathPow(0.60217 * l_icustom_4 + 0.0645, 3); double ld_36 = ((-ld_12) + MathSqrt(ld_20 + 32.0 * ld_12)) / 8.0; double ld_ret_28 = 0.7 * ld_44 + ld_36 / 2.0; return (ld_ret_28); } double QFltr(int ai_0) { double ld_ret_4; double ld_20; double ld_28; if (ai_0 >= gi_76) ld_ret_4 = OWMEstim(ai_0); else { ld_20 = g_ibuf_84[ai_0 + 1]; ld_28 = NASASc(ai_0); ld_ret_4 = ld_20 + ld_28 * (OWMEstim(ai_0) - ld_20); } return (ld_ret_4); }