RicardoSantos

[RS]VDUB-TRENDMASTER IV V0

815 1 108
Request for vdubus:
concept:
Remove from Favorite Scripts Add to Favorite Scripts
study(title="[RS]VDUB-TRENDMASTER IV V0", overlay=false)
//  ||-->   Concept vdubus, Code RicardoSantos. <-------------------------------------------------------------------------------------------------------||
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
//  ||-->   Input:  <-----------------------------------------------------------------------------------------------------------------------------------||
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
_Type = input(defval=0, minval=0, maxval=2, title='0: Crossover, 1: MACD, 2: STOCH')
_NOTE0 = input(false, title='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).')
_A = input(defval=0, minval=0, maxval=6, title='Input A for Crossover:')
_B = input(defval=0, minval=0, maxval=6, title='Input B for Crossover:')
_SRC_A = input(close, type=source, title='Source For Series A:')
_SRC_B = input(close, type=source, title='Source For Series B:')
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
//  ||-->   SMA, EMA, WMA Inputs:  <--------------------------------------------------------------------------------------------------------------------||
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
_MA_A_Length = input(12, title='Moving Average A Length:')
_MA_B_Length = input(24, title='Moving Average B Length:')
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
//  ||-->   Ichimoku cloud  <---------------------------------------------------------------------------------------------------------------------------||
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
IC_A_conversionPeriods = input(34, title='Ichimoku Cloud A - Conversion Period:')
IC_A_basePeriods = input(26, title='Ichimoku Cloud A - Base Period:')
IC_A_laggingSpan2Periods = input(52, title='Ichimoku Cloud A - Lagging Span:')
IC_A_displacement = input(26, title='Ichimoku Cloud A - Displacement:')
IC_B_conversionPeriods = input(34, title='Ichimoku Cloud B - Conversion Period:')
IC_B_basePeriods = input(26, title='Ichimoku Cloud B - Base Period:')
IC_B_laggingSpan2Periods = input(52, title='Ichimoku Cloud B - Lagging Span:')
IC_B_displacement = input(26, title='Ichimoku Cloud B - Displacement:')
//  ||-->   Functions:  <-------------------------------------------------------------------------------------------------------------------------------||
donchian(len) => avg(lowest(len), highest(len))
leadLine1(_conversionPeriods, _basePeriods)=>
    _conversionLine = donchian(_conversionPeriods)
    _baseLine = donchian(_basePeriods)
    avg(_conversionLine, _baseLine)
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
//  ||-->   MACD  <-------------------------------------------------------------------------------------------------------------------------------------||
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
_MACD_K = input(21)
_MACD_D = input(34)
_MACD_I = 1
//  ||-->   Functions:  <-------------------------------------------------------------------------------------------------------------------------------||
_MACD_FAST()=>
    [_fast, _, _] = macd(_SRC_A, _MACD_K, _MACD_D, _MACD_I)
    _fast
_MACD_SLOW()=>
    [_, _slow, _] = macd(_SRC_B, _MACD_K, _MACD_D, _MACD_I)
    _slow
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
//  ||-->   STOCH  <------------------------------------------------------------------------------------------------------------------------------------||
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
_STOCH_Length = input(14)
_STOCH_K = input(2)
_STOCH_D = input(4)
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
//  ||-->   Output:  <----------------------------------------------------------------------------------------------------------------------------------||
//  ||--------------------------------------------------------------------------------------------------------------------------------------------------||
CrossOverA = _Type == 0 and _A == 0 ? sma(_SRC_A, _MA_A_Length) :
        _Type == 0 and _A == 1 ? wma(_SRC_A, _MA_A_Length) :
        _Type == 0 and _A == 2 ? ema(_SRC_A, _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(_SRC_A, high, low, _STOCH_Length), _STOCH_K) :
        na

CrossOverB = _Type == 0 and _B == 0 ? sma(_SRC_B, _MA_B_Length) :
        _Type == 0 and _B == 1 ? wma(_SRC_B, _MA_B_Length) :
        _Type == 0 and _B == 2 ? ema(_SRC_B, _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(_SRC_B, high, low, _STOCH_Length), _STOCH_D) :
        na

OutputSignal = CrossOverA >= CrossOverB ? 1 : 0
plot(OutputSignal>0?1:-1, title='Trend Master IV - Signal', style=columns, color=OutputSignal>0?gray:red, transp=25)
Hi , what is the best timeframe to run indicator on ?
Reply
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out