Skip to content

Instantly share code, notes, and snippets.

@paul1522
Forked from illcrx/BarTzar
Last active September 18, 2018 17:04
Show Gist options
  • Save paul1522/2c4ed5ae11a6d3dc06587f8306c063e2 to your computer and use it in GitHub Desktop.
Save paul1522/2c4ed5ae11a6d3dc06587f8306c063e2 to your computer and use it in GitHub Desktop.
Bar analyzing Indicator for TradingView from Real-Crypto
//@version=3
study("BarTzar", overlay=true)
//Variables to get percentage open/close
breadth = high - low //this is the bar range
closeBreadth = close - low // this is the closing
barCloseBreadth = closeBreadth / breadth
//supDayThresh = input(40, minval=0, maxval=100, title="Threshold for support")
volAvg = input(50,minval=1,title="Number of bars", type=integer)
volAvgX = input(1.4, title="Breakout Volume Threshold %")
upBar = close > open
downBar = open > close
higherVolume = volume > 2*volume[1]
sellingWick = barCloseBreadth < .4 // (high-close > close-low)
buyingWick = barCloseBreadth > .6 //(high-close <= close-low)
avgVolMult = volAvg * volAvg
avgVolume = sma(volume,avgVolMult)
highVolume = volume > (avgVolume*2)
insideBar = high < high[1] and low > low[1]
//plotshape(close, title="1", locationlocation.belowbar, transp=0)
//plotshape(supportDay, title="Support Day", color=lime, style=shape.arrowup, location=location.belowbar, text="SupportDay", transp=0)
//plotshape(upBar, title="Up", color=lime, style=shape.arrowup, location=location.belowbar, text="Up", transp=0)
bullishEngulfingData=(high > high[1] and low < low[1] and upBar and higherVolume)
plotshape(bullishEngulfingData, title="Bullish Engulfing", color=lime, style=shape.arrowup, location=location.belowbar, text="BULL", transp=0)
bearishEngulfingData=(high > high[1] and low < low[1] and downBar and higherVolume)
plotshape(bearishEngulfingData, title="Bearish Engulfing", color=fuchsia, style=shape.arrowdown, location=location.abovebar, text="BEAR", transp=0)
//******************************Buying and Selling Pressure***************************
selling=((volume > avgVolume) and sellingWick and volume > volume[1] and volume > volume[2] and not insideBar)
plotshape(selling, title="Selling Bar", color=red, style=shape.arrowdown, location=location.abovebar, text="Selling", transp=0)
buying=((volume > avgVolume) and buyingWick and volume > volume[1] and volume > volume [2] and not insideBar)
plotshape(buying, title="Buying Bar", color=lime, style=shape.arrowup, location=location.belowbar, text="Buying", transp=0)
//define what close the low is, then see if volume is a factor while testing
//reversal=(high > high[1] and close )
//plotshape(buying, title="Reversal bar", color=red, style=shape.square, location=location.abovebar, text="Reversal", transp=0)
//******************************Topping Candles *************************************
//topping=(high > high [1] and upBar and highVolume)
//plotshape(topping, title="Topping Signal", color=red, style=shape.triangledown, location=location.abovebar, text="Topping", transp=0)
//Potential Areas to move
//lowVolume = (volume < (avgVolume/2) and volume[1] < volume [2] and volume < volume[1] and (volume < (avgVolume/4)))
//plotshape(lowVolume, title="Low Volume Alert", color=yellow, style=shape.circle, location=location.abovebar, text="Low Volume", transp=0)
@paul1522
Copy link
Author

Improved readability for older eyeballs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment