RicardoSantos

[RS]VDUB-TRENDMASTER IV V0.01

4538瀏覽
690
4538 2
Concept by vdubus.
Fixed a missing option on the macd inputs, added option to toggle visual style(toggle box)
從喜愛的腳本中移除 添加到喜愛的腳本
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)
Beautiful work!
回覆
+9 回覆
首頁 股票篩選器 外匯篩選器 加密貨幣篩選器 全球財經日曆 節目 如何運作 圖表功能 價格 網站規則 版主 網站 & 經紀商解決方案 小工具 圖表解決方案 輕量圖表庫 幫助中心 推薦朋友 功能請求 部落格 & 新聞 推特
概述 個人資料設定 賬戶和賬單 推薦朋友 我的客服工單 幫助中心 發表的想法 粉絲 正在關注 私人訊息 在線聊天 登出