Initial Commit ...

This commit is contained in:
2024-01-25 04:07:49 +03:30
commit e24b73106d
76 changed files with 9457 additions and 0 deletions
+149
View File
@@ -0,0 +1,149 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center Cycle Channel Oscillator
// ---------------------------------------------
// saherelm implementation of above oscillator ...
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
//@version=5
indicator(title="SaherElm Cycle Channel Oscillator", shorttitle = "XS_CC_OSC", overlay = false)
//
// START Inputs ....
//
scl_t = input.int(defval = 10, title = "Short Cycle Length")
mcl_t = input.int(defval = 30, title = "Medium Cycle Length")
scm = input.float(defval = 1.0, title = "Short Cycle Multiplier")
mcm = input.float(defval = 3.0, title = "Medium Cycle Multiplier")
src = input.source(defval = close, title = "Source")
ebc = input.bool(defval = false, title = "Enable bar colors")
//
// END Inputs ....
//
//
// START Functions ....
//
//
// END Functions ....
//
//
// START Calculations ....
//
//
scl = scl_t / 2
mcl = mcl_t / 2
ma_scl = ta.rma(src, scl)
ma_mcl = ta.rma(src, mcl)
scm_off = scm * ta.atr(scl)
mcm_off = mcm * ta.atr(mcl)
//
scl_2 = scl / 2
mcl_2 = mcl / 2
sct = nz(ma_scl[scl_2], src) + scm_off
scb = nz(ma_scl[scl_2], src) - scm_off
mct = nz(ma_mcl[mcl_2], src) + mcm_off
mcb = nz(ma_mcl[mcl_2], src) - mcm_off
//
scmm = math.avg(sct,scb)
//
omed = (scmm - mcb) / (mct - mcb)
oshort = (src - mcb) / (mct - mcb)
//
bc = (oshort > 0.5) ? (oshort > 1.0 ? color.purple : (oshort > omed ? color.lime : color.green)) : (oshort < 0 ? color.purple : ( oshort < omed ? color.red : color.orange))
//
var bullishColor = color.aqua
var bearishColor = color.fuchsia
//
showSignals = input.bool(defval = false, title = "Show Signals", group = "Signals")
showBullishSignals = input.bool(defval = false, title = "Show Bullish Signals", group = "Signals")
showBearishSignals = input.bool(defval = false, title = "Show Bearish Signals", group = "Signals")
//
// RED ...
FastOSC = oshort
//
// Green ...
SlowOSC = omed
//
MIDOSC = FastOSC >= SlowOSC ? (FastOSC - SlowOSC) / 2 : (SlowOSC - FastOSC) / 2
//
isFastOSCCrossOverSlowOSC = ta.crossover(FastOSC, SlowOSC)
isFastOSCCrossUnderSlowOSC = ta.crossunder(FastOSC, SlowOSC)
//
hasBullishSignal = isFastOSCCrossOverSlowOSC and MIDOSC >= 0.02
hasBearishSignal = isFastOSCCrossUnderSlowOSC and MIDOSC >= 0.02
//
hasSignal = hasBullishSignal or hasBearishSignal
//
// END Calculations ....
//
//
// START Plots ....
//
// Draw Area ...
//
upperLine = plot(1.0, title = "Upper Line", color = color.gray)
middleLine = plot(0.5, title = "Middle Line", color = color.gray)
lowerLine = plot(0.0, title = "Lower Line", color = color.gray)
//
fill(lowerLine, middleLine, color = color.new(color.red, 95), title = "Lower Area Fill")
fill(upperLine, middleLine, color = color.new(color.green, 95), title = "Upper Area Fill")
//
plot(series = omed >= 1.0 ? omed : na, histbase = 1.0, style = plot.style_histogram, color = color.purple, linewidth = 2, title = "Medium Cycle OB")
plot(series = omed <= 0.0 ? omed : na, histbase = 0.0, style = plot.style_histogram, color = color.purple, linewidth = 2, title = "Medium Cycle OS")
//
plot(series = oshort >= 1.0 ? oshort : na, histbase = 1.0, style = plot.style_histogram, color = color.purple, linewidth = 2, title = "Short Cycle OB")
plot(series = oshort <= 0.0 ? oshort : na, histbase = 0.0, style = plot.style_histogram, color = color.purple, linewidth = 2, title = "Short Cycle OS")
//
plot(series = oshort, color = color.red, linewidth = 2, title = "Fast Osc")
plot(series = omed, color = color.green, linewidth = 2, title = "Slow Osc")
//
plot(series = MIDOSC, title = "Mid Osc", style = plot.style_histogram, color = color.yellow, linewidth = 2)
//
plotshape(series = showSignals and showBullishSignals and hasBullishSignal ? FastOSC : na, title = "FastOSC CrossOver SlowOSC", location = location.bottom, style = shape.triangleup, color = bullishColor, size = size.small)
plotshape(series = showSignals and showBearishSignals and hasBearishSignal ? FastOSC : na, title = "FastOSC CrossUnder SlowOSC", location = location.top, style = shape.triangledown, color = bearishColor, size = size.small)
//
// END Plots ....
//
//
// START Alerts ...
//
alertcondition(hasSignal, "XS_CC_OSC > Signal")
alertcondition(hasBullishSignal, "XS_CC_OSC > Long Signal")
alertcondition(hasBearishSignal, "XS_CC_OSC > Short Signal")
//
// END Alerts ...
//
//////////////////////////////////////////////////////
// TODOS:
// -------
// - []
//////////////////////////////////////////////////////
+158
View File
@@ -0,0 +1,158 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center Hull butterfly Oscillator
// ---------------------------------------------
// saherelm implementation of above oscillator ...
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
//@version=5
indicator(title="SaherElm Hull butterfly Oscillator", shorttitle = "XS_HUBF_OSC", overlay = false)
//
// START Inputs ....
//
//
HUBFSrc = input.source(defval = close, title = "Source")
//
HUBFLength = input.int(defval = 11, title = "Length")
//
HUBFMult = input.float(defval = 2.0, title = "Levels Multiplier")
//
// END Inputs ....
//
//
// START Functions ....
//
//
// END Functions ....
//
//
// START Calculations ....
//
//
var bullishColor = color.lime
var bullishColor1 = color.new(bullishColor, 50)
//
var bearishColor = color.red
var bearishColor1 = color.new(bearishColor, 50)
//
var HUBFShortLen = int(HUBFLength / 2)
var HUBFHullLen = int(math.sqrt(HUBFLength))
//
var HUBFDen1 = HUBFShortLen * (HUBFShortLen + 1) / 2
var HUBFDen2 = HUBFLength * (HUBFLength + 1) / 2
var HUBFDen3 = HUBFHullLen * (HUBFHullLen + 1) / 2
//
var HUBFLcwaCoeffs = array.new_float(HUBFHullLen, 0)
var HUBFHullCoeffs = array.new_float(0)
//
if barstate.isfirst
//
// Linearly combined WMA coeffs ...
for i = 0 to HUBFLength - 1
//
HUBFSum1 = math.max(HUBFShortLen - i, 0)
HUBFSum2 = HUBFLength - i
//
array.unshift(HUBFLcwaCoeffs, 2 * (HUBFSum1 / HUBFDen1) - (HUBFSum2 / HUBFDen2))
//
// Zero padding of linearly combined WMA coeffs ...
for i = 0 to HUBFHullLen - 2
array.unshift(HUBFLcwaCoeffs, 0)
//
// WMA convolution of linearly combined WMA coeffs ...
for i = HUBFHullLen to array.size(HUBFLcwaCoeffs) - 1
//
HUBFSum3 = 0.0
for j = i - HUBFHullLen to i - 1
HUBFSum3 += array.get(HUBFLcwaCoeffs, j) * (i - j)
//
array.unshift(HUBFHullCoeffs, HUBFSum3 / HUBFDen3)
//
var HUBFOs = 0
var HUBFLen = array.size(HUBFHullCoeffs) - 1
//
HUBFHma = 0.0
HUBFInvHma = 0.0
//
for i = 0 to HUBFLen
HUBFHma += HUBFSrc[i] * array.get(HUBFHullCoeffs, i)
HUBFInvHma += HUBFSrc[HUBFLen - i] * array.get(HUBFHullCoeffs, i)
//
HUBFHso = HUBFHma - HUBFInvHma
//
HUBFCmean = ta.cum(math.abs(HUBFHso)) / bar_index * HUBFMult
//
HUBFOs := ta.cross(HUBFHso, HUBFCmean) or ta.cross(HUBFHso, - HUBFCmean) ? 0 : HUBFHso < HUBFHso[1] and HUBFHso > HUBFCmean ? -1 : HUBFHso > HUBFHso[1] and HUBFHso < -HUBFCmean ? 1 : HUBFOs
//
HUBFCss0 = color.from_gradient(HUBFHso, 0, HUBFCmean, bullishColor1, bullishColor)
HUBFCss1 = color.from_gradient(HUBFHso, - HUBFCmean, 0, bearishColor, bearishColor1)
HUBFCss = HUBFHso > 0 ? HUBFCss0 : HUBFCss1
//
// END Calculations ....
//
//
// START Plots ....
//
//
// Oscillator line/histogram ...
plot(series = HUBFHso, title = "Hull Butterfly", color = HUBFCss, style = plot.style_histogram)
plot(series = HUBFHso, title = "Hull Butterfly", color = chart.fg_color)
//
// Bullish Dots ...
plot(series = HUBFOs > HUBFOs[1] and HUBFOs == 1 ? HUBFHso : na, title = "Bullish Dot", color = bullishColor, linewidth = 2, style = plot.style_columns)
//
// Bearish Dots ...
plot(series = HUBFOs < HUBFOs[1] and HUBFOs == -1 ? HUBFHso : na, title = "Bearish Dot", color = bearishColor, linewidth = 2, style = plot.style_columns)
//
// Levels ...
plot(series = HUBFCmean, color = color.gray, editable = false)
plot(series = HUBFCmean / 2, color = color.gray, editable = false)
plot(series = -HUBFCmean / 2, color = color.gray, editable = false)
plot(series = -HUBFCmean, color = color.gray, editable = false)
//
// END Plots ....
//
//
// START Alerts ...
//
//
// END Alerts ...
//
//////////////////////////////////////////////////////
// TODOS:
// -------
// - []
//////////////////////////////////////////////////////
+110
View File
@@ -0,0 +1,110 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center Impulse MACD Oscillator
// -------------------------------------------------
// saherelm implementation of above oscillator ...
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
//@version=5
indicator(title="SaherElm Impulse MACD Oscillator", shorttitle = "XS_IMPMACD_OSC", overlay = false)
//
// START Inputs ....
//
//
IMPMACDLengthMA = input.int(defval = 34, title = "LenghtMA")
IMPMACDLengthSignal = input.int(defval = 9, title = "Length Signal")
IMPMACDEbc = input.bool(defval = false, title = "Enable bar colors")
//
IMPMACDShowSignals = input.bool(defval = false, title = "Show Signals", group = "Signals")
IMPMACDShowLongSignals = input.bool(defval = true, title = "Show Long Signals", group = "Signals")
IMPMACDShowShortSignals = input.bool(defval = true, title = "Show Show Signals", group = "Signals")
//
// END Inputs ....
//
//
// START Functions ....
//
calc_smma(src, len) =>
float result = na
rSma = ta.sma(src, len)
result := na(result[1]) ? rSma : (result[1] * (len - 1) + src) / len
result
calc_zlema(src, length) =>
ema1 = ta.ema(src, length)
ema2 = ta.ema(ema1, length)
d = ema1 - ema2
result = ema1+d
result
//
// END Functions ....
//
//
// START Calculations ....
//
//
var bullishColor = color.lime
var bearishColor = color.red
//
IMPMACDSrc = hlc3
IMPMACDHi = calc_smma(high, IMPMACDLengthMA)
IMPMACDLo = calc_smma(low, IMPMACDLengthMA)
IMPMACDNi = calc_zlema(IMPMACDSrc, IMPMACDLengthMA)
//
IMPMACDMd = (IMPMACDNi > IMPMACDHi) ? (IMPMACDNi - IMPMACDHi) : (IMPMACDNi < IMPMACDLo) ? (IMPMACDNi - IMPMACDLo) : 0.0
IMPMACDSb = ta.sma(IMPMACDMd, IMPMACDLengthSignal)
IMPMACDSh = IMPMACDMd - IMPMACDSb
//
IMPMACDIsBullish = (ta.crossunder(IMPMACDSb, IMPMACDMd) or ta.crossunder(IMPMACDSb[1], IMPMACDMd) or ta.crossunder(IMPMACDSb[2], IMPMACDMd)) and IMPMACDMd < 0 and IMPMACDSh > 0.1 and IMPMACDSb < IMPMACDMd and IMPMACDMd < -0.6
IMPMACDIsBearish = (ta.crossover(IMPMACDSb, IMPMACDMd) or ta.crossover(IMPMACDSb[1], IMPMACDMd) or ta.crossover(IMPMACDSb[2], IMPMACDMd)) and IMPMACDMd > 0 and IMPMACDSh < -0.1 and IMPMACDSb > IMPMACDMd and IMPMACDMd > 0.6
//
IMPMACDMdc = IMPMACDSrc > IMPMACDNi ? IMPMACDSrc > IMPMACDHi ? color.lime : color.green : IMPMACDSrc < IMPMACDLo ? color.red : color.red
//
// END Calculations ....
//
//
// START Plots ....
//
//
plot(series = 0, color = color.gray, linewidth = 1, title = "MidLine")
plot(series = IMPMACDMd, color = IMPMACDMdc, linewidth = 2, title = "ImpulseMACD", style = plot.style_columns)
plot(series = IMPMACDSh, color = color.yellow, linewidth = 2, title = "ImpulseHisto", style = plot.style_histogram)
plot(IMPMACDSb, color = color.maroon, linewidth = 2, title = "ImpulseMACDCDSignal")
//
barcolor(IMPMACDEbc ? IMPMACDMdc : na)
//
plotshape(series = IMPMACDShowSignals and IMPMACDShowLongSignals and IMPMACDIsBullish ? IMPMACDMd : na, title = "Bullish Signals", color = color.rgb(36, 206, 206), style = shape.arrowup, location = location.absolute, size = size.normal)
plotshape(series = IMPMACDShowSignals and IMPMACDShowShortSignals and IMPMACDIsBearish ? IMPMACDMd : na, title = "Bearish Signals", color = color.rgb(49, 39, 134), style = shape.arrowdown, location = location.absolute, size = size.normal)
//
// END Plots ....
//
//
// START Alerts ...
//
//
// END Alerts ...
//
//////////////////////////////////////////////////////
// TODOS:
// -------
// - []
//////////////////////////////////////////////////////
@@ -0,0 +1,156 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center Multpile Strategies Oscillator
// -------------------------------------------------
// saherelm implementation of above oscillator ...
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
//@version=5
indicator(title="SaherElm Multpile Strategies Oscillator", shorttitle = "XS_MPS_OSC", overlay = false)
//
// START Inputs ....
//
MPSScale = input.float(defval = 75.0, title = "General scale")
//
// Momentum ...
MPSShowMomentum = input.bool(defval = true, title = "Show Squeeze Momentum", group = "Squeeze Momentum")
MPSLengthM = input.int(defval = 17, title = "MOM Length", minval = 1, step = 1, group = "Squeeze Momentum")
MPSSrcM = input.source(defval = close, title = "MOM Source", group = "Squeeze Momentum")
MPSLength = input.int(defval = 17, title = "SQZ Length", minval = 1, step = 1, group = "Squeeze Momentum")
MPSSrc = input.source(defval = close, title="SQZ Source", group = "Squeeze Momentum")
//
// RSI ...
MPSShowRsi = input.bool(defval = true, title = "Show RSI", group = "RSI")
MPSShowRsiFondo = input.bool(defval = true, title = "Show RSI background", group = "RSI")
MPSRsiApart = input.int(defval = 0, title = "RSI Separation", group = "RSI")
MPSLen = input.int(defval = 14, minval = 1, title = "RSI Length", group = "RSI")
MPSUpperR = input.int(defval = 70, title = "RSI Upper Band", group = "RSI")
MPSMiddleR = input.int(defval = 50, title = "RSI Middle Band", group = "RSI")
MPSLowerR = input.int(defval = 30, title = "RSI Lower Band", group = "RSI")
//
// RSI DIVERGENCE ...
MPSShowRsiDivergence = input.bool(defval = false, title = "Show RSI DIVERGENCE", group = "RSI")
MPSFarRSI = input.int(defval = 70, title = "Adjust RSI DIVERGENCE", group = "RSI")
MPSLenFast = input.int(defval = 5, minval = 1, title = "Fast RSI Length", group = "RSI")
MPSLenSlow = input.int(defval = 14, minval = 1, title = "Slow RSI Length", group = "RSI")
//
// END Inputs ....
//
//
// START Functions ....
//
biggest(series) =>
max = 0.0
max := nz(max[1], series)
if series > max
max := series
max
//
// END Functions ....
//
//
// START Calculations ....
//
//
var bullishColor = color.lime
var bearishColor = color.red
//
// Momentum ...
MPSSz = ta.linreg(MPSSrcM - math.avg(math.avg(ta.highest(high, MPSLengthM), ta.lowest(low, MPSLengthM)), ta.sma(close, MPSLengthM)), MPSLengthM, 0)
MPSNi = biggest(MPSSz)
//
// Momentum Conditions ...
MPSSc1 = MPSSz >= 0
MPSSc2 = MPSSz < 0
MPSSc3 = MPSSz >= MPSSz[1]
MPSSc4 = MPSSz < MPSSz[1]
//
// Momentum Identifiers ...
isMPSMomentumBullish = (MPSSc1 and MPSSc3) or (MPSSc1 and MPSSc4)
isMPSMomentumBearish = (MPSSc2 and MPSSc4) or (MPSSc2 and MPSSc3)
//
MPSClr = isMPSMomentumBullish ? bullishColor : isMPSMomentumBearish ? bearishColor : color.gray
//
// RSI ...
MPSRsi = ta.rsi(MPSSrc, MPSLen)
MPSRsiColor = MPSRsi <= MPSLowerR ? bullishColor : MPSRsi >= MPSUpperR ? bearishColor : #da00ff
MPSRsiScale = (MPSRsi + MPSRsiApart) * MPSNi / MPSScale
//
MPSB1s = (MPSRsiApart + MPSUpperR) * MPSNi/MPSScale
MPSBm = (MPSRsiApart + MPSMiddleR) * MPSNi/MPSScale
MPSB0s = (MPSRsiApart + MPSLowerR) * MPSNi/MPSScale
//
// RSI DIVERGENCE ...
MPSSrcSlow = close
MPSSrcFast = close
//
MPSUpFast = ta.rma(math.max(ta.change(MPSSrcFast), 0), MPSLenFast)
MPSDownFast = ta.rma(-math.min(ta.change(MPSSrcFast), 0), MPSLenFast)
MPSRsiFast = MPSDownFast == 0 ? 100 : MPSUpFast == 0 ? 0 : 100 - (100 / (1 + MPSUpFast / MPSDownFast))
//
MPSUpSlow = ta.rma(math.max(ta.change(MPSSrcSlow), 0), MPSLenSlow)
MPSDownSlow = ta.rma(-math.min(ta.change(MPSSrcSlow), 0), MPSLenSlow)
MPSRsiSlow = MPSDownSlow == 0 ? 100 : MPSUpSlow == 0 ? 0 : 100 - (100 / (1 + MPSUpSlow / MPSDownSlow))
//
MPSDivergence = MPSRsiFast - MPSRsiSlow
MPSDivergenceScale = MPSDivergence * (MPSNi / MPSScale)
//
MPSDivergenceColor = MPSDivergence > 0 ? bullishColor : bearishColor
//
// END Calculations ....
//
//
// START Plots ....
//
//
// Momentum ...
plot(MPSShowMomentum ? MPSSz : na, title = "Squeeze Momentum", color = MPSClr, style = plot.style_area)
//
// RSI ...
plot(MPSShowRsi ? MPSRsiScale : na, "RSI", color = MPSRsiColor)
//
// Divergence ...
plot(MPSShowRsiDivergence ? MPSDivergenceScale + (MPSFarRSI * MPSNi / MPSScale) : na, "RSI Divergence", color = MPSDivergenceColor)
//
// END Plots ....
//
//
// START Alerts ...
//
//
// END Alerts ...
//
//////////////////////////////////////////////////////
// TODOS:
// -------
// - []
//////////////////////////////////////////////////////
+65
View File
@@ -0,0 +1,65 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center Stochastic Histogram
// ---------------------------------------------
// saherelm implementation of above oscillator ...
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
//@version=5
indicator(title="SaherElm Stochastic Histogram", shorttitle = "XS_STHS_OSC", overlay = false)
//
// START Inputs ....
//
STHSLength = input.int(defval= 14, minval = 1, title = "Length")
STHSSmoothK = input.int(defval = 3, minval = 1, title = "Smooth K")
//
// END Inputs ....
//
//
// START Functions ....
//
//
// END Functions ....
//
//
// START Calculations ....
//
STHSK = (ta.sma(ta.stoch(close, high, low, STHSLength), STHSSmoothK) - 50)
STHSColor = (STHSK > 0) ? color.green : (STHSK < 0) ? color.red : color.black
//
//
// END Calculations ....
//
//
// START Plots ....
//
// Draw Area ...
//
plot(series = STHSK, style = plot.style_histogram, color = STHSColor, title = "Histogram")
plot(series = STHSK, color = color.black, title = "Histogram Line")
//
// END Plots ....
//
//
// START Alerts ...
//
//
// END Alerts ...
//
//////////////////////////////////////////////////////
// TODOS:
// -------
// - []
//////////////////////////////////////////////////////