Guide
How does the Trend Reversal Alerts Strategy [4H/3M] strategy work ?
The Trend Reversal Alerts Strategy (T-R.A.S) [4H/3M] is designed to identify potential trend reversals on a 4-hour to 3-month timeframe. The strategy uses a combination of closing and opening prices to determine the direction of the market and generate signals for entering and exiting trades.
- Delta: This is a user-defined sensitivity setting that affects the closeness between consecutive closing prices to signal a potential trend change.
- Buy and Sell Resistance: These inputs determine the threshold beyond which a trend reversal signal is confirmed.
- The topSource and bottomSource variables identify the higher and lower values between the opening and closing prices, respectively.
- The resistance factor is calculated based on the full range of the candlestick (body) and the difference between opening and closing prices (spirit), providing a measure for the trend's strength.
- A buy_signal is generated when the current and previous closing prices are greater than the closing price two periods ago, adjusted by the delta, and the resistance is higher than the user-defined buyResistance level.
- Conversely, a sell_signal is generated when the closing prices show a downtrend considering the delta, and the resistance falls below the sellResistance level.
- Finally, the script enters a buy position at a buy signal and closes it at a sell signal. The strategy's current position size is visualized using the plot function.