MTF Trend Fusion - V1📌 MTF Trend Fusion - V1
Multi-Timeframe (MTF) Trend Indicator
🔍 Description: What Does It Do?
This indicator helps you visually analyze the overall market trend by combining Exponential Moving Averages (EMA) calculated on three different timeframes. It determines the trend direction by checking whether the price is above or below the EMAs from all selected timeframes.
The trend direction is clearly visualized through background color:
Green Background: Price is above the EMA on all three timeframes (bullish trend)
Red Background: Price is below the EMA on all three timeframes (bearish trend)
This approach aims to provide a more reliable trend confirmation by filtering out short-term misleading signals.
⚙️ How It Works
The script takes input from the user for three different timeframes and one EMA length. It calculates EMAs on those timeframes and determines the trend as follows:
If the price is above EMA1, EMA2, and EMA3 → Bullish signal
If the price is below EMA1, EMA2, and EMA3 → Bearish signal
In all other cases (mixed structure) → No signal
The background color is adjusted accordingly. All three EMAs are also plotted on the chart with different colors.
🛠️ How to Use
After activating the script, use the settings panel to select your desired three timeframes and the EMA length.
Regardless of your main chart's timeframe, this indicator analyzes the trend structure based on the selected timeframes.
You can quickly interpret the trend direction through the colored background.
🧠 Approach and Interpretation
This indicator helps you evaluate trend direction from a broader perspective using multi-timeframe (MTF) analysis. It focuses on understanding the overall direction rather than short-term price movements.
It can be particularly useful for:
Trend-following strategies
As a filter tool
Lower timeframe traders to see the higher timeframe trend direction
⚠️ Warnings & Recommendations
This is an indicator, not a strategy. It should not be used alone for buy/sell decisions.
Remember that EMA values are recalculated on different timeframes, which may introduce a delay effect.
Optimal settings may vary across markets and assets. Optimization is recommended.
📈 Default Settings
EMA Length: 50
Timeframe 1: 15 Minutes
Timeframe 2: 60 Minutes (1 Hour)
Timeframe 3: 240 Minutes (4 Hours)
💡 Why This Script?
This script goes beyond a simple EMA structure and offers a powerful tool for trend filtering. It reduces contradictions caused by different timeframes and provides stronger decision support.
With the combined EMA data:
Trend direction becomes clearer
False signals are filtered
The decision-making process is simplified
📌 Note: This indicator does not provide investment advice. It is designed to support your own analysis.
المتوسطات المتحركة
Moving Average Trend ToolsI. How M.A.T.T. Adds Value to the TradingView Community:
The "Moving Average Trend Tools" (M.A.T.T.) is a versatile Pine Script v6 indicator that empowers traders with clear trend analysis, reliable trade signals, and real-time insights. Its intuitive design and robust features make it a valuable addition to the TradingView Community Scripts by catering to traders of all levels. Here’s why it stands out:
Clear Trend Visualization: M.A.T.T. plots a moving average (MA) with dynamic coloring—green for rising, red for falling, and gray for flat—based on a user-defined lookback period. This simplifies trend interpretation, helping traders quickly assess market momentum.
Reliable Trade Signals : The script identifies price crossovers above or below the MA, plotting green circles for bullish crosses and red for bearish, confirmed on closed bars to prevent repainting. These signals guide entry and exit points for trend-following or reversal strategies.
Real-Time Extension Detection : M.A.T.T. calculates percentage price deviations from the MA, displaying real-time labels when thresholds (e.g., 6%) are exceeded. This highlights overextended moves, ideal for spotting reversals or pullbacks, with alerts to keep traders informed.
Extensive Customization : Traders can tailor the MA type (SMA, EMA, WMA, HMA), length, colors, line width, and label sizes. This flexibility supports diverse strategies across markets like stocks, forex, and crypto, from scalping to swing trading.
Automated Alerts : Alert conditions for crossovers and extensions integrate seamlessly with TradingView’s system, enabling traders to stay updated without constant chart monitoring.
M.A.T.T. combines trend analysis, signal generation, and overextension detection into a single, user-friendly tool. Its accessibility, reliability, and educational value for Pine Script learners make it a compelling contribution to the community.
II. What M.A.T.T. Does, How It Works, and Its Originality:
What It Does :
M.A.T.T. enhances trend analysis and trade decision-making through three core features:
Dynamic MA Visualization: Plots a customizable MA (SMA, EMA, WMA, or HMA) with trend-based coloring to reflect rising, falling, or flat market conditions.
Price Crossover Signals : Marks bullish (green circles) and bearish (red circles) crossovers, confirmed on closed bars, with alerts for trade opportunities.
Price Extension Labels : Displays real-time percentage deviations of price from the MA, with alerts when user-defined thresholds are breached, signaling potential reversals.
How It Works :
M.A.T.T. leverages Pine Script v6 for precise calculations and user-friendly outputs:
Inputs: Users select MA type, length, lookback period, colors, and thresholds for extensions, plus label styles and sizes for customization.
MA Calculation : A switch function computes the chosen MA (e.g., ta.ema(close, 21) for EMA). Trend direction is determined using ta.rising or ta.falling over the lookback period, coloring the MA accordingly.
Crossover Logic : Bullish crossovers (close > ma and close < ma ) and bearish crossovers (close < ma and close > ma ) are plotted as circles on confirmed bars (barstate.isconfirmed) to ensure reliability. Alerts trigger only on the first bar of a crossover.
Extension Logic : Percentage deviations are calculated as ((price - ma) / ma) * 100, using the high for above-MA extensions and low for below. Labels appear in real-time when thresholds are exceeded, with alerts on transitions to avoid noise.
Why It’s Original
M.A.T.T. distinguishes itself through a unique blend of features and thoughtful design:
All-in-One Design : It integrates dynamic MA coloring, non-repainting crossover signals, and real-time extension detection, addressing trend identification, trade signals, and overextension warnings in one tool—unlike most MA indicators that focus on a single aspect.
Real-Time Extension Labels : Displaying percentage deviations with customizable thresholds is a rare feature, ideal for volatile markets and not commonly found in standard scripts.
Non-Repainting Signals : Confirmed crossover signals enhance reliability for live trading, setting M.A.T.T. apart from less rigorous indicators.
Optimized Alert Condtions : Alerts trigger only on transitions (e.g., first bar of a crossover or extension), reducing noise and improving usability.
Visual and Functional Flexibility : Support for four MA types, extensive customization, and a clean interface (dynamic colors, tiny circles, clear labels) make it adaptable and user-friendly.
While MA plotting or crossovers exist elsewhere, M.A.T.T.’s seamless integration, real-time extension detection, alert conditions, and focus on reliability and customization create a distinctive, practical tool. Its balance of simplicity and sophistication makes it a unique asset for the TradingView community.
EMA ConditionsThis indicator was developed with the intention to display current market conditions according to the EMAs. There's a little box in the top right to display the conditions. I wanted to design something that shows already established market conditions, which is why I chose to use EMAs and candle closes as the source for identifying market conditions.
Personally, I scalp momentum in trending market conditions, so having an already established trend lets me know when it's appropriate for me to apply my edge on my lower time frame. I use a 5m time frame for my setups and this is where I apply this indicator. I designed the indicator to function off any time frame, so you can use this indicator with whatever time frame you want.
There are 5 conditions that I've set in place for this indicator, they're as follows:
1. Bullish conditions are met when price has closed 3+ consecutive candles over both EMAs (9 and 20 EMAs by default, but you can also choose what EMAs you want).
2. Bearish conditions are met when price has closed 3+ consecutive candles below both EMAs.
3. Reversal conditions are met when EMAs have crossed, and it will show those reversal conditions for the following 4 bars after the EMA cross over has taken place. Once there have been 4 bars closed, it will then show whatever condition is currently present.
4. Wait conditions are met when price is above/below (depending on direction of trend) the 9 ema.
- So in a bull trend, if price is below the 9 ema, it'll show "Wait"
5. Flat conditions are met when both EMAs are showing minimal changes in value over a specified number of candles. This indicates that EMAs are moving sideways and volatility is low. Likely in range bound or chop environments.
- The Flat threshold is adjustable. I have it set to 0.03% with a candle look back of 2 bars. This works the best for my edge, but you can set them to what you want.
The Flat and Wait conditions will override all other conditions. The Reversal conditions will override both Bullish and Bearish conditions. This way, when the indicator is showing Bullish or Bearish conditions, you'll know that nothing else is present.
Since I only trade in trending market conditions, I only trade when Bullish or Bearish conditions are met. If anything else is there then I'm not looking for my setups at that time. But you can use this however you'd like. If you like trading ranges, then trade when EMAs show flat. If you want to fade reversals and trade mean reversion, wait for a reversal condition to show and then look to fade that move. Get creative with it and with your edge. Don't put yourself in a box.
This indicator was made using Grok AI since I have no clue how to write code. I'll make the script available for everyone, so you can make adjustments yourself and do your own thing with it if you want.
If you have any questions or suggestions on how to improve the indicator, feel free to contact me on X: x.com
MTF vol short term volume indicator with a built in multi time frame trend guage for 60 min and low trend alignment
ZLSMA (Zero Lag Smoothed Moving Average)This is a smooted moving average works very good in daily charts.
Umesh BC IST 3:30 AM Session Tracker + 4H Candles📌 IST 3:30 AM Session Tracker + 4H Candle Marker
This indicator is designed for traders who follow Indian Standard Time (IST) and want precise session tracking and 4H candle insights.
🔧 Features:
🕒 Daily Session Start at 3:30 AM IST
Automatically detects and marks the beginning of each new trading day based on 3:30 AM IST, not midnight.
Displays session Open, High, and Low lines.
Background shading for each session.
Customizable alert when a new day starts.
🟧 4H Candle Start Markers (IST Time)
Identifies every new 4-hour candle that starts at:
3:30, 7:30, 11:30, 3:30 PM, 7:30 PM, 11:30 PM IST
Adds a vertical line and label ("🟧 4H") above the candle.
Plots a dynamic line for the 4H candle's opening price.
Includes optional alert for new 4H candles.
🔔 Alerts Included:
"🕒 New IST Day Start": Triggers at 3:30 AM IST.
"🟧 New 4H Candle": Triggers at each 4H candle start (IST).
✅ Best for:
Intraday, swing, and institutional traders using IST-based analysis.
Those wanting more accurate daily sessions and clear candle structuring.
[Kpt-Ahab] Moving Average Alarm OutputVarious Moving Average with Signal Outputs
Compatible with various backtesting-systems or risk management-systems for generating alarms and trading signals.
Also compatible with the djmad Multibit ecosystem, allowing for signal filtering or combining indicators.
Standard signal output Long/Short +1/-1
Filter, for suppressing signals
Various color variations.
Trend Signals By Spike Forex✅ How to Use This Script for Buying & Selling
Buy Signal Strategy
When a "Buy" label appears:
The price has likely broken above the middle or top of the band.
The band color may shift to blue/green, indicating a bullish trend.
You can consider entering a long (buy) trade.
Place a stop-loss slightly below the ribbon or recent swing low.
Sell Signal Strategy
When a "Sell" label appears:
The price has likely dropped below the middle or lower part of the ribbon.
The ribbon turns red, indicating a bearish trend.
Enter a short (sell) trade.
Place a stop-loss slightly above the ribbon or recent swing high.
📈 Tips for Better Trading Using This Indicator
Avoid Trading in Ranging Markets: If the band is flat or narrow, it might be better to wait.
Use Additional Confirmation: Combine with RSI, MACD, or volume for extra confirmation.
Timeframes Matter: Works better in trending conditions; test on higher timeframes for more reliable signals.
Candle Open Below 5 EMA (No Touch)Certainly! Here's a detailed explanation of how the indicator works:
### **Purpose:**
The indicator is designed to alert you when a **candle opens below the 5 EMA** (Exponential Moving Average) and **does not touch** or **cross** the 5 EMA at any point during its formation. This condition can potentially signal a bearish momentum, as the price opens below the 5 EMA but does not go back up to test or reach the EMA during the duration of the candle.
### **Steps in the Indicator:**
1. **5 EMA Calculation**:
The script calculates the **5-period Exponential Moving Average** of the regular candles' closing prices. The 5 EMA is a fast-moving average, which reacts quicker to price changes compared to longer-period EMAs (like 20 or 50 periods). This makes it a sensitive indicator of short-term price trends.
```pinescript
ema5 = ta.ema(close, 5)
```
2. **Candle Data**:
For each candle on the chart, the script checks its **open** and **high** prices. It’s essential because:
- **Candle Open** is compared with the 5 EMA to determine if the candle opened below the EMA.
- **Candle High** is compared with the 5 EMA to verify if the candle **does not touch** or **cross** the EMA during its formation.
```pinescript
candleOpen = open
candleHigh = high
```
3. **Condition for Signal**:
The key condition is that the **candle opens below the 5 EMA** and **does not touch or cross** the 5 EMA (its **high remains below** the 5 EMA). If both of these conditions are true, then the script flags it as a potential signal. This is the core logic of the indicator.
```pinescript
condition = candleOpen < ema5 and candleHigh < ema5
```
4. **Visualizing the Signal**:
When the condition is met, the indicator will plot a **red triangle** above the bar (candle) where the condition was true. This gives a visual cue that a candle meeting the criteria occurred.
```pinescript
plotshape(condition, title="Signal", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)
```
5. **Alert Condition**:
The indicator also sets up an alert condition. If the condition is met (candle opens below the 5 EMA and doesn’t touch it), the alert will trigger. You can then set up an alert in TradingView based on this condition, which will notify you in real-time.
```pinescript
alertcondition(condition, title="Candle Opened Below EMA and Didn't Touch", message="Candle opened below and did not touch the 5 EMA.")
```
### **How It Helps in Trading:**
This indicator can be useful in the following ways:
- **Bearish Continuation Signal**: If a candle opens below the 5 EMA and doesn’t reach it, it might be signaling that the bearish trend is intact, and price is unlikely to reverse or consolidate at the EMA level.
- **Avoids False Signals**: The condition that the high of the candle must remain below the EMA reduces false signals where a candle might briefly cross above the EMA but fail to sustain that level.
### **How to Use the Indicator:**
- **Alert Setup**: You can set up an alert based on this script to notify you whenever a candle opens below the 5 EMA and doesn’t touch the 5 EMA.
- **Trend Confirmation**: This could be used alongside other indicators (like RSI, MACD, or volume) to confirm the trend and get a more reliable signal.
### **Example:**
If you're trading on a 1-minute chart and see a red triangle above a candle, you’ll know that this candle opened below the 5 EMA and didn't go back up to touch or test the 5 EMA during its duration. This could signal that price might continue to move lower, so it might be a good time to consider entering a short position (if confirmed by other factors).
---
Let me know if you need further details on any part of this explanation or additional features!
Jack's ADX Entry V5Updated Jack's ADX Entry Indicator to show entry for long/short positions based on:
1. Order of the short, medium and long EMAs.
2. ADX Trend strength momentum value increasing from previous value.
SPY Trend-Based Buy Signals🔹 Overview
This indicator identifies potential buy signals on any asset by combining MACD and Stochastic Oscillator crossovers, while using the SPY’s trend (via exponential moving averages) as a broader market filter.
It helps traders stay aligned with macro momentum and avoid counter-trend entries.
🔍 How it works
SPY Trend Filter (Daily Timeframe):
Pulls SPY (S&P 500 ETF) data using EMAs (5, 20, 80)
Categorizes SPY market trend with color codes:
🟢 Green: Strong uptrend (EMA5 > EMA20 > EMA80)
🟡 Yellow: Potential uptrend / early momentum (EMA5 < EMA20 > EMA80)
🔴 Red: Downtrend (EMA5 < EMA20 < EMA80)
🔵 Blue: Possible trend reversal or mixed trend (EMA5 > EMA20 < EMA80)
Buy Signal Conditions (Combined Logic):
A signal is only triggered when:
- SPY trend is either yellow or blue (indicating a neutral-to-bullish or early recovery environment)
-The Stochastic Oscillator's %D line is below 50, showing possible upside
- A bullish MACD crossover occurs on the current symbol
🟢 Green signal: MACD crossover occurs below 0 (early reversal)
🟠 Orange signal: MACD crossover occurs above 0 (momentum continuation)
📈 Visual Output
🟢 Green label below the bar when an early reversal setup occurs
🟠 Orange label above the bar when a trend continuation signal appears
✅ Best Use Case
Ideal for:
Swing traders and position traders
LEAPS (long-term options) traders aligning entries with SPY trend
Anyone seeking clean, contextual entries filtered by market momentum
⚠️ Note: This indicator is most effective when used on fundamentally strong stocks that are sector leaders with solid earnings growth and market presence. Use technical signals as a complement to quality fundamentals.
ℹ️ Clarification: The moving averages displayed on the chart (e.g., on QQQ) are for visual reference only, to help users understand the color logic of the SPY trend filter. The actual logic and signals are based on SPY’s moving averages, regardless of the charted symbol.
BotBeans Optimizer - MA CrosserBotBeans Optimizer - MA Crosser
This script allows you to:
1. Select up to 12 types of Moving Averages (MA)
2. Backtest 7 combinations of MA crossover strategy at a time with key metrics such as Net Profit%, Profit Factor, Win Rate%, Total Trades and Maximum Drowdown (Max DD)
3. Easy to define slow MA length by using SlowMultiplier. Slow MA length is calculated by fast MA length multiplied by SlowMultipleir.
4. Ability to plot MA lines, trading signals, slop loss and take profit levels for clarification
5. Risk Management is implemented. By default, risk only 2% for each trade.
6. The script uses 14 Average True Range (ATR) multiplied by ATRMultiplier to determine stop loss level
7. Take profit level is calculated by stop loss level multiplied by RiskRewardRatio.
8. Implemented with trading fee for more accurate backtest result
DCA马丁格尔网格策略**Core Objective**
To reduce the average cost of holding (DCA) through "doubling down on the dip + grid-based diversified entry," and to take profit when the price rebounds to the target profit level.
**Key Mechanisms**
✅ **Initial Position Setup**
On the first entry, purchase a fixed amount (e.g., $100).
✅ **Martingale Trigger (Doubling Down on the Dip)**
Trigger Condition: The current price falls by X% (e.g., 4%) compared to the last trigger point (or the initial entry price).
Position Addition Method:
Set N grids (e.g., 8 levels) below the trigger point.
Each grid’s purchase amount increases exponentially (e.g., doubling each time).
✅ **Grid Trading (Diversified Buying)**
Grid Spacing: The distance between each grid is Y% (e.g., 0.5%).
Stacked Grids:
If the price crashes through multiple grids (e.g., 8 levels) in a single candlestick, combine the buy orders and execute a single buy at 8 times the amount (instead of buying layer by layer).
✅ **Take Profit Logic**
Target Profit: When the price rebounds to the current average holding cost + X% (e.g., 2%), close all positions.
核心目标
通过“下跌加倍买入 + 网格分散建仓”降低持仓平均成本(DCA),并在反弹至目标利润时统一止盈。
关键机制
✅ 初始建仓
首次入场时,按固定金额(如 $100)买入。
✅ 马丁格尔触发(下跌加倍买入)
触发条件:当前价格比上一次触发点(或初始建仓价)下跌 X%(如 4%)。
加仓方式:
在触发点下方设置 N 个网格(如 8 层)。
每层网格的买入金额按指数增长(如 1 倍递增)。
✅ 网格交易(分散买入)
网格间距:每层网格间隔 Y%(如 0.5%)。
堆叠网格(Stacked Grids):
如果价格单根K线暴跌穿透多个网格(如 8 层),则合并加仓单,一次性买入 8 倍金额(而非逐层买入)。
✅ 止盈逻辑
目标利润:当价格反弹至当前平均持仓成本 + X%(如 2%)时,全部平仓。
MACD_V1New Features:
Golden/Death Crossover Markers
Golden/Death Crossover Alerts
新增功能
1、金叉死叉标识
2、金叉死叉警报
XAUUSD MTF Profit Hack (RR Enhanced)Profit Hack is a high-performance trading tool optimized for XAUUSD on the 5-minute timeframe, built to deliver clear entries, dynamic risk-to-reward visualization, and multi-timeframe trend filtering to eliminate noise and false signals.
💡 Key Features
✅ Smart Entry Logic – Signals are generated after crossover with ATR trailing stop, confirmed by MTF trend direction.
✅ Dynamic SL & TP System – SL is auto-placed below/above swing structure with customizable buffer. TP1, TP2, TP3 calculated at 2x, 3x, and 5x R:R levels.
✅ Trailing Stop (Optional) – Automatically updates SL to lock in profits as price moves in your favor.
✅ Risk-to-Reward Label – Real-time R:R stats for every setup.
✅ EMA 200 & RSI Dashboard – Visual guidance for trend strength and reversal zones.
✅ Multi-Timeframe Trend Filter – Aligns lower timeframe signals with higher timeframe direction (e.g., 1H EMA200).
20 & 50 EMA + ATR, TR & DATRIndicator Name: 20 & 50 EMA + ATR, TR & DATR
This custom indicator combines trend and volatility analysis into a single tool, helping you make smarter trading decisions with fewer indicators on your chart.
---
1. 20 & 50 Exponential Moving Averages (EMAs)
EMA 20 (Blue Line): A short-term trend indicator that reacts quickly to price changes.
EMA 50 (Orange Line): A medium-term trend indicator that smooths out more of the noise.
How to Use:
Bullish signal: EMA 20 crosses above EMA 50
Bearish signal: EMA 20 crosses below EMA 50
Use crossovers or distance between EMAs to confirm trends or potential reversals
---
2. True Range (TR)
Definition: The greatest of the following:
High - Low
High - Previous Close
Previous Close - Low
Use: Shows how much the asset moved during the candle. Useful for understanding raw price movement.
---
3. Average True Range (ATR)
Definition: The average of the True Range over a 14-bar period
Line color: Red (shown in the status line above your chart)
How to Use:
High ATR = High volatility
Low ATR = Low volatility
Use ATR to help determine stop-loss and take-profit levels, or to avoid low-volatility periods
---
4. Daily ATR (DATR)
Definition: ATR calculated from the daily timeframe, regardless of the chart's current timeframe
Line color: Green (also shown in the status line)
How to Use:
Know how much the asset typically moves in a full day
Helps intraday traders set realistic targets or detect when the market is unusually quiet or active
HMG MA ZonesIt provides zones of possible peaks and troughs. It is an indicator that might show up at a possible top or bottom. It could be used as an overbought or oversold signal. Does Not necessarily mean that the price is topping or bottoming, but it could be possible.
All in One Custom IB RangeThis is sure shot winning Indicator. Combining Opening Range, Pvs Day H L M, CPR, EMA , Vwap
OBV by Randy_NewThis indicator plots the On-Balance Volume (OBV) and compares it with a 21-period Exponential Moving Average (EMA).
The difference between OBV and EMA21 is shown as an oscillator:
Red when OBV is above EMA21 (bullish volume)
Green when OBV is below EMA21 (bearish volume)
Use it to spot volume momentum shifts and potential trend reversals.
Visionary Insights (200 EMA on 1H + 20 EMA on 15m)How to use this script?
Open the 15 min chart and u will see the 200 EMA from the 1 hour chart and the 20 EMA of the 15 min chart
Trend Filter (1H Timeframe):
Price must be above the 200 EMA for a bullish setup
Price must be below the 200 EMA for a bearish setup
Entry Conditions (15m Timeframe):
Bullish:
Pullback to 20 EMA (close is near or below EMA 20)
RSI > 50
Bullish engulfing pattern
Bearish:
Pullback to 20 EMA (close is near or above EMA 20)
RSI < 50
Bearish engulfing pattern
SMA JJE CryptoSMA JJE Crypto is a technical indicator that calculates and displays three simple moving averages (SMA 50, SMA 100, and SMA 200) – including color-coded trend direction and a clean trend summary panel at the top right of the chart.
Features:
✅ Dynamic SMA lines (50 / 100 / 200)
✅ Color-coded logic:
🟢 Green = Price above the SMA → Bullish
🔴 Red = Price below the SMA → Bearish
✅ Clean table with trend status for each SMA
✅ Overall trend calculation:
• Shows "Bullish" if 2 out of 3 SMAs are bullish
• Shows "Bearish" if 2 or more SMAs are below price
✅ Optimized for all markets (Crypto, Forex, Stocks)
Usage:
Use this indicator to quickly understand market structure, identify potential long/short zones, and visually confirm trends.
Created by:
JJE / For the TradingView Community 🧠💥
Version: 1.0
Daily EMAThis script displays the Exponential Moving Average (EMA) calculated on the daily timeframe, regardless of the chart's current timeframe. It's designed for intraday traders who want to use the daily EMA as a reference for identifying key support/resistance levels or higher time frame trends.
PG MA Crossover and Direction based Strategy### PG MA Crossover and Direction-Based Strategy: How It Works
The **PG MA Crossover and Direction-Based Strategy** is a versatile trading algorithm designed to capitalize on market trends and momentum using dynamic moving averages (MA). It combines MA crossover signals, trend direction analysis, and customizable exit conditions to execute long and short trades efficiently.
#### Key Features:
1. **Dynamic Moving Average (MA)**:
- The strategy supports multiple types of moving averages: Simple Moving Average (SMA), Exponential Moving Average (EMA), and Volume Weighted Moving Average (VWMA).
- Users can select the type of MA and the calculation basis (e.g., close price, average of OHLC prices).
2. **Color-Coded Trend Detection**:
- The moving average dynamically switches colors:
- **Green** for rising trends, indicating bullish momentum.
- **Red** for declining trends, signaling bearish momentum.
- Trend direction is determined by comparing the MA against a customizable reversal threshold.
3. **Long Trade Logic**:
- Entry Conditions:
- The MA must be green (rising) **or** the price must positively cross above the MA.
- Re-Entry Logic:
- After a long trade exits, re-entry occurs if the price dips below the MA and recovers above it with a positive crossover.
- Exit Conditions:
- Exit when the price exceeds the MA by **2.5%** (customizable).
- Stop-loss triggered if the MA turns red or if the price crosses below the MA.
4. **Short Trade Logic**:
- Entry Conditions:
- The MA must be red (declining) **and** the price must negatively cross below the MA.
- Exit Conditions:
- Exit when the price falls **1.5%** below the MA (customizable).
- Stop-loss triggered if the price crosses back above the MA.
5. **Back-Test Period Customization**:
- The strategy allows users to define a specific range for back-testing using start and end dates.
- Trades are executed only within the selected testing period.
#### Visualization:
- The moving average is plotted on the chart, dynamically changing color to represent market trends and trade signals.
- Buy and sell orders are highlighted, enabling easy tracking of trade performance.
#### Benefits:
- Flexibility: Customizable inputs for MA type, calculation basis, periods, and thresholds.
- Clarity: The strategy visualizes market trends and trading signals using color-coded moving averages.
- Efficiency: Combines trend-following and crossover logic to execute trades at optimal points.