vdubus

VDUB-TRENDMASTER_WALL_[RS]

1135 0 171
A follow on addition to
RS-VDUB-TRENDMASTER-IV-V0-01/
A massive thanks to @RicardoSantos for all the coding
Remove from Favorite Scripts Add to Favorite Scripts
study("VDUB-TRENDMASTER_WALL[RS]", overlay=true)
//  ||-->   Concept vdubus, Code RicardoSantos. <-------------------------------------------------------------------------------------------------------|| 
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
//  ||-->   Input:  <-----------------------------------------------------------------------------------------------------------------------------------||
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
_Type = input(defval=0, minval=0, maxval=2, title='0: Crossover, 1: MACD, 2: STOCH')
_A = input(defval=0, minval=0, maxval=6, title='Input A for Crossover:(0: SMA, 1: WMA, 2: EMA, 3: Kijun-Sen(Base), 4: Tenkan-Sen(Conversion), 5: Senkou Span A(Leading A), 6: Senkou Span B(Leading B))')
_B = input(defval=0, minval=0, maxval=6, title='Input B for Crossover:(0: SMA, 1: WMA, 2: EMA, 3: Kijun-Sen(Base), 4: Tenkan-Sen(Conversion), 5: Senkou Span A(Leading A), 6: Senkou Span B(Leading B))')
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
//  ||-->   SMA, EMA, WMA Inputs:  <--------------------------------------------------------------------------------------------------------------------||
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
_MA_SRC = input(close)
_MA_A_Length = input(12)
_MA_B_Length = input(24)
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
//  ||-->   Ichimoku cloud  <---------------------------------------------------------------------------------------------------------------------------||
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
IC_A_conversionPeriods = input(34)
IC_A_basePeriods = input(26)
IC_A_laggingSpan2Periods = input(52)
IC_A_displacement = input(26)
IC_B_conversionPeriods = input(34)
IC_B_basePeriods = input(26)
IC_B_laggingSpan2Periods = input(52)
IC_B_displacement = input(26)
//  ||-->   Functions:  <-------------------------------------------------------------------------------------------------------------------------------||
donchian(len) => avg(lowest(len), highest(len))
leadLine1(_conversionPeriods, _basePeriods)=>
    _conversionLine = donchian(_conversionPeriods)
    _baseLine = donchian(_basePeriods)
    avg(_conversionLine, _baseLine)
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
//  ||-->   MACD  <-------------------------------------------------------------------------------------------------------------------------------------||
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
_MACD_SRC = input(close)
_MACD_K = input(21)
_MACD_D = input(34)
_MACD_I = input(4)
//  ||-->   Functions:  <-------------------------------------------------------------------------------------------------------------------------------||
_MACD_FAST()=>
    [_fast, _, _] = macd(_MACD_SRC, _MACD_K, _MACD_D, _MACD_I)
    _fast
_MACD_SLOW()=>
    [_, _slow, _] = macd(_MACD_SRC, _MACD_K, _MACD_D, _MACD_I)
    _slow
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
//  ||-->   STOCH  <------------------------------------------------------------------------------------------------------------------------------------||
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
_STOCH_SRC = input(close)
_STOCH_Length = input(14)
_STOCH_K = input(2)
_STOCH_D = input(4)
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
//  ||-->   Output:  <----------------------------------------------------------------------------------------------------------------------------------||
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
CrossOverA = _Type == 0 and _A == 0 ? sma(_MA_SRC, _MA_A_Length) :
        _Type == 0 and _A == 1 ? wma(_MA_SRC, _MA_A_Length) :
        _Type == 0 and _A == 2 ? ema(_MA_SRC, _MA_A_Length) :
        _Type == 0 and _A == 3 ? donchian(IC_A_basePeriods) :                            // Ichimoku Baseline
        _Type == 0 and _A == 4 ? donchian(IC_A_conversionPeriods) :                      // Ichimoku Conversion
        _Type == 0 and _A == 5 ? leadLine1(IC_A_conversionPeriods, IC_A_basePeriods) :   // Ichimoku leading A
        _Type == 0 and _A == 6 ? donchian(IC_A_laggingSpan2Periods) :                    // Ichimoku leading B
        _Type == 1 ? _MACD_FAST() :
        _Type == 2 ? sma(stoch(_STOCH_SRC, high, low, _STOCH_Length), _STOCH_K) :
        na
 
CrossOverB = _Type == 0 and _B == 0 ? sma(_MA_SRC, _MA_B_Length) :
        _Type == 0 and _B == 1 ? wma(_MA_SRC, _MA_B_Length) :
        _Type == 0 and _B == 2 ? ema(_MA_SRC, _MA_B_Length) :
        _Type == 0 and _B == 3 ? donchian(IC_B_basePeriods) :                            // Ichimoku Baseline
        _Type == 0 and _B == 4 ? donchian(IC_B_conversionPeriods) :                      // Ichimoku Conversion
        _Type == 0 and _B == 5 ? leadLine1(IC_B_conversionPeriods, IC_A_basePeriods) :   // Ichimoku leading A
        _Type == 0 and _B == 6 ? donchian(IC_B_laggingSpan2Periods) :                    // Ichimoku leading B
        _Type == 1 ? _MACD_SLOW() :
        _Type == 2 ? sma(stoch(_STOCH_SRC, high, low, _STOCH_Length), _STOCH_D) :
        na
 
OutputSignal = CrossOverA >= CrossOverB ? 1 : 0
bgcolor(OutputSignal>0?gray:red)
//=================================================
Ideas Scripts Chart
United States
United Kingdom
India
España
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 Billing Sign Out