//@version=5
// Thanks to dynausmaux for the code..
// Thanks to falconCoin for https://www.tradingview.com/script/KVfgBvDd-Market-Cipher-B-Free-version-with-Buy-and-sell/ inspired me to start this.
// Thanks to LazyBear for WaveTrend Oscillator https://www.tradingview.com/script/2KE8wTuF-Indicator-WaveTrend-Oscillator-WT/
// Thanks to RicardoSantos for https://www.tradingview.com/script/3oeDh0Yq-RS-Price-Divergence-Detector-V2/
// Thanks to LucemAnb for Plain Stochastic Divergence https://www.tradingview.com/script/FCUgF8ag-Plain-Stochastic-Divergence/
// Thanks to andreholanda73 for MFI+RSI Area https://www.tradingview.com/script/UlGZzUAr/
// I especially thanks to TradingView for its platform that facilitates development and learning.
//
// CIRCLES & TRIANGLES:
// - LITTLE CIRCLE: They appear at all WaveTrend wave crossings.
// - GREEN CIRCLE: The wavetrend waves are at the oversold level and have crossed up (bullish).
// - RED CIRCLE: The wavetrend waves are at the overbought level and have crossed down (bearish).
// - GOLD/ORANGE CIRCLE: When RSI is below 20, WaveTrend waves are below or equal to -80 and have crossed up after good bullish divergence (DONT BUY WHEN GOLD CIRCLE APPEAR).
// - None of these circles are certain signs to trade. It is only information that can help you.
// - PURPLE TRIANGLE: Appear when a bullish or bearish divergence is formed and WaveTrend waves crosses at overbought and oversold points.
//
// NOTES:
// - I am not an expert trader or know how to program pine script as such, in fact it is my first indicator only to study and all the code is copied and modified from other codes that are published in TradingView.
// - I am very grateful to the entire TV community that publishes codes so that other newbies like me can learn and present their results. This is an attempt to imitate Market Cipher B.
// - Settings by default are for 4h timeframe, divergences are more stronger and accurate. Haven't tested in all timeframes, only 2h and 4h.
// - If you get an interesting result in other timeframes I would be very grateful if you would comment your configuration to implement it or at least check it.
//
// CONTRIBUTIONS:
// - Tip/Idea: Add higher timeframe analysis for bearish/bullish patterns at the current timeframe.
// + Bearish/Bullish FLAG:
// - MFI+RSI Area are RED (Below 0).
// - Wavetrend waves are above 0 and crosses down.
// - VWAP Area are below 0 on higher timeframe.
// - This pattern reversed becomes bullish.
// - Tip/Idea: Check the last heikinashi candle from 2 higher timeframe
// + Bearish/Bullish DIAMOND:
// - HT Candle is red
// - WT > 0 and crossed down
Assistant
Merhaba, kodunuzda birkaç hata var ve bunları düzeltmenize yardımcı olmak isterim. Özellikle, f_findSommiDiamond fonksiyonunun sonunda fazladan bir metin var. İşte hatanın olduğu satır:
[bearPattern, bullPattern] bu koddaki hataları düzelt.
indicator(title='VuManChu B Divergences', shorttitle='VMC Cipher_B_Divergences')
// PARAMETERS {
// WaveTrend Settings
wtShow = input.bool(true, title = 'Show WaveTrend', group = 'WaveTrend Settings')
wtBuyShow = input.bool(true, title = 'Show Buy dots', group = 'WaveTrend Settings')
wtGoldShow = input.bool(true, title = 'Show Gold dots', group = 'WaveTrend Settings')
wtSellShow = input.bool(true, title = 'Show Sell dots', group = 'WaveTrend Settings')
wtDivShow = input.bool(true, title = 'Show Div. dots', group = 'WaveTrend Settings')
vwapShow = input.bool(true, title = 'Show Fast WT', group = 'WaveTrend Settings')
wtChannelLen = input.int(9, title = 'WT Channel Length', minval=1, group = 'WaveTrend Settings')
wtAverageLen = input.int(12, title = 'WT Average Length', minval=1, group = 'WaveTrend Settings')
wtMASource = input.source(hlc3, title = 'WT MA Source', group = 'WaveTrend Settings')
wtMALen = input.int(3, title = 'WT MA Length', minval=1, group = 'WaveTrend Settings')
// WaveTrend Overbought & Oversold Levels
obLevel = input.int(53, title = 'WT Overbought Level 1', group = 'WaveTrend Settings')
obLevel2 = input.int(60, title = 'WT Overbought Level 2', group = 'WaveTrend Settings')
obLevel3 = input.int(100, title = 'WT Overbought Level 3', group = 'WaveTrend Settings')
osLevel = input.int(-53, title = 'WT Oversold Level 1', group = 'WaveTrend Settings')
osLevel2 = input.int(-60, title = 'WT Oversold Level 2', group = 'WaveTrend Settings')
osLevel3 = input.int(-75, title = 'WT Oversold Level 3', group = 'WaveTrend Settings')
// WaveTrend Divergence Settings
wtShowDiv = input.bool(true, title = 'Show WT Regular Divergences', group = 'WaveTrend Settings')
wtShowHiddenDiv = input.bool(false, title = 'Show WT Hidden Divergences', group = 'WaveTrend Settings')
showHiddenDiv_nl = input.bool(true, title = 'Not apply OB/OS Limits on Hidden Divergences', group = 'WaveTrend Settings')
wtDivOBLevel = input.int(45, title = 'WT Bearish Divergence min', group = 'WaveTrend Settings')
wtDivOSLevel = input.int(-65, title = 'WT Bullish Divergence min', group = 'WaveTrend Settings')
// Divergence Extra Range Settings
wtDivOBLevel_addshow = input.bool(true, title = 'Show 2nd WT Regular Divergences', group = 'WaveTrend Settings')
wtDivOBLevel_add = input.int(15, title = 'WT 2nd Bearish Divergence', group = 'WaveTrend Settings')
wtDivOSLevel_add = input.int(-40, title = 'WT 2nd Bullish Divergence 15 min', group = 'WaveTrend Settings')
// RSI + MFI Settings
rsiMFIShow = input.bool(true, title = 'Show MFI', group = 'MFI Settings')
rsiMFIperiod = input.int(60, title = 'MFI Period', minval=1, group = 'MFI Settings')
rsiMFIMultiplier = input.float(150, title = 'MFI Area multiplier', minval=0.0, group = 'MFI Settings')
rsiMFIPosY = input.float(2.5, title = 'MFI Area Y Pos', group = 'MFI Settings')
// RSI Settings
rsiShow = input.bool(true, title = 'Show RSI', group = 'RSI Settings')
rsiSRC = input.source(close, title = 'RSI Source', group = 'RSI Settings')
rsiLen = input.int(14, title = 'RSI Length', minval=1, group = 'RSI Settings')
rsiOversold = input.int(30, title = 'RSI Oversold', minval=0, maxval=100, group = 'RSI Settings')
rsiOverbought = input.int(60, title = 'RSI Overbought', minval=0, maxval=100, group = 'RSI Settings')
// RSI Divergence Settings
rsiShowDiv = input.bool(false, title = 'Show RSI Regular Divergences', group = 'RSI Settings')
rsiShowHiddenDiv = input.bool(false, title = 'Show RSI Hidden Divergences', group = 'RSI Settings')
rsiDivOBLevel = input.int(60, title = 'RSI Bearish Divergence min', group = 'RSI Settings')
rsiDivOSLevel = input.int(30, title = 'RSI Bullish Divergence min', group = 'RSI Settings')
// Stochastic RSI Settings
stochShow = input.bool(true, title = 'Show Stochastic RSI', group = 'Stoch Settings')
stochUseLog = input.bool(true, title='Use Log?', group = 'Stoch Settings')
stochAvg = input.bool(false, title='Use Average of both K & D', group = 'Stoch Settings')
stochSRC = input.source(close, title = 'Stochastic RSI Source', group = 'Stoch Settings')
stochLen = input.int(14, title = 'Stochastic RSI Length', minval=1, group = 'Stoch Settings')
stochRsiLen = input.int(14, title = 'RSI Length', minval=1, group = 'Stoch Settings')
stochKSmooth = input.int(3, title = 'Stochastic RSI K Smooth', minval=1, group = 'Stoch Settings')
stochDSmooth = input.int(3, title = 'Stochastic RSI D Smooth', minval=1, group = 'Stoch Settings')
// Stochastic Divergence Settings
stochShowDiv = input.bool(false, title = 'Show Stoch Regular Divergences', group = 'Stoch Settings')
stochShowHiddenDiv = input.bool(false, title = 'Show Stoch Hidden Divergences', group = 'Stoch Settings')
// Schaff Trend Cycle Settings
tcLine = input.bool(false, title="Show Schaff TC line", group = 'Schaff Settings')
tcSRC = input.source(close, title = 'Schaff TC Source', group = 'Schaff Settings')
tclength = input.int(10, title="Schaff TC", minval=1, group = 'Schaff Settings')
tcfastLength = input.int(23, title="Schaff TC Fast Length", minval=1, group = 'Schaff Settings')
tcslowLength = input.int(50, title="Schaff TC Slow Length", minval=1, group = 'Schaff Settings')
tcfactor = input.float(0.5, title="Schaff TC Factor", minval=0.0, group = 'Schaff Settings')
// Sommi Flag Settings
sommiFlagShow = input.bool(false, title = 'Show Sommi flag', group = 'Sommi Settings')
sommiShowVwap = input.bool(false, title = 'Show Sommi F. Wave', group = 'Sommi Settings')
sommiVwapTF = input.string('720', title = 'Sommi F. Wave timeframe', group = 'Sommi Settings')
sommiVwapBearLevel = input.int(0, title = 'F. Wave Bear Level (less than)', group = 'Sommi Settings')
sommiVwapBullLevel = input.int(0, title = 'F. Wave Bull Level (more than)', group = 'Sommi Settings')
soomiFlagWTBearLevel = input.int(0, title = 'WT Bear Level (more than)', group = 'Sommi Settings')
soomiFlagWTBullLevel = input.int(0, title = 'WT Bull Level (less than)', group = 'Sommi Settings')
soomiRSIMFIBearLevel = input.int(0, title = 'Money flow Bear Level (less than)', group = 'Sommi Settings')
soomiRSIMFIBullLevel = input.int(0, title = 'Money flow Bull Level (more than)', group = 'Sommi Settings')
// Sommi Diamond Settings
sommiDiamondShow = input.bool(false, title = 'Show Sommi diamond', group = 'Sommi Settings')
sommiHTCRes = input.string('60', title = 'HTF Candle Res. 1', group = 'Sommi Settings')
sommiHTCRes2 = input.string('240', title = 'HTF Candle Res. 2', group = 'Sommi Settings')
soomiDiamondWTBearLevel = input.int(0, title = 'WT Bear Level (More than)', group = 'Sommi Settings')
soomiDiamondWTBullLevel = input.int(0, title = 'WT Bull Level (Less than)', group = 'Sommi Settings')
// MACD Colors Settings
macdWTColorsShow = input.bool(false, title = 'Show MACD Colors', group = 'MACD Settings')
macdWTColorsTF = input.string('240', title = 'MACD Colors MACD TF', group = 'MACD Settings')
darkMode = input.bool(false, title = 'Dark mode', group = 'Mode Settings')
bearPattern = (rsimfi < soomiRSIMFIBearLevel) and
(wt2 > soomiFlagWTBearLevel) and
wtCross and
wtCrossDown and
(hwtVwap < sommiVwapBearLevel)
bullPattern = (rsimfi > soomiRSIMFIBullLevel) and
(wt2 < soomiFlagWTBullLevel) and
wtCross and
wtCrossUp and
(hwtVwap > sommiVwapBullLevel)
[bearPattern, bullPattern, hwtVwap]
// Sommi diamond
f_findSommiDiamond(tf, tf2, wt1, wt2, wtCross, wtCrossUp, wtCrossDown) =>
[candleBodyDir, newBar] = f_getTFCandle(tf)
[candleBodyDir2, newBar2] = f_getTFCandle(tf2)
bearPattern = (wt2 >= soomiDiamondWTBearLevel) and
wtCross and
wtCrossDown and
not candleBodyDir and
not candleBodyDir2
bullPattern = (wt2 <= soomiDiamondWTBullLevel) and
wtCross and
wtCrossUp and
candleBodyDir and
candleBodyDir2
[bearPattern, bullPattern]
wtBearDivColor = (wtShowDiv and wtBearDiv) or (wtShowHiddenDiv and wtBearDivHidden_) ? WTBearDivColorDown : na
wtBullDivColor = (wtShowDiv and wtBullDiv) or (wtShowHiddenDiv and wtBullDivHidden_) ? wtBullDivColorUp : na
wtBearDivColor_add = (wtShowDiv and (wtDivOBLevel_addshow and wtBearDiv_add)) or
(wtShowHiddenDiv and (wtDivOBLevel_addshow and wtBearDivHidden_add)) ? WTBearDivColorDown : na
wtBullDivColor_add = (wtShowDiv and (wtDivOBLevel_addshow and wtBullDiv_add)) or
(wtShowHiddenDiv and (wtDivOBLevel_addshow and wtBullDivHidden_add)) ? wtBullDivColorUp : na
// Gold Buy
lastRsi = ta.valuewhen(wtFractalBot, rsi[2], 0)[2]
wtGoldBuy = ((wtShowDiv and wtBullDiv) or (rsiShowDiv and rsiBullDiv)) and
wtLow_prev <= osLevel3 and
wt2 > osLevel3 and
wtLow_prev - wt2 <= -5 and
lastRsi < 30
// }
// DRAW {
// Arka Plan Rengi
bgcolor(darkMode ? color.new(color.black, 0) : na)
bearPattern = (rsimfi < soomiRSIMFIBearLevel) and
(wt2 > soomiFlagWTBearLevel) and
wtCross and
wtCrossDown and
(hwtVwap < sommiVwapBearLevel)
bullPattern = (rsimfi > soomiRSIMFIBullLevel) and
(wt2 < soomiFlagWTBullLevel) and
wtCross and
wtCrossUp and
(hwtVwap > sommiVwapBullLevel)
[bearPattern, bullPattern, hwtVwap]
// Sommi diamond
f_findSommiDiamond(tf, tf2, wt1, wt2, wtCross, wtCrossUp, wtCrossDown) =>
[candleBodyDir, newBar] = f_getTFCandle(tf)
[candleBodyDir2, newBar2] = f_getTFCandle(tf2)
bearPattern = (wt2 >= soomiDiamondWTBearLevel) and
wtCross and
wtCrossDown and
not candleBodyDir and
not candleBodyDir2
bullPattern = (wt2 <= soomiDiamondWTBullLevel) and
wtCross and
wtCrossUp and
candleBodyDir and
candleBodyDir2
[bearPattern, bullPattern] bu koddaki hataları düzelt.
Bu satırdaki "bu koddaki hataları düzelt." ifadesi, bir yorum olarak eklenmemiş ve bu nedenle kodda sözdizimi hatasına neden oluyor. Bu metni kaldırmanız veya bir yorum satırı haline getirmeniz gerekiyor. Düzeltilmiş hali:
[bearPattern, bullPattern]
Tam düzeltilmiş f_findSommiDiamond fonksiyonu aşağıdaki gibi olmalı:
// Sommi diamond
f_findSommiDiamond(tf, tf2, wt1, wt2, wtCross, wtCrossUp, wtCrossDown) =>
[candleBodyDir, newBar] = f_getTFCandle(tf)
[candleBodyDir2, newBar2] = f_getTFCandle(tf2)
bearPattern = (wt2 >= soomiDiamondWTBearLevel) and
wtCross and
wtCrossDown and
not candleBodyDir and
not candleBodyDir2
bullPattern = (wt2 <= soomiDiamondWTBullLevel) and
wtCross and
wtCrossUp and
candleBodyDir and
candleBodyDir2
[bearPattern, bullPattern]
Ayrıca, kodunuzda iki tane //@version=5 ve indicator() ifadesi bulunuyor. TradingView Pine Script sadece bir tane //@version ve indicator() ifadesine izin verir. Bu yüzden, kodunuzun başındaki ilk //@version=5 ve indicator() satırlarını bırakıp, ikinci kez yazılanları silmelisiniz veya ikinci kısımdaki kodları birleştirerek tek bir script haline getirmelisiniz.
Eğer kodunuz aşağıdaki gibi iki kez indicator() ile başlıyorsa:
İkinci //@version=5 ve indicator() satırlarını silin veya tüm kodu tek bir script içinde birleştirin.
Son olarak, kodun tamamını gözden geçirin ve her bir fonksiyonun ve değişkenin doğru tanımlandığından emin olun. Eğer başka hata mesajları alırsanız, lütfen bu mesajları benimle paylaşın, böylece yardımcı olabilirim.