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
+62
View File
@@ -0,0 +1,62 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center ATR StopLoss Indicator
// ---------------------------------------------
// saherelm implementation of above indicator ...
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
//@version=5
indicator(title="SaherElm ATR StopLoss Indicator", shorttitle = "XS_ATRSL_IND", overlay = true)
//
// START Inputs ....
//
source = input(low, title = "Source")
length = input.int(defval = 14, minval = 1, title = "Period")
multiplier = input.float(defval = 1.6, minval = 0.1, step = 0.1, title = "Multiplier")
//
// END Inputs ....
//
//
// START Functions ....
//
//
// END Functions ....
//
//
// START Calculations ....
//
longStopLoss = source - ta.atr(length) * multiplier
shortStopLoss = source + ta.atr(length) * multiplier
//
// END Calculations ....
//
//
// START Plots ....
//
plot(series = shortStopLoss, color = color.aqua, linewidth = 1, style = plot.style_stepline, title = "Short Stop Loss")
plot(series = longStopLoss, color = color.fuchsia, linewidth = 1, style = plot.style_stepline, title = "Long Stop Loss")
//
// END Plots ....
//
//
// START Alerts ...
//
// END Alerts ...
//
//////////////////////////////////////////////////////
// TODOS:
// -------
// - []
//////////////////////////////////////////////////////
@@ -0,0 +1,466 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center XTrade XCRT_IND Indicator
// ---------------------------------------------
// Candle Recognition Types
//
// it is an indicator which going to find candle types
// and provides some usefull info based on them.
//
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
//@version=5
indicator(title="SaherElm X-Candle Recognition Type Indicator", shorttitle = "XS_CRT_IND", overlay = true)
//
// START Inputs ....
//
//
CRTShowCandleTypeLabel = input.bool(defval = false, title = "Show Recognized Candle Types Labels")
//
CRTShowCandleTypeShape = input.bool(defval = true, title = "Show Recognized Candle Types Shapes")
//
var CRTTrendRule1 = "Price 50 SMA"
var CRTTrendRule2 = "50 SMA and 200 SMA"
var CRTTrendRule = input.string(CRTTrendRule1, "Trend Detection Rule", options=[CRTTrendRule1, CRTTrendRule2, "None"])
//
// END Inputs ....
//
//
// START Functions ....
//
//
// Determines candle is Green or not ...
isGreenCandle() =>
if close > open
true
else
false
//
// Retreive Lower Shadow of Candle ...
lowerShadow() =>
if isGreenCandle()
open - low
else
close - low
//
// Retrieve Upper Shadow of Candle ...
upperShadow() =>
if isGreenCandle()
high - close
else
high - open
//
// Retrieve Real Body Size of Candle ...
realBody() =>
math.abs(close - open)
//
// END Functions ....
//
//
// START Calculations ....
//
CRTUpTrend = true
CRTDownTrend = true
//
// Trend Rule 1 ...
if CRTTrendRule == CRTTrendRule1
CRTPriceAvg = ta.sma(close, 50)
CRTDownTrend := close < CRTPriceAvg
CRTUpTrend := close > CRTPriceAvg
//
// Trend Rule 2 ...
if CRTTrendRule == CRTTrendRule2
CRTSma200 = ta.sma(close, 200)
CRTSma50 = ta.sma(close, 50)
CRTDownTrend := close < CRTSma200 and CRTSma50 < CRTSma200
CRTUpTrend := close > CRTSma200 and CRTSma50 > CRTSma200
//
// ema depth for bodyAvg ...
CRTLen = 14
//
// size of shadows ...
CRTShadowPercent = 5.0
//
CRTShadowEqualsPercent = 100.0
CRTDojiBodyPercent = 5.0
//
// shows the number of times the shadow dominates the candlestick body
CRTFactor = 2.0
//
CRTBodyHi = math.max(close, open)
CRTBodyLo = math.min(close, open)
//
CRTBody = CRTBodyHi - CRTBodyLo
CRTBodyAvg = ta.ema(CRTBody, CRTLen)
//
CRTLongBody = CRTBody > CRTBodyAvg
CRTSmallBody = CRTBody < CRTBodyAvg
//
CRTUpShadow = high - CRTBodyHi
CRTDnShadow = CRTBodyLo - low
CRTHasUpShadow = CRTUpShadow > CRTShadowPercent / 100 * CRTBody
CRTHasDnShadow = CRTDnShadow > CRTShadowPercent / 100 * CRTBody
//
CRTWhiteBody = open < close
CRTBlackBody = open > close
CRTRange = high-low
//
CRTBodyMiddle = CRTBody / 2 + CRTBodyLo
CRTIsInsideBar = CRTBodyHi[1] > CRTBodyHi and CRTBodyLo[1] < CRTBodyLo
CRTIsDojiBody = CRTRange > 0 and CRTBody <= CRTRange * CRTDojiBodyPercent / 100
CRTShadowEquals = CRTUpShadow == CRTDnShadow or (math.abs(CRTUpShadow - CRTDnShadow) / CRTDnShadow * 100) < CRTShadowEqualsPercent and (math.abs(CRTDnShadow - CRTUpShadow) / CRTUpShadow * 100) < CRTShadowEqualsPercent
//
CRTDoji = CRTIsDojiBody and CRTShadowEquals
//
CRTOAbandonedBaby = CRTUpTrend[2] and CRTWhiteBody[2] and CRTIsDojiBody[1] and high[2] < low[1] and CRTBlackBody and low[1] > high
//
CRTOEngulfing = CRTUpTrend and CRTBlackBody and CRTLongBody and CRTWhiteBody[1] and CRTSmallBody[1] and close <= open[1] and open >= close[1] and (close < open[1] or open > close[1])
//
CRTOEveningStar = CRTLongBody[2] and CRTSmallBody[1] and CRTLongBody ? CRTUpTrend and CRTWhiteBody[2] and CRTBodyLo[1] > CRTBodyHi[2] and CRTBlackBody and CRTBodyLo <= CRTBodyMiddle[2] and CRTBodyLo > CRTBodyLo[2] and CRTBodyLo[1] > CRTBodyHi ? true : false : false
//
CRTGravestoneDoji = CRTIsDojiBody and CRTDnShadow <= CRTBody
//
CRTOHangingMan = CRTSmallBody and CRTBody > 0 and CRTBodyLo > hl2 and CRTDnShadow >= CRTFactor * CRTBody and not CRTHasUpShadow ? CRTUpTrend ? true : false : false
//
CRTHarami = CRTLongBody[1] and CRTWhiteBody[1] and CRTUpTrend[1] and CRTIsDojiBody and CRTIsInsideBar
//
CRTMarubozuShadowPercent = 5.0
CRTMarubozu = CRTLongBody and CRTUpShadow <= CRTMarubozuShadowPercent / 100 * CRTBody and CRTDnShadow <= CRTMarubozuShadowPercent / 100 * CRTBody
CRTMarubozuWhite = CRTMarubozu and CRTWhiteBody
CRTMarubozuBlack = CRTMarubozu and CRTBlackBody
CRTKicking = CRTMarubozuWhite[1] and CRTMarubozuBlack and low[1] > high
//
CRTLongShadowPercent = 75.0
CRTLongUpperShadow = CRTUpShadow > CRTRange / 100 * CRTLongShadowPercent
//
CRTOShootingStar = CRTSmallBody and CRTBody > 0 and CRTBodyHi < hl2 and CRTUpShadow >= CRTFactor * CRTBody and not CRTHasDnShadow ? CRTUpTrend ? true : false : false
//
CRT3BCrwShadowPercent = 5.0
CRT3BCrwHaveNotDnShadow = CRTRange * CRT3BCrwShadowPercent / 100 > CRTDnShadow
//
CRTOThreeBlackCrows = CRTLongBody and CRTLongBody[1] and CRTLongBody[2] ? CRTBlackBody and CRTBlackBody[1] and CRTBlackBody[2] ? close < close[1] and close[1] < close[2] and open > close[1] and open < open[1] and open[1] > close[2] and open[1] < open[2] and CRT3BCrwHaveNotDnShadow and CRT3BCrwHaveNotDnShadow[1] and CRT3BCrwHaveNotDnShadow[2] : false : false
//
CRT3Dojis = CRTDoji[2] and CRTDoji[1] and CRTDoji
CRTBodyGapUp = CRTBodyHi[1] < CRTBodyLo
CRTBodyGapDn = CRTBodyLo[1] > CRTBodyHi
CRTTriStar = CRT3Dojis and CRTUpTrend[2] and CRTBodyGapUp[1] and CRTBodyGapDn
//
CRTOAbandonedBaby1 = CRTDownTrend[2] and CRTBlackBody[2] and CRTIsDojiBody[1] and low[2] > high[1] and CRTWhiteBody and high[1] < low
//
CRTDragonflyDoji1 = CRTIsDojiBody and CRTUpShadow <= CRTBody
//
CRTOEngulfing1 = CRTDownTrend and CRTWhiteBody and CRTLongBody and CRTBlackBody[1] and CRTSmallBody[1] and close >= open[1] and open <= close[1] and ( close > open[1] or open < close[1] )
//
CRTOHammer1 = CRTSmallBody and CRTBody > 0 and CRTBodyLo > hl2 and CRTDnShadow >= CRTFactor * CRTBody and not CRTHasUpShadow ? CRTDownTrend ? true : false : false
//
CRTHarami1 = CRTLongBody[1] and CRTBlackBody[1] and CRTDownTrend[1] and CRTIsDojiBody and CRTIsInsideBar
//
CRTKicking1 = CRTMarubozuBlack[1] and CRTMarubozuWhite and high[1] < low
//
CRTOInvertedHammer = CRTSmallBody and CRTBody > 0 and CRTBodyHi < hl2 and CRTUpShadow >= CRTFactor * CRTBody and not CRTHasDnShadow ? CRTDownTrend ? true : false : false
//
CRTLongLowerShadow1 = CRTDnShadow > CRTRange / 100 * CRTLongShadowPercent
//
CRTMarubozuWhite1 = CRTMarubozu and CRTWhiteBody
//
CRTOMorningStar1 = CRTLongBody[2] and CRTSmallBody[1] and CRTLongBody ? CRTDownTrend and CRTBlackBody[2] and CRTBodyHi[1] < CRTBodyLo[2] and CRTWhiteBody and CRTBodyHi >= CRTBodyMiddle[2] and CRTBodyHi < CRTBodyHi[2] and CRTBodyHi[1] < CRTBodyLo ? true : false : false
//
CRT3WSldShadowPercent = 5.0
CRT3WSldHaveNotUpShadow = CRTRange * CRT3WSldShadowPercent / 100 > CRTUpShadow
//
CRTOThreeWhiteSoldiers = CRTLongBody and CRTLongBody[1] and CRTLongBody[2] ? CRTWhiteBody and CRTWhiteBody[1] and CRTWhiteBody[2] ? close > close[1] and close[1] > close[2] and open < close[1] and open > open[1] and open[1] < close[2] and open[1] > open[2] and CRT3WSldHaveNotUpShadow and CRT3WSldHaveNotUpShadow[1] and CRT3WSldHaveNotUpShadow[2] ? true : false : false : false
//
CRTTriStar1 = CRT3Dojis and CRTDownTrend[2] and CRTBodyGapDn[1] and CRTBodyGapUp
//
CRTDragonflyDoji = CRTIsDojiBody and CRTUpShadow <= CRTBody
//
CRTSpinningTopPercent = 34.0
CRTIsSpinningTop = CRTDnShadow >= CRTRange / 100 * CRTSpinningTopPercent and CRTUpShadow >= CRTRange / 100 * CRTSpinningTopPercent and not CRTIsDojiBody
CRTSpinningTopBlack = CRTIsSpinningTop and CRTBlackBody
//
CRTSpinningTopWhite = CRTIsSpinningTop and CRTWhiteBody
//
var bullishColor = color.lime
var bullishShape = shape.arrowup
//
var bearishColor = color.red
var bearishShape = shape.arrowdown
//
var neutralColor = color.gray
var neutralShape = shape.circle
//
// END Calculations ....
//
//
// START Plots ....
//
/////////////////
// Bearish ...
/////////////////
//
plotshape(series = CRTShowCandleTypeShape ? CRTOEngulfing : na, style = bearishShape, size = size.tiny, location = location.belowbar, color = bearishColor, editable = false)
if CRTOEngulfing and CRTShowCandleTypeLabel
var tt = "Engulfing\nAt the end of a given uptrend, a reversal pattern will most likely appear. During the first day, this candlestick pattern uses a small body. It is then followed by a day where the candle body fully overtakes the body from the day before it and closes in the trend’s opposite direction. Although similar to the outside reversal chart pattern, it is not essential for this pattern to fully overtake the range (high to low), rather only the open and the close."
label.new(bar_index, low, yloc=yloc.abovebar, text="BE", style=label.style_label_down, color = bearishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTOEveningStar : na, style = bearishShape, size = size.tiny, location = location.belowbar, color = bearishColor, editable = false)
if CRTOEveningStar and CRTShowCandleTypeLabel
var tt = "Evening Star\nThis candlestick pattern is bearish and continues an uptrend with a long-bodied, green candle day. It is then followed by a gapped and small-bodied candle day, and concludes with a downward close. The close would be below the first day’s midpoint."
label.new(bar_index, low, yloc=yloc.abovebar, text="ES", style=label.style_label_down, color = bearishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTGravestoneDoji : na, style = bearishShape, size = size.tiny, location = location.belowbar, color = bearishColor, editable = false)
if CRTGravestoneDoji and CRTShowCandleTypeLabel
var tt = "Gravestone Doji\nWhen a doji is at or is close to the day’s low point, a doji line will develop."
label.new(bar_index, low, yloc=yloc.abovebar, text="GD", style=label.style_label_down, color = bearishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTOHangingMan : na, style = bearishShape, size = size.tiny, location = location.belowbar, color = bearishColor, editable = false)
if CRTOHangingMan and CRTShowCandleTypeLabel
var tt = "Hanging Man\nWhen a specified security notably moves lower after the open, but continues to rally to close above the intraday low, a Hanging Man candlestick will form. The candlestick will resemble a square, attached to a long stick-like figure. It is referred to as a Hanging Man if the candlestick forms during an advance."
label.new(bar_index, low, yloc=yloc.abovebar, text="HM", style=label.style_label_down, color = bearishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTHarami : na, style = bearishShape, size = size.tiny, location = location.belowbar, color = bearishColor, editable = false)
if CRTHarami and CRTShowCandleTypeLabel
var tt = "Harami\nThis is a two-day candlestick pattern with a small, red-bodied candle that is entirely encompassed within the range that was once a green-bodied candle."
label.new(bar_index, low, yloc=yloc.abovebar, text="BH", style=label.style_label_down, color = bearishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTKicking : na, style = bearishShape, size = size.tiny, location = location.belowbar, color = bearishColor, editable = false)
if CRTKicking and CRTShowCandleTypeLabel
var tt = "Kicking\nA bearish kicking pattern will occur, subsequently signaling a reversal for a new downtrend. The first day candlestick is a bullish marubozu. The second day gaps down extensively and opens below the opening price of the day before. There is a gap between day one and two’s bearish candlesticks."
label.new(bar_index, low, yloc=yloc.abovebar, text="K", style=label.style_label_down, color = bearishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTLongUpperShadow : na, style = bearishShape, size = size.tiny, location = location.belowbar, color = bearishColor, editable = false)
if CRTLongUpperShadow and CRTShowCandleTypeLabel
var tt = "Long Upper Shadow\nTo indicate buyer domination of the first part of a session, candlesticks will present with long upper shadows, as well as short lower shadows, consequently raising bidding prices."
label.new(bar_index, low, yloc=yloc.abovebar, text="LUS", style=label.style_label_down, color = bearishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTMarubozuBlack : na, style = bearishShape, size = size.tiny, location = location.belowbar, color = bearishColor, editable = false)
if CRTMarubozuBlack and CRTShowCandleTypeLabel
var tt = "Marubozu Black\nThis is a candlestick that has no shadow, which extends from the red-bodied candle at the open, the close, or even at both. In Japanese, the name means “close-cropped” or “close-cut.” The candlestick can also be referred to as Bald or Shaven Head."
label.new(bar_index, low, yloc=yloc.abovebar, text="MB", style=label.style_label_down, color = bearishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTOShootingStar : na, style = bearishShape, size = size.tiny, location = location.belowbar, color = bearishColor, editable = false)
if CRTOShootingStar and CRTShowCandleTypeLabel
var tt = "Shooting Star\nThis single day pattern can appear during an uptrend and opens high, while it closes near its open. It trades much higher as well. It is bearish in nature, but looks like an Inverted Hammer."
label.new(bar_index, low, yloc=yloc.abovebar, text="SS", style=label.style_label_down, color = bearishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTOThreeBlackCrows : na, style = bearishShape, size = size.tiny, location = location.belowbar, color = bearishColor, editable = false)
if CRTOThreeBlackCrows and CRTShowCandleTypeLabel
var tt = "Three Black Crows\nThis is a bearish reversal pattern that consists of three long, red-bodied candles in immediate succession. For each of these candles, each day opens within the body of the day before and closes either at or near its low."
label.new(bar_index, low, yloc=yloc.abovebar, text="3BC", style=label.style_label_down, color = bearishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTTriStar : na, style = bearishShape, size = size.tiny, location = location.belowbar, color = bearishColor, editable = false)
if CRTTriStar and CRTShowCandleTypeLabel
var tt = "Tri-Star\nThis particular pattern can form when three doji candlesticks appear in immediate succession at the end of an extended uptrend. The first doji candle marks indecision between bull and bear. The second doji gaps in the direction of the leading trend. The third changes the attitude of the market once the candlestick opens in the direction opposite to the trend. Each doji candle has a shadow, all comparatively shallow, which signify an interim cutback in volatility."
label.new(bar_index, low, yloc=yloc.abovebar, text="3S", style=label.style_label_down, color = bearishColor, textcolor=color.white, tooltip = tt)
/////////////////
// Bullish ...
/////////////////
//
plotshape(series = CRTShowCandleTypeShape ? CRTOAbandonedBaby1 : na, style = bullishShape, size = size.tiny, location = location.belowbar, color = bullishColor, editable = false)
if CRTOAbandonedBaby1 and CRTShowCandleTypeLabel
var tt = "Abandoned Baby\nThis candlestick pattern is quite rare as far as reversal patterns go. The first of the pattern is a large down candle. Next comes a doji candle that gaps below the candle before it. The doji candle is then followed by another candle that opens even higher and swiftly moves to the upside."
label.new(bar_index, low, yloc=yloc.belowbar, text="AB", style=label.style_label_up, color = bullishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTDragonflyDoji1 : na, style = bullishShape, size = size.tiny, location = location.belowbar, color = bullishColor, editable = false)
if CRTDragonflyDoji1 and CRTShowCandleTypeLabel
var tt = "Dragonfly Doji\nSimilar to other Doji days, this particular Doji also regularly appears at pivotal market moments. This is a specific Doji where both the open and close price are at the high of a given day."
label.new(bar_index, low, yloc=yloc.belowbar, text="DD", style=label.style_label_up, color = bullishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTOEngulfing1 : na, style = bullishShape, size = size.tiny, location = location.belowbar, color = bullishColor, editable = false)
if CRTOEngulfing1 and CRTShowCandleTypeLabel
var tt = "Engulfing\nAt the end of a given downward trend, there will most likely be a reversal pattern. To distinguish the first day, this candlestick pattern uses a small body, followed by a day where the candle body fully overtakes the body from the day before, and closes in the trend’s opposite direction. Although similar to the outside reversal chart pattern, it is not essential for this pattern to completely overtake the range (high to low), rather only the open and the close."
label.new(bar_index, low, yloc=yloc.belowbar, text="BE", style=label.style_label_up, color = bullishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTOHammer1 : na, style = bullishShape, size = size.tiny, location = location.belowbar, color = bullishColor, editable = false)
if CRTOHammer1 and CRTShowCandleTypeLabel
var tt = "Hammer\nHammer candlesticks form when a security moves lower after the open, but continues to rally into close above the intraday low. The candlestick that you are left with will look like a square attached to a long stick-like figure. This candlestick is called a Hammer if it happens to form during a decline."
label.new(bar_index, low, yloc=yloc.belowbar, text="H", style=label.style_label_up, color = bullishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTHarami1 : na, style = bullishShape, size = size.tiny, location = location.belowbar, color = bullishColor, editable = false)
if CRTHarami1 and CRTShowCandleTypeLabel
var tt = "Harami\nThis two-day candlestick pattern consists of a small-bodied green candle that is entirely encompassed within the range of what was once a red-bodied candle."
label.new(bar_index, low, yloc=yloc.belowbar, text="BH", style=label.style_label_up, color = bullishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTKicking1 : na, style = bullishShape, size = size.tiny, location = location.belowbar, color = bullishColor, editable = false)
if CRTKicking1 and CRTShowCandleTypeLabel
var tt = "Kicking\nThe first day candlestick is a bearish marubozu candlestick with next to no upper or lower shadow and where the price opens at the day’s high and closes at the day’s low. The second day is a bullish marubozu pattern, with next to no upper or lower shadow and where the price opens at the day’s low and closes at the day’s high. Additionally, the second day gaps up extensively and opens above the opening price of the day before. This gap or window, as the Japanese call it, lies between day one and day two’s bullish candlesticks."
label.new(bar_index, low, yloc=yloc.belowbar, text="K", style=label.style_label_up, color = bullishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTOInvertedHammer : na, style = bullishShape, size = size.tiny, location = location.belowbar, color = bullishColor, editable = false)
if CRTOInvertedHammer and CRTShowCandleTypeLabel
var tt = "Inverted Hammer\nIf in a downtrend, then the open is lower. When it eventually trades higher, but closes near its open, it will look like an inverted version of the Hammer Candlestick. This is a one-day bullish reversal pattern."
label.new(bar_index, low, yloc=yloc.belowbar, text="IH", style=label.style_label_up, color = bullishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTLongLowerShadow1 : na, style = bullishShape, size = size.tiny, location = location.belowbar, color = bullishColor, editable = false)
if CRTLongLowerShadow1 and CRTShowCandleTypeLabel
var tt = "Long Lower Shadow\nTo indicate seller domination of the first part of a session, candlesticks will present with long lower shadows and short upper shadows, consequently lowering prices."
label.new(bar_index, low, yloc=yloc.belowbar, text="LLS", style=label.style_label_up, color = bullishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTMarubozuWhite1 : na, style = bullishShape, size = size.tiny, location = location.belowbar, color = bullishColor, editable = false)
if CRTMarubozuWhite1 and CRTShowCandleTypeLabel
var tt = "Marubozu White\nA Marubozu White Candle is a candlestick that does not have a shadow that extends from its candle body at either the open or the close. Marubozu is Japanese for “close-cropped” or “close-cut.” Other sources may call it a Bald or Shaven Head Candle."
label.new(bar_index, low, yloc=yloc.belowbar, text="MW", style=label.style_label_up, color = bullishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTOMorningStar1 : na, style = bullishShape, size = size.tiny, location = location.belowbar, color = bullishColor, editable = false)
if CRTOMorningStar1 and CRTShowCandleTypeLabel
var tt = "Morning Star\nA three-day bullish reversal pattern, which consists of three candlesticks will look something like this: The first being a long-bodied red candle that extends the current downtrend. Next comes a short, middle candle that gaps down on the open. After comes a long-bodied green candle, which gaps up on the open and closes above the midpoint of the body of the first day."
label.new(bar_index, low, yloc=yloc.belowbar, text="MS", style=label.style_label_up, color = bullishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTOThreeWhiteSoldiers : na, style = bullishShape, size = size.tiny, location = location.belowbar, color = bullishColor, editable = false)
if CRTOThreeWhiteSoldiers and CRTShowCandleTypeLabel
var tt = "Three White Soldiers\nThis bullish reversal pattern is made up of three long-bodied, green candles in immediate succession. Each one opens within the body before it and the close is near to the daily high."
label.new(bar_index, low, yloc=yloc.belowbar, text="3WS", style=label.style_label_up, color = bullishColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTTriStar1 : na, style = bullishShape, size = size.tiny, location = location.belowbar, color = bullishColor, editable = false)
if CRTTriStar1 and CRTShowCandleTypeLabel
var tt = "Tri-Star\nA bullish TriStar candlestick pattern can form when three doji candlesticks materialize in immediate succession at the tail-end of an extended downtrend. The first doji candle marks indecision between bull and bear. The second doji gaps in the direction of the leading trend. The third changes the attitude of the market once the candlestick opens in the direction opposite to the trend. Each doji candle has a shadow, all comparatively shallow, which signify an interim cutback in volatility."
label.new(bar_index, low, yloc=yloc.belowbar, text="3S", style=label.style_label_up, color = bullishColor, textcolor=color.white, tooltip = tt)
/////////////////
// Neutral ...
/////////////////
//
plotshape(series = CRTShowCandleTypeShape ? CRTDoji : na, style = neutralShape, size = size.tiny, location = location.belowbar, color = neutralColor, editable = false)
if CRTDoji and not CRTDragonflyDoji and not CRTGravestoneDoji and CRTShowCandleTypeLabel
var tt = "Doji\nWhen the open and close of a security are essentially equal to each other, a doji candle forms. The length of both upper and lower shadows may vary, causing the candlestick you are left with to either resemble a cross, an inverted cross, or a plus sign. Doji candles show the playout of buyer-seller indecision in a tug-of-war of sorts. As price moves either above or below the opening level during the session, the close is either at or near the opening level."
label.new(bar_index, low, yloc=yloc.belowbar, text="D", style=label.style_label_center, color = neutralColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTSpinningTopBlack : na, style = neutralShape, size = size.tiny, location = location.belowbar, color = neutralColor, editable = false)
if CRTSpinningTopBlack and CRTShowCandleTypeLabel
var tt = "Spinning Top Black\nBlack spinning tops are candlestick lines that are small, red-bodied, and possess shadows (upper and lower) that end up exceeding the length of candle bodies. They often signal indecision."
label.new(bar_index, low, yloc=yloc.belowbar, text="STB", style=label.style_label_center, color = neutralColor, textcolor=color.white, tooltip = tt)
//
plotshape(series = CRTShowCandleTypeShape ? CRTSpinningTopWhite : na, style = neutralShape, size = size.tiny, location = location.belowbar, color = neutralColor, editable = false)
if CRTSpinningTopWhite and CRTShowCandleTypeLabel
var tt = "Spinning Top White\nWhite spinning tops are candlestick lines that are small, green-bodied, and possess shadows (upper and lower) that end up exceeding the length of candle bodies. They often signal indecision between buyer and seller."
label.new(bar_index, low, yloc=yloc.belowbar, text="STW", style=label.style_label_center, color = neutralColor, textcolor=color.white, tooltip = tt)
//
// END Plots ....
//
//
// START Alerts ...
//
alertcondition(CRTOEngulfing, title = "Engulfing")
alertcondition(CRTOEveningStar, title = "Evening Star")
alertcondition(CRTGravestoneDoji, title = "Gravestone Doji")
alertcondition(CRTOHangingMan, title = "Hanging Man")
alertcondition(CRTHarami, title = "Harami")
alertcondition(CRTKicking, title = "Kicking")
alertcondition(CRTLongUpperShadow, title = "Long Upper Shadow")
alertcondition(CRTMarubozuBlack, title = "Marubozu Black")
alertcondition(CRTOShootingStar, title = "Shooting Star")
alertcondition(CRTOThreeBlackCrows, title = "Three Black Crows")
alertcondition(CRTTriStar, title = "Tri-Star")
alertcondition(CRTOAbandonedBaby1, title = "Abandoned Baby")
alertcondition(CRTDragonflyDoji1, title = "Dragonfly Doji")
alertcondition(CRTOEngulfing1, title = "Engulfing")
alertcondition(CRTOHammer1, title = "Hammer")
alertcondition(CRTHarami1, title = "Harami")
alertcondition(CRTKicking1, title = "Kicking")
alertcondition(CRTOInvertedHammer, title = "Inverted Hammer")
alertcondition(CRTLongLowerShadow1, title = "Long Lower Shadow")
alertcondition(CRTMarubozuWhite1, title = "Marubozu White")
alertcondition(CRTOMorningStar1, title = "Morning Star")
alertcondition(CRTOThreeWhiteSoldiers, title = "Three White Soldiers")
alertcondition(CRTTriStar1, title = "Tri-Star")
alertcondition(CRTDoji and not CRTDragonflyDoji and not CRTGravestoneDoji, title = "Doji")
alertcondition(CRTSpinningTopBlack, title = "Spinning Top Black")
alertcondition(CRTSpinningTopWhite, title = "Spinning Top White")
//
// END Alerts ...
//
//////////////////////////////////////////////////////
// TODOS:
// -------
// - []
//////////////////////////////////////////////////////
+83
View File
@@ -0,0 +1,83 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center Hull Trend Indicator
// ---------------------------------------------
// saherelm implementation of above indicator ...
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
//@version=5
indicator(title="SaherElm Hull Trend Indicator", shorttitle = "XS_HUTR_IND", overlay = true)
//
// START Inputs ....
//
HUTRSrc = input.source(defval = hl2, title = "Source")
HUTRLength = input.int(defval = 23, title = "Length")
HUTRShowCross = input.bool(defval = true, title = "Show cross over/under")
//
// END Inputs ....
//
//
// START Functions ....
//
//
HUTRHma(src, length)=>
ta.wma((2 * ta.wma(src, length / 2)) - ta.wma(src, length), math.round(math.sqrt(length)))
//
HUTRHma3(src, length)=>
p = length / 2
ta.wma(ta.wma(close, p / 3) * 3 - ta.wma(close, p / 2) - ta.wma(close, p) ,p)
//
// END Functions ....
//
//
// START Calculations ....
//
//
HUTRA = HUTRHma(HUTRSrc, HUTRLength)
HUTRB = HUTRHma3(HUTRSrc, HUTRLength)
HUTRColor = HUTRB > HUTRA ? color.lime : color.red
//
HUTRCrossDown = HUTRA > HUTRB and HUTRA[1] < HUTRB[1]
HUTRCrossUp = HUTRB > HUTRA and HUTRB[1] < HUTRA[1]
//
// END Calculations ....
//
//
// START Plots ....
//
HUTRP1 = plot(series = HUTRA, color = color.new(HUTRColor, 75), linewidth = 1, title = "Upper Line")
HUTRP2 = plot(series = HUTRB, color = color.new(HUTRColor, 75), linewidth = 1, title = "Downer Line")
//
fill(HUTRP1, HUTRP2, color = color.new(HUTRColor, 55), title = "Cloud Fill")
//
plotshape(HUTRShowCross and HUTRCrossDown ? HUTRA : na, location = location.absolute, style = shape.labeldown, color = color.red, size = size.tiny, text = "Sell", textcolor = color.white, offset=-1)
plotshape(HUTRShowCross and HUTRCrossUp ? HUTRA : na, location = location.absolute, style = shape.labelup, color = color.green, size = size.tiny, text = "Buy", textcolor = color.white, offset=-1)
//
// END Plots ....
//
//
// START Alerts ...
//
// END Alerts ...
//
//////////////////////////////////////////////////////
// TODOS:
// -------
// - []
//////////////////////////////////////////////////////
+135
View File
@@ -0,0 +1,135 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center Leledc Level Indicator
// ---------------------------------------------
// saherelm implementation of above indicator ...
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
//@version=5
indicator(title="SaherElm Leledc Levels Indicator", shorttitle = "XS_LL_IND", overlay = true)
//
// START Inputs ....
//
exhaustionSwitch = input.bool(defval = true, title = "Show exhaustion Bar point (Arrows)")
levelSwitch = input.bool(defval = true, title = "Show exhaustion levels (Lines)")
length = input.int(defval = 40, title = "Exhaustions swing length")
bars = input.int(defval = 42, title = "Exhaustion bar count")
thicknesSwitch = input.int(defval = 7, title ="Line Thickness(Level thickness)")
//
// END Inputs ....
//
//
// START Functions ....
//
Lelec(bars, len) =>
//
result = 0
bindex = int(na)
bindex := nz(bindex[1], 0)
sindex = int(na)
sindex := nz(sindex[1], 0)
//
bindex := close > close[4] ? bindex + 1 : bindex
sindex := close < close[4] ? sindex + 1 : sindex
//
lowest = ta.lowest(low, len)
highest = ta.highest(high, len)
//
if bindex > bars and close < open and high >= highest
bindex := 0
result := -1
result
else
if sindex > bars and close > open and low <= lowest
sindex := 0
result := 1
result
//
// END Functions ....
//
//
// START Calculations ....
//
//
// Out C ...
Lelex = Lelec(bars, length)
//
// Out Bar ...
highlel = Lelex == -1 ? high : na
lowlel = Lelex == 1 ? low : na
//
// Out level ...
resistance = float(na)
support = float(na)
resistance := close < open and Lelex ? high : resistance[1]
support := close > open and Lelex ? low : support[1]
//
// Resistanse Color ...
resistanseColor = color.red
highColor = ta.change(resistance) == 0 ? resistanseColor : na
//
// Support Color ...
supportColor = color.lime
lowColor = ta.change(support) == 0 ? supportColor : na
//
// Has Signal ...
hasSignal = exhaustionSwitch
//
// Up Signals ...
upSignal = hasSignal ? lowlel : na
//
// Down Signals ...
downSignal = hasSignal ? highlel : na
//
// END Calculations ....
//
//
// START Plots ....
//
// Plot Bar ...
plotshape(hasSignal ? upSignal : na, title = "Up", color = supportColor, location = location.belowbar, style = shape.triangleup, size = size.normal)
plotshape(hasSignal ? downSignal : na, title = "Down", color = resistanseColor, location = location.abovebar, style = shape.triangledown, size = size.normal)
//
// Plot level ...
plot(levelSwitch ? resistance : na, title = "Reistance Level", style = plot.style_line, color = highColor, linewidth = thicknesSwitch)
plot(levelSwitch ? support : na, title = "Support Level", style = plot.style_line, color = lowColor, linewidth = thicknesSwitch)
//
// END Plots ....
//
//
// START Alerts ...
//
alertcondition(lowlel, "Up")
alertcondition(highlel, "Down")
//
// END Alerts ...
//
//////////////////////////////////////////////////////
// TODOS:
// -------
// - []
//////////////////////////////////////////////////////
@@ -0,0 +1,145 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center XTrade XCRT_IND Indicator
// ---------------------------------------------
// Candle Recognition Types
//
// it is an indicator which going to find candle types
// and provides some usefull info based on them.
//
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
//@version=5
indicator(title="SaherElm X-Price Action Candle Recognition Indicator", shorttitle = "XS_PA_CR_IND", overlay = true)
//
// START Inputs ....
//
//
showCandleTypeLabel = input.bool(defval = false, title = "Show Recognized Candle Types Labels")
showCandleTypeTitlesAsTooltip = input.bool(defval = false, title = "Show Titles as Tooltip")
//
// Candle Type Recognition Rules ...
var candleItselfRule = "Candle itself"
var candleByItsNeighborhoodRule = "Candle and it's prev Neighborhood"
candleRecognitionRule = input.string(defval = candleItselfRule, title = "Candle Recognition Rule", options = [candleItselfRule, candleByItsNeighborhoodRule])
//
// END Inputs ....
//
//
// START Functions ....
//
//
// Retrieve Specific Candle Height (based on low and high) ...
getCandleRange() =>
high - low
//
// Retrieve Candle Ranges Thirs Section ...
getCandleThird() =>
getCandleRange() / 3
//
// Determines a Candle is Bullish or not ...
isBullishCandle() =>
close > low + (getCandleThird() * 2)
//
// Determines a Candle is Bearish or not ...
isNeutralCandle() =>
close < low + (getCandleThird() * 2) and close > low + getCandleThird()
//
// Determines a Candle is Neutral or not ...
isBearishCandle() =>
close < low + getCandleThird()
//
// END Functions ....
//
//
// START Calculations ....
//
//
var bullishColor = color.lime
var bullishShape = shape.arrowup
var bullishTitle = "Bullish"
var bullishType = 1
//
var bearishColor = color.red
var bearishShape = shape.arrowdown
var bearishTitle = "Bearish"
var bearishType = -1
//
var neutralColor = color.gray
var neutralShape = shape.circle
var neutralTitle = "Neutral"
var neutralType = 0
//
candleType = isBullishCandle() ? bullishType : isNeutralCandle() ? neutralType : isBearishCandle() ? bearishType : neutralType
//
prevCandleType = not na(candleType[1]) ? candleType[1] : neutralType
//
candleNeighborhoodBaseType = prevCandleType + candleType
candleNeighborhoodBaseTypeTitle = str.tostring(prevCandleType) + "," + str.tostring(candleType)
//
// END Calculations ....
//
//
// START Plots ....
//
//
// Plot Range inside of indicator title ...
// plot(getCandleRange(), color = color.orange, title = "Bar Ranges")
//
// Plot Range inside of indicator title ...
// plot(getCandleThird(), color = color.aqua, title = "Bar Thirds")
//
// Plot Candle State ...
//
// Candle Type ...
if showCandleTypeLabel and candleRecognitionRule == candleItselfRule
candleTypeLabelStyle = candleType > 0 ? label.style_label_up : candleType == 0 ? label.style_label_center : candleType < 0 ? label.style_label_down : na
candleTypeLabelColor = candleType > 0 ? bullishColor : candleType == 0 ? neutralColor : candleType < 0 ? bearishColor : na
candleTypeLabel = label.new(x = bar_index, y = low, yloc = yloc.belowbar, style = candleTypeLabelStyle, text = showCandleTypeTitlesAsTooltip ? na : str.tostring(candleType), color = candleTypeLabelColor, textcolor = color.white, tooltip = showCandleTypeTitlesAsTooltip ? str.tostring(candleType) : na)
//
// Candle Neighborhood Base Type ...
if showCandleTypeLabel and candleRecognitionRule == candleByItsNeighborhoodRule
candleTypeLabelStyle = candleNeighborhoodBaseType > 0 ? label.style_label_up : candleNeighborhoodBaseType == 0 ? label.style_label_center : candleNeighborhoodBaseType < 0 ? label.style_label_down : na
candleTypeLabelColor = candleNeighborhoodBaseType > 0 ? bullishColor : candleNeighborhoodBaseType == 0 ? neutralColor : candleNeighborhoodBaseType < 0 ? bearishColor : na
candleTypeLabel = label.new(x = bar_index, y = low, yloc = yloc.belowbar, style = candleTypeLabelStyle, text = showCandleTypeTitlesAsTooltip ? na : candleNeighborhoodBaseTypeTitle, color = candleTypeLabelColor, textcolor = color.white, tooltip = showCandleTypeTitlesAsTooltip ? candleNeighborhoodBaseTypeTitle : na)
//
// END Plots ....
//
//
// START Alerts ...
//
//
// END Alerts ...
//
//////////////////////////////////////////////////////
// TODOS:
// -------
// - []
//////////////////////////////////////////////////////
@@ -0,0 +1,143 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center ATR StopLoss Indicator
// ---------------------------------------------
// saherelm implementation of above indicator ...
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
//@version=5
indicator(title="SaherElm Range Filter Buy Sell Indicator", shorttitle = "XS_RFBS_IND", overlay = true)
//
// START Inputs ....
//
// Source
RFBSSrc = input.source(defval = close, title = "Source")
//
// Sampling Period
RFBSPer = input.int(defval = 41, minval = 1, title = "Sampling Period")
//
// Range Multiplier ...
RFBSMult = input.float(defval = 3.0, minval = 0.1, title = "Range Multiplier")
//
// END Inputs ....
//
//
// START Functions ....
//
// Smooth Average Range
smoothAverageRange(x, t, m) =>
wper = t * 2 - 1
avrng = ta.ema(math.abs(x - x[1]), t)
result = ta.ema(avrng, wper) * m
result
//
// Range Filter ...
rangeFilter(x, r) =>
result = x
result := x > nz(result[1]) ? x - r < nz(result[1]) ? nz(result[1]) : x - r : x + r > nz(result[1]) ? nz(result[1]) : x + r
result
//
// END Functions ....
//
//
// START Calculations ....
//
//
// Color variables ...
RFBSUpColor = color.green
RFBSMidColor = color.blue
RFBSDownColor = color.red
//
RFBSSmrng = smoothAverageRange(RFBSSrc, RFBSPer, RFBSMult)
RFBSFilt = rangeFilter(RFBSSrc, RFBSSmrng)
//
// Filter UP Direction ...
RFBSUpward = 0.0
RFBSUpward := RFBSFilt > RFBSFilt[1] ? nz(RFBSUpward[1]) + 1 : RFBSFilt < RFBSFilt[1] ? 0 : nz(RFBSUpward[1])
//
// Filter DOWN Direction ...
RFBSDownward = 0.0
RFBSDownward := RFBSFilt < RFBSFilt[1] ? nz(RFBSDownward[1]) + 1 : RFBSFilt > RFBSFilt[1] ? 0 : nz(RFBSDownward[1])
//
// Target Bands
RFBSHband = RFBSFilt + RFBSSmrng
RFBSLband = RFBSFilt - RFBSSmrng
//
// Colors
RFBSFiltcolor = RFBSUpward > 0 ? RFBSUpColor : RFBSDownward > 0 ? RFBSDownColor : RFBSMidColor
RFBSBarcolor = RFBSSrc > RFBSFilt and RFBSSrc > RFBSSrc[1] and RFBSUpward > 0 ? RFBSUpColor : RFBSSrc > RFBSFilt and RFBSSrc < RFBSSrc[1] and RFBSUpward > 0 ? RFBSUpColor : RFBSSrc < RFBSFilt and RFBSSrc < RFBSSrc[1] and RFBSDownward > 0 ? RFBSDownColor : RFBSSrc < RFBSFilt and RFBSSrc > RFBSSrc[1] and RFBSDownward > 0 ? RFBSDownColor : RFBSMidColor
//
// Break Outs
RFBSLongCond = bool(na)
RFBSShortCond = bool(na)
RFBSLongCond := RFBSSrc > RFBSFilt and RFBSSrc > RFBSSrc[1] and RFBSUpward > 0 or RFBSSrc > RFBSFilt and RFBSSrc < RFBSSrc[1] and RFBSUpward > 0
RFBSShortCond := RFBSSrc < RFBSFilt and RFBSSrc < RFBSSrc[1] and RFBSDownward > 0 or RFBSSrc < RFBSFilt and RFBSSrc > RFBSSrc[1] and RFBSDownward > 0
//
RFBSCondIni = 0
RFBSCondIni := RFBSLongCond ? 1 : RFBSShortCond ? -1 : RFBSCondIni[1]
RFBSLongCondition = RFBSLongCond and RFBSCondIni[1] == -1
RFBSShortCondition = RFBSShortCond and RFBSCondIni[1] == 1
//
// END Calculations ....
//
//
// START Plots ....
//
// Range Filter ...
RFBSFiltPlot = plot(series = RFBSFilt, color = RFBSFiltcolor, linewidth = 2, title = "RFBS > Range Filter")
//
// Target ...
RFBSHbandPlot = plot(series = RFBSHband, color = color.new(RFBSUpColor, 70), title = "RFBS > High Target")
RFBSLbandPlot = plot(series = RFBSLband, color = color.new(RFBSDownColor, 70), title = "RFBS > Low Target")
//
// Fills
fill(RFBSHbandPlot, RFBSFiltPlot, color = color.new(RFBSUpColor, 90), title = "RFBS > High Target Range")
fill(RFBSLbandPlot, RFBSFiltPlot, color = color.new(RFBSDownColor, 90), title = "RFBS > Low Target Range")
//
// Bar Color
barcolor(RFBSBarcolor)
//
// Plot Signal Labels ...
plotshape(series = RFBSLongCondition, title = "RFBS > Buy Signal", text = "Buy", textcolor = color.white, style = shape.labelup, size = size.small, location = location.belowbar, color = color.new(RFBSUpColor, 20))
plotshape(series = RFBSShortCondition, title = "RFBS > Sell Signal", text = "Sell", textcolor = color.white, style = shape.labeldown, size = size.small, location = location.abovebar, color = color.new(RFBSDownColor, 20))
//
// END Plots ....
//
//
// START Alerts ...
//
//
// END Alerts ...
//
//////////////////////////////////////////////////////
// TODOS:
// -------
// - []
//////////////////////////////////////////////////////
+59
View File
@@ -0,0 +1,59 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center RMA Indicator
// ---------------------------------------------
// saherelm implementation of above indicator ...
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
//@version=5
indicator(title="SaherElm RMA Indicator", shorttitle = "XS_RMA_IND", overlay = true)
//
// START Inputs ....
//
source = input(close, title = "Source")
rmaLength = input.int(defval = 10, minval = 1, title = "Length")
//
// END Inputs ....
//
//
// START Functions ....
//
//
// END Functions ....
//
//
// START Calculations ....
//
rma = ta.rma(source, rmaLength)
//
// END Calculations ....
//
//
// START Plots ....
//
plot(series = rma, color = color.fuchsia, linewidth = 1, style = plot.style_line, title = "RMA")
//
// END Plots ....
//
//
// START Alerts ...
//
// END Alerts ...
//
//////////////////////////////////////////////////////
// TODOS:
// -------
// - []
//////////////////////////////////////////////////////
@@ -0,0 +1,73 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center Swing Stop Losses Indicator
// ---------------------------------------------
// saherelm implementation of above indicator ...
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
//@version=5
indicator(title="SaherElm Swing Stop Losses Indicator", shorttitle = "XS_SWSL_IND", overlay = true)
//
// START Inputs ....
//
swingLoopback = input.int(defval = 7, title = "Swing Loopback Period")
showLongStopLoss = input.bool(defval = true, title = "Show Long Stop Losses")
showShortStopLoss = input.bool(defval = true, title = "Show Short Stop Losses")
//
// END Inputs ....
//
//
// START Functions ....
//
//
// END Functions ....
//
//
// START Calculations ....
//
//
lastMarketLowest = ta.lowest(low, swingLoopback)
lastMarketLowest2 = ta.lowest(low, swingLoopback * 2)
lastMarketLowest3 = ta.lowest(low, swingLoopback * 3)
//
lastMarketHighest = ta.highest(high, swingLoopback)
lastMarketHighest2 = ta.highest(high, swingLoopback * 2)
lastMarketHighest3 = ta.highest(high, swingLoopback * 3)
//
// END Calculations ....
//
//
// START Plots ....
//
//
// Stop Losses ...
plot(series = showLongStopLoss ? lastMarketLowest : na, color = color.fuchsia, linewidth = 1, style = plot.style_stepline, title = "Long Stop Loss")
plot(series = showShortStopLoss ? lastMarketHighest : na, color = color.aqua, linewidth = 1, style = plot.style_stepline, title = "Short Stop Loss")
//
// END Plots ....
//
//
// START Alerts ...
//
//
// END Alerts ...
//
//////////////////////////////////////////////////////
// TODOS:
// -------
// - []
//////////////////////////////////////////////////////
+69
View File
@@ -0,0 +1,69 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center Trend Magic Indicator
// ---------------------------------------------
// saherelm implementation of above indicator ...
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
//@version=5
indicator(title="SaherElm Trend Magic Indicator", shorttitle = "XS_TM_IND", overlay = true)
//
// START Inputs ....
//
TMPeriod = input.int(defval = 20, title = "CCI period")
TMCoeff = input.int(defval = 1, title = "ATR Multiplier")
TMAP = input.int(defval = 5, title = "ATR Period")
TMATR = ta.sma(ta.tr,TMAP)
TMSrc = input.source(defval = close, title = "Source")
//
// END Inputs ....
//
//
// START Functions ....
//
//
// END Functions ....
//
//
// START Calculations ....
//
//
TMUpT = low - TMATR * TMCoeff
TMDownT = high + TMATR * TMCoeff
//
MagicTrend = 0.0
MagicTrend := ta.cci(TMSrc, TMPeriod) >= 0 ? (TMUpT < nz(MagicTrend[1]) ? nz(MagicTrend[1]) : TMUpT) : (TMDownT > nz(MagicTrend[1]) ? nz(MagicTrend[1]) : TMDownT)
TMColor = ta.cci(TMSrc, TMPeriod) >= 0 ? color.blue : color.red
//
// END Calculations ....
//
//
// START Plots ....
//
plot(series = MagicTrend, color = TMColor, linewidth = 3, title = "Trend Magic")
//
// END Plots ....
//
//
// START Alerts ...
//
// END Alerts ...
//
//////////////////////////////////////////////////////
// TODOS:
// -------
// - []
//////////////////////////////////////////////////////
+107
View File
@@ -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:
// -------
// - []
//////////////////////////////////////////////////////