Skip to content

Instantly share code, notes, and snippets.

@illcrx
Created August 18, 2018 18:18
Show Gist options
  • Save illcrx/bbd2aef4485f20bf5c323c2f5da37433 to your computer and use it in GitHub Desktop.
Save illcrx/bbd2aef4485f20bf5c323c2f5da37433 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)
//plotshape(supportDay, title="Support Day", color=green, style=shape.arrowup, location=location.belowbar, text="SupportDay")
//plotshape(upBar, title="Up", color=green, style=shape.arrowup, location=location.belowbar, text="Up")
bullishEngulfingData=(high > high[1] and low < low[1] and upBar and higherVolume)
plotshape(bullishEngulfingData, title="Bullish Engulfing", color=green, style=shape.arrowup, location=location.belowbar, text="BULL")
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")
//******************************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")
buying=((volume > avgVolume) and buyingWick and volume > volume[1] and volume > volume [2] and not insideBar)
plotshape(buying, title="Buying Bar", color=green, style=shape.arrowup, location=location.belowbar, text="Buying")
//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")
//******************************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")
//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")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment