This library contains Chikou Filter function to enhances functionality of Chikou-Span from using a simple trend filter.
Chikou is basically close value of ticker offset to close and it is a good for indicating if close value has crossed potential zone from past. Chikou is usually used with 26 period.
Chikou filter uses a lookback length calculated from provided lookback percentage and checks if trend was or within that lookback period.
Bullish : Trend is if Chikou span is above high values of all candles within defined lookback period. Bull color shows .
Bearish: Trend is if Chikou span is below low values of all candles within defined lookback period. This is indicated by color.
Reversal / : Reversal color indicates that Chikou are swinging around candles within defined lookback period which is an indication of consolidation or trend reversal.
chikou( src , len , perc, _high, _low, bull_col, bear_col, r_col) Chikou Filter for with Color and Signal Output
src: Price Source (better to use (OHLC4+high+low/3 instead of default close value)
len: Chikou Legth (displaced source value)
perc: Percentage lookback period for Chikou Filter with defined how much candels of total length should be considered for backward filteration
_high: Ticker High Value
_low: Ticker Low Value
bull_col: Color to be returned if source value is greater than all candels within provided lookback percentage.
bear_col: Color to be returned if source value is lower than all candels within provided lookback percentage.
r_col: Color to be returned if source value is swinging around candles within defined lookback period which is an indication of consolidation or trend reversal.
Returns: Color based on trend. 'bull_col' if trend is , 'bear_col' if trend is . 'r_col' if no prominent trend. Integer Signal is also returned as 1 for , -1 for and 0 for no prominent trend.
Updated: Erased lookback percentage and let the function work only based on Chikou (displaced Source) length with same results as before
In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in a publication is governed by House Rules.
Copy the following line and paste it in your script.