I Created My First Tradingview Indicator: RSI MTF Optimizer
This indicator shows the optimal time to buy a stock based on ROI or Win Rate.
Are you frustrated with the available Tradingview indicators?
I’ve tried dozens of free and paid indicators. However, they don’t consider multiple factors or timeframes.
I’m creating a series of indicators that show the best conditions to buy or sell. I’m also creating an indicator for buy and sell signals that optimizes the overall market environment and the symbol’s momentum and risk reward.
These indicators will work in synergy. They will show me what’s in an optimal environment to buy or sell and signal the most optimal entry.
The first indicator in this series shows the ideal RSI range for buying or selling.
This indicator is meant to confirm buy or sell signals, which is next in the series.
See how to get it or try it out at the end of the post.
Disclaimer
This is meant for educational purposes only. It’s not financial advice. Please do your own due diligence.
Investing in stocks and options is risky and not suitable for everyone. You are responsible for your losses and profits.
I’m not a financial advisor and can’t give you financial advice. Read the full disclaimer here.
RSI MTF Optimizer
The RSI MTF Optimizer is a Pine Script indicator designed for TradingView that enhances trading decisions by analyzing the Relative Strength Index (RSI) across multiple timeframes (MTF). It also optimizes stop loss (SL) and take profit (TP) levels.
It overlays a table on the price chart, providing detailed metrics and signals based on historical trade simulations within predefined RSI ranges (0-30, 30-40, 40-50, 50-60, 60-70, 70-80, 80-100).
The indicator: calculates RSI Across Timeframes: Computes RSI values for Monthly (M), Weekly (W), Daily (D), 4-hour (4H), 1-hour (1H), 15-minute (15M), and 5-minute (5M) timeframes, alongside the chart’s current timeframe.
Simulates Trades: Tests buy and sell trades across RSI ranges using a range of SL (0.5% to 5%) and TP (0.5% to 20%) levels to identify optimal setups.
Optimizes Trading Parameters: Determines the best SL and TP levels for each RSI range based on user-selected criteria (ROI, Win Rate, or risk reward).
Displays Multi-Timeframe Analysis: Shows a table with performance metrics and a multi-timeframe (MTF) optimality row, coloring timeframes green for optimal buys and red for optimal sells.
Provides Trade Signals: Suggests SL and TP prices for the current RSI range, aiding in trade setup.
How To Use It
Adding the Indicator:
Request access because it is an invite only. Next, In TradingView, go to the chart, click "Indicators," open invite only, search for "RSI MTF Optimizer," and add it.
The table will appear on the right side of the price chart, centered vertically (position.middle_right)
.
Understanding the Table:
Rows: Each row represents a different metric or signal:
RSI Range: Lists the 7 RSI ranges (e.g., <30, 30-40, etc.).
Trades/Wins: Number of simulated trades and wins per range.
Optimal SL/TP (%): Best SL and TP percentages for each range.
Avg Bars to SL/TP: Average bars to hit SL or TP.
Avg Bar ROI (%): Average ROI per bar.
RR: Risk-reward ratio (TP/SL).
Win Rate (%): Percentage of winning trades.
ROI (%): Total return on investment per range.
Current RSI: Shows the current timeframe’s RSI in its range column.
Suggested SL/TP Price: Suggested SL and TP prices in dollars for the current RSI range.
Optimal MTFs: Shows M, W, D, 4H, 1H, 15M, 5M with green (optimal buy) or red (optimal sell) coloring.
Columns: Correspond to RSI ranges (plus a label column), with data aligned to each range.
Configuring Settings:
RSI Length: Default is 14; adjust for sensitivity (shorter for faster signals, longer for smoother).
Look-Ahead Mode:
"Specific": Limits trade simulation to a set number of bars forward (default 20, adjustable via look_ahead_bars).
"Max Available": Uses all available future bars up to the current bar.
Trade Evaluation Method:
"Look-Ahead": Simulates trades forward from the entry bar.
"All Days Forward": Uses all subsequent bars (historical bias).
Trade Bias: Sets simulation focus:
"Buy": Optimizes for buy trades.
"Sell": Optimizes for sell trades.
"Buy or Sell": Combines both, favoring the best combined performance.
Optimization Method: Chooses optimization criteria:
"ROI": Maximizes return on investment.
"Win Rate": Maximizes winning trade percentage.
"Risk-Reward": Maximizes TP/SL ratio.
Timeframe Visibility: Toggle which timeframes (M, W, D, 4H, 1H, 15M, 5M) appear in the "Optimal MTFs" row.
Row Visibility: Toggle which rows to display in the table.
Confirming Buy or Sell Signals:
Buy Signals:
Look at the "Optimal MTFs" row. Green cells indicate the timeframe’s RSI is in the optimal buying range (buy_optimal_range), suggesting a potential buy opportunity.
Check the "Current RSI" row to see the current timeframe’s RSI. If it aligns with the optimal buy range (e.g., same column as green cells), it strengthens the signal.
Use "Suggested SL Price" and "Suggested TP Price" for trade setup. For example, if "Current RSI" is in the 30-40 range and 30-40 is optimal for buying, set SL and TP as shown.
Confirm with price action (e.g., support levels, candlestick patterns) and ensure multiple timeframes (e.g., D, 4H) show green for stronger confluence.
Sell Signals:
Red cells in "Optimal MTFs" indicate the timeframe’s RSI is in the optimal selling range (sell_optimal_range), suggesting a potential sell opportunity.
If "Current RSI" matches the optimal sell range (e.g., same column as red cells), it supports a sell signal.
Use "Suggested SL Price" and "Suggested TP Price" for sell trade setup, adjusted for selling (SL above entry, TP below).
Validate with price action (e.g., resistance levels, bearish patterns) and check for red across multiple timeframes for confirmation.
Confluence: The more timeframes showing green (buy) or red (sell) aligned with the current RSI range, the stronger the signal. For example, if D, 4H, and 1H are green and the current RSI is in the same range, it’s a robust buy signal.
Executing a Trade:
Buy Example: If "Current RSI" is 35 (in 30-40), "Optimal MTFs" shows D and 4H green, "Suggested SL Price" is $95, and "Suggested TP Price" is $105:
Enter a buy at the current price (e.g., $100).
Set SL at $95 and TP at $105.
Monitor price action for confirmation (e.g., bounce off support).
Sell Example: If "Current RSI" is 75 (in 70-80), "Optimal MTFs" shows W and D red, "Suggested SL Price" is $105, and "Suggested TP Price" is $95:
Enter a sell at the current price (e.g., $100).
Set SL at $105 and TP at $95.
Confirm with bearish signals (e.g., rejection at resistance).
Limitations
Historical Bias:
The indicator uses past data to simulate trades, which may not predict future performance accurately, especially in changing market conditions.
Look-Ahead Limitation:
"Look-Ahead" mode is limited by available future bars or the user-defined look_ahead_bars (default 20), potentially missing longer-term outcomes. "All Days Forward" introduces hindsight bias.
Fixed RSI Ranges:
Uses static 10-unit RSI ranges (e.g., 30-40), which may not adapt to asset-specific volatility or optimal thresholds.
Single Timeframe Optimization:
Trade simulations and SL/TP optimization are based only on the chart’s current timeframe, not reflecting multi-timeframe dynamics fully.
Performance Overhead:
Simulating trades across multiple SL/TP combinations and timeframes can be computationally intensive, potentially slowing down on large datasets or low-powered devices.
No Real-Time Adjustment:
SL and TP suggestions are static for the current bar’s RSI range and don’t adjust dynamically as price moves unless the chart updates.
Trade Bias Dependency:
Optimal ranges and SL/TP values depend on trade_bias. "Buy or Sell" may dilute signal clarity by combining metrics, while "Buy" or "Sell" focuses on one direction, potentially missing opportunities in the other.
Lack of Confirmation Filters:
Relies solely on RSI and simulated trade outcomes without integrating other indicators (e.g., volume, moving averages) for signal validation.
Tips for Effective Use
Combine with Other Tools: Use trendlines, support/resistance, or other indicators (e.g., MACD, Bollinger Bands) to confirm signals.
Adjust Settings: Experiment with rsi_length, look_ahead_bars, and optimization_method to match your trading style (e.g., shorter RSI for scalping, ROI for profit focus).
Monitor Multi-Timeframe Alignment: Stronger signals occur when multiple timeframes align (e.g., green on D, 4H, and 1H).
Backtest: Test the indicator on historical data for your asset to assess its effectiveness before live trading.
Risk Management: Always use proper position sizing and consider the suggested SL/TP as a starting point, not a guarantee.
How To Get It
If you are a current paid subscriber, please message me with your Tradingview username and I will grant you access. However, you may lose access if you cancel your membership.
Once you’ve paid a certain amount for my Substack, I will grant you lifetime access to all past and future indicators. I will update you when I decide on an amount.
I will raise my paid subscriber prices when I release my next indicator.
Want a free trial? Subscribe and message me and I will grant you free access for 1 week. (I may end or change this offer at any time).
Up Next: Buy Signals
The next indicator will synergize with my RSI MRF Optimizer to find high ROI entries with fewer false signals.
You will also need to use fewer indicators as it will check for confluences across many factors and timeframes.
Please let me know if you have any questions or suggestions.