OPEN-SOURCE SCRIPT
RSI Strategy with Auto Tuner (PF)

# RSI Auto‑Tuner Strategy — How To Use
This document explains **how to use** the RSI Auto‑Tuner strategy. It intentionally avoids math and implementation details. Follow this as an operating guide.
---
## 1. What This Tool Is For
This strategy helps you:
* Discover **which RSI length works best** on a given ticker and timeframe
* Measure performance using **Profit Factor (PF)**
* Improve RSI performance on noisy markets by **transforming price first**
The auto‑tuner is a **research tool**, not a live trading signal generator.
---
## 2. Two Modes You Must Treat Differently
### Research Mode
Used to explore and discover parameters.
* Auto‑Tune: **ON**
* Parameters are allowed to change
* Results may look very good
* Overfitting risk is real
### Trading Mode
Used for forward testing or live trading.
* Auto‑Tune: **OFF**
* Parameters are fixed
* Behavior is stable and repeatable
* This is the only acceptable mode for live use
**Never trade live with Auto‑Tune enabled.**
---
## 3. Manual Mode (Trading Mode)
Use this after parameters are finalized.
Steps:
1. Set **Auto‑Tune = OFF**
2. Choose:
* Source (raw price or transformed price)
* RSI Length (manual, default 14)
* Oversold / Overbought levels
3. The strategy will:
* Enter long when RSI crosses up through Oversold
* Enter short when RSI crosses down through Overbought
* Flip positions on opposite signals
This mode is predictable and safe for forward testing.
---
## 4. Auto‑Tune Mode (Research Mode)
Use this to find optimal RSI lengths.
Steps:
1. Set **Auto‑Tune = ON**
2. Configure the search range:
* Minimum Length (default 5)
* Maximum Length (default 14)
* Step Size (default 1)
3. The strategy will:
* Internally simulate trades for each RSI length
* Track gross profit, gross loss, and trades
* Select the length with the highest Profit Factor
4. The best length is applied automatically
Auto‑Tune evaluates historical data only.
---
## 5. Using a Transform on Price (Critical)
RSI does **not** have to run on raw price.
You can significantly improve results by:
* Applying a **price transform** first
* Feeding the transformed series into the RSI Source input
Examples of transforms:
* Moving averages
* Low‑pass filters
* Butterworth filters
* Any smoother or denoiser
Why this works:
* Busy, wicky markets cause RSI to whipsaw
* Transforms remove micro‑noise
* RSI responds to structure instead of chaos
* Profit Factor often increases dramatically
Best practice:
* Auto‑tune on raw price
* Auto‑tune on transformed price
* Compare PF, trade count, and stability
---
## 6. Reading the Status Label
At the last bar, the on‑chart label shows:
* Whether Auto‑Tune is ON or OFF
* Whether candidates were built successfully
* Number of RSI lengths tested
* Best RSI length found
* Profit Factor and trade count
If Auto‑Tune is OFF, the label shows the manual length.
---
## 7. Recommended Workflow
1. Choose ticker and timeframe
2. Enable Auto‑Tune on **raw price**
3. Record best RSI length and PF
4. Enable Auto‑Tune on **transformed price**
5. Compare results
6. Lock parameters
7. Disable Auto‑Tune
8. Forward test
---
## 8. Warnings and Discipline
* High PF with few trades is unreliable
* Transforms can hide execution costs
* Always validate on a different period
* Auto‑Tune is a **lens**, not an edge
Treat this tool as a research microscope, not an autopilot.
This document explains **how to use** the RSI Auto‑Tuner strategy. It intentionally avoids math and implementation details. Follow this as an operating guide.
---
## 1. What This Tool Is For
This strategy helps you:
* Discover **which RSI length works best** on a given ticker and timeframe
* Measure performance using **Profit Factor (PF)**
* Improve RSI performance on noisy markets by **transforming price first**
The auto‑tuner is a **research tool**, not a live trading signal generator.
---
## 2. Two Modes You Must Treat Differently
### Research Mode
Used to explore and discover parameters.
* Auto‑Tune: **ON**
* Parameters are allowed to change
* Results may look very good
* Overfitting risk is real
### Trading Mode
Used for forward testing or live trading.
* Auto‑Tune: **OFF**
* Parameters are fixed
* Behavior is stable and repeatable
* This is the only acceptable mode for live use
**Never trade live with Auto‑Tune enabled.**
---
## 3. Manual Mode (Trading Mode)
Use this after parameters are finalized.
Steps:
1. Set **Auto‑Tune = OFF**
2. Choose:
* Source (raw price or transformed price)
* RSI Length (manual, default 14)
* Oversold / Overbought levels
3. The strategy will:
* Enter long when RSI crosses up through Oversold
* Enter short when RSI crosses down through Overbought
* Flip positions on opposite signals
This mode is predictable and safe for forward testing.
---
## 4. Auto‑Tune Mode (Research Mode)
Use this to find optimal RSI lengths.
Steps:
1. Set **Auto‑Tune = ON**
2. Configure the search range:
* Minimum Length (default 5)
* Maximum Length (default 14)
* Step Size (default 1)
3. The strategy will:
* Internally simulate trades for each RSI length
* Track gross profit, gross loss, and trades
* Select the length with the highest Profit Factor
4. The best length is applied automatically
Auto‑Tune evaluates historical data only.
---
## 5. Using a Transform on Price (Critical)
RSI does **not** have to run on raw price.
You can significantly improve results by:
* Applying a **price transform** first
* Feeding the transformed series into the RSI Source input
Examples of transforms:
* Moving averages
* Low‑pass filters
* Butterworth filters
* Any smoother or denoiser
Why this works:
* Busy, wicky markets cause RSI to whipsaw
* Transforms remove micro‑noise
* RSI responds to structure instead of chaos
* Profit Factor often increases dramatically
Best practice:
* Auto‑tune on raw price
* Auto‑tune on transformed price
* Compare PF, trade count, and stability
---
## 6. Reading the Status Label
At the last bar, the on‑chart label shows:
* Whether Auto‑Tune is ON or OFF
* Whether candidates were built successfully
* Number of RSI lengths tested
* Best RSI length found
* Profit Factor and trade count
If Auto‑Tune is OFF, the label shows the manual length.
---
## 7. Recommended Workflow
1. Choose ticker and timeframe
2. Enable Auto‑Tune on **raw price**
3. Record best RSI length and PF
4. Enable Auto‑Tune on **transformed price**
5. Compare results
6. Lock parameters
7. Disable Auto‑Tune
8. Forward test
---
## 8. Warnings and Discipline
* High PF with few trades is unreliable
* Transforms can hide execution costs
* Always validate on a different period
* Auto‑Tune is a **lens**, not an edge
Treat this tool as a research microscope, not an autopilot.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.