Specification
The best last three possible support and resistance levels on a chart
1. Determine the primary trend using Simple Moving Average (SMA):
a. Calculate a 50-day SMA for the price data.
b. Calculate a 200-day SMA for the price data.
c. If the 50-day SMA is above the 200-day SMA, set the primary trend as bullish.
d. If the 50-day SMA is below the 200-day SMA, set the primary trend as bearish.
2. Identify swing highs and lows using the ZigZag indicator:
a. Apply the ZigZag indicator to the price data with a deviation setting of 5%.
b. Store the swing high and low points identified by the ZigZag indicator as potential support and resistance levels.
3. Apply Fibonacci retracement levels:
a. Calculate Fibonacci retracement levels (38.2%, 50%, and 61.8%) between the most recent significant high and low points identified by the ZigZag indicator.
b. Add these levels to the list of potential support and resistance levels.
4. Analyze horizontal price levels using a Support/Resistance indicator:
a. Apply a Support/Resistance indicator to the price data (e.g., Pivot Points or Horizontal Lines).
b. Identify significant horizontal price levels that have acted as support or resistance in the past.
c. Add these levels to the list of potential support and resistance levels.
5. Apply the Relative Strength Index (RSI) indicator:
a. Calculate the 14-day RSI for the price data.
b. Use the RSI levels of 30 (oversold) and 70 (overbought) as additional confluence factors for support and resistance levels.
6. Check for confluence:
a. For each potential support and resistance level, determine if it has multiple technical indicators and price action analysis converging at that level.
b. Assign a score to each level based on the number of confluence factors present (e.g., Fibonacci levels, horizontal price levels, and RSI levels).
7. Rank the levels:
a. Sort the list of potential support and resistance levels based on their assigned scores, with the highest scores representing the most significant levels.
8. Select the best three levels:
a. Extract the top three support levels and the top three resistance levels from the ranked list.
b. Return these levels as the best last three possible support and resistance levels on the chart.