Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 8888888888 8888888b. 8888888888 8888888888 d8888 888 .d8888b. .d88888b. As you
- // 888 888 Y88b 888 888 d88888 888 d88P Y88b d88P" "Y88b Can see
- // 888 888 888 888 888 d88P888 888 888 888 888 888 Are all
- // 8888888 888 d88P 8888888 8888888 d88P 888 888 888 888 888 .d8888b Basic free
- // 888 8888888P" 888 888 d88P 888 888 888 88888 888 888 88K tradingview
- // 888 888 T88b 888 888 d88P 888 888 888 888 888 888 "Y8888b. indicators
- // 888 888 T88b 888 888 d8888888888 888 Y88b d88P Y88b. .d88P X88 repackaged
- // 888 888 T88b 8888888888 8888888888 d88P 888 88888888 "Y8888P88 "Y88888P" 88888P' into one
- //
- // FAQ
- //
- // Why?
- // I want you to see what you are willing to pay hundereds of dollars a month
- // Has the code been leaked/hacked?
- // No, this code has been created from scratch only using common sense and public information from the internet
- // What's the accuracy I can expect from this version of the indicator?
- // I'd say it's about 95% the same as the one you would pay
- // The indicator needs to be updated?
- // Write me a private message on TradingView (Nick42_for_win)
- // Can I suggest an indicator to get a FREE ALGOs version?
- // Write me a private message on TradingView (Nick42_for_win)
- // Do you get any monetary return from this project?
- // Nope, 0$
- // Enjoy ;)
- //@version=5
- indicator("FREE ALGOs [TBO]", overlay=true)
- //------------------------- TBO | https://www.thebettertraders.com -----------//
- // Get user input
- bool enableCustomTBO = input(false, "Enable?", "Custom trend settings are not enabled by default. The default settings loaded are not shown publicly. You have the option to enter your own custom settings as you get more familiar with the TBO.", group="CUSTOM TREND STRENGTH SETTINGS")
- var fastLen = input.int(1, "TBO Fast", 1, group="CUSTOM TREND STRENGTH SETTINGS")
- var mediumLen = input.int(2, "TBO Medium", 2, group="CUSTOM TREND STRENGTH SETTINGS")
- var medfastLen = input.int(3, "TBO Med Fast", 3, group="CUSTOM TREND STRENGTH SETTINGS")
- var slowLen = input.int(4, "TBO Slow", 4, group="CUSTOM TREND STRENGTH SETTINGS")
- bool enableRSI = input(false, "Enable?", "Enable this if you wish to combine an RSI requirement with the TBO Long or TBO Short signal. The default settings shown here have no importance, they are just placeholders and are not significant. It is raccomended to have the RSI showing when this is enabled so you can see what kind of settings will work.", group="TBO LONG/SHORT W/ RSI")
- var shortRsiBand = input.int(70, "Short RSI Band", 1, 100, group="TBO LONG/SHORT W/ RSI")
- var shortBandGL = input.string("Greater Than", "Greater/Less Than", ["Greater Than", "Less Than"], group="TBO LONG/SHORT W/ RSI")
- var longRsiBand = input.int(30, "Long RSI Band", 1, 100, group="TBO LONG/SHORT W/ RSI")
- var longBandGL = input.string("Less Than", "Greater/Less Than", ["Greater Than", "Less Than"], group="TBO LONG/SHORT W/ RSI")
- var rsiLen = input.int(14, "TBO Med Fast", 1, group="TBO LONG/SHORT W/ RSI")
- bool enableTP = input(false, "Enable?", group="TAKE PROFIT SETTINGS")
- var longTPperc = input.int(9, "TP Long %", 1, group="TAKE PROFIT SETTINGS")
- var shortTPperc = input.int(9, "TP Short %", 1, group="TAKE PROFIT SETTINGS")
- bool static = input(false, "Static", "If enabled will plot a signal every time volume gets greater than your defined value.", group="DHP VOLUME SCALPING")
- var volThreshold = input.int(20000, "Volume", 1, group="DHP VOLUME SCALPING")
- bool maMultiple = input(false, "MA Multiple", "If enabled will plot a signal every time volume gets greater than his average multiplied by your defined value.", group="DHP VOLUME SCALPING")
- var average = input.int(20, "Average", 2, tooltip="Number of bars back used to calculate the volume's average.", group="DHP VOLUME SCALPING")
- var multipleX = input.int(3, "Multiple X", 1, tooltip="Number of times the volume's average will be multiplied.", group="DHP VOLUME SCALPING")
- // Functions
- bb(src, len, mult) =>
- float basis = ta.ema(src, len)
- float dev = mult * ta.stdev(src, len)
- [basis, basis + dev, basis - dev]
- [_, upperBB, lowerBB] = bb(close, 25, 1)
- isLast(var1, var2) => ta.barssince(var1) < ta.barssince(var2)
- // Get components
- float fastTBO = ta.ema(close, enableCustomTBO ? fastLen : 20)
- float mediumTBO = ta.ema(close, enableCustomTBO ? mediumLen : 40)
- float medfastTBO = ta.sma(close, enableCustomTBO ? medfastLen : 50)
- float slowTBO = ta.sma(close, enableCustomTBO ? slowLen : 150)
- float rsi = ta.rsi(close, rsiLen)
- bool rsiShort = enableRSI and shortBandGL == "Greater Than" ? (rsi > shortRsiBand) : (rsi < shortRsiBand)
- bool rsiLong = enableRSI and longBandGL == "Less Than" ? (rsi < longRsiBand) : (rsi > longRsiBand)
- float vol = volume
- float volMA = ta.sma(vol, average) * multipleX
- bool openLong = ta.crossover(fastTBO, mediumTBO) and rsiLong, lastLong = ta.barssince(openLong), long = ta.crossover(fastTBO, mediumTBO)
- bool openShort = ta.crossunder(fastTBO, mediumTBO) and rsiShort, lastShort = ta.barssince(openShort), short = ta.crossunder(fastTBO, mediumTBO)
- bool closeLong = fastTBO > slowTBO and mediumTBO > medfastTBO and medfastTBO > slowTBO and ta.crossunder(close, mediumTBO)
- bool closeShort = fastTBO < slowTBO and mediumTBO < medfastTBO and medfastTBO < slowTBO and ta.crossover(close, mediumTBO)
- float longTP = enableTP ? (lastLong < lastShort ? close[lastLong] * (1 + longTPperc / 100) : na) : na, longTpHit = ta.crossover(close, longTP)
- float shortTP = enableTP ? (lastLong > lastShort ? close[lastShort] * (1 - shortTPperc / 100) : na) : na, shortTpHit = ta.crossunder(close, shortTP)
- bool crossUp = ta.crossover(mediumTBO, medfastTBO)
- bool crossDown = ta.crossunder(mediumTBO, medfastTBO)
- bool staticLongPump = static and close > fastTBO and vol > volThreshold
- bool staticShortPump = static and close < fastTBO and vol > volThreshold
- bool maLongPump = maMultiple and close > fastTBO and vol > volMA
- bool maShortPump = maMultiple and close < fastTBO and vol > volMA
- float resistance = 0.0, resistance := ta.crossunder(close, upperBB) ? high : resistance[1]
- float support = 0.0, support := ta.crossover(close, lowerBB) ? low : support[1]
- bool breakout = close > fastTBO and open > fastTBO and mediumTBO > slowTBO and ta.highest(50) > ta.highest(50)[1]
- bool breakdown = close < fastTBO and open < fastTBO and mediumTBO < slowTBO and ta.lowest(50) < ta.lowest(50)[1]
- bool breakoutZone = isLast(long, short) and isLast(crossUp, crossDown)
- bool breakdownZone = isLast(short, long) and isLast(crossDown, crossUp)
- int countBreakout = 0, countBreakout := breakout and breakoutZone ? countBreakout[1] + 1 : long or breakdownZone ? 0 : countBreakout[1]
- int countBreakdown = 0, countBreakdown := breakdown and breakdownZone ? countBreakdown[1] + 1 : short or breakoutZone ? 0 : countBreakdown[1]
- // Colors
- green = #2FD282, lightGreen = #86C8B9
- red = color.red
- blue = color.blue
- orange = color.orange
- pink = #E34DED, lightPink = #F283B8
- yellow = color.yellow
- white = color.white
- // Plots
- p1 = plot(fastTBO, "TBO Fast", fastTBO > mediumTBO ? lightGreen : lightPink, 3)
- p2 = plot(mediumTBO, "TBO Medium", mediumTBO > slowTBO ? color.new(#42BDA8, 97.5) : color.new(lightPink, 97.5))
- p3 = plot(medfastTBO, "TBO Med Fast", medfastTBO > slowTBO ? color.new(#42BDA8, 97.5) : color.new(lightPink, 97.5))
- p4 = plot(slowTBO, "TBO Slow", fastTBO > slowTBO ? color.new(#42BDA8, 97.5) : color.new(lightPink, 97.5))
- plot(resistance, "Resistance", close <= resistance ? #CC4242 : #3D8C40, 1, plot.style_circles)
- plot(support, "Support", close > support ? #3D8C40 : #CC4242, 1, plot.style_circles)
- plotshape(breakout and breakoutZone and countBreakout <= 3, "⌂ Breakout", shape.labelup, location.belowbar, white, size=size.tiny)
- plotshape(breakdown and breakdownZone and countBreakdown <= 3, "○ Breakdown", shape.circle, location.abovebar, yellow, size=size.tiny)
- plotshape(openLong, "▲ Open Long", shape.triangleup, location.belowbar, green, size=size.tiny)
- plot(longTP, "Long TP", color.blue, 1, plot.style_circles)
- plotshape(crossUp, "✖ Cross Up", shape.xcross, location.abovebar, green, size=size.tiny)
- plotshape(crossDown, "✖ Cross Down", shape.xcross, location.belowbar, red, size=size.tiny)
- plotshape(closeLong, "◆ Close Long", shape.diamond, location.abovebar, blue, size=size.tiny)
- plotshape(openShort, "▼ Open Short", shape.triangledown, location.abovebar, pink, size=size.tiny)
- plot(shortTP, "Short TP", color.blue, 1, plot.style_circles)
- plotshape(closeShort, "◆ Close Short", shape.diamond, location.belowbar, orange, size=size.tiny)
- plotshape(staticShortPump, "Static Short Pump", shape.flag, location.belowbar, white, size=size.tiny)
- plotshape(staticLongPump, "Static Long Pump", shape.flag, location.abovebar, white, size=size.tiny)
- plotshape(maShortPump, "MA Short Pump", shape.flag, location.belowbar, yellow, size=size.tiny)
- plotshape(maLongPump, "MA Long Pump", shape.flag, location.abovebar, yellow, size=size.tiny)
- fill(p3, p4, medfastTBO > slowTBO ? color.new(#42BDA8, 75) : color.new(lightPink, 75), "Long Trend")
- fill(p2, p3, mediumTBO > medfastTBO ? color.new(#42BDA8, 80) : color.new(lightPink, 80), "Mid Trend")
- fill(p1, p2, fastTBO > mediumTBO ? color.new(#42BDA8, 85) : color.new(lightPink, 85), "Short Trend")
- // Alerts
- alertcondition(breakout and breakoutZone and countBreakout <= 3, "⌂ Breakout", "⌂ Breakout")
- alertcondition(openLong, "▲ Open Long", "▲ Open Long")
- alertcondition(openShort, "▼ Open Short", "▼ Open Short")
- alertcondition(closeLong, "◆ Close Long", "◆ Close Long")
- alertcondition(closeShort, "◆ Close Short", "◆ Close Short")
- alertcondition(breakdown and breakdownZone and countBreakdown <= 3, "○ Breakdown", "○ Breakdown")
- alertcondition(crossDown, "✖ Cross Down", "✖ Cross Down")
- alertcondition(crossUp, "✖ Cross Up", "✖ Cross Up")
- alertcondition(longTpHit or shortTpHit, "Long or Short TP Hit", "Long or Short TP Hit")
- alertcondition(longTpHit, "Long TP", "Long TP")
- alertcondition(maLongPump, "MA Long Pump", "MA Long Pump")
- alertcondition(maShortPump, "MA Short Pump", "MA Short Pump")
- alertcondition(shortTpHit, "Short TP", "Short TP")
- alertcondition(staticLongPump, "Static Long Pump", "Static Long Pump")
- alertcondition(staticShortPump, "Static Short Pump", "Static Short Pump")
Add Comment
Please, Sign In to add comment