Initial Commit ...
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center VBM Buy Sell Indicator
|
||||
// ---------------------------------------------
|
||||
// saherelm implementation of above indicator ...
|
||||
//
|
||||
// Maintainer:
|
||||
// ------------
|
||||
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
//@version=5
|
||||
indicator(title="SaherElm VBM Buy Sell Indicator", shorttitle = "XS_VBMBS_IND", overlay = true)
|
||||
|
||||
//
|
||||
// START Inputs ....
|
||||
//
|
||||
VBMBSFactor = input.int(defval = 4, minval = 1, maxval = 100, title = "Factor")
|
||||
VBMBSPd = input.int(defval = 7, minval = 1, maxval = 100, title = "Period")
|
||||
//
|
||||
// END Inputs ....
|
||||
//
|
||||
|
||||
//
|
||||
// START Functions ....
|
||||
//
|
||||
//
|
||||
// END Functions ....
|
||||
//
|
||||
|
||||
//
|
||||
// START Calculations ....
|
||||
//
|
||||
var bullishColor = color.lime
|
||||
var bearishColor = color.red
|
||||
|
||||
//
|
||||
VBMBSUp = hl2 - (VBMBSFactor * ta.atr(VBMBSPd))
|
||||
VBMBSDown = hl2 + (VBMBSFactor * ta.atr(VBMBSPd))
|
||||
|
||||
//
|
||||
// Trend Up ...
|
||||
float VBMBSTrendUp = na
|
||||
VBMBSTrendUp := close[1] > VBMBSTrendUp[1] ? math.max(VBMBSUp, VBMBSTrendUp[1]) : VBMBSUp
|
||||
|
||||
//
|
||||
// Trend Down ...
|
||||
float VBMBSTrendDown = na
|
||||
VBMBSTrendDown := close[1] < VBMBSTrendDown[1] ? math.min(VBMBSDown, VBMBSTrendDown[1]) : VBMBSDown
|
||||
|
||||
//
|
||||
float VBMBSTrend = na
|
||||
VBMBSTrend := close > VBMBSTrendDown[1] ? 1 : close < VBMBSTrendUp[1] ? -1 : nz(VBMBSTrend[1], 1)
|
||||
|
||||
//
|
||||
VBMBSMACD = VBMBSTrend == 1 ? VBMBSTrendUp : VBMBSTrendDown
|
||||
|
||||
//
|
||||
VBMBSLinecolor = VBMBSTrend == 1 ? bullishColor : bearishColor
|
||||
|
||||
//
|
||||
VBMBSUpArrow = ta.cross(close, VBMBSMACD) and close > VBMBSMACD
|
||||
VBMBSDownArrow = ta.cross(VBMBSMACD, close) and close < VBMBSMACD
|
||||
|
||||
//
|
||||
VBMBSLongSignal = VBMBSTrend == 1 and VBMBSTrend[1] == -1 ? VBMBSTrend : na
|
||||
VBMBSHasLongSignal = not na (VBMBSLongSignal)
|
||||
|
||||
//
|
||||
VBMBSShortSignal = VBMBSTrend == -1 and VBMBSTrend[1] == 1 ? VBMBSTrend : na
|
||||
VBMBSHasShortSignal = not na (VBMBSShortSignal)
|
||||
|
||||
//
|
||||
VBMBSHasSignal = VBMBSHasLongSignal or VBMBSHasShortSignal
|
||||
//
|
||||
// END Calculations ....
|
||||
//
|
||||
|
||||
//
|
||||
// START Plots ....
|
||||
//
|
||||
plot(series = VBMBSMACD, color = VBMBSLinecolor , style = plot.style_line, linewidth = 2, title = "B/S Line")
|
||||
|
||||
//
|
||||
plotshape(series = VBMBSUpArrow, title = "Up Arrow", style = shape.triangleup, location = location.belowbar, color = bullishColor)
|
||||
plotshape(series = VBMBSDownArrow, title = "Down Arrow", style = shape.triangledown, location = location.abovebar, color = bearishColor)
|
||||
|
||||
//
|
||||
plotarrow(series = VBMBSHasLongSignal ? VBMBSLongSignal : na, title = "Up Entry Arrow", colorup = bullishColor, maxheight = 40, minheight = 30)
|
||||
plotarrow(series = VBMBSHasShortSignal ? VBMBSShortSignal : na, title = "Down Entry Arrow", colordown = bearishColor, maxheight = 40, minheight = 30)
|
||||
//
|
||||
// END Plots ....
|
||||
//
|
||||
|
||||
//
|
||||
// START Alerts ...
|
||||
//
|
||||
// END Alerts ...
|
||||
//
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// TODOS:
|
||||
// -------
|
||||
// - []
|
||||
//////////////////////////////////////////////////////
|
||||
Reference in New Issue
Block a user