OPEN-SOURCE SCRIPT

Dual MTF Confirmed Trend Strategy (5m Entry / 15m MACD & RSI) v1

78
That is a detailed Dual Multi-Timeframe (MTF) Confirmed Trend Strategy written in Pine Script for TradingView. The core idea of this strategy is to only take entry signals on a faster timeframe (5-minute) when the trend is strongly confirmed on a slower, higher timeframe (15-minute). This aims to reduce false signals and trade in the direction of the dominant trend. Here is an explanation of how the strategy works, broken down by section:

1. 5-Minute Entry Filters 🚀This section calculates several indicators on the current 5-minute chart to identify potential trade setups. A position is only considered if all 5-minute conditions align.
Supertrend: A trend-following indicator based on Average True Range (ATR).
Long Condition: The closing price must be above the Supertrend line.
Short Condition: The closing price must be below the Supertrend line.
Gann Hi-Lo (GHL): A trend indicator using Simple Moving Averages (SMA) of the high and low prices. GHL Line: Switches between the SMA of the Highs and the SMA of the Lows based on price action.
Long Condition: The closing price must be above the GHL line.
Short Condition: The closing price must be below the GHL line.
Exponential Moving Averages (EMAs): It uses a 50-period EMA and a 100-period EMA to confirm the short-term trend direction.
Long Condition: The closing price must be above both the 50 EMA and the 100 EMA.
Short Condition: The closing price must be below both the 50 EMA and the 100 EMA.

2. 15-Minute MTF Confirmation Filters ⏳This is the crucial step where the strategy verifies the trend on the slower, 15-minute timeframe using the request security function. This step acts as a gatekeeper to ensure the 5-minute trade aligns with the larger trend.
MACD Histogram (12, 26, 9): The difference between the MACD Line and the Signal Line.
Long Confirmation: The 15m MACD Histogram must be greater than 0 (MACD line is above the Signal line, indicating bullish momentum).
Short Confirmation: The 15m MACD Histogram must be less than 0 (MACD line is below the Signal line, indicating bearish momentum).
RSI (Relative Strength Index) (14): A momentum oscillator. The 50 level is often used to determine the general market trend.
Long Confirmation: The 15m RSI must be greater than 50 (indicating stronger bullish momentum).
Short Confirmation: The 15m RSI must be less than 50 (indicating stronger bearish momentum).
The Total 15m Confirmation is only true if both the MACD and the RSI confirmation signals align.

3. Trade Orders (Entry Logic) ⚖️
The strategy only executes a trade when the 5-minute entry conditions are met AND the 15-minute confirmation conditions are met.

Final Long Condition:
5m Conditions (Supertrend, GHL, EMA alignment) AND
15m Confirmation (MACD Hist > 0 AND RSI > 50)

Final Short Condition:
5m Conditions (Supertrend, GHL, EMA alignment) AND
15m Confirmation (MACD Hist < 0 AND RSI < 50)

When a trade signal is generated, the strategy:

Closes any opposite position (e.g., closes a "Short" trade if a "Long" signal appears).

Enters the new position (e.g., enters a "Long" trade).

This is designed as a reversal strategy where a new entry automatically closes the previous opposing trade.

In Summary
The strategy operates on a principle of Trend Alignment:

5-Minute Chart: Is used for Signal Timing (when exactly to enter the market).

15-Minute Chart: Is used for Trend Validation (is the overall market momentum supporting the signal?).

It's an attempt to capture short-term moves (5m signals) that are backed by strong medium-term momentum (15m confirmation), thereby aiming for higher probability trades.

This is not investment advice; it is recommended to perform optimization and backtesting for the assets intended for implementation.

כתב ויתור

המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.