OPEN-SOURCE SCRIPT

RSI Overbought and Oversold Levels - Mikel Vaquero

This Pine Script strategy is designed to trade using RSI (Relative Strength Index) overbought and oversold levels. Below is an overview of its functionality:

1. RSI Configuration
RSI Length: Calculates RSI with a customizable length (default is 14).
Key Levels: Includes overbought (70), oversold (30), and an optional middle level (50).
RSI Source: Uses the closing price by default, but it's adjustable.
2. Risk and Reward Parameters
Defines Stop Loss, Take Profit, and Partial Profit levels in pips, converted to the chart's price scale.
3. Trading Window
Operates only within a specific time window in GMT+2 (default: 8:00 to 11:00).
4. RSI Calculation and Conditions
Computes RSI based on price changes.
Detects two conditions:
Overbought: RSI crosses above level 70.
Oversold: RSI crosses below level 30.
5. Visual Representation
Plots RSI and key levels on the chart.
Displays labels when RSI reaches overbought ("B") or oversold ("S") conditions.
6. Alerts
Triggers automatic alerts when RSI crosses overbought or oversold levels.
7. Entry and Exit Management
Entry Conditions:
Long: When RSI is oversold.
Short: When RSI is overbought.
Exit Conditions:
Partial Take Profit: Closes 50% of the position at a predefined price level.
Full Take Profit: Closes the entire position upon reaching the full profit target.
Stop Loss: Closes the position if the price reverses by a defined amount.
Dynamic Breakeven: Moves the Stop Loss to the entry price after reaching the partial profit level.
8. State Management
Prevents duplicate entries in the same direction during an open position.
Strategy Summary
This strategy is ideal for trading within a specific time range using RSI signals. It dynamically manages positions with partial profits and breakeven adjustments, balancing simplicity and customization.

Feel free to adjust parameters such as RSI length, time windows, and pip values to suit your trading style.
OscillatorsRelative Strength Index (RSI)

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer