//@version=5 indicator('Ehlers Decycler', overlay=true, timeframe = '', timeframegaps =…
- User
//@version=5 indicator('Ehlers Decycler', overlay=true, timeframe = '', timeframe_gaps = true)
length = input.int ( 60, 'Length') src = input.source(close, 'Source')
clr_mono = input.color(color.blue, 'Colors ', inline='colors') clr_up = input.color(color.green, '', inline='colors') clr_dn = input.color(color.red, '', inline='colors')
smart_clr_ON = input.bool(true, 'Colorize.', inline = 'line')
line_width = input.int(2, 'Line width: ', minval = 1, maxval=20, inline = 'line')
//■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
Decycler(float src, int length) => PIx2_Length = 2 * math.pi / length
codecos = math.cos(PIx2_Length) alpha = 0.0 alpha := cos != 0 ? (cos + math.sin(PIx2_Length) - 1) / cos : nz(alpha[1]) decycler = 0.0 decycler := alpha / 2 * (src + nz(src[1])) + (1 - alpha) * nz(decycler[1]) decycler//
//🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰🀰
MA_Smart_Color(float ma, bool smart_clr_ON, color color_up, color color_dn, color clr) =>
codecolor clr_ma = na clr_ma := switch not smart_clr_ON => clr // Mono color ma > ma[1] => color_up // Up ma < ma[1] => color_dn // Down => clr_ma[1] // The same // clr_ma//
//■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
ma = Decycler(src, length)
clr_ma = MA_Smart_Color(ma, smart_clr_ON, clr_up, clr_dn, clr_mono)
plot(ma, 'Decycler', clr_ma, line_width)
//■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
EVENT_up = ma > ma[1] and barstate.isconfirmed EVENT_dn = ma < ma[1] and barstate.isconfirmed
alertcondition(EVENT_up, 'Trend up', 'Trend up') alertcondition(EVENT_dn, 'Trend dn', 'Trend dn')
//■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 帮我注释好每一句代码
- Assistant