-
-
Save somme/1e8ebe8cdf4921623ccad834a17f12a8 to your computer and use it in GitHub Desktop.
//@version=4 | |
// CIRCLES: | |
// - LITTLE: They appear at all WaveTrend wave crossings | |
// - GREEN: The wavetrend waves are at the oversold level and have crossed up (bullish) | |
// - RED: The wavetrend waves are at the overbought level and have crossed down (bearish) | |
// - PURPLE: Appear when a bullish or bearish divergence is formed and WaveTrend waves crosses at overbought and oversold points | |
// - GOLD: When RSI is below 20, WaveTrend waves are below or equal to -80 and have crossed up (DONT BUY WHEN GOLD CIRCLE APPEAR) | |
// - None of these circles are certain signs to trade. It is only information that can help you. | |
// | |
// 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. | |
study(title="Cipher_B", shorttitle="Cipher_B") | |
// FUNCTIONS { | |
// DIVERGENCES | |
f_top_fractal(_src) => _src[4] < _src[2] and _src[3] < _src[2] and _src[2] > _src[1] and _src[2] > _src[0] | |
f_bot_fractal(_src) => _src[4] > _src[2] and _src[3] > _src[2] and _src[2] < _src[1] and _src[2] < _src[0] | |
f_fractalize(_src) => f_top_fractal(_src) ? 1 : f_bot_fractal(_src) ? -1 : 0 | |
// MA Selector | |
ma(matype, src, length) => | |
if matype == "RMA" | |
rma(src, length) | |
else | |
if matype == "SMA" | |
sma(src, length) | |
else | |
if matype == "EMA" | |
ema(src, length) | |
else | |
if matype == "WMA" | |
wma(src, length) | |
else | |
if matype == "VWMA" | |
vwma(src, length) | |
else | |
src | |
// } FUNCTIONS | |
// PARAMETERS { | |
// WaveTrend Channel Length | |
n1 = input(7, "WT Channel Length") | |
// WaveTrend Average Length | |
n2 = input(13, "WT Average Length") | |
// WaveTrend MA Params | |
wtMA = input(defval="EMA", title="WT MA Type", options=["RMA", "SMA", "EMA", "WMA"]) | |
wtMA1 = input(defval="EMA", title="WT MA Type 1", options=["RMA", "SMA", "EMA", "WMA"]) | |
wtMA2 = input(defval="EMA", title="WT MA Type 2", options=["RMA", "SMA", "EMA", "WMA"]) | |
wtMA3 = input(defval="SMA", title="WT MA Type 3", options=["RMA", "SMA", "EMA", "WMA"]) | |
// WaveTrend Overbought & Oversold lines | |
obLevel = input(53, "WT Overbought Level 1") | |
obLevel2 = input(60, "WT Overbought Level 2") | |
osLevel = input(-53, "WT Oversold Level 1") | |
osLevel2 = input(-60, "WT Oversold Level 2") | |
osLevel3 = input(-80, "WT Oversold Level 3") | |
// WaveTrend MA Source | |
ap = input(ohlc4, "WaveTrend MA Source") | |
// WaveTrend MA Length | |
sp = input(3, "WaveTrend MA Length") | |
// RSI+MFI Period | |
rsiMFIperiod = input(60, "RSI+MFI Period") | |
MFRSIMA = input(defval="SMA", title="MFRSIMA", options=["RMA", "SMA", "EMA", "WMA", "VWMA"]) | |
//RSI+MFI Area multiplier | |
rsiMFIMultiplier = input(150, "RSI+MFI Area multiplier") | |
// Colors | |
colorRed = #ff0000 | |
colorPurple = #da00ff | |
colorGreen = #03ff00 | |
colorOrange = color.orange | |
colorWT1 = #8ec7fb | |
colorWT2 = #1353ac | |
// Divergence WT | |
WTShowDiv = input(true, 'Show WT Divergences') | |
WTDivOBLevel = input(35, title="WT Bearish Divergence min") | |
WTDivOSLevel = input(-65, title="WT Bullish Divergence min") | |
// Divergence RSI | |
RSIShowDiv = input(false, 'Show RSI Divergences') | |
RSIDivOBLevel = input(60) | |
RSIDivOSLevel = input(30) | |
// RSI Levels | |
RSIOversold = input(30, "RSI Oversold", input.integer, minval=50, maxval=100) | |
RSIOverbought = input(60, "RSI Overbought", input.integer, minval=0, maxval=50) | |
// } PARAMETERS | |
// CALCULATE INDICATORS { | |
// RSI + MFI Area | |
candleValue = (close - open) / (high - low) | |
MVC = ma(MFRSIMA, candleValue * rsiMFIMultiplier, rsiMFIperiod) | |
color_area = MVC > 0 ? color.green : color.red | |
// RSI | |
up = rma(max(change(close), 0), 14) | |
down = rma(-min(change(close), 0), 14) | |
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down) | |
rsiColor = rsi <= RSIOversold ? color.green : rsi >= RSIOverbought ? color.red : color.purple | |
// Calculates WaveTrend | |
esa = ma(wtMA, ap, n1) | |
de = ma(wtMA1, abs(ap - esa), n1) | |
ci = (ap - esa) / (0.015 * de) | |
tci = ma(wtMA2, ci, n2) | |
wt1 = tci | |
wt2 = ma(wtMA3, wt1, sp) | |
// VWAP | |
vwap_area = wt1 - wt2 | |
// WaveTrend Conditions | |
WTCross = cross(wt1, wt2) | |
WTCrossUp = wt2 - wt1 <= 0 | |
WTCross_last = cross(wt1[2], wt2[2]) | |
WTCrossUp_last = wt2[2] - wt1[2] <= 0 | |
WTCrossDown_last = wt2[2] - wt1[2] >= 0 | |
WTCrossDown = wt2 - wt1 >= 0 | |
WTOverSold = wt2 <= osLevel | |
WTOverBought = wt2 >= obLevel | |
// WT Divergence | |
WTFractal_top = f_fractalize(wt2) > 0 and wt2[2] >= WTDivOBLevel ? wt2[2] : na | |
WTFractal_bot = f_fractalize(wt2) < 0 and wt2[2] <= WTDivOSLevel ? wt2[2] : na | |
WTHigh_prev = valuewhen(WTFractal_top, wt2[2], 0)[2] | |
WTHigh_price = valuewhen(WTFractal_top, high[2], 0)[2] | |
WTLow_prev = valuewhen(WTFractal_bot, wt2[2], 0)[2] | |
WTLow_price = valuewhen(WTFractal_bot, low[2], 0)[2] | |
WTRSI_prev = valuewhen(WTFractal_bot, rsi[2], 0)[2] | |
bearWTSignal = WTFractal_top and high[2] > WTHigh_price and wt2[2] < WTHigh_prev | |
bullWTSignal = WTFractal_bot and low[2] < WTLow_price and wt2[2] > WTLow_prev | |
WTCol1 = bearWTSignal ? colorRed : na | |
WTCol2 = bullWTSignal ? #00FF00EB : na | |
WTGoldBuy = WTLow_prev <= osLevel3 and WTRSI_prev < 20 and bullWTSignal | |
// RSI Divergence | |
RSIFractal_top = f_fractalize(rsi) > 0 and rsi >= RSIDivOBLevel ? rsi[2] : na | |
RSIFractal_bot = f_fractalize(rsi) < 0 and rsi <= RSIDivOSLevel ? rsi[2] : na | |
RSIHigh_prev = valuewhen(RSIFractal_top, rsi[2], 0)[2] | |
RSIHigh_price = valuewhen(RSIFractal_top, high[2], 0)[2] | |
RSILow_prev = valuewhen(RSIFractal_bot, rsi[2], 0)[2] | |
RSILow_price = valuewhen(RSIFractal_bot, low[2], 0)[2] | |
bearRSISignal = RSIFractal_top and high[2] > RSIHigh_price and rsi[2] < RSIHigh_prev | |
bullRSISignal = RSIFractal_bot and low[2] < RSILow_price and rsi[2] > RSILow_prev | |
RSICol1 = bearRSISignal ? #ff0000: na | |
RSICol2 = bullRSISignal ? #00FF00EB : na | |
// Small Circles WT Cross | |
signalColor = wt2 - wt1 > 0 ? color.red : color.lime | |
// Buy signal. | |
buySignal = WTCross and WTCrossUp and WTOverSold | |
divBuySignal = WTCross_last and WTCrossUp_last and ((WTShowDiv ? bullWTSignal : false) or (RSIShowDiv ? bullRSISignal : false)) | |
buySignalColor = buySignal ? color.new(colorGreen, 65) : na | |
// Sell signal | |
sellSignal = WTCross and WTCrossDown and WTOverBought | |
divSellSignal = WTCross_last and WTCrossDown_last and (bearWTSignal) | |
sellSignalColor = sellSignal ? color.new(colorRed, 65) : na | |
// Gold Buy | |
plotWTGoldBuy = WTCrossUp_last and WTGoldBuy | |
// } CALCULATE INDICATORS | |
// DRAW { | |
// 0 Line | |
plot(0, title="0 Line", color=color.gray) | |
// Draw Overbought & Oversold lines | |
plot(obLevel, title="Over Bought Level 1", color=color.gray, linewidth=2, style=plot.style_stepline, transp=15) | |
plot(obLevel2, title="Over Bought Level 2", color=color.gray, style=plot.style_cross, transp=60) | |
plot(osLevel, title="Over Sold Level 1", color=color.gray, linewidth=2, style=plot.style_stepline, transp=15) | |
plot(osLevel2, title="Over Sold Level 2", color=color.gray, style=plot.style_cross, transp=60) | |
// Divergences | |
plot(series = WTFractal_top and WTShowDiv ? wt2[2] : na, title='WT Bearish Divergence', color=WTCol1, linewidth=2, transp=65, offset=-2) | |
plot(series = WTFractal_bot and WTShowDiv ? wt2[2] : na, title='WT Bullish Divergence', color=WTCol2, linewidth=2, transp=65, offset=-2) | |
plot(series = RSIFractal_top and RSIShowDiv ? rsi[2] : na, title='RSI Bearish Divergence', color=RSICol1, linewidth=1, transp=65, offset=-2) | |
plot(series = RSIFractal_bot and RSIShowDiv? rsi[2] : na, title='RSI Bullish Divergence', color=RSICol2, linewidth=1, transp=65, offset=-2) | |
// RSI | |
plot(rsi, title="RSI", color=rsiColor, linewidth=1, transp=35) | |
// RSI + MFI AREA | |
RSIMFIplot = plot(MVC, title="RSI+MFI Area", color=color_area, transp=35) | |
fill(RSIMFIplot, plot(0), color_area, transp=45) | |
// RSI + MFI BAR | |
rsimfiBarTopLine = plot(-95, title="RSI+MFI Bar TOP Line", color=color.black, transp=100) | |
rsimfiBarBottomLine = plot(-105, title="RSI+MFI Bar BOTTOM Line", color=color.black, transp=100) | |
fill(rsimfiBarTopLine, rsimfiBarBottomLine, color=color_area, transp=65) | |
// WT Area 1 | |
plot(wt1, style=plot.style_area, title="WT Wave 1", color=colorWT1, transp=0) | |
// WT Area 2 | |
plot(wt2, style=plot.style_area, title="WT Wave 2", color=colorWT2, transp=10) | |
// VWAP | |
plot(vwap_area, title="VWAP", color=color.yellow, style=plot.style_area, transp=35) | |
// Circles | |
plot(WTCross ? wt2 : na, title="Buy and sell signals", color=signalColor, style=plot.style_circles, linewidth=3, transp=35) // Small circles | |
plotshape(buySignal ? -100 : na, title="Big buy signal", color=buySignalColor, style=shape.circle, location=location.absolute, size=size.tiny) // Big green circle, oversold | |
plotshape(divBuySignal ? -120 : na, title="Big buy signal", color=colorPurple, style=shape.triangleup, offset=-2, location=location.absolute, size=size.tiny) // Big purple triangle, bullish divergence | |
plotshape(divBuySignal ? -100 : na, title="Divergence buy signal", color=color.new(colorGreen, 0), style=shape.circle, offset=-2, location=location.absolute, size=size.tiny) // Big green circle divergence, bullish divergence | |
plotshape(plotWTGoldBuy ? -100 : na, title="Big short signal", color=color.orange, style=shape.circle, transp=25, offset=-2, location=location.absolute, size=size.tiny) | |
plotshape(sellSignal ? 100 : na, title="Big short signal", color=sellSignalColor, style=shape.circle, location=location.absolute, size=size.tiny) // Big green circle, overbought | |
plotshape(divSellSignal ? 120 : na, title="Big short signal", color=colorPurple, style=shape.triangledown, offset=-2, location=location.absolute, size=size.tiny) // Big purple circle, bearish divergence | |
plotshape(divSellSignal ? 100 : na, title="Divergence short signal", color=color.new(colorRed, 0), style=shape.circle, offset=-2, location=location.absolute, size=size.tiny) // Big purple circle, bearish divergence | |
// } DRAW | |
// ALERTS { | |
// BUY | |
alertcondition(buySignal != 0, "Buy Signal (Big green circle)", "Green circle WaveTrend Oversold") | |
alertcondition(divBuySignal != 0, "Buy Signal (Big green circle + Div)", "Buy signal & WT Bullish Divergence & WT Overbought ") | |
alertcondition(plotWTGoldBuy != 0, "GOLD Buy Signal (Big GOLDEN circle)", "Green & GOLD circle WaveTrend Overbought") | |
// SELL | |
alertcondition(sellSignal != 0, "Sell Signal (Big red circle)", "Red Circle WaveTrend Overbought") | |
alertcondition(divSellSignal != 0, "Sell Signal (Big red circle + Div)", "Buy signal & WT Bearish Divergence & WT Overbought ") | |
// } ALERTS |
Can i also find version A anywhere?
https://www.tradingview.com/script/cAw5GEAB-Market-Cipher-A-free-version-1-1/
here you go :D
can anyone point me in the direction of the source code for "market cipher support/resistance" // "market cipher SR", please?
the MFI is close to market cipher but not exact. has anyone optimized the parameters to better match?
I recommend market liberator. Its accessable for a donation of any size!
GL
there are those who set up money flow more accurately?
Any way to make Money Flow behave like Market Cypher's? (It's 2023!)
i figured the formula, add me on discord ihlmns
@ihlmns cant find you om dc, Add me instead: Dennzo99
Anyone know what the real forumal is for MCB money flow?
dm me on discord kimo3063 I don't have the code but I found a guy who have exactly the same moneyflow like original MCB in his indicator it's very good
Why not post it here...?
The money flow is behind the wave trend with this script? Anyway you can update it?
ay yooo guys i got old code of vumanchu B that is editable can anyone help me how to add stoch indicator like on market cipher b and can someone help me how to set mfi calculations to be calculated as heiken ashi candles cause when u use heiken ashi its pretty simular to market cipher B but i kinda dont like heiken ashi so i think it can be coded also if someone can do that just comment on this please
ay yooo guys i got old code of vumanchu B that is editable can anyone help me how to add stoch indicator like on market cipher b and can someone help me how to set mfi calculations to be calculated as heiken ashi candles cause when u use heiken ashi its pretty simular to market cipher B but i kinda dont like heiken ashi so i think it can be coded also if someone can do that just comment on this please
ask chatgpt
Can i also find version A anywhere?