//@version=5 //////////////////////////////////////////////////////////// // Copyright by HPotter v1.0 10/04/2017 // This simple indicator gives you a lot of useful information - when to enter, when to exit // and how to reduce risks by entering a trade on a double confirmed signal. // You can use in the xPrice any series: Open, High, Low, Close, HL2, HLC3, OHLC4 and ect... // // Added Alerts when signal changes. //////////////////////////////////////////////////////////// indicator(title='FX Sniper: T3-CCI Strategy', shorttitle='T3-CCI') CCI_Period = input.int(14, minval=1) T3_Period = input.int(5, minval=1) b = input(0.618) hline(0, color=color.purple, linestyle=hline.style_solid) hline(200, color=#FC8A8A, linestyle=hline.style_solid) hline(-200, color=#008000, linestyle=hline.style_solid) e1 = 0.0 e2 = 0.0 e3 = 0.0 e4 = 0.0 e5 = 0.0 e6 = 0.0 pos = 0.0 xPrice = close b2 = b * b b3 = b2 * b c1 = -b3 c2 = 3 * (b2 + b3) c3 = -3 * (2 * b2 + b + b3) c4 = 1 + 3 * b + b3 + 3 * b2 nn = T3_Period < 1 ? 1 : T3_Period nr = 1 + 0.5 * (nn - 1) w1 = 2 / (nr + 1) w2 = 1 - w1 xcci = ta.cci(xPrice, CCI_Period) e1 := w1 * xcci + w2 * nz(e1[1]) e2 := w1 * e1 + w2 * nz(e2[1]) e3 := w1 * e2 + w2 * nz(e3[1]) e4 := w1 * e3 + w2 * nz(e4[1]) e5 := w1 * e4 + w2 * nz(e5[1]) e6 := w1 * e5 + w2 * nz(e6[1]) xccir = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3 iff_1 = xccir < 0 ? color.red : color.black cciHcolor = xccir >= 0 ? color.green : iff_1 iff_2 = xccir < 0 ? -1 : nz(pos[1], 0) pos := xccir > 0 ? 1 : iff_2 barcolor(pos == -1 ? color.red : pos == 1 ? color.green : color.blue) alertcondition(pos != pos[1] and pos == 1, title='Buy Signal', message='Buy') alertcondition(pos != pos[1] and pos == -1, title='Sell Signal', message='Sell') barcolor(pos == -1 ? color.red : pos == 1 ? color.green : color.blue) plot(xccir, color=color.new(color.blue, 0), title='T3-CCI') plot(xccir, color=cciHcolor, title='CCIH', style=plot.style_histogram)