Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=2
- study("Leveraged S/R", overlay = true, max_bars_back=2000)
- //If this indicator made you money or you just appreciate the work put into it, feel free to leave one:
- //BTC: 1KHAhAwVd8GeeA1ezovzJmo82ee38TFhiw
- //ETH: 0xe26a4381380be19752Af83F6b0b628C412fD53b8
- //Rules
- TKcross10306030 = input(true, title="TK Cross (10, 30, 60, 30)")
- TKcross20603060 = input(true, title= "TK Cross(20, 60, 30, 60)")
- DeMark = input(true, title ="DeMark")
- RSI_BB = input(true, title = "RSI + BB Cross")
- Leverage = input(5, title = "Leverage")
- src = input(close, title = "Source")
- //TD
- up = src > src[4] ? nz(up[1]) + 1 : 0, tdup = up - valuewhen(up < up[1], up, 0)
- dn = src < src[4] ? nz(dn[1]) + 1 : 0, tddn = dn - valuewhen(dn < dn[1], dn, 0)
- //Ichimoku
- d(l) => avg(highest(l), lowest(l))
- t = d(10)
- t2x = d(20)
- k = d(30)
- k2x = d(60)
- //BB
- BBp = input(20, title = "BB periods)")
- mult = input(2, title = "Multiplier")
- basis = sma(src, BBp)
- dev = mult * stdev(src, BBp)
- upper = basis + dev
- lower = basis - dev
- //RSI
- RSIp = input(14, title="RSI periods")
- rsi = rsi(close, RSIp)
- os = input(30, title="Oversold RSI level")
- ob = input(70, title="Overbought RSI level")
- //Signals
- bear_TKx = crossunder(t, k)
- bull_TKx = crossover(t, k)
- bear_TKx2x = crossunder(t2x, k2x)
- bull_TKx2x = crossover(t2x, k2x)
- RSIob = rsi > ob
- RSIos = rsi < os
- BBxup = crossover(src, upper)
- BBxdown = crossunder(src, lower)
- TDbuysetup = tdup == 9
- TDsellsetup = tddn == 9
- //SR Ichi
- IchiLongLiqLevel = src[barssince(bull_TKx)] - (src[barssince(bull_TKx)]/Leverage)
- IchiShortLiqLevel = src[barssince(bear_TKx)] + (src[barssince(bear_TKx)]/Leverage)
- //SR Ichi 2x
- Ichi2xLongLiqLevel = src[barssince(bull_TKx2x)] - (src[barssince(bull_TKx2x)]/Leverage)
- Ichi2xShortLiqLevel = src[barssince(bear_TKx2x)] + (src[barssince(bear_TKx2x)]/Leverage)
- //SR RSI + BB (OS = oversold, OB = overbought)
- RSIBB_OSLiqLevel = src[barssince(RSIos and BBxdown)] - (src[barssince(RSIos and BBxdown)]/Leverage)
- RSIBB_OBLiqLevel = src[barssince(RSIob and BBxup)] + (src[barssince(RSIob and BBxup)]/Leverage)
- //SR TD
- TDLongLiqLevel = src[barssince(TDbuysetup)] - (src[barssince(TDbuysetup)]/Leverage)
- TDShortLiqLevel = src[barssince(TDsellsetup)] + (src[barssince(TDsellsetup)]/Leverage)
- //plots (LLL = Long Liquidation Level; SLL = Short Liquidation Level)
- plot(TKcross10306030 and src > IchiLongLiqLevel ? IchiLongLiqLevel : false, style = circles, linewidth = 2, color = #70C1B3, title = "Ichi LLL")
- plot(TKcross10306030 and src < IchiShortLiqLevel ? IchiShortLiqLevel : false, style = circles, linewidth = 2, color = #F25F5C, title = "Ichi SLL")
- //Ichi2x
- plot(TKcross20603060 and src > Ichi2xLongLiqLevel ? Ichi2xLongLiqLevel : false, offset = 0, style = circles, linewidth = 2, color = #247BA0, title = "Ichi 2x, LLL")
- plot(TKcross20603060 and src < Ichi2xShortLiqLevel ? Ichi2xShortLiqLevel : false, style = circles, linewidth = 2, color = #FFE066, title = "Ichi 2x SLL")
- //rsibb
- plot(RSI_BB and src > RSIBB_OSLiqLevel ? RSIBB_OSLiqLevel : false, style = circles, linewidth = 2, color = silver, title = "RSI/BB LLL")
- plot(RSI_BB and src < RSIBB_OBLiqLevel ? RSIBB_OBLiqLevel : false, style = circles, linewidth = 2, color = gray, title = "RSI/BB SLL")
- //td
- plot(DeMark and src > TDLongLiqLevel ? TDLongLiqLevel : false, color = #EFCEFA, linewidth = 2, style = circles, title = "TD LLL")
- plot(DeMark and src < TDShortLiqLevel ? TDShortLiqLevel : false, color = #92BCEA, linewidth = 2, style = circles, title = "TD SLL")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement