Bolinger and RSI
Download scriptThis automated trading script is designed to manage trades automatically by combining two popular market analysis tools: Bollinger Bands and the Relative Strength Index (RSI). Its primary goal is to identify specific price "extremes" where a market might be overextended, signaling potential entry points for profitable trades.
Core Logic Overview
The script operates by monitoring the market in real-time and looking for "confluence"—situations where both technical indicators agree on a direction. It focuses on two main types of movements:
1. Buy Opportunities (Potential Undervaluation)
The script looks to enter a "Buy" position when it detects that the price has dropped significantly enough to be considered potentially oversold. It checks for two specific conditions simultaneously:
- Price Position: The previous candle's closing price must be at or below the Lower Bollinger Band. This suggests the price is pushing into a statistically low zone.
- Momentum Check: The RSI indicator must be at or below a level of 30. This confirms that the downward momentum is reaching an extreme point.
If both conditions are met, and there isn't already a buy position open, the script will automatically execute a purchase at the current market price.
2. Sell Opportunities (Potential Overvaluation)
Conversely, the script looks to enter a "Sell" position when it detects that the price has surged to an extreme high. It monitors for:
- Price Position: The previous candle's closing price must be at or above the Upper Bollinger Band. This indicates the price is pushing into a statistically high zone.
- Momentum Check: The RSI indicator must be at or above a level of 70. This confirms that the upward momentum is reaching a peak.
If these conditions align, the script will automatically execute a sell order.
Key Features and Safeguards
To ensure the trading process is organized and safe, the script includes several professional-grade management features:
- Automatic Trade Protection: Every trade opened by the script is automatically equipped with a Stop Loss (to limit potential losses) and a Take Profit (to secure gains at a predetermined target).
- Smart Execution: The script is programmed to only evaluate trades at the start of a new candle (time bar). This prevents "over-trading" or reacting to tiny price fluctuations within a single minute.
- Safety Checks:
- Volume Verification: It automatically checks if your requested trade size meets the minimum and maximum volume requirements of the specific broker/symbol you are trading.
- Duplicate Prevention: The script is designed to prevent opening multiple identical positions (e.g., it won't open a second "Buy" if one is already active).
- Broker Compatibility: It includes logic to automatically adjust stop-loss and take-profit values for different types of broker price quotes (3-digit vs. 5-digit).
Summary for the User
In simple terms, this script acts as a disciplined automated trader. It waits for the market to reach "stretched" territory (using Bollinger Bands) while simultaneously confirming that the market is exhausted in that direction (using RSI). Once it sees these two signals align, it takes action, manages the risk automatically with stops and targets, and moves on to the next opportunity.
ÿþ/ / + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
/ / | B o l i n g e r a n d R S I . m q 5 |
/ / | C o p y r i g h t 2 0 2 0 , Z a k h v a t k i n A l e k s a n d r |
/ / | h t t p s : / / w w w . m q l 5 . c o m / r u / u s e r s / z . a . m |
/ / + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
# p r o p e r t y c o p y r i g h t "