Created
April 8, 2025 18:40
-
-
Save feliperazeek/e09b0752dff4396e123326da33ec75fa to your computer and use it in GitHub Desktop.
PFR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@version=5 | |
indicator("NakInvest - PFR Identifier", overlay=true) | |
// === PFR CONDITIONS === | |
reversalBody = math.abs(close - open) | |
prevBody1 = math.abs(close[1] - open[1]) | |
prevBody2 = math.abs(close[2] - open[2]) | |
bullishCandle = close > open | |
bearishCandle = close < open | |
prevTwoRed = close[1] < open[1] and close[2] < open[2] // Previous two candles must be red | |
prevTwoGreen = close[1] > open[1] and close[2] > open[2] // Previous two candles must be green | |
bullishPFR = bullishCandle and prevTwoRed and low < ta.lowest(low[1], 2) and high > ta.highest(high[1], 2) and close > close[1] and | |
reversalBody > prevBody1 and reversalBody > prevBody2 | |
bearishPFR = bearishCandle and prevTwoGreen and high > ta.highest(high[1], 2) and low < ta.lowest(low[1], 2) and close < close[1] and | |
reversalBody > prevBody1 and reversalBody > prevBody2 | |
// === PLOT SIGNALS === | |
plotshape(series=bullishPFR, location=location.belowbar, color=color.green, style=shape.labelup, title="Bullish PFR", text="PFR") | |
plotshape(series=bearishPFR, location=location.abovebar, color=color.red, style=shape.labeldown, title="Bearish PFR", text="PFR") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment