1 - Pro Trading

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 4

// This source code is subject to the terms of the Mozilla Public License 2.

0 at
https://mozilla.org/MPL/2.0/
// � protradingart

//@version=5
indicator("Pro Trading Art - Candlestick Patterns with alert", "PTA - Candlestick
Patterns", overlay=true)
emaLen = input.int(21, "EMA Length")
ema = ta.ema(close, emaLen)

distance = math.abs((open - close)/close*100)

var candleRange = array.new_float(na)

array.push(candleRange, distance)

avgRange = array.avg(candleRange)

//#region Hammer
shadowGroup = "=========== Shadow ==========="
isHammer = input.bool(true, "Hammer", group=shadowGroup, inline = "Hammer")
hammerMult = input.float(defval=2.0, title="Multiplier", step=0.1,
group=shadowGroup, inline = "Hammer")
hammer = (open-low) > (close-open)*hammerMult and (close-open) > (high-close) and
isHammer and close < ema

plotshape(hammer ? low : na, title="Hammer", text = "Hammer", style=shape.labelup,


color=color.lime, size=size.normal, location=location.absolute, textcolor =
color.black)

if hammer
alert("Hammer in : "+syminfo.ticker, alert.freq_once_per_bar_close)
//#endregion

//#region Hanging Man


isHanging = input.bool(true, "Hanging Man", group=shadowGroup, inline = "Hanging
Man")
hangingMult = input.float(defval=3.0, title="Multiplier", step=0.1,
group=shadowGroup, inline = "Hanging Man")
hanging = (open-low) > (close-open)*hangingMult and (close-open) > (high-close) and
isHanging and close > ema

plotshape(hanging ? high : na, title="Hanging Man", text = "Hanging Man",


style=shape.labeldown, color=color.rgb(240, 116, 116), size=size.normal,
location=location.absolute, textcolor = color.white)

if hanging
alert("Hanging Man In : "+syminfo.ticker, alert.freq_once_per_bar_close)
//#endregion

//#region Inverted Hammer


isInvertedHammer = input.bool(true, "Inverted Hammer", group=shadowGroup, inline =
"Inverted Hammer")
invertedHammerMult = input.float(defval=2.0, title="Multiplier", step=0.1,
group=shadowGroup, inline = "Inverted Hammer")
invertedHammer = (high-open) > (open-close)*invertedHammerMult and (open-close) >
(close-low) and isInvertedHammer and close < ema
plotshape(invertedHammer ? low : na, title=" Inverted Hammer", text = "Inverted
Hammer", style=shape.labelup, color=color.rgb(60, 231, 148), size=size.normal,
location=location.absolute, textcolor = color.black)

if invertedHammer
alert("Inverted Hammer : "+syminfo.ticker, alert.freq_once_per_bar_close)

//#endregion

//#region Shooting Star


starGroup = "=========== Star ==========="
isShootingStar = input.bool(true, "Shooting Star", group=starGroup, inline =
"Shooting Star")
shootingStarMult = input.float(defval=2.0, title="Multiplier", step=0.1,
group=starGroup, inline = "Shooting Star")
shootingStar = (high-open) > (open-close)*shootingStarMult and (open-close) >
(close-low) and isShootingStar and close > ema

plotshape(shootingStar ? high : na, title="Shooting Star", text = "Shooting Star",


style=shape.labeldown, color=color.red, size=size.normal,
location=location.absolute, textcolor = color.white)

if shootingStar
alert("Shooting Star : "+syminfo.ticker, alert.freq_once_per_bar_close)
//#endregion

//#region Morning Star


isMorningStar = input.bool(true, "Morning Star", group=starGroup)
morningStar(Open, Close, High, Low)=>
Close > Open and Close > Close[1] and Open > Open[1] and Open > Close [1] and
Open[1] < Open[2] and Open[1] < Close[2] and Close[1] < Open[2] and Close[1] <
Close[2] and Close < ta.sma(Close, 50) and
High > Low[2] and Close > Low[2]

morningstar = morningStar(open, close, high, low) and isMorningStar and close < ema
plotshape(morningstar ? low : na, title="Morning Star", style=shape.labelup,
color=color.rgb(54, 167, 58), location=location.absolute, text="Morning Star",
textcolor=color.black, size=size.normal)

if morningstar
alert("Morning Star : "+syminfo.ticker, alert.freq_once_per_bar_close)

//#endregion

//#region Evening Star


isEveningStar = input.bool(true, "Evening Star", group=starGroup)
eveningStar(Open, Close, High, Low)=>
Close < Open and Close < Close[1] and Open < Open[1] and Open < Close [1] and
Open[1] > Open[2] and Open[1] > Close[2] and Close[1] > Open[2] and Close[1] >
Close[2] and Close > ta.sma(Close, 50) and
Low < High[2] and Close < High[2]

eveningstar = eveningStar(open, close, high, low) and isEveningStar and close > ema
plotshape(eveningstar ? high : na, title="Evening Star", style=shape.labeldown,
color=color.rgb(230, 47, 47, 7), location=location.absolute, text="Evening Star",
textcolor=color.white, size=size.normal)

if eveningstar
alert("Evening Star : "+syminfo.ticker, alert.freq_once_per_bar_close)
//#endregion

//#region Bullish Engulfing


engulfingGroup = "=========== Engulfing ==========="
isBulllishEngulfing = input.bool(true, "Bullish Engulfing", group=engulfingGroup)

bullishEngulfing = close > open[1] and close > close[1] and open < open[1] and open
< close[1] and close < ema and distance > avgRange and isBulllishEngulfing

plotshape(bullishEngulfing ? low : na, title="Bullish Engulfing", text = "Bullish


Engulfing", style=shape.labelup, color=color.rgb(1, 189, 98), size=size.normal,
location=location.absolute, textcolor = color.black)

if bullishEngulfing
alert("Bullish Engulfing in : "+syminfo.ticker, alert.freq_once_per_bar_close)
//#endregion

//#region Bearish Engulfing

isBearishEngulfing = input.bool(true, "Bearish Engulfing", group=engulfingGroup)

bearishEngulfing = close < open[1] and close < close[1] and open > open[1] and open
> close[1] and close > ema and distance > avgRange and isBearishEngulfing

plotshape(bearishEngulfing ? high : na, title="Bearish Engulfing", text = "Bearish


Engulfing", style=shape.labeldown, color=color.rgb(250, 64, 64), size=size.normal,
location=location.absolute, textcolor = color.white)

if bearishEngulfing
alert("Bearish Engulfing in : "+syminfo.ticker, alert.freq_once_per_bar_close)
//#endregion

//#region Dark Cloud Cover


cloudGroup = "=========== Cloud ==========="
isDarkCloudCover = input.bool(true, "Dark - Cloud Cover", group = cloudGroup)
darkCloud = close[1] > open[1] and close < open and open > high[1] and close <
close[1] - (high[1] - low[1])/4 and close > open[1] and close > ema

plotshape(darkCloud ? high : na, title="Dark - Cloud Cover", text = "Dark - Cloud


Cover", style=shape.labeldown, color=color.rgb(250, 64, 64), size=size.normal,
location=location.absolute, textcolor = color.white)

if darkCloud
alert("Dark - Cloud Cover in : "+syminfo.ticker, alert.freq_once_per_bar_close)
//#endregion

//#region Piercing Pattern


isPiercingPattern = input.bool(true, "Piercing Pattern", group = cloudGroup)
piercing = close[1] < open[1] and close > open and close > close[1] + (open[1] -
close[1])/2 and open < low[1] and close < open[1] and close < ema

plotshape(piercing ? low : na, title="Piercing Pattern", text = "Piercing Pattern",


style=shape.labelup, color=color.rgb(1, 189, 98), size=size.normal,
location=location.absolute, textcolor = color.black)

if piercing
alert("Piercing Pattern in : "+syminfo.ticker, alert.freq_once_per_bar_close)
//#endregion

You might also like