[RS]Linear Regression Bull and Bear Power V0

Bull and Bear power based on linear regression (this is a non lagging oscillator, the parameter are for the lookup window for the donchian extremes)
this indicator can also be used for convergence/divergence.
从常用的脚本中删除 添加到常用的脚本
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)
Ricardo, just thinking out loud... would it be difficult to incorporate an accumation option into this script?

For example: sum up al bull bars (above the 0-line) and bear bars (below the 0-line) within a given time period (which would be an input).
RicardoSantos accidentjev2
its possible, ill have stab at it on the weekend
RicardoSantos RicardoSantos
+1 回复
accidentje RicardoSantos
Superb. Thanks man
accidentje RicardoSantos
Ricardo, I've been playing with it and it would be very useful to make the script "multi-timeframe-able". Only I'm not succeeding in modifying it succesfully :). Could you take a last look?
accidentje accidentje
> the accumulation version I mean
i can add a security() to get the values for higher timeframes, or you can use higher length values on the inputs to fit the higher timeframes.
the security is just a matter of adding 1/2 lines to the script(altho by using security its subject to repaint values when it re updates).
accidentje RicardoSantos
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!
accidentje RicardoSantos
Sweet, thanks again. Was indeed rather simple I now see ;)
首页 股票筛选器 外汇筛选器 加密货币筛选器 财经日历 如何运作 图表功能 价格 网站规则 版主 网站 & 经纪商解决方案 插件 图表解决方案 寻求帮助 功能请求 博客 & 新闻 常见问题 维基百科 Twitter
概述 个人资料设置 账号和账单 TradingView代币 我的客服工单 寻求帮助 已发表观点 粉丝 正在关注 私人消息 聊天 退出