Pivot Points Calculation:
The script calculates the Pivot Point as the average of the high price (high), low price (low), and closing price (close) of the current bar.
The Pivot Point is plotted on the chart as a red line.
Support and Resistance Levels:
The Support Level is calculated as the lowest price over the last lookback bars.
The Resistance Level is calculated as the highest price over the last lookback bars.
These levels are displayed on the chart using horizontal lines: green for support and red for resistance.
RSI (Relative Strength Index) Indicator:
A momentum oscillator calculated based on the closing price over the last rsiLength bars.
It is plotted as a yellow line.
MACD (Moving Average Convergence Divergence) Indicator:
An indicator consisting of the MACD line (blue) and the signal line (orange).
It is calculated based on the closing price with reduced periods for faster reaction.
Exponential Moving Averages (EMA):
EMA 10: An exponential moving average over the last 10 bars. It is plotted as a green line.
EMA 20: An exponential moving average over the last 20 bars. It is plotted as a red line.
ATR (Average True Range) Indicator:
A volatility indicator calculated over the last atrLength bars.
It is plotted as a purple line.
Candlestick Patterns (Price Action):
Bullish Pin Bar: Forms when the close is above the open and above the previous bar's high, and the open is below the previous bar's low.
Bearish Pin Bar: Forms when the close is below the open and below the previous bar's low, and the open is above the previous bar's high.
Bullish Engulfing: Forms when the current candle fully engulfs the previous bearish candle.
Bearish Engulfing: Forms when the current candle fully engulfs the previous bullish candle.
Trend Filters:
Uptrend: Determined when EMA 10 is above EMA 20.
Downtrend: Determined when EMA 10 is below EMA 20.
Conditions for Longs (Buy):
Price is above the Pivot Point.
Price is above the Support Level.
RSI is above 50.
MACD line is above the signal line.
Uptrend (EMA 10 > EMA 20).
ATR is above its average value.
Volume is above its average value.
Presence of a bullish pin bar or bullish engulfing.
Conditions for Shorts (Sell):
Price is below the Pivot Point.
Price is below the Resistance Level.
RSI is below 50.
MACD line is below the signal line.
Downtrend (EMA 10 < EMA 20).
ATR is above its average value.
Volume is above its average value.
Presence of a bearish pin bar or bearish engulfing.
Alerts and Visualization:
Alerts for longs and shorts.
"BUY" and "SELL" labels on the chart.
Background highlighting for signals.