//@version=2 study(title='[RS]Linear Regression Bull and Bear Power V0', shorttitle='BBP', overlay=false) window = input(title='Lookback Window:', type=integer, defval=10) f_exp_lr(_height, _length)=> _ret = _height + (_height/_length) h_value = highest(close, window) l_value = lowest(close, window) h_bar = n-highestbars(close, window) l_bar = n-lowestbars(close, window) bear = 0-f_exp_lr(h_value-close, n-h_bar) bull = 0+f_exp_lr(close-l_value, n-l_bar) plot(title='Bear', series=bear, style=columns, color=maroon) plot(title='Bull', series=bull, style=columns, color=green)
I leave that decision up to you Ricardo since I don't fully grasp the implications. The idea is to have a view of the net bull-bear accumulation on the daily (for example), and underneath that the net accumulation on the weekly (or any higher timeframe, for example). So making the prefered timeframe an input would be ideal (preferably without having to calibrate length values). Thanks in advance!