What I added is a signal line that indicates when to buy and when to sell.
Advised use :
Combine with a zero-lag indicator like ZeroLagEMA_LB by LazyBear (suggested period = 34)
Then use the following Rules of engagement :
Current price > & Signal line of BBP_NM is green : BUY
Current price < & Signal line of BBP_NM is red : SELL Please click the like button if you dig this indicator !
//@version=1 // this code uses the Linear Regression Bull and Bear Power indicator created by RicardoSantos // and adds a signal line // Use : if signal line is changes color, you have your signal, green = buy, red = sell // Advice : best used with a zero lag indicator like ZeroLagEMA_LB from LazyBear // if price is above ZLEMA and signal = green => buy, price below ZLEMA and signal = red => sell study(title='[RS][NM]Improved Linear Regression Bull and Bear Power v01', shorttitle='BBP_NM', 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) direction = bull*2 + bear*2 plot(title='Bear', series=bear, style=columns, color=maroon, transp=90) plot(title='Bull', series=bull, style=columns, color=green, transp=90) plot(title='Direction', series=direction, style=line, linewidth=3, color= direction > 0 ? green : red)
Whether you are a day trader, swing trader or position trader. If you trade stocks, options, forex or crypto, every trader should be able to identify with our exclusive designs.
n returns the bar number (a built-in variable
the => symbol declares f_exp_lr as a function that requires 2 parameters, height and length and using those parameters calculates the return (_ret) using the formula height + (_height/_length)
This allows to create the calculation formula only once and use it with different parameters throughout the scripts as you can see :
bear = 0-f_exp_lr(h_value-close, n-h_bar)
bull = 0+f_exp_lr(close-l_value, n-l_bar)
hope this helps ... and again sorry for the (very) late reply