RicardoSantos

[RS]VDUB-TRENDMASTER IV V0.01

Concept by vdubus.
Fixed a missing option on the macd inputs, added option to toggle visual style(toggle box)
Açık kaynak kodlu komut dosyası

Gerçek TradingView ruhuyla, bu betiğin yazarı, yatırımcının anlayabilmesi ve doğrulayabilmesi için onu açık kaynak olarak yayınladı. Yazarın eline sağlık! Bunu ücretsiz olarak kullanabilirsiniz, ancak bu kodun bir yayında yeniden kullanımı Kullanım Koşulları ile yönetilir. Bir grafikte kullanmak için favorilere ekleyebilirsiniz.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.

Bu komut dosyasını bir grafikte kullanmak ister misiniz?
study(title="[RS]VDUB-TRENDMASTER IV V0.01", 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 = input(2)
//  ||-->   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(_NOTE0 ? 1 : (OutputSignal>0?1:-1), title='Trend Master IV - Signal', style=columns, color=OutputSignal>0?gray:red, transp=25)