RicardoSantos

[RS]JDSarano Alert V0

518 1 41
Request for JDSarano:
alert signal on indicator accordance:
  • Coral trend Indicator from LazyBear
  • pip Collector from LazyBear ( I use this only for the red, gray, green background
  • Weis Wave Volume (LazyBear) default settings. (2)
  • Linear Regression Bull and Bear power acummulation V0
  • UCS_SQZ_Opt_Alert
Remove from Favorite Scripts Add to Favorite Scripts
//@version=2
study(title='[RS]JDSarano Alert V0', shorttitle='J', overlay=false)
//  ||  -->
//  ||  Collar Trend Indicator Inputs:
lb_cti_src=close
lb_cti_sm = input(21, title="LB_CTI Smoothing Period:")
lb_cti_cd = input(0.2, title="LB_CTI Constant D:")
//  ||  -->
//  ||  PIP Collector Inputs:
lb_pc_src=input(close, title="Source")
lb_pc_tf1=input("D", title="Timeframe 1")
lb_pc_tf2=input("240", title="Timeframe 2")
lb_pc_tf3=input("60", title="Timeframe 3")
lb_pc_length=input(50, title="Center EMA Length")
//  ||  -->
//  ||  Weis Wave Volume Inputs:
lb_wwv_detection_window = input(2)
//  ||  -->
//  ||  Linear Regression Bull and Bear Power Accumulation Inputs:
window = input(title='Lookback Window:', type=integer, defval=10)
USE_ACC = input(title='Use accumulation?', type=bool, defval=true)
acc_length = input(title='Accumulation Length:', type=integer, defval=100)
USE_ALT_TF = input(title='Use alternative timeframe?', type=bool, defval=false)
alt_tf = input(title='Alternative timeframe:', type=string, defval='D', confirm=false)
//  ||  -->
//  ||  UCS Squeeze Momentum Inputs:
ucs_sm_length = input(20, title="Squeeze Length")
ucs_sm_multBB = input(2,title="BB MultFactor")
ucs_sm_multKC = input(1.5, title="KC MultFactor")
ucs_sm_smooth = input(20, title = "Momentum Smoothing")
ucs_sm_usebbr = input(true, title = "Use Bollinger Band Ratio Instead of Momentum", type = bool)
ucs_sm_useHAC = input(true, title = "Heikin Ashi Optimization", type=bool)
//  ||  -->
//  ||  -->
//  ||  Collar Trend Indicator by LazyBear:
f_LB_cti(_src, _sm, _cd)=>
    _di = (_sm - 1.0) / 2.0 + 1.0
    _c1 = 2 / (_di + 1.0)
    _c2 = 1 - _c1
    _c3 = 3.0 * (_cd * _cd + _cd * _cd * _cd)
    _c4 = -3.0 * (2.0 * _cd * _cd + _cd + _cd * _cd * _cd)
    _c5 = 3.0 * _cd + 1.0 + _cd * _cd * _cd + 3.0 * _cd * _cd
    _i1 = _c1*_src + _c2*nz(_i1[1])
    _i2 = _c1*_i1 + _c2*nz(_i2[1])
    _i3 = _c1*_i2 + _c2*nz(_i3[1])
    _i4 = _c1*_i3 + _c2*nz(_i4[1])
    _i5 = _c1*_i4 + _c2*nz(_i5[1])
    _i6 = _c1*_i5 + _c2*nz(_i6[1])
    _bfr = -_cd*_cd*_cd*_i6 + _c3*(_i5) + _c4*(_i4) + _c5*(_i3)
    _return = _bfr > nz(_bfr[1]) ? 1 : _bfr < nz(_bfr[1]) ? -1 : 0
//  ||  -->
//  ||  PIP Collector by LazyBear:
f_LB_pc(_src, _tf1, _tf2, _tf3, _length)=>
    _pip = syminfo.mintick 
    _ltfsrc = ema(_src, _length) < _src
    _stfsrc = ema(_src, _length) > _src
    _ltf1=security(tickerid, _tf1, _ltfsrc), _stf1=security(tickerid, _tf1, _stfsrc)
    _ltf2=security(tickerid, _tf2, _ltfsrc), _stf2=security(tickerid, _tf2, _stfsrc)
    _ltf3=security(tickerid, _tf3, _ltfsrc), _stf3=security(tickerid, _tf3, _stfsrc)
    _return = _ltf1 and _ltf2 and _ltf3 ? 1 : _stf1 and _stf2 and _stf3 ? -1 : 0
//  ||  -->
//  ||  Weis Wave Volume vy LazyBear:
f_LB_wwv(_window)=>
    _mov = close>close[1] ? 1 : close<close[1] ? -1 : 0
    _trend = (_mov != 0) and (_mov != _mov[1]) ? _mov : nz(_trend[1])
    _isTrending = rising(close, _window) or falling(close, _window)
    _wave = (_trend != nz(_wave[1])) and _isTrending ? _trend : nz(_wave[1])
    _vol = _wave == _wave[1] ? (nz(_vol[1]) + volume) : volume
    _up = _wave == 1 ? _vol : 0
    _dn = _wave == 1 ? 0 : _vol
    _return = _up > 0 ? 1 : _dn > 0 ? -1 : 0
//  ||  -->
//  ||  Linear Regression Bull and Bear Power Accumulation:
f_exp_lr(_height, _length)=>
    _ret = _height + (_height/_length)
//------------------------------------
f_rs_bbpa(_window, _use_acc, _acc_length, _use_tf, _tf)=>
    _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)
    _bear_acc = sum(nz(_bear, 0), _acc_length)
    _bull_acc = sum(nz(_bull, 0), _acc_length)
    _rem = _use_acc ? _bull_acc-abs(_bear_acc) : _bull - abs(_bear)
    _rem_bull = _rem > 0 ? _rem : 0
    _rem_bear = _rem < 0 ? _rem : 0
    _bear_output = _use_tf ? security(tickerid, _tf, _rem_bear) : _rem_bear
    _bull_output = _use_tf ? security(tickerid, _tf, _rem_bull) : _rem_bull
    _return = _bear_output + _bull_output > 0 ? 1 : _bear_output + _bull_output < 0 ? -1 : 0
//  ||  -->
//  ||  UCS Squeeze Momentum by UCS:
f_UCS_sm(_length, _multBB, _multKC, _smooth, _usebbr, _useHAC)=>
    _haclose = ohlc4
    _haopen = na(_haopen[1]) ? (open + close)/2 : (_haopen[1] + _haclose[1]) / 2
    _hahigh = max (high, max(_haopen, _haclose))
    _halow = min (low, min(_haopen, _haclose))
    _haatra = abs(_hahigh - _haclose[1])
    _haatrb = abs(_haclose[1] - _halow)
    _haatrc = abs(_hahigh - _halow)
    _haatr = max(_haatra, max(_haatrb, _haatrc))
    _source = _useHAC ? _haclose : close
    _basis = sma(_source, _length)
    _dev = _multBB * stdev(_source, _length)
    _upperBB = _basis + _dev
    _lowerBB = _basis - _dev
    _ma = sma(_source, _length)
    _range = _useHAC ? _haatr : tr
    _rangema = sma(_range, _length)
    _upperKC = _ma + _rangema * _multKC
    _lowerKC = _ma - _rangema * _multKC
    _sqzOn  = (_lowerBB > _lowerKC) ? _sqzOn[1]+1 : 0
    _sqzOff = (_lowerBB < _lowerKC) ? _sqzOff[1]+1 : 0
    _noSqz  = (_sqzOn == false) and (_sqzOff == false)
    _return = _sqzOff - _sqzOn > 0 ? 1 : _sqzOff - _sqzOn < 0 ? -1 : 0
//  ||  -->
lb_cti_signal = f_LB_cti(lb_cti_src, lb_cti_sm, lb_cti_cd)
lb_pc_signal = f_LB_pc(lb_pc_src, lb_pc_tf1, lb_pc_tf2, lb_pc_tf3, lb_pc_length)
lb_wwv_signal = f_LB_wwv(lb_wwv_detection_window)
rs_bbpa_signal = f_rs_bbpa(window, USE_ACC, acc_length, USE_ALT_TF, alt_tf)
ucs_sm_signal = f_UCS_sm(ucs_sm_length, ucs_sm_multBB, ucs_sm_multKC, ucs_sm_smooth, ucs_sm_usebbr, ucs_sm_useHAC)

// plot(lb_cti_signal, color=black)
// plot(lb_pc_signal, color=blue)
// plot(lb_wwv_signal, color=aqua)
// plot(rs_bbpa_signal, color=red)
// plot(ucs_sm_signal, color=fuchsia)

signal_counter = lb_cti_signal + lb_pc_signal + lb_wwv_signal + rs_bbpa_signal + ucs_sm_signal
signal_output = signal_counter == 5 ? 1 : signal_counter == -5 ? -1 : 0
signal_color = signal_output > 0 ? green : signal_output < 0 ? maroon : black
plot(title='Signal', series=signal_output, style=columns, color=signal_color, transp=75)
JDSarano PRO
a year ago
Awesome!!!! testing now!!...
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
France
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out