OPEN-SOURCE SCRIPT

Market Cipher B

// © ElVortex2

//version=6
indicator(title = "Market Cipher B", shorttitle = 'Cipher B', overlay = false)

// Inputs
show_wt = input.bool(true, 'Show WaveTrend', group = 'WaveTrend')
show_wt_lines = input.bool(true, 'Show WaveTrend Lines', group = 'WaveTrend')
show_wt_dots = input.bool(true, 'Show Buy/Sell Dots', group = 'WaveTrend')
show_vwap = input.bool(true, 'Show VWAP', group = 'WaveTrend')

wt_channel_len = input.int(9, 'WT Channel Length', group = 'WaveTrend')
wt_average_len = input.int(12, 'WT Average Length', group = 'WaveTrend')
wt_source = input.source(hlc3, 'WT Source', group = 'WaveTrend', inline = 'wt source')
wt_source_type = input.string(
'Heikin Ashi',
' Type ',
group = 'WaveTrend',
inline = 'wt source',
options = ['Inherit', 'Heikin Ashi', 'Standard']
)
wt_ma_len = input.int(3, 'WT MA Length', group = 'WaveTrend')

overbought_l1 = input.int(53, 'Lev 1', group = 'OverBought Levels', inline = 'wt ob levels')
overbought_l2 = input.int(60, 'Lev 2', group = 'OverBought Levels', inline = 'wt ob levels')
overbought_l3 = input.int(70, 'Lev 3', group = 'OverBought Levels', inline = 'wt ob levels')
oversold_l1 = input.int(-53, 'Lev 1', group = 'OverSold Levels', inline = 'wt os levels')
oversold_l2 = input.int(-60, 'Lev 2', group = 'OverSold Levels', inline = 'wt os levels')
oversold_l3 = input.int(-70, 'Lev 3', group = 'OverSold Levels', inline = 'wt os levels')

show_mfi = input.bool(true, 'Show MFI', group = 'MFI')
mfi_source = input.source(hlc3, 'MFI Source', group = 'MFI', inline = 'mfi source')
mfi_source_type = input.string(
'Heikin Ashi',
' Type ',
group = 'MFI',
inline = 'mfi source',
options = ['Inherit', 'Heikin Ashi', 'Standard']
)
mfi_baseline_len = input.int(5, 'Baseline MA Length', group = 'MFI')
mfi_deviation_len = input.int(5, 'Deviation MA Length', group = 'MFI')
mfi_smoothing_len = input.int(60, 'Smoothing MA Length', group = 'MFI')
show_mfi_bar = input.bool(false, 'Show MFI Bar', group = 'MFI')

show_rsi = input.bool(false, 'Show RSI', group = 'RSI')
rsi_source = input.source(close, 'Source', group = 'RSI', inline = 'rsi source')
rsi_source_type = input.string(
'Standard',
' Type ',
group = 'RSI',
inline = 'rsi source',
options = ['Inherit', 'Heikin Ashi', 'Standard']
)
rsi_len = input.int(14, 'RSI Length', group = 'RSI')

stoch_type = input.string(
'Cipher B',
'Stoch RSI type',
group = 'Stochastic',
options = ['Vumanchu', 'Cipher B']
)
show_stoch = input.bool(false, 'Show Stochastic', group = 'Stochastic')
cipher_stoch_source = input.source(close, 'Source', group = 'Cipher B Stochastic', inline = 'stoch source')
cipher_stoch_source_type = input.string(
'Heikin Ashi',
' Type ',
group = 'Cipher B Stochastic',
inline = 'stoch source',
options = ['Inherit', 'Heikin Ashi', 'Standard']
)
cipher_stoch_len = input.int(81, 'Lenght', group = 'Cipher B Stochastic')
cipher_stoch_rsi_len = input.int(40, 'RSI Lenght', group = 'Cipher B Stochastic')
cipher_stoch_smooth = input.int(2, 'Stoch Smooth', group = 'Cipher B Stochastic', inline = 'cipher stoch smooth')
cipher_stoch_rsi_smooth = input.int(2, 'RSI Smooth', group = 'Cipher B Stochastic', inline = 'cipher stoch smooth')

vmc_stoch_source = input.source(close, 'Source', group = 'VuManChu Stochastic RSI', inline = 'vmc stoch source')
vmc_stoch_source_type = input.string(
'Inherit',
' Type ',
group = 'VuManChu Stochastic RSI',
inline = 'vmc stoch source',
options = ['Inherit', 'Heikin Ashi', 'Standard']
)
vmc_stoch_len = input.int(14, 'Length', group = 'VuManChu Stochastic RSI')
vmc_stoch_rsi_len = input.int(14, 'RSI Lenght', group = 'VuManChu Stochastic RSI')
vmc_stoch_K_smooth = input.int(3, 'K Smooth', group = 'VuManChu Stochastic RSI', inline = 'vmc stoch smooth')
vmc_stoch_D_smooth = input.int(3, 'D Smooth', group = 'VuManChu Stochastic RSI', inline = 'vmc stoch smooth')

// Functions

f_get_ticker_source(source) =>
switch source
'Inherit' => syminfo.tickerid
'Heikin Ashi' => ticker.heikinashi(syminfo.tickerid)
'Standard' => ticker.standard(syminfo.tickerid)
=> na // Default case for unexpected values

f_wavetrend(source_type, source, channel_len, average_len, ma_len) =>
src = request.security(f_get_ticker_source(source_type), timeframe.period, source)
baseline_ma = ta.ema(src, channel_len)
average_deviation = ta.ema(math.abs(src - baseline_ma), channel_len)
normalized_deviation = (src - baseline_ma) / (0.015 * average_deviation)
wt1 = ta.ema(normalized_deviation, average_len)
wt2 = ta.sma(wt1, ma_len)
vwap = wt1 - wt2
oversold = wt2 <= oversold_l2
overbought = wt2 >= overbought_l2
wt_cross = ta.cross(wt1, wt2)
wt_cross_up = wt2 - wt1 <= 0
wt_cross_down = wt2 - wt1 >= 0
[wt1, wt2, oversold, overbought, vwap, wt_cross, wt_cross_up, wt_cross_down]

f_rsi(source_type, source, length) =>
src = request.security(f_get_ticker_source(source_type), timeframe.period, source)
rsi = ta.rsi(src, length)

mfi(source_type, source, baseline_len, deviation_len, smoothing_len) =>
src = request.security(f_get_ticker_source(source_type), timeframe.period, source)
baseline_ma = ta.sma(src, baseline_len)
average_deviation = ta.sma(math.abs(src - baseline_ma), deviation_len)
normalized_deviation = (src - baseline_ma) / (0.015 * average_deviation)
money_flow = ta.sma(normalized_deviation, smoothing_len)

f_vmc_stoch(source_type, source, stoch_len, rsi_len, smooth_k, smooth_d) =>
src = request.security(f_get_ticker_source(source_type), timeframe.period, source)
rsi = ta.rsi(src, rsi_len)
k_ma = ta.sma(ta.stoch(rsi, rsi, rsi, stoch_len), smooth_k)
d_ma = ta.sma(k_ma, smooth_d)
[k_ma, d_ma]

f_cipher_stoch(source_type, source, stoch_len, rsi_len, stoch_smooth, rsi_smooth) =>
src = request.security(f_get_ticker_source(source_type), timeframe.period, source)
stoch = ta.sma(ta.stoch(src, high, low, stoch_len), stoch_smooth)
stoch_rsi = ta.sma(ta.stoch(src, high, low, rsi_len), rsi_smooth)
[stoch, stoch_rsi]

[wt1, wt2, wt_is_oversold_l2, wt_is_overbought_l2, vwap, wt_cross, wt_cross_up, wt_cross_down] = f_wavetrend(wt_source_type, wt_source, wt_channel_len, wt_average_len, wt_ma_len)

rsi = f_rsi(rsi_source_type, rsi_source, rsi_len)

buy_signal = wt_cross and wt_cross_up
sell_signal = wt_cross and wt_cross_down

buy_signal_bar = buy_signal and wt_is_oversold_l2
sell_signal_bar = sell_signal and wt_is_overbought_l2

money_flow_index = mfi(mfi_source_type, mfi_source, mfi_baseline_len, mfi_deviation_len, mfi_smoothing_len)
money_flow_color = money_flow_index > 0 ? color.new(#00FF00, 55) : color.new(#FF0000, 55)

[vmc_stoch_k, vmc_stoch_d] = f_vmc_stoch(vmc_stoch_source_type, vmc_stoch_source, vmc_stoch_len, vmc_stoch_rsi_len, vmc_stoch_K_smooth, vmc_stoch_D_smooth)
[cipher_stoch, cipher_stoch_rsi] = f_cipher_stoch(cipher_stoch_source_type, cipher_stoch_source, cipher_stoch_len, cipher_stoch_rsi_len, cipher_stoch_smooth, cipher_stoch_rsi_smooth)

plot(show_wt_lines ? overbought_l1 : na, 'Overbought Level 1', color.new(#FFFFFF, 30), 1)
plot(show_wt_lines ? overbought_l2 : na, 'Overbought Level 2', color.new(#FFFFFF, 30), 1)
plot(show_wt_lines ? overbought_l3 : na, 'Overbought Level 3', color.new(#FFFFFF, 30), 1)
plot(show_wt_lines ? oversold_l1 : na, 'Overbought Level 1', color.new(#FFFFFF, 30), 1)
plot(show_wt_lines ? oversold_l2 : na, 'Overbought Level 2', color.new(#FFFFFF, 30), 1)
plot(show_wt_lines ? oversold_l3 : na, 'Overbought Level 3', color.new(#FFFFFF, 30), 1)

plot(show_wt ? wt1 : na, 'Wave Trend 1', color.new(#90CAF9, 0), style = plot.style_area)
plot(show_wt ? wt2 : na, 'Wave Trend 2', color.new(#0C47A1, 10), style = plot.style_area)
plot(show_wt and buy_signal ? wt2 : na, 'Green Dot', #00FF00, 2, plot.style_circles)
plot(show_wt and sell_signal ? wt2 : na, 'Red Dot', #FF0000, 2, plot.style_circles)

plot(show_wt_dots and buy_signal_bar ? -105 : na, 'Buy Circle', #00FF00, 3, plot.style_circles)
plot(show_wt_dots and sell_signal_bar ? 105 : na, 'Sell Circle', #FF0000, 3, plot.style_circles)

plot(show_vwap ? vwap : na, 'VWAP', color.new(#FFEB3B, 40), 1, plot.style_area)

plot(show_rsi ? rsi : na, 'RSI', #E600E6, 1)

plot_mfi = plot(show_mfi ? money_flow_index : na, 'Money Flow', money_flow_color, 1, plot.style_area)
plot_mfi_bar_top = plot(show_mfi and show_mfi_bar ? -93 : na, 'MFI Bar', color.new(#FFFFFF, 100))
plot_mfi_bar_bottom = plot(show_mfi and show_mfi_bar ? -103 : na, 'MFI Bar', color.new(#FFFFFF, 100))
fill(plot_mfi_bar_top, plot_mfi_bar_bottom, money_flow_color, 'MFI Bar Fill')

plot(show_stoch and stoch_type == 'Cipher B' ? cipher_stoch : na, 'Cipher B Stoch', #CA1BFFe7, 2)
plot(show_stoch and stoch_type == 'Cipher B' ? cipher_stoch_rsi : na, 'Cipher B Stoch RSI', cipher_stoch < cipher_stoch_rsi ? #3FFB03 : #FE1000, 2)

plot_vmc_stoch_k = plot(show_stoch and stoch_type == 'Vumanchu' ? vmc_stoch_k : na, 'VMC Stoch K', #21BAF3, 2)
plot_vmc_stoch_d = plot(show_stoch and stoch_type == 'Vumanchu' ? vmc_stoch_d : na, 'VMC Stoch D', color.new(#673AB7, 60), 1)
vmc_stoch_fill_color = vmc_stoch_k >= vmc_stoch_d ? color.new(#21baf3, 75) : color.new(#673ab7, 60)
fill(plot_vmc_stoch_k, plot_vmc_stoch_d, vmc_stoch_fill_color, 'Stoch KD Fill')
Candlestick analysis

Script open-source

Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?


Aussi sur:

Clause de non-responsabilité