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.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。