Support Line: This is drawn at the lowest low over the lookback period. Resistance Line: This is drawn at the highest high over the lookback period. Both are represented as dotted lines on the chart for better visualization. Entry Points (Buy/Sell):
Buy: Triggered when the candle is bullish, price is above support, and RSI is in the oversold region (below 30). Sell: Triggered when the candle is bearish, price is below resistance, and RSI is in the overbought region (above 70). Exit Points:
Exit Long: Triggered when the price falls below the lowest low over the trendLookback period or if RSI crosses above the overbought level (above 70). Exit Short: Triggered when the price rises above the highest high over the trendLookback period or if RSI crosses below the oversold level (below 30). Channel Visualization:
Support and resistance are drawn dynamically as dotted lines that adjust with price. Signal Alerts:
Alerts are set for Buy, Sell, Exit Long, and Exit Short signals. Expected Behavior: Buy signals (green triangles) will appear below the bars when a bullish candle forms, the price is above support, and the RSI is oversold. Sell signals (red triangles) will appear above the bars when a bearish candle forms, the price is below resistance, and the RSI is overbought. Exit signals (blue and orange crosses) will appear when it is time to exit based on trend changes or RSI crossing the threshold. How to Test: Apply this script to a 15-minute chart (or your preferred timeframe). Observe the buy/sell signals in relation to the support and resistance levels. Watch the exit points to check how well the strategy works with the trend and RSI. Adjust the parameters as needed, such as candleSizeFactor, rsiPeriod, lookback, etc. This should now give you a more refined visualization and strategy logic that includes entry/exit points, channels for support/resistance, and takes the candlestick patterns, trend analysis, RSI, and CHoCH into account. Let me know if you'd like any further adjustments!