ES/NQ Price Action Sync See when ES & NQ move in syncSee when ES & NQ move in sync — revealing real market momentum at a glance.”
⚖️ ES/NQ Price Action Sync
Discover when the market moves as one.
This indicator tracks when S&P 500 Futures (ES1!) and Nasdaq Futures (NQ1!) align in momentum — helping you spot broad-market confirmation or early divergence in real time.
🧠 Concept
The ES/NQ relationship often reveals the market’s underlying strength or hesitation. When both indices turn bullish or bearish together with meaningful movement, that’s a sign of true market alignment.
When they disagree — expect mixed momentum and possible reversals.
⚙️ Features
✅ Highlights new bullish and bearish syncs on chart
✅ Dynamic info table showing % change and direction for each index
✅ Optional triangle markers for clean visual cues
✅ Alert conditions for new sync events
✅ Adjustable lookback and minimum-move filters
💡 How to Use
Use this as a market-context tool, not a direct buy/sell signal.
When both indices sync, intraday trends often hold better; when they diverge, momentum may fade.
Combine it with your own system or higher-time-frame analysis for confirmation.
📊 Why Traders Love It
Simple idea — powerful insight.
This tool helps traders instantly see when “the market machine” is running in harmony… or pulling in opposite directions.
⚠️ Disclaimer:
This script is for educational and analytical purposes only.
It does not provide financial advice or trading signals. Always perform your own research before making trading decisions.
ابحث في النصوص البرمجية عن "profit"
DIP BUYING by HAZEREAL BUY THE DIP - Educational Price Movement Indicator
This technical indicator is designed for educational purposes to help traders identify potential price reversal opportunities in equity markets, particularly focusing on NASDAQ-100 index tracking instruments and technology sector ETFs.
Key Features:
Monitors price movements relative to recent highs over customizable lookback periods
Identifies two distinct price decline thresholds: standard (5%+) and extreme (12.3%+)
Visual signals with triangular markers and background color zones
Real-time data table showing current metrics and status
Customizable alert system with webhook-ready JSON formatting
Clean overlay design that doesn't obstruct price action
How It Works:
The indicator tracks the highest price within a specified lookback period and calculates the percentage decline from that high. When price drops below the minimum threshold, it generates visual buy signals. The extreme threshold triggers enhanced alerts for more significant market movements.
Best Use Cases:
Educational analysis of market volatility patterns
Identifying potential support levels during market corrections
Studying historical price behavior around significant declines
Risk management and position sizing education
Important Note: This is a technical analysis tool for educational purposes only. All trading decisions should be based on comprehensive analysis and appropriate risk management. Past performance does not guarantee future results.
[ProfitTrailer:Feeder] VWAP %This script will help you create a strategy bases on VWAP % on BaseCoin & Top xx coin settings.
Enjoy & Like and follow if you like this kind of content.
[ProfitTrailer:Feeder] Market Trends Top X / BTCThis script will help you determine your MarketConditions Grouping for PtFeeder. You're able to input the specific top 10/20/xx pairs you want to use to fine-tune your groupings as well as specific BasePairs, there values will be automatically printed on the chart!
When measuring top coins trend, this is how many top coins to check by volume from the exchanges that you have configured PT Feeder for. For, the top 50 coins will be checked and their price change over the MeasureTimes property and the average change calculated. This average is used for the MaxTopCoinAverageChange property
If you like this kind of content, please 'like' and 'follow' and I'll continue publishing these kind of scripts!
Enjoy!
Profitable L 1800 Candle Highlight [Beta]
Certainly! Here's a user guide for the provided Pine Script code:
User Guide: 1800 Candle Highlight Indicator
Overview:
The "1800 Candle Highlight" indicator is designed to visually emphasize the 18:00 (6:00 PM) candle on the chart, providing clarity on its open and close prices, and highlighting its timeframe with a distinctive color.
Key Features:
Candle Highlighting: The indicator identifies the candle that opens at 18:00 and visually distinguishes it from other candles on the chart.
Open and Close Prices: The indicator plots the open and close prices of the 18:00 candle as step lines, making it easy to identify price movements during that timeframe.
Background Color: It colors the background within the 18:00 candle's timeframe with a transparent blue shade, providing further emphasis on that period.
Start Marker: A downward triangle shape marks the start of the 18:00 candle, aiding in identifying the beginning of the highlighted timeframe.
Usage:
Overlay: The indicator is designed to be overlaid on the price chart, allowing users to visualize the highlighted candle alongside price movements.
Interpretation: Traders can observe the open and close prices of the 18:00 candle relative to previous and subsequent candles, aiding in analysis and decision-making.
Timeframe Focus: The highlighted candle's timeframe can serve as a reference point for analyzing price action during specific hours, such as the end of a trading day.
Installation:
Access: Users can access the Pine Script editor within the TradingView platform to create a new indicator.
Copy and Paste: Copy the provided Pine Script code and paste it into the editor.
Save and Apply: Save the indicator and apply it to the desired chart, adjusting settings as needed.
Customization:
Color Scheme: Users can customize the colors used for highlighting, open/close prices, and background to suit their preferences and chart aesthetics.
Styling: Adjustments can be made to line styles, widths, and marker sizes to enhance visibility and clarity.
Compatibility:
The indicator is compatible with TradingView's Pine Script version 5 and can be applied to various financial instruments and timeframes supported by the platform.
Disclaimer:
The "1800 Candle Highlight" indicator is provided for informational purposes only and should not be considered as financial advice. Users are encouraged to conduct thorough analysis and consider multiple factors before making trading decisions.
Profitable Supertrend v0.1 - AlphaThis a script to try detect the best combination of supertrend parameters in a space of time. Sadly the script is slow. Evaluate all possibilities params is hard for a pinescript and my knowledge too. In some cases, when you want evaluate many time could be the script fails for timeout. Perhaps with time I could enhance. For this problem of speed the calculate of combinatios it's not complete: In factor use a increment of 0.2 in each param (0.1, 0.3, 0.5 ...) in period the increment for each value is 3. The range for factor it's from 3.0 to 12.0. The range of period it's from 10 to 43
My knowledge don't let me go more far. Perhaps with time I can enhance the script.
PMax on RSI with Tillson T3Profit Maximizer Indicator on RSI with Tillson T3 Moving Average:
PMax uses ATR calculation inside, for this reason users couldn't manage to use PMax on RSI because RSI indicator doesn't have High and Low values in bars, but ATR needs that values. So I personally calculate RSI in a different way to have High and Low values of RSI wrt price bars.
IMPORTANT:
Because of the sudden movements and divergences on RSI, this indicator must firstly optimized for the charts before using. Optimization can be held by users for the meaningful parameters for each chart.
3 parameters are critical when optimizing:
First: Multiplier
Second: Tillson T3 Length
Third: T3 Volume Factor
Here are some information about Profit Maximizer:
PMax Indicator:
PMax Screener and Strategy:
PMax Explorer STRATEGY & SCREENERProfit Maximizer - PMax Explorer STRATEGY & SCREENER screens the BUY and SELL signals (trend reversals) for 20 user defined different tickers in Tradingview charts.
Simply input the name of the ticker in Tradingview that you want to screen.
Terminology explanation:
Confirmed Reversal: PMax reversal that happened in the last bar and cannot be repainted.
Potential Reversal: PMax reversal that might happen in the current bar but can also not happen depending upon the timeframe closing price.
Downtrend: Tickers that are currently in the sell zone
Uptrend: Tickers that are currently in the buy zone
Screener has also got a built in PMax indicator which users can confirm the reversals on graphs.
Screener explores the 20 tickers in current graph's time frame and also in desired parameters of the SuperTrend indicator.
Also you can optimize the parameters manually with the built in STRATEGY version.
PMax indicator :
Profit Maximizer - PMax is a brand new indicator developed by me.
It's a combination of two trailing stop loss indicators;
One is Anıl Özekşi's MOST (Moving Stop Loss) Indicator
and the other one is well known ATR based SuperTrend
Profit Maximizer - PMax tries to solve this problem. PMax combines the powerful sides of MOST (Moving Average Trend Changer) and SuperTrend (ATR price detection) in one indicator.
Backtest and optimization results of PMax are far better when compared to its ancestors MOST and SuperTrend. It reduces the number of false signals in sideways and give more reliable trade signals.
PMax is easy to determine the trend and can be used in any type of markets and instruments. It does not repaint.
The first parameter in the PMax indicator set by the three parameters is the period/length of ATR.
The second Parameter is the Multiplier of ATR which would be useful to set the value of distance from the built in Moving Average.
I personally think the most important parameter is the Moving Average Length and type.
PMax will be much sensitive to trend movements if Moving Average Length is smaller. And vice versa, will be less sensitive when it is longer.
As the period increases it will become less sensitive to little trends and price actions.
In this way, your choice of period, will be closely related to which of the sort of trends you are interested in.
We are under the effect of the uptrend in cases where the Moving Average is above PMax;
conversely under the influence of a downward trend, when the Moving Average is below PMax.
Built in Moving Average type defaultly set as EMA but users can choose from 8 different Moving Average types like:
SMA : Simple Moving Average
EMA : Exponential Movin Average
WMA : Weighted Moving Average
TMA : Triangular Moving Average
VAR : Variable Index Dynamic Moving Average aka VIDYA
WWMA : Welles Wilder's Moving Average
ZLEMA : Zero Lag Exponential Moving Average
TSF : True Strength Force
Tip: In sideways VAR would be a good choice
You can use PMax default alarms and Buy Sell signals like:
1-
BUY when Moving Average crosses above PMax
SELL when Moving Average crosses under PMax
2-
BUY when prices jumps over PMax line.
SELL when prices go under PMax line.
McGinley Dynamic debugged🔍 McGinley Dynamic Debugged (Adaptive Moving Average)
This indicator plots the McGinley Dynamic, a mathematically adaptive moving average designed to reduce lag and better track price action during both trends and consolidations.
✅ Key Features:
Adaptive smoothing: The McGinley Dynamic adjusts itself based on the speed of price changes.
Lag reduction: Compared to traditional moving averages like EMA or SMA, McGinley provides smoother yet responsive tracking.
Stability fix: This version includes a robust fix for rare recursive calculation issues, particularly on low-priced historical assets (e.g., Wipro pre-2000).
⚙️ What’s Different in This Debugged Version?
Implements manual clamping on the source / previous value ratio to prevent mathematical spikes that could cause flattening or distortion in the plotted line.
Ensures more stable behavior across all instruments and timeframes, especially those with historically low price points or volatile early data.
💡 Use Case:
Ideal for:
Trend confirmation
Entry filtering
Adaptive support/resistance visualization
Improving signal precision in low-volatility or high-noise environments
⚠️ Notes:
Works best when combined with volume filters or other trend indicators for validation.
This version is optimized for visual use—for signal generation, consider pairing it with additional logic or thresholds.
PROFIT INDICATORFirst let me tell you which indicators have been used in this script so that you have the confidence while taking the trade:
(a) Bollinger Band with 20 SMA Inside it - Currently it is off, you can turn it on from settings.
(b) HMA 33, I have added the option of using two HMA's simultaneously. You can use HMA, EMA, SMA as per your settings and it would be color trending.
(c) VWAP- you can turn it on from settings
(d) CPR- you can turn it on from settings
(e) EMA's 20, 50, 200. Currently off, you can turn it on from settings.
(d) SMA's 50 and 200. Currently off, yu can turn it on from settings, if you want to use 20 SMA you can use bollinger band basis that is 20 period SMA.
(f) Trend bar at bottom on the basis of 50 EMA.
(g) Half Trend
(h) Trend strength Detector
(d) EMA 50 high and low to show the pac channel. I am not using this however as per request I have added this. Currently, it is trun on and you can turn it off from settings.
(f) Auto Fib levels
Please use a stick note for few days and mention imp notes before taking trade to check if all the conditions are matching to take the trade.
Buy Condition:-
1. Bolling band should be widely open.
2. Check the support and resistance from CPR. Candle should close above support in green.
3. Check the trend bar at bottom, it should be green, if it is grey in colour dont enter in trade.
4. Candle should be closing above EMA 50 and its upto you if you need additional confirmation, you can use EMA 20, 50, 200 and SMA 50 and 200, this is optional.
5. You can use VWAP as support or resistance and you can turn it on from settings.
6. Trending HMA of 33 should be in green for buy.
7. Half trend Indicator should give buy signal.
8. Trend Strength Indicator for checking the strength of the trend, if the arrow is big upside, you can go for buy.
9. Exit from buy trade when it start showing very small arrow which means trend is about to change.
10.Exit buy trade at 61.8 Fib level
Sell Condition:-
1. Bolling band should be widely open.
2. Check the support and resistance from CPR. Candle should close below resistance in red.
3. Check the trend bar at bottom, it should be red, if it is grey in colour dont enter in trade.
4. Candle should be closing below EMA 50 and its upto you if you need additional confirmation, you can use EMA 20, 50, 200 and SMA 50 and 200, this is optional.
5. You can use VWAP as support or resistance and you can turn it on from settings.
6. Trending HMA of 33 should be in red for sell.
7. Half trend Indicator should give sell signal.
8. Trend Strength Indicator for checking the strength of the trend, if the arrow is big downside, you can go for sell.
9. Exit from sell trade when down arrows start showing very small in size which means trend is about to change.
10.Exit sell trade at 61.8 Fib level
PMax on Rsi w/T3 *Strategy*Profit Maximizer Indicator on RSI with Tillson T3 Moving Average:
PMax uses ATR calculation inside, for this reason users couldn't manage to use PMax on RSI because RSI indicator doesn't have High and Low values in bars, but ATR needs that values. So I personally calculate RSI in a different way to have High and Low values of RSI wrt price bars.
IMPORTANT:
Because of the sudden movements and divergences on RSI , this indicator must firstly optimized for the charts before using. Optimization can be held by users for the meaningful parameters for each chart.
3 parameters are critical when optimizing:
First: Multiplier
Second: Tillson T3 Length
Third: T3 Volume Factor
Says, Kıvanç Özbilgiç. Here's the strategy version for you to backtest & optimize properly.
Enjoy.
$EURUSD 1 Minute Chart StrategyYou must be using the renko chart with traditional settings with the block size set at .0001. This can be done by going to settings. Style at the bottom should be changed from ATR to traditional. The set the block size as .0001.
Profit target areaUpdate.
- you can specify count of bars used to detect reversal pattern
- you can specify count of bars used to determine lowest or highest price to place support or resistance
- area between lines is filled by green - ascending, red - descending trend
To trade:
- open position using stop command on S/R
- close position using limit command on retracement line
- close position when background colour indicates trend change
(erratum: last balloon on right should say "buy limit")
VV Moving Average Convergence Divergence # VMACDv3 - Volume-Weighted MACD with A/D Divergence Detection
## Overview
**VMACDv3** (Volume-Weighted Moving Average Convergence Divergence Version 3) is a momentum indicator that applies volume-weighting to traditional MACD calculations on price, while using the Accumulation/Distribution (A/D) line for divergence detection. This hybrid approach combines volume-weighted price momentum with volume distribution analysis for comprehensive market insight.
## Key Features
- **Volume-Weighted Price MACD**: Traditional MACD calculation on price but weighted by volume for earlier signals
- **A/D Divergence Detection**: Identifies when A/D trend diverges from MACD momentum
- **Volume Strength Filtering**: Distinguishes high-volume confirmations from low-volume noise
- **Color-Coded Histogram**: 4-color system showing momentum direction and volume strength
- **Real-Time Alerts**: Background colors and alert conditions for bullish/bearish divergences
## Difference from ACCDv3
| Aspect | VMACDv3 | ACCDv3 |
|--------|---------|---------|
| **MACD Input** | **Price (Close)** | **A/D Line** |
| **Volume Weighting** | Applied to price | Applied to A/D line |
| **Primary Signal** | Volume-weighted price momentum | Volume distribution momentum |
| **Use Case** | Price momentum with volume confirmation | Volume flow and accumulation/distribution |
| **Sensitivity** | More responsive to price changes | More responsive to volume patterns |
| **Best For** | Trend following, breakouts | Volume analysis, smart money tracking |
**Key Insight**: VMACDv3 shows *where price is going* with volume weight, while ACCDv3 shows *where volume is accumulating/distributing*.
## Components
### 1. Volume-Weighted MACD on Price
Unlike standard MACD that uses simple price EMAs, VMACDv3 weights each price by its corresponding volume:
```
Fast Line = EMA(Price × Volume, 12) / EMA(Volume, 12)
Slow Line = EMA(Price × Volume, 26) / EMA(Volume, 26)
MACD = Fast Line - Slow Line
```
**Benefits of Volume Weighting**:
- High-volume price movements have greater impact
- Filters out low-volume noise and false moves
- Provides earlier trend change signals
- Better reflects institutional activity
### 2. Accumulation/Distribution (A/D) Line
Used for divergence detection, measuring buying/selling pressure:
```
A/D = Σ ((2 × Close - Low - High) / (High - Low)) × Volume
```
- **Rising A/D**: Accumulation (buying pressure)
- **Falling A/D**: Distribution (selling pressure)
- **Doji Handling**: When High = Low, contribution is zero
### 3. Signal Lines
- **MACD Line** (Blue, #2962FF): The fast-slow difference showing momentum
- **Signal Line** (Orange, #FF6D00): EMA or SMA smoothing of MACD
- **Zero Line**: Reference for bullish (above) vs bearish (below) bias
### 4. Histogram Color System
The histogram uses 4 distinct colors based on **direction** and **volume strength**:
| Condition | Color | Meaning |
|-----------|-------|---------|
| Rising + High Volume | **Dark Green** (#1B5E20) | Strong bullish momentum with volume confirmation |
| Rising + Low Volume | **Light Teal** (#26A69A) | Bullish momentum but weak volume (less reliable) |
| Falling + High Volume | **Dark Red** (#B71C1C) | Strong bearish momentum with volume confirmation |
| Falling + Low Volume | **Light Pink** (#FFCDD2) | Bearish momentum but weak volume (less reliable) |
Additional shading:
- **Light Cyan** (#B2DFDB): Positive but not rising (momentum stalling)
- **Bright Red** (#FF5252): Negative and accelerating down
### 5. Divergence Detection
VMACDv3 compares A/D trend against volume-weighted price MACD:
#### Bullish Divergence (Green Background)
- **Condition**: A/D is trending up BUT MACD is negative and trending down
- **Interpretation**: Volume is accumulating while price momentum appears weak
- **Signal**: Smart money accumulation, potential bullish reversal
- **Action**: Look for long entries, especially at support levels
#### Bearish Divergence (Red Background)
- **Condition**: A/D is trending down BUT MACD is positive and trending up
- **Interpretation**: Volume is distributing while price momentum appears strong
- **Signal**: Smart money distribution, potential bearish reversal
- **Action**: Consider exits, avoid new longs, watch for breakdown
## Parameters
| Parameter | Default | Range | Description |
|-----------|---------|-------|-------------|
| **Source** | Close | OHLC/HLC3/etc | Price source for MACD calculation |
| **Fast Length** | 12 | 1-50 | Period for fast EMA (shorter = more sensitive) |
| **Slow Length** | 26 | 1-100 | Period for slow EMA (longer = smoother) |
| **Signal Smoothing** | 9 | 1-50 | Period for signal line (MACD smoothing) |
| **Signal Line MA Type** | EMA | SMA/EMA | Moving average type for signal calculation |
| **Volume MA Length** | 20 | 5-100 | Period for volume average (strength filter) |
## Usage Guide
### Reading the Indicator
1. **MACD Lines (Blue & Orange)**
- **Blue Line (MACD)**: Volume-weighted price momentum
- **Orange Line (Signal)**: Smoothed trend of MACD
- **Crossovers**: Blue crosses above orange = bullish, below = bearish
- **Distance**: Wider gap = stronger momentum
- **Zero Line Position**: Above = bullish bias, below = bearish bias
2. **Histogram Colors**
- **Dark Green (#1B5E20)**: Strong bullish move with high volume - **most reliable buy signal**
- **Light Teal (#26A69A)**: Bullish but low volume - wait for confirmation
- **Dark Red (#B71C1C)**: Strong bearish move with high volume - **most reliable sell signal**
- **Light Pink (#FFCDD2)**: Bearish but low volume - may be temporary dip
3. **Background Divergence Alerts**
- **Green Background**: A/D accumulating while price weak - potential bottom
- **Red Background**: A/D distributing while price strong - potential top
- Most powerful at key support/resistance levels
### Trading Strategies
#### Strategy 1: Volume-Confirmed Trend Following
1. Wait for MACD to cross above zero line
2. Look for **dark green** histogram bars (high volume confirmation)
3. Enter long on second consecutive dark green bar
4. Hold while histogram remains green
5. Exit when histogram turns light green or red appears
6. Set stop below recent swing low
**Example**:
```
Price: 26,400 → 26,450 (rising)
MACD: -50 → +20 (crosses zero)
Histogram: Light teal → Dark green → Dark green
Volume: 50k → 75k → 90k (increasing)
```
#### Strategy 2: Divergence Reversal Trading
1. Identify divergence background (green = bullish, red = bearish)
2. Confirm with price structure (support/resistance, chart patterns)
3. Wait for MACD to cross signal line in divergence direction
4. Enter on first **dark colored** histogram bar after divergence
5. Set stop beyond divergence area
6. Target previous swing high/low
**Example - Bullish Divergence**:
```
Price: Making lower lows (26,350 → 26,300 → 26,250)
A/D: Rising (accumulation)
MACD: Below zero but starting to curve up
Background: Green shading appears
Entry: MACD crosses signal line + dark green bar
Stop: Below 26,230
Target: 26,450 (previous high)
```
#### Strategy 3: Momentum Scalping
1. Trade only in direction of MACD zero line (above = long, below = short)
2. Enter on dark colored bars only
3. Exit on first light colored bar or opposite color
4. Quick in and out (1-5 minute holds)
5. Tight stops (0.2-0.5% depending on instrument)
#### Strategy 4: Histogram Pattern Trading
**V-Bottom Reversal (Bullish)**:
- Red histogram bars start rising (becoming less negative)
- Forms "V" shape at the bottom
- Transitions to light red → light teal → **dark green**
- Entry: First dark green bar
- Signal: Momentum reversal with volume
**Λ-Top Reversal (Bearish)**:
- Green histogram bars start falling (becoming less positive)
- Forms inverted "V" at the top
- Transitions to light green → light pink → **dark red**
- Entry: First dark red bar
- Signal: Momentum exhaustion with volume
### Multi-Timeframe Analysis
**Recommended Approach**:
1. **Higher Timeframe (15m/1h)**: Identify overall trend direction
2. **Trading Timeframe (5m)**: Time entries using VMACDv3 signals
3. **Lower Timeframe (1m)**: Fine-tune entry prices
**Example Setup**:
```
15-minute: MACD above zero (bullish bias)
5-minute: Dark green histogram appears after pullback
1-minute: Enter on break of recent high with volume
```
### Volume Strength Interpretation
The volume filter compares current volume to 20-period average:
- **Volume > Average**: Dark colors (green/red) - high confidence signals
- **Volume < Average**: Light colors (teal/pink) - lower confidence signals
**Trading Rules**:
- ✓ **Aggressive**: Take all dark colored signals
- ✓ **Conservative**: Only take dark colors that follow 2+ light colors of same type
- ✗ **Avoid**: Trading light colored signals during high volatility
- ✗ **Avoid**: Ignoring volume context during news events
## Technical Details
### Volume-Weighted Calculation
```pine
// Volume-weighted fast EMA
fast_ma = ta.ema(src * volume, fast_length) / ta.ema(volume, fast_length)
// Volume-weighted slow EMA
slow_ma = ta.ema(src * volume, slow_length) / ta.ema(volume, slow_length)
// MACD is the difference
macd = fast_ma - slow_ma
// Signal line smoothing
signal = ta.ema(macd, signal_length) // or ta.sma() if SMA selected
// Histogram
hist = macd - signal
```
### Divergence Detection Logic
```pine
// A/D trending up if above its 5-period SMA
ad_trend = ad > ta.sma(ad, 5)
// MACD trending up if above zero
macd_trend = macd > 0
// Divergence when trends oppose each other
divergence = ad_trend != macd_trend
// Specific conditions for alerts
bullish_divergence = ad_trend and not macd_trend and macd < 0
bearish_divergence = not ad_trend and macd_trend and macd > 0
```
### Histogram Coloring Logic
```pine
hist_color = (hist >= 0
? (hist < hist
? (vol_strength ? #1B5E20 : #26A69A) // Rising: dark/light green
: #B2DFDB) // Positive but falling: cyan
: (hist < hist
? (vol_strength ? #B71C1C : #FFCDD2) // Rising (less negative): dark/light red
: #FF5252)) // Falling more: bright red
```
## Alerts
Built-in alert conditions for divergence detection:
### Bullish Divergence Alert
- **Trigger**: A/D trending up, MACD negative and trending down
- **Message**: "Bullish Divergence: A/D trending up but MACD trending down"
- **Use Case**: Potential reversal or continuation after pullback
- **Action**: Look for long entry setups
### Bearish Divergence Alert
- **Trigger**: A/D trending down, MACD positive and trending up
- **Message**: "Bearish Divergence: A/D trending down but MACD trending up"
- **Use Case**: Potential top or trend reversal
- **Action**: Consider exits or short entries
### Setting Up Alerts
1. Click "Create Alert" in TradingView
2. Condition: Select "VMACDv3"
3. Choose alert type: "Bullish Divergence" or "Bearish Divergence"
4. Configure: Email, SMS, webhook, or popup
5. Set frequency: "Once Per Bar Close" recommended
## Comparison Tables
### VMACDv3 vs Standard MACD
| Feature | Standard MACD | VMACDv3 |
|---------|---------------|---------|
| **Price Weighting** | Equal weight all bars | Volume-weighted |
| **Sensitivity** | Fixed | Adaptive to volume |
| **False Signals** | More during low volume | Fewer (volume filter) |
| **Divergence** | Price vs MACD | A/D vs MACD |
| **Volume Analysis** | None | Built-in |
| **Color System** | 2 colors | 4+ colors |
| **Best For** | Simple trend following | Volume-confirmed trading |
### VMACDv3 vs ACCDv3
| Aspect | VMACDv3 | ACCDv3 |
|--------|---------|--------|
| **Focus** | Price momentum | Volume distribution |
| **Reactivity** | Faster to price moves | Faster to volume shifts |
| **Best Markets** | Trending, breakouts | Accumulation/distribution phases |
| **Signal Type** | Where price + volume going | Where smart money positioning |
| **Divergence Meaning** | Volume vs price disagreement | A/D vs momentum disagreement |
| **Use Together?** | ✓ Yes, complementary | ✓ Yes, different perspectives |
## Example Trading Scenarios
### Scenario 1: Strong Bullish Breakout
```
Time: 9:30 AM (market open)
Price: Breaks above 26,400 resistance
MACD: Crosses above zero line
Histogram: Dark green bars (#1B5E20)
Volume: 2x average (150k vs 75k avg)
A/D: Rising (no divergence)
Action: Enter long at 26,405
Stop: 26,380 (below breakout)
Target 1: 26,450 (risk:reward 1:2)
Target 2: 26,500 (risk:reward 1:4)
Result: High probability setup with volume confirmation
```
### Scenario 2: False Breakout (Avoided)
```
Time: 2:30 PM (slow period)
Price: Breaks above 26,400 resistance
MACD: Slightly positive
Histogram: Light teal bars (#26A69A)
Volume: 0.5x average (40k vs 75k avg)
A/D: Flat/declining
Action: Avoid trade
Reason: Low volume, no conviction, potential false breakout
Outcome: Price reverses back below 26,400 within 10 minutes
Saved: Avoided losing trade due to volume filter
```
### Scenario 3: Bullish Divergence Bottom
```
Time: 11:00 AM
Price: Making lower lows (26,350 → 26,300 → 26,280)
MACD: Below zero but curving upward
Histogram: Red bars getting shorter (V-bottom forming)
Background: Green shading (divergence alert)
A/D: Rising despite price falling
Volume: Increasing on down bars
Setup:
1. Divergence appears at 26,280 (green background)
2. Wait for MACD to cross signal line
3. First dark green bar appears at 26,290
4. Enter long: 26,295 (next bar open)
5. Stop: 26,265 (below divergence low)
6. Target: 26,350 (previous swing high)
Result: +55 points (30 point risk, 1.8:1 reward)
Key: Divergence + volume confirmation = high probability reversal
```
### Scenario 4: Bearish Divergence Top
```
Time: 1:45 PM
Price: Making higher highs (26,500 → 26,520 → 26,540)
MACD: Positive but flattening
Histogram: Green bars getting shorter (Λ-top forming)
Background: Red shading (bearish divergence)
A/D: Declining despite rising price
Volume: Decreasing on up bars
Setup:
1. Bearish divergence at 26,540 (red background)
2. MACD crosses below signal line
3. First dark red bar appears at 26,535
4. Enter short: 26,530
5. Stop: 26,555 (above divergence high)
6. Target: 26,475 (support level)
Result: +55 points (25 point risk, 2.2:1 reward)
Key: Distribution while price rising = smart money exiting
```
### Scenario 5: V-Bottom Reversal
```
Downtrend in progress
MACD: Deep below zero (-150)
Histogram: Series of dark red bars
Pattern Development:
Bar 1: Dark red, hist = -80, falling
Bar 2: Dark red, hist = -95, falling
Bar 3: Dark red, hist = -100, falling (extreme)
Bar 4: Light pink, hist = -98, rising!
Bar 5: Light pink, hist = -90, rising
Bar 6: Light teal, hist = -75, rising (crosses to positive momentum)
Bar 7: Dark green, hist = -55, rising + volume
Action: Enter long on Bar 7
Reason: V-bottom confirmed with volume
Stop: Below Bar 3 low
Target: Zero line on histogram (mean reversion)
```
## Best Practices
### Entry Rules
✓ **Wait for dark colors**: High-volume confirmation is key
✓ **Confirm divergences**: Use with price support/resistance
✓ **Trade with zero line**: Long above, short below for best odds
✓ **Multiple timeframes**: Align 1m, 5m, 15m signals
✓ **Watch for patterns**: V-bottoms and Λ-tops are reliable
### Exit Rules
✓ **Partial profits**: Take 50% at first target
✓ **Trail stops**: Use histogram color changes
✓ **Respect signals**: Exit on opposite dark color
✓ **Time stops**: Close positions before major news
✓ **End of day**: Square up before close
### Avoid
✗ **Don't chase light colors**: Low volume = low confidence
✗ **Don't ignore divergence**: Early warning system
✗ **Don't overtrade**: Wait for clear setups
✗ **Don't fight the trend**: Zero line dictates bias
✗ **Don't skip stops**: Always use risk management
## Risk Management
### Position Sizing
- **Dark green/red signals**: 1-2% account risk
- **Light signals**: 0.5% account risk or skip
- **Divergence plays**: 1% account risk (higher uncertainty)
- **Multiple confirmations**: Up to 2% account risk
### Stop Loss Placement
- **Trend trades**: Below/above recent swing (20-30 points typical)
- **Breakout trades**: Below/above breakout level (15-25 points)
- **Divergence trades**: Beyond divergence extreme (25-40 points)
- **Scalp trades**: Tight stops at 10-15 points
### Profit Targets
- **Minimum**: 1.5:1 reward to risk ratio
- **Scalps**: 15-25 points (quick in/out)
- **Swing**: 50-100 points (hold through pullbacks)
- **Runners**: Trail with histogram color changes
## Timeframe Recommendations
| Timeframe | Trading Style | Typical Hold | Advantages | Challenges |
|-----------|---------------|--------------|------------|------------|
| **1-minute** | Scalping | 1-5 minutes | Fast profits, many setups | Noisy, high false signals |
| **5-minute** | Intraday | 15-60 minutes | Balance of speed/clarity | Still requires quick decisions |
| **15-minute** | Swing | 1-4 hours | Clearer trends, less noise | Fewer opportunities |
| **1-hour** | Position | 4-24 hours | Strong signals, less monitoring | Wider stops required |
**Recommendation**: Start with 5-minute for best balance of signal quality and opportunity frequency.
## Combining with Other Indicators
### VMACDv3 + ACCDv3
- **Use**: Confirm volume flow with price momentum
- **Signal**: Both showing dark green = highest conviction long
- **Divergence**: VMACDv3 bullish + ACCDv3 bearish = examine price action
### VMACDv3 + RSI
- **Use**: Overbought/oversold with momentum confirmation
- **Signal**: RSI < 30 + dark green VMACD = strong reversal
- **Caution**: RSI > 70 + light green VMACD = potential false breakout
### VMACDv3 + Elder Impulse
- **Use**: Bar coloring + histogram confirmation
- **Signal**: Green Elder bars + dark green VMACD = aligned momentum
- **Exit**: Blue Elder bars + light colors = momentum stalling
## Limitations
- **Requires volume data**: Will not work on instruments without volume feed
- **Lagging indicator**: MACD inherently follows price (2-3 bar delay)
- **Consolidation noise**: Generates false signals in tight ranges
- **Gap handling**: Large gaps can distort volume-weighted values
- **Not standalone**: Should combine with price action and support/resistance
## Troubleshooting
**Problem**: Too many light colored signals
**Solution**: Increase Volume MA Length to 30-40 for stricter filtering
**Problem**: Missing entries due to waiting for dark colors
**Solution**: Lower Volume MA Length to 10-15 for more signals (accept lower quality)
**Problem**: Divergences not appearing
**Solution**: Verify volume data available; check if A/D line is calculating
**Problem**: Histogram colors not changing
**Solution**: Ensure real-time data feed; refresh indicator
## Version History
- **v3**: Removed traditional MACD, using volume-weighted MACD on price with A/D divergence
- **v2**: Added A/D divergence detection, volume strength filtering, enhanced histogram colors
- **v1**: Basic volume-weighted MACD on price
## Related Indicators
**Companion Tools**:
- **ACCDv3**: Volume-weighted MACD on A/D line (distribution focus)
- **RSIv2**: RSI with A/D divergence detection
- **DMI**: Directional Movement Index with A/D divergence
- **Elder Impulse**: Bar coloring system using volume-weighted MACD
**Use Together**: VMACDv3 (momentum) + ACCDv3 (distribution) + Elder Impulse (bar colors) = complete volume-based trading system
---
*This indicator is for educational purposes. Past performance does not guarantee future results. Always practice proper risk management and never risk more than you can afford to lose.*
Trend Strength Meter [Eˣ]📊 Trend Strength Meter - Free Indicator
Overview
The Trend Strength Meter quantifies market momentum with a simple 0-100 score. No more guessing if a trend is strong or weak - this indicator gives you an objective, numerical measurement of trend strength that combines trend direction, momentum, volatility, and moving average alignment into one clear reading.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 What This Indicator Does
Quantifies Trend Strength:
• Measures trend on a scale from -100 (extreme bearish) to +100 (extreme bullish)
• Combines 4 key components: Trend Direction, Momentum, Volatility, MA Alignment
• Provides objective measurement instead of subjective interpretation
• Works on all timeframes and instruments
Visual Display:
• Green Histogram Bars = Bullish strength (0 to +100)
• Red Histogram Bars = Bearish strength (0 to -100)
• Smooth Overlay Line = Trend direction (filters noise)
• Triangle Markers = Trend reversals (zero-line crosses)
• Background Zones = Visual strength categories
Multi-Timeframe Analysis:
• See strength readings from 3 timeframes simultaneously
• Identify when trends align across multiple timeframes
• "ALIGNED" indicator shows when all timeframes agree
• Spot divergences between timeframes
Clean & Professional:
• Minimal clutter, maximum clarity
• Compact info panel in top-right corner
• No overwhelming indicators or text
• Easy to read at a glance
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 Understanding The Strength Scale
Bullish Readings (0 to +100)
+75 to +100 - VERY STRONG BULL
• Extremely powerful uptrend
• All components aligned bullishly
• Best time for aggressive long positions
• Trend likely to continue
• Strategy: Hold longs, avoid shorts
+50 to +75 - STRONG BULL
• Strong uptrend with good momentum
• High probability of continuation
• Quality long setups
• Pullbacks are buying opportunities
• Strategy: Enter longs on dips
+25 to +50 - BULL
• Moderate bullish trend
• Decent upward momentum
• Trend following longs work
• Watch for weakening signals
• Strategy: Ride the trend, trail stops
+10 to +25 - WEAK BULL
• Weak bullish bias
• Trend may be exhausting
• Lower probability setups
• Consider taking profits
• Strategy: Caution, reduce position sizes
-10 to +10 - NEUTRAL
• No clear trend
• Choppy, range-bound market
• Conflicting signals
• Low probability for trend trades
• Strategy: Stay flat or trade ranges
Bearish Readings (0 to -100)
-10 to -25 - WEAK BEAR
• Weak bearish bias
• Trend may be exhausting
• Lower probability setups
• Consider taking profits on shorts
• Strategy: Caution, reduce position sizes
-25 to -50 - BEAR
• Moderate bearish trend
• Decent downward momentum
• Trend following shorts work
• Watch for weakening signals
• Strategy: Ride the trend down, trail stops
-50 to -75 - STRONG BEAR
• Strong downtrend with momentum
• High probability of continuation
• Quality short setups
• Bounces are selling opportunities
• Strategy: Enter shorts on rallies
-75 to -100 - VERY STRONG BEAR
• Extremely powerful downtrend
• All components aligned bearishly
• Best time for aggressive short positions
• Trend likely to continue
• Strategy: Hold shorts, avoid longs
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 How To Use This Indicator
Basic Usage
1. Check Current Strength
• Look at the histogram height and color
• Read the exact number in the info panel
• Note the status label (STRONG BULL, WEAK BEAR, etc.)
• Higher absolute value = stronger trend
2. Watch For Reversals
• Triangle markers appear when strength crosses zero
• 🟢 Green triangle up = Bullish reversal signal
• 🔴 Red triangle down = Bearish reversal signal
• These mark potential trend changes
3. Monitor Multi-Timeframe Alignment
• Check if all timeframes show same direction
• "✓ ALIGNED" = All timeframes agree (high confidence)
• "✗ Mixed" = Timeframes disagree (lower confidence)
• Aligned trends have higher probability
4. Observe Strength Changes
• Rising strength = Trend strengthening
• Falling strength = Trend weakening
• Strength near extremes (+75/-75) = Potential exhaustion
• Strength near zero = Indecision/consolidation
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💡 Trading Strategies
Strategy 1: Trend Following
Best For: Capturing major moves
Timeframes: 1H, 4H, Daily
Rules:
1. Wait for strength to reach +50 or higher (or -50 or lower)
2. Check MTF alignment - all timeframes should agree
3. Enter on pullbacks in the direction of strength
4. Hold position while strength remains above +25 (or below -25)
5. Exit when strength crosses back to weak zone or reverses
Example - Long Setup:
• Strength crosses above +50 = Strong bull trend
• All MTF readings positive and aligned
• Wait for minor pullback to support
• Enter long with stop below recent swing low
• Hold while strength stays above +25
• Exit if strength drops below +10 or reverses to negative
Strategy 2: Reversal Trading
Best For: Catching trend changes early
Timeframes: 15min, 1H, 4H
Rules:
1. Watch for strength to reach extreme levels (+75 or -75)
2. Look for divergence (price new high/low but strength declining)
3. Wait for zero-line cross (triangle marker appears)
4. Enter in direction of new trend
5. Use tight stops since you're catching early
Example - Bullish Reversal:
• Strength at -80 (very strong bear)
• Price makes new low but strength only at -70 = Divergence
• Green triangle appears = Zero-line cross
• Enter long on confirmation
• Stop below recent swing low
• Target: Strength reaching +50
Strategy 3: Avoid Bad Trades
Best For: Improving win rate
Timeframes: All
Rules:
• DON'T trade when strength is between -10 and +10 (neutral zone)
• DON'T go long when strength is negative
• DON'T go short when strength is positive
• DON'T trade against MTF alignment
• DO wait for clear strength readings
Why It Works: Most losses come from trading in choppy markets or against the trend
Strategy 4: Position Sizing Based On Strength
Best For: Risk management
Timeframes: All
Rules:
• Strength +75 to +100 or -75 to -100 = Full position size (2-3% risk)
• Strength +50 to +75 or -50 to -75 = Normal position (1.5-2% risk)
• Strength +25 to +50 or -25 to -50 = Reduced position (1% risk)
• Strength -10 to +10 = No trades or minimal size (0.5% risk)
Why It Works: Bigger positions in stronger trends, smaller in weak trends
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙️ Settings Explained
Multi-Timeframe Analysis
• Toggle ON/OFF the MTF readings in the info panel
• Turn OFF for cleaner display if you only trade one timeframe
Timeframe 1, 2, 3 (Default: 15min, 1H, 4H)
• Choose which timeframes to analyze
• For day trading: Use 5min, 15min, 1H
• For swing trading: Use 1H, 4H, Daily
• For position trading: Use 4H, Daily, Weekly
• Higher timeframes show bigger picture trends
MA Length (Default: 20)
• Moving average period for trend direction component
• Lower values (10-15): More responsive, more signals
• Higher values (25-50): Smoother, fewer signals
• Recommended: 20 for most styles
ATR Length (Default: 14)
• Period for measuring volatility
• Standard setting works well for most markets
• Recommended: Keep at 14
RSI Length (Default: 14)
• Period for momentum measurement
• Standard setting works well for most markets
• Recommended: Keep at 14
Show Trend Labels on Chart
• Toggle ON to display "BULL" / "BEAR" text at reversals
• Keep OFF for cleaner chart (default)
• Useful when backtesting to see historical signals
Show Reversal Signals
• Toggle triangle markers at zero-line crosses
• Keep ON to catch trend changes
• Turn OFF if you only care about current strength
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎓 How The Calculation Works
The indicator measures 4 components, each worth 25 points (total = 100):
1. Trend Direction (25 points)
• Compares price to moving average
• Checks if MA is rising or falling
• Perfect score: Price above rising MA
• Minimum score: Price below falling MA
2. Momentum (25 points)
• Uses RSI to measure momentum strength
• RSI > 70 = Maximum bullish points
• RSI < 30 = Maximum bearish points
• RSI near 50 = Neutral points
3. Volatility Alignment (25 points)
• Checks if price moves align with volatility
• Strong moves in trending direction = High score
• Weak moves or counter-trend = Low score
• Uses ATR to measure volatility
4. Moving Average Alignment (25 points)
• Checks EMA 8, 21, and 55 positioning
• Perfect bullish: 8 > 21 > 55 above price
• Perfect bearish: 8 < 21 < 55 below price
• Misaligned = Reduced score
Final Score = Sum of all 4 components (-100 to +100)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📱 Info Panel Guide
Current
• Shows exact strength number for current timeframe
• Color-coded background (green = bullish, red = bearish)
• Larger number for quick visibility
Status
• Text description of current trend state
• Examples: "STRONG BULL", "WEAK BEAR", "NEUTRAL"
• Quick interpretation without looking at number
Timeframe Readings
• Shows strength for each selected timeframe
• Color-coded for quick reading
• Compare to spot divergences
MTF Alignment
• ✓ ALIGNED = All timeframes show same direction (high confidence)
• ✗ Mixed = Timeframes disagree (proceed with caution)
• Most reliable trades happen when aligned
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📱 Alert Setup
This indicator includes 4 alert types:
1. Bullish Reversal
• Triggers when strength crosses from negative to positive
• Potential trend change from bearish to bullish
• Early warning of new uptrend
2. Bearish Reversal
• Triggers when strength crosses from positive to negative
• Potential trend change from bullish to bearish
• Early warning of new downtrend
3. Very Strong Bull
• Triggers when strength reaches +75 or higher
• Extreme bullish conditions
• Aggressive long opportunity
4. Very Strong Bear
• Triggers when strength reaches -75 or lower
• Extreme bearish conditions
• Aggressive short opportunity
To Set Up Alerts:
1. Click "Alert" button (clock icon)
2. Select "Trend Strength Meter"
3. Choose your alert type
4. Configure notifications
5. Click "Create"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💎 Pro Tips & Best Practices
✅ DO:
• Trust the extremes - Readings above +75 or below -75 are highly reliable
• Wait for alignment - Best trades happen when MTF shows "ALIGNED"
• Use with price action - Combine with support/resistance for entries
• Respect the neutral zone - Avoid trading when strength is -10 to +10
• Scale position size - Bigger positions in stronger trends
• Watch for divergence - Price new high but strength declining = Warning
• Follow the trend - Don't fight strong readings (±50 or more)
⚠️ DON'T:
• Don't trade neutral readings - Wait for clear strength above ±25
• Don't fade extremes - Very strong trends (+75/-75) can stay extreme
• Don't ignore MTF - Mixed timeframes = Lower probability
• Don't overtrade - Wait for quality setups with good strength
• Don't use alone - Combine with support/resistance and risk management
• Don't expect perfection - Even strong trends can reverse suddenly
🎯 Best Timeframes:
• Scalping: 1min, 5min (fast readings, quick changes)
• Day Trading: 5min, 15min, 1H (balanced view)
• Swing Trading: 1H, 4H, Daily (stable trends)
• Position Trading: 4H, Daily, Weekly (major trends)
🔥 Best Markets:
• Trending markets (crypto, indices, commodities)
• High liquidity instruments (BTC, ES, NQ, EUR/USD)
• Avoid on low-volume stocks or exotic pairs
⏰ Works Best When:
• Market has clear direction
• Good volatility (not too choppy, not too quiet)
• Multiple timeframes aligned
• Away from major news events
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🚀 What Makes This Different?
Unlike subjective trend analysis, the Trend Strength Meter:
• Objective Measurement - No guessing, exact numerical score
• Multi-Component - Combines 4 factors, not just one indicator
• Multi-Timeframe - See alignment across timeframes instantly
• Clean Visual - Professional display, easy to interpret
• Actionable - Clear signals for entries, exits, and position sizing
• Universal - Works on all timeframes and instruments
• Proven Components - Based on trend, momentum, volatility, MA alignment
Perfect For:
• Trend followers who want confirmation
• Swing traders seeking high-probability setups
• Risk managers wanting to size positions properly
• Anyone tired of subjective "is this trend strong?" questions
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📈 Common Patterns To Watch
Pattern 1: The Steady Climb
• Strength gradually rises from +25 to +50 to +75
• Indicates building momentum
• Trade: Hold longs, add on pullbacks
Pattern 2: The Quick Spike
• Strength jumps from 0 to +75 in few bars
• Indicates explosive momentum
• Trade: Enter quickly, but expect pullback
Pattern 3: The Exhaustion
• Strength at +80, price new high, strength drops to +70
• Bearish divergence forming
• Trade: Take profits, prepare for reversal
Pattern 4: The Whipsaw
• Strength oscillates between +10 and -10
• Choppy, range-bound market
• Trade: Stay flat, wait for breakout
Pattern 5: The False Breakout
• Strength briefly crosses +50 then drops back
• Weak momentum, trend not confirmed
• Trade: Wait for sustained strength above +50
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📈 Upgrade Your Trading System
This free indicator quantifies trend strength objectively. Want more?
🔥 Check out my premium scripts for:
• Automated entry and exit signals with trend confirmation
• Advanced multi-timeframe strategy systems
• Dynamic position sizing based on trend strength
• Backtested performance with statistics
• Complete trading solutions
• And much more...
👉 Visit my profile for professional-grade trading tools!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📝 Important Notes
• This indicator measures trend strength, not direction alone
• Strong readings don't guarantee continuation (manage risk)
• Always use with proper stop losses
• Combine with support/resistance analysis
• Test on demo before live trading
• Past performance doesn't guarantee future results
• Adjust settings to match your trading style
Disclaimer: For educational purposes only. Trading involves substantial risk. Always do your own research and never risk more than you can afford to lose.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🙏 Support This Work
If this indicator helps your trading:
• ⭐ Give it a thumbs up
• 💬 Share your best strength-based trades in comments
• 🔔 Follow for more free professional tools
• 🚀 Share with traders who need objective trend analysis
Questions about trend strength? Drop a comment and I'll help!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Developed with ❤️ for traders who want objective, quantified analysis
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Version History
• v1.0 - Initial release with 4-component strength calculation and MTF analysis
HL/2 Fast & Slow - Cloud Signals + Backtest + Exit AlarmsDescription:
This indicator plots two HL/2 moving averages—a fast and a slow line—on the chart, along with dynamic upper and lower bands based on the slow line and ATR. It features a colored cloud between the two averages to visualize trend direction, and it provides buy/sell signals based on the alignment of the two lines.
Key Features:
Fast & Slow HL/2 Averages
Fast and slow HL/2 lines calculated as simple moving averages.
Lines change color based on direction (up/down), configurable via style settings.
Dynamic Upper and Lower Bands
Bands calculated from the slow line using ATR to capture volatility.
Trend Cloud
Fills the area between fast and slow lines.
Green if both lines are rising, red if both are falling, gray if lines disagree.
Transparency adjustable for better visual clarity.
Buy/Sell Signals
Signals appear only when both lines align in the same direction.
Two modes available:
Series Signals: generates a signal whenever the cloud color changes.
Single Signal: generates a signal only when the slow line changes direction.
Signals are plotted as small triangles above/below bars.
Alerts can be set for both buy/sell signals.
Exit Modes and Alerts
Exit positions either on a reverse signal or when the cloud enters a neutral gray zone.
Exit alerts are available for both conditions.
Integrated Backtest Panel
Shows total trades, win rate, and cumulative profit in USD.
Considers position size and commission (configurable).
Panel color indicates profit (green) or loss (red).
Fixed position on chart for easy reference.
Inputs:
Fast and slow periods, ATR length, ATR multiplier.
Position size, commission percentage.
Signal mode (Series or Single).
Exit mode (Reverse Signal or Gray Area).
Style options for line colors and cloud colors.
Time window for backtesting (daily, weekly, monthly, or custom date range).
Usage:
Ideal for identifying trend direction and potential entry points.
Can be used for manual trading or as part of an automated strategy with alerts.
Provides a visual and statistical overview of trading performance via the backtest panel.
Developing Midpoint TrackerDeveloping Midpoint Tracker (DMT)
Original Concept: This indicator tracks key midpoint levels from either session opens or custom timeframe periods, providing precise reference levels for intraday trading decisions.
Dual Tracking Modes:
Session Mode: Tracks midpoints from a specific session start time (e.g., 1800 ET electronic trading open) with full timezone support
Timeframe Mode: Tracks midpoints from any custom timeframe (15m, 1H, 4H, etc.) using higher timeframe OHLC data via request.security()
Core Calculations:
The indicator calculates three distinct midpoint levels:
Open-to-High Midpoint: (Session/Timeframe Open + Highest High) / 2
Open-to-Low Midpoint: (Session/Timeframe Open + Lowest Low) / 2
High-to-Low Midpoint: (Highest High + Lowest Low) / 2
Visual Features:
Horizontal lines extending from the reference period start with customizable colors, styles, and extension length
Smart collision detection prevents duplicate lines at identical price levels
Price labels with transparent backgrounds showing exact values
Optional reference open price line
Real-time info table displaying current mode and all calculated levels
Technical Implementation:
Uses Pine Script's native time() function for accurate session detection across multiple timezones
Employs request.security() for reliable higher timeframe data access
Implements proper line and label management to prevent memory issues
Supports 13 major global timezones including US markets, Europe, and Asia
Use Cases:
Identifying potential support/resistance levels from key price relationships
Setting profit targets and stop levels based on mathematical price midpoints
Analyzing price behavior around session or timeframe-specific reference levels
Multi-timeframe analysis when using custom timeframe mode on lower timeframe charts
This indicator is particularly useful for traders who utilize midpoint reversion strategies or need precise reference levels derived from session or timeframe opens.
Ashok 07 Dec 25 updated scriptTried to fix the bugs in previous script. Even now improvements are needed, but for now it looks reasonably profiting.
Supertrend Advance Pullback StrategyHandbook for the Supertrend Advance Strategy
1. Introduction
Purpose of the Handbook:
The main purpose of this handbook is to serve as a comprehensive guide for traders and investors who are looking to explore and harness the potential of the Supertrend Advance Strategy. In the rapidly changing financial market, having the right tools and strategies at one's disposal is crucial. Whether you're a beginner hoping to dive into the world of trading or a seasoned investor aiming to optimize and diversify your portfolio, this handbook offers the insights and methodologies you need. By the end of this guide, readers should have a clear understanding of how the Supertrend Advance Strategy works, its benefits, potential pitfalls, and practical application in various trading scenarios.
Overview of the Supertrend Advance Pullback Strategy:
At its core, the Supertrend Advance Strategy is an evolution of the popular Supertrend Indicator. Designed to generate buy and sell signals in trending markets, the Supertrend Indicator has been a favorite tool for many traders around the world. The Advance Strategy, however, builds upon this foundation by introducing enhanced mechanisms, filters, and methodologies to increase precision and reduce false signals.
1. Basic Concept:
The Supertrend Advance Strategy relies on a combination of price action and volatility to determine the potential trend direction. By assessing the average true range (ATR) in conjunction with specific price points, this strategy aims to highlight the potential starting and ending points of market trends.
2. Methodology:
Unlike the traditional Supertrend Indicator, which primarily focuses on closing prices and ATR, the Advance Strategy integrates other critical market variables, such as volume, momentum oscillators, and perhaps even fundamental data, to validate its signals. This multidimensional approach ensures that the generated signals are more reliable and are less prone to market noise.
3. Benefits:
One of the main benefits of the Supertrend Advance Strategy is its ability to filter out false breakouts and minor price fluctuations, which can often lead to premature exits or entries in the market. By waiting for a confluence of factors to align, traders using this advanced strategy can increase their chances of entering or exiting trades at optimal points.
4. Practical Applications:
The Supertrend Advance Strategy can be applied across various timeframes, from intraday trading to swing trading and even long-term investment scenarios. Furthermore, its flexible nature allows it to be tailored to different asset classes, be it stocks, commodities, forex, or cryptocurrencies.
In the subsequent sections of this handbook, we will delve deeper into the intricacies of this strategy, offering step-by-step guidelines on its application, case studies, and tips for maximizing its efficacy in the volatile world of trading.
As you journey through this handbook, we encourage you to approach the Supertrend Advance Strategy with an open mind, testing and tweaking it as per your personal trading style and risk appetite. The ultimate goal is not just to provide you with a new tool but to empower you with a holistic strategy that can enhance your trading endeavors.
2. Getting Started
Navigating the financial markets can be a daunting task without the right tools. This section is dedicated to helping you set up the Supertrend Advance Strategy on one of the most popular charting platforms, TradingView. By following the steps below, you'll be able to integrate this strategy into your charts and start leveraging its insights in no time.
Setting up on TradingView:
TradingView is a web-based platform that offers a wide range of charting tools, social networking, and market data. Before you can apply the Supertrend Advance Strategy, you'll first need a TradingView account. If you haven't set one up yet, here's how:
1. Account Creation:
• Visit TradingView's official website.
• Click on the "Join for free" or "Sign up" button.
• Follow the registration process, providing the necessary details and setting up your login credentials.
2. Navigating the Dashboard:
• Once logged in, you'll be taken to your dashboard. Here, you'll see a variety of tools, including watchlists, alerts, and the main charting window.
• To begin charting, type in the name or ticker of the asset you're interested in the search bar at the top.
3. Configuring Chart Settings:
• Before integrating the Supertrend Advance Strategy, familiarize yourself with the chart settings. This can be accessed by clicking the 'gear' icon on the top right of the chart window.
• Adjust the chart type, time intervals, and other display settings to your preference.
Integrating the Strategy into a Chart:
Now that you're set up on TradingView, it's time to integrate the Supertrend Advance Strategy.
1. Accessing the Pine Script Editor:
• Located at the top-center of your screen, you'll find the "Pine Editor" tab. Click on it.
• This is where custom strategies and indicators are scripted or imported.
2. Loading the Supertrend Advance Strategy Script:
• Depending on whether you have the script or need to find it, there are two paths:
• If you have the script: Copy the Supertrend Advance Strategy script, and then paste it into the Pine Editor.
• If searching for the script: Click on the “Indicators” icon (looks like a flame) at the top of your screen, and then type “Supertrend Advance Strategy” in the search bar. If available, it will show up in the list. Simply click to add it to your chart.
3. Applying the Strategy:
• After pasting or selecting the Supertrend Advance Strategy in the Pine Editor, click on the “Add to Chart” button located at the top of the editor. This will overlay the strategy onto your main chart window.
4. Configuring Strategy Settings:
• Once the strategy is on your chart, you'll notice a small settings ('gear') icon next to its name in the top-left of the chart window. Click on this to access settings.
• Here, you can adjust various parameters of the Supertrend Advance Strategy to better fit your trading style or the specific asset you're analyzing.
5. Interpreting Signals:
• With the strategy applied, you'll now see buy/sell signals represented on your chart. Take time to familiarize yourself with how these look and behave over various timeframes and market conditions.
3. Strategy Overview
What is the Supertrend Advance Strategy?
The Supertrend Advance Strategy is a refined version of the classic Supertrend Indicator, which was developed to aid traders in spotting market trends. The strategy utilizes a combination of data points, including average true range (ATR) and price momentum, to generate buy and sell signals.
In essence, the Supertrend Advance Strategy can be visualized as a line that moves with the price. When the price is above the Supertrend line, it indicates an uptrend and suggests a potential buy position. Conversely, when the price is below the Supertrend line, it hints at a downtrend, suggesting a potential selling point.
Strategy Goals and Objectives:
1. Trend Identification: At the core of the Supertrend Advance Strategy is the goal to efficiently and consistently identify prevailing market trends. By recognizing these trends, traders can position themselves to capitalize on price movements in their favor.
2. Reducing Noise: Financial markets are often inundated with 'noise' - short-term price fluctuations that can mislead traders. The Supertrend Advance Strategy aims to filter out this noise, allowing for clearer decision-making.
3. Enhancing Risk Management: With clear buy and sell signals, traders can set more precise stop-loss and take-profit points. This leads to better risk management and potentially improved profitability.
4. Versatility: While primarily used for trend identification, the strategy can be integrated with other technical tools and indicators to create a comprehensive trading system.
Type of Assets/Markets to Apply the Strategy:
1. Equities: The Supertrend Advance Strategy is highly popular among stock traders. Its ability to capture long-term trends makes it particularly useful for those trading individual stocks or equity indices.
2. Forex: Given the 24-hour nature of the Forex market and its propensity for trends, the Supertrend Advance Strategy is a valuable tool for currency traders.
3. Commodities: Whether it's gold, oil, or agricultural products, commodities often move in extended trends. The strategy can help in identifying and capitalizing on these movements.
4. Cryptocurrencies: The volatile nature of cryptocurrencies means they can have pronounced trends. The Supertrend Advance Strategy can aid crypto traders in navigating these often tumultuous waters.
5. Futures & Options: Traders and investors in derivative markets can utilize the strategy to make more informed decisions about contract entries and exits.
It's important to note that while the Supertrend Advance Strategy can be applied across various assets and markets, its effectiveness might vary based on market conditions, timeframe, and the specific characteristics of the asset in question. As always, it's recommended to use the strategy in conjunction with other analytical tools and to backtest its effectiveness in specific scenarios before committing to trades.
4. Input Settings
Understanding and correctly configuring input settings is crucial for optimizing the Supertrend Advance Strategy for any specific market or asset. These settings, when tweaked correctly, can drastically impact the strategy's performance.
Grouping Inputs:
Before diving into individual input settings, it's important to group similar inputs. Grouping can simplify the user interface, making it easier to adjust settings related to a specific function or indicator.
Strategy Choice:
This input allows traders to select from various strategies that incorporate the Supertrend indicator. Options might include "Supertrend with RSI," "Supertrend with MACD," etc. By choosing a strategy, the associated input settings for that strategy become available.
Supertrend Settings:
1. Multiplier: Typically, a default value of 3 is used. This multiplier is used in the ATR calculation. Increasing it makes the Supertrend line further from prices, while decreasing it brings the line closer.
2. Period: The number of bars used in the ATR calculation. A common default is 7.
EMA Settings (Exponential Moving Average):
1. Period: Defines the number of previous bars used to calculate the EMA. Common periods are 9, 21, 50, and 200.
2. Source: Allows traders to choose which price (Open, Close, High, Low) to use in the EMA calculation.
RSI Settings (Relative Strength Index):
1. Length: Determines how many periods are used for RSI calculation. The standard setting is 14.
2. Overbought Level: The threshold at which the asset is considered overbought, typically set at 70.
3. Oversold Level: The threshold at which the asset is considered oversold, often at 30.
MACD Settings (Moving Average Convergence Divergence):
1. Short Period: The shorter EMA, usually set to 12.
2. Long Period: The longer EMA, commonly set to 26.
3. Signal Period: Defines the EMA of the MACD line, typically set at 9.
CCI Settings (Commodity Channel Index):
1. Period: The number of bars used in the CCI calculation, often set to 20.
2. Overbought Level: Typically set at +100, denoting overbought conditions.
3. Oversold Level: Usually set at -100, indicating oversold conditions.
SL/TP Settings (Stop Loss/Take Profit):
1. SL Multiplier: Defines the multiplier for the average true range (ATR) to set the stop loss.
2. TP Multiplier: Defines the multiplier for the average true range (ATR) to set the take profit.
Filtering Conditions:
This section allows traders to set conditions to filter out certain signals. For example, one might only want to take buy signals when the RSI is below 30, ensuring they buy during oversold conditions.
Trade Direction and Backtest Period:
1. Trade Direction: Allows traders to specify whether they want to take long trades, short trades, or both.
2. Backtest Period: Specifies the time range for backtesting the strategy. Traders can choose from options like 'Last 6 months,' 'Last 1 year,' etc.
It's essential to remember that while default settings are provided for many of these tools, optimal settings can vary based on the market, timeframe, and trading style. Always backtest new settings on historical data to gauge their potential efficacy.
5. Understanding Strategy Conditions
Developing an understanding of the conditions set within a trading strategy is essential for traders to maximize its potential. Here, we delve deep into the logic behind these conditions, using the Supertrend Advance Strategy as our focal point.
Basic Logic Behind Conditions:
Every strategy is built around a set of conditions that provide buy or sell signals. The conditions are based on mathematical or statistical methods and are rooted in the study of historical price data. The fundamental idea is to recognize patterns or behaviors that have been profitable in the past and might be profitable in the future.
Buy and Sell Conditions:
1. Buy Conditions: Usually formulated around bullish signals or indicators suggesting upward price momentum.
2. Sell Conditions: Centered on bearish signals or indicators indicating downward price momentum.
Simple Strategy:
The simple strategy could involve using just the Supertrend indicator. Here:
• Buy: When price closes above the Supertrend line.
• Sell: When price closes below the Supertrend line.
Pullback Strategy:
This strategy capitalizes on price retracements:
• Buy: When the price retraces to the Supertrend line after a bullish signal and is supported by another bullish indicator.
• Sell: When the price retraces to the Supertrend line after a bearish signal and is confirmed by another bearish indicator.
Indicators Used:
EMA (Exponential Moving Average):
• Logic: EMA gives more weight to recent prices, making it more responsive to current price movements. A shorter-period EMA crossing above a longer-period EMA can be a bullish sign, while the opposite is bearish.
RSI (Relative Strength Index):
• Logic: RSI measures the magnitude of recent price changes to analyze overbought or oversold conditions. Values above 70 are typically considered overbought, and values below 30 are considered oversold.
MACD (Moving Average Convergence Divergence):
• Logic: MACD assesses the relationship between two EMAs of a security’s price. The MACD line crossing above the signal line can be a bullish signal, while crossing below can be bearish.
CCI (Commodity Channel Index):
• Logic: CCI compares a security's average price change with its average price variation. A CCI value above +100 may mean the price is overbought, while below -100 might signify an oversold condition.
And others...
As the strategy expands or contracts, more indicators might be added or removed. The crucial point is to understand the core logic behind each, ensuring they align with the strategy's objectives.
Logic Behind Each Indicator:
1. EMA: Emphasizes recent price movements; provides dynamic support and resistance levels.
2. RSI: Indicates overbought and oversold conditions based on recent price changes.
3. MACD: Showcases momentum and direction of a trend by comparing two EMAs.
4. CCI: Measures the difference between a security's price change and its average price change.
Understanding strategy conditions is not just about knowing when to buy or sell but also about comprehending the underlying market dynamics that those conditions represent. As you familiarize yourself with each condition and indicator, you'll be better prepared to adapt and evolve with the ever-changing financial markets.
6. Trade Execution and Management
Trade execution and management are crucial aspects of any trading strategy. Efficient execution can significantly impact profitability, while effective management can preserve capital during adverse market conditions. In this section, we'll explore the nuances of position entry, exit strategies, and various Stop Loss (SL) and Take Profit (TP) methodologies within the Supertrend Advance Strategy.
Position Entry:
Effective trade entry revolves around:
1. Timing: Enter at a point where the risk-reward ratio is favorable. This often corresponds to confirmatory signals from multiple indicators.
2. Volume Analysis: Ensure there's adequate volume to support the movement. Volume can validate the strength of a signal.
3. Confirmation: Use multiple indicators or chart patterns to confirm the entry point. For instance, a buy signal from the Supertrend indicator can be confirmed with a bullish MACD crossover.
Position Exit Strategies:
A successful exit strategy will lock in profits and minimize losses. Here are some strategies:
1. Fixed Time Exit: Exiting after a predetermined period.
2. Percentage-based Profit Target: Exiting after a certain percentage gain.
3. Indicator-based Exit: Exiting when an indicator gives an opposing signal.
Percentage-based SL/TP:
• Stop Loss (SL): Set a fixed percentage below the entry price to limit potential losses.
• Example: A 2% SL on an entry at $100 would trigger a sell at $98.
• Take Profit (TP): Set a fixed percentage above the entry price to lock in gains.
• Example: A 5% TP on an entry at $100 would trigger a sell at $105.
Supertrend-based SL/TP:
• Stop Loss (SL): Position the SL at the Supertrend line. If the price breaches this line, it could indicate a trend reversal.
• Take Profit (TP): One could set the TP at a point where the Supertrend line flattens or turns, indicating a possible slowdown in momentum.
Swing high/low-based SL/TP:
• Stop Loss (SL): For a long position, set the SL just below the recent swing low. For a short position, set it just above the recent swing high.
• Take Profit (TP): For a long position, set the TP near a recent swing high or resistance. For a short position, near a swing low or support.
And other methods...
1. Trailing Stop Loss: This dynamic SL adjusts with the price movement, locking in profits as the trade moves in your favor.
2. Multiple Take Profits: Divide the position into segments and set multiple TP levels, securing profits in stages.
3. Opposite Signal Exit: Exit when another reliable indicator gives an opposite signal.
Trade execution and management are as much an art as they are a science. They require a blend of analytical skill, discipline, and intuition. Regularly reviewing and refining your strategies, especially in light of changing market conditions, is crucial to maintaining consistent trading performance.
7. Visual Representations
Visual tools are essential for traders, as they simplify complex data into an easily interpretable format. Properly analyzing and understanding the plots on a chart can provide actionable insights and a more intuitive grasp of market conditions. In this section, we’ll delve into various visual representations used in the Supertrend Advance Strategy and their significance.
Understanding Plots on the Chart:
Charts are the primary visual aids for traders. The arrangement of data points, lines, and colors on them tell a story about the market's past, present, and potential future moves.
1. Data Points: These represent individual price actions over a specific timeframe. For instance, a daily chart will have data points showing the opening, closing, high, and low prices for each day.
2. Colors: Used to indicate the nature of price movement. Commonly, green is used for bullish (upward) moves and red for bearish (downward) moves.
Trend Lines:
Trend lines are straight lines drawn on a chart that connect a series of price points. Their significance:
1. Uptrend Line: Drawn along the lows, representing support. A break below might indicate a trend reversal.
2. Downtrend Line: Drawn along the highs, indicating resistance. A break above might suggest the start of a bullish trend.
Filled Areas:
These represent a range between two values on a chart, usually shaded or colored. For instance:
1. Bollinger Bands: The area between the upper and lower band is filled, giving a visual representation of volatility.
2. Volume Profile: Can show a filled area representing the amount of trading activity at different price levels.
Stop Loss and Take Profit Lines:
These are horizontal lines representing pre-determined exit points for trades.
1. Stop Loss Line: Indicates the level at which a trade will be automatically closed to limit losses. Positioned according to the trader's risk tolerance.
2. Take Profit Line: Denotes the target level to lock in profits. Set according to potential resistance (for long trades) or support (for short trades) or other technical factors.
Trailing Stop Lines:
A trailing stop is a dynamic form of stop loss that moves with the price. On a chart:
1. For Long Trades: Starts below the entry price and moves up with the price but remains static if the price falls, ensuring profits are locked in.
2. For Short Trades: Starts above the entry price and moves down with the price but remains static if the price rises.
Visual representations offer traders a clear, organized view of market dynamics. Familiarity with these tools ensures that traders can quickly and accurately interpret chart data, leading to more informed decision-making. Always ensure that the visual aids used resonate with your trading style and strategy for the best results.
8. Backtesting
Backtesting is a fundamental process in strategy development, enabling traders to evaluate the efficacy of their strategy using historical data. It provides a snapshot of how the strategy would have performed in past market conditions, offering insights into its potential strengths and vulnerabilities. In this section, we'll explore the intricacies of setting up and analyzing backtest results and the caveats one must be aware of.
Setting Up Backtest Period:
1. Duration: Determine the timeframe for the backtest. It should be long enough to capture various market conditions (bullish, bearish, sideways). For instance, if you're testing a daily strategy, consider a period of several years.
2. Data Quality: Ensure the data source is reliable, offering high-resolution and clean data. This is vital to get accurate backtest results.
3. Segmentation: Instead of a continuous period, sometimes it's helpful to backtest over distinct market phases, like a particular bear or bull market, to see how the strategy holds up in different environments.
Analyzing Backtest Results:
1. Performance Metrics: Examine metrics like the total return, annualized return, maximum drawdown, Sharpe ratio, and others to gauge the strategy's efficiency.
2. Win Rate: It's the ratio of winning trades to total trades. A high win rate doesn't always signify a good strategy; it should be evaluated in conjunction with other metrics.
3. Risk/Reward: Understand the average profit versus the average loss per trade. A strategy might have a low win rate but still be profitable if the average gain far exceeds the average loss.
4. Drawdown Analysis: Review the periods of losses the strategy could incur and how long it takes, on average, to recover.
9. Tips and Best Practices
Successful trading requires more than just knowing how a strategy works. It necessitates an understanding of when to apply it, how to adjust it to varying market conditions, and the wisdom to recognize and avoid common pitfalls. This section offers insightful tips and best practices to enhance the application of the Supertrend Advance Strategy.
When to Use the Strategy:
1. Market Conditions: Ideally, employ the Supertrend Advance Strategy during trending market conditions. This strategy thrives when there are clear upward or downward trends. It might be less effective during consolidative or sideways markets.
2. News Events: Be cautious around significant news events, as they can cause extreme volatility. It might be wise to avoid trading immediately before and after high-impact news.
3. Liquidity: Ensure you are trading in assets/markets with sufficient liquidity. High liquidity ensures that the price movements are more reflective of genuine market sentiment and not due to thin volume.
Adjusting Settings for Different Markets/Timeframes:
1. Markets: Each market (stocks, forex, commodities) has its own characteristics. It's essential to adjust the strategy's parameters to align with the market's volatility and liquidity.
2. Timeframes: Shorter timeframes (like 1-minute or 5-minute charts) tend to have more noise. You might need to adjust the settings to filter out false signals. Conversely, for longer timeframes (like daily or weekly charts), you might need to be more responsive to genuine trend changes.
3. Customization: Regularly review and tweak the strategy's settings. Periodic adjustments can ensure the strategy remains optimized for the current market conditions.
10. Frequently Asked Questions (FAQs)
Given the complexities and nuances of the Supertrend Advance Strategy, it's only natural for traders, both new and seasoned, to have questions. This section addresses some of the most commonly asked questions regarding the strategy.
1. What exactly is the Supertrend Advance Strategy?
The Supertrend Advance Strategy is an evolved version of the traditional Supertrend indicator. It's designed to provide clearer buy and sell signals by incorporating additional indicators like EMA, RSI, MACD, CCI, etc. The strategy aims to capitalize on market trends while minimizing false signals.
2. Can I use the Supertrend Advance Strategy for all asset types?
Yes, the strategy can be applied to various asset types like stocks, forex, commodities, and cryptocurrencies. However, it's crucial to adjust the settings accordingly to suit the specific characteristics and volatility of each asset type.
3. Is this strategy suitable for day trading?
Absolutely! The Supertrend Advance Strategy can be adjusted to suit various timeframes, making it versatile for both day trading and long-term trading. Remember to fine-tune the settings to align with the timeframe you're trading on.
4. How do I deal with false signals?
No strategy is immune to false signals. However, by combining the Supertrend with other indicators and adhering to strict risk management protocols, you can minimize the impact of false signals. Always use stop-loss orders and consider filtering trades with additional confirmation signals.
5. Do I need any prior trading experience to use this strategy?
While the Supertrend Advance Strategy is designed to be user-friendly, having a foundational understanding of trading and market analysis can greatly enhance your ability to employ the strategy effectively. If you're a beginner, consider pairing the strategy with further education and practice on demo accounts.
6. How often should I review and adjust the strategy settings?
There's no one-size-fits-all answer. Some traders adjust settings weekly, while others might do it monthly. The key is to remain responsive to changing market conditions. Regular backtesting can give insights into potential required adjustments.
7. Can the Supertrend Advance Strategy be automated?
Yes, many traders use algorithmic trading platforms to automate their strategies, including the Supertrend Advance Strategy. However, always monitor automated systems regularly to ensure they're operating as intended.
8. Are there any markets or conditions where the strategy shouldn't be used?
The strategy might generate more false signals in markets that are consolidative or range-bound. During significant news events or times of unexpected high volatility, it's advisable to tread with caution or stay out of the market.
9. How important is backtesting with this strategy?
Backtesting is crucial as it allows traders to understand how the strategy would have performed in the past, offering insights into potential profitability and areas of improvement. Always backtest any new setting or tweak before applying it to live trades.
10. What if the strategy isn't working for me?
No strategy guarantees consistent profits. If it's not working for you, consider reviewing your settings, seeking expert advice, or complementing the Supertrend Advance Strategy with other analysis methods. Remember, continuous learning and adaptation are the keys to trading success.
Other comments
Value of combining several indicators in this script and how they work together
Diversification of Signals: Just as diversifying an investment portfolio can reduce risk, using multiple indicators can offer varied perspectives on potential price movements. Each indicator can capture a different facet of the market, ensuring that traders are not overly reliant on a single data point.
Confirmation & Reduced False Signals: A common challenge with many indicators is the potential for false signals. By requiring confirmation from multiple indicators before acting, the chances of acting on a false signal can be significantly reduced.
Flexibility Across Market Conditions: Different indicators might perform better under different market conditions. For example, while moving averages might excel in trending markets, oscillators like RSI might be more useful during sideways or range-bound conditions. A mashup strategy can potentially adapt better to varying market scenarios.
Comprehensive Analysis: With multiple indicators, traders can gauge trend strength, momentum, volatility, and potential market reversals all at once, providing a holistic view of the market.
How do the different indicators in the Supertrend Advance Strategy work together?
Supertrend: This is primarily a trend-following indicator. It provides traders with buy and sell signals based on the volatility of the price. When combined with other indicators, it can filter out noise and give more weight to strong, confirmed trends.
EMA (Exponential Moving Average): EMA gives more weight to recent price data. It can be used to identify the direction and strength of a trend. When the price is above the EMA, it's generally considered bullish, and vice versa.
RSI (Relative Strength Index): An oscillator that measures the magnitude of recent price changes to evaluate overbought or oversold conditions. By cross-referencing with other indicators like EMA or MACD, traders can spot potential reversals or confirmations of a trend.
MACD (Moving Average Convergence Divergence): This indicator identifies changes in the strength, direction, momentum, and duration of a trend in a stock's price. When the MACD line crosses above the signal line, it can be a bullish sign, and when it crosses below, it can be bearish. Pairing MACD with Supertrend can provide dual confirmation of a trend.
CCI (Commodity Channel Index): Initially developed for commodities, CCI can indicate overbought or oversold conditions. It can be used in conjunction with other indicators to determine entry and exit points.
In essence, the synergy of these indicators provides a balanced, comprehensive approach to trading. Each indicator offers its unique lens into market conditions, and when they align, it can be a powerful indication of a trading opportunity. This combination not only reduces the potential drawbacks of each individual indicator but leverages their strengths, aiming for more consistent and informed trading decisions.
Backtesting and Default Settings
• This indicator has been optimized to be applied for 1 hour-charts. However, the underlying principles of this strategy are supply and demand in the financial markets and the strategy can be applied to all timeframes. Daytraders can use the 1min- or 5min charts, swing-traders can use the daily charts.
• This strategy has been designed to identify the most promising, highest probability entries and trades for each stock or other financial security.
• The combination of the qualifiers results in a highly selective strategy which only considers the most promising swing-trading entries. As a result, you will normally only find a low number of trades for each stock or other financial security per year in case you apply this strategy for the daily charts. Shorter timeframes will result in a higher number of trades / year.
• Consequently, traders need to apply this strategy for a full watchlist rather than just one financial security.
• Default properties: RSI on (length 14, RSI buy level 50, sell level 50), EMA, RSI, MACD on, type of strategy pullback, SL/TP type: ATR (length 10, factor 3), trade direction both, quantity 5, take profit swing hl 5.1, highest / lowest lookback 2, enable ATR trail (ATR length 10, SL ATR multiplier 1.4, TP multiplier 2.1, lookback = 4, trade direction = both).
Uhl MA System - Strategy AnalysisThe Uhl MA crossover system was specifically designed to provide an adaptive MA crossover system that didn't committed the same errors of more classical MA systems. This crossover system is based on a fast and a slow moving average, with the slow moving average being the corrected moving average (CMA) originally proposed by Andreas Uhl, and the fast moving average being the corrected trend step (CTS) which is also based on the corrected moving average design.
For more information see :
In this post, the performances of this system are analyzed on various markets.
Setup And Rules
The analysis is solely based on the indicator signals, therefore no spread is applied. Constant position sizing is used. The strategy will be backtested on the 15 minute time-frame. The mult setting is discarded, the default setting used for length is 100.
Here are the rules of our strategy :
long: CTS crossover CMA
short: CTS crossunder CMA
Results And Data
EURUSD:
Net Profit: $ 0.08
Total number of trades: 99
Profitability: 35.35 %
Profit Factor: 1.834
Max Drawdown: $ 0.01
EURUSD behaved pretty well, and was most of time showing long term trends without exhibiting particularly tricky structures, the moving averages still did cross during ranging phases, since march 9 we can see a downtrend with more pronounced cyclical variations (retracements) that could potentially lead to loosing trades.
BTCUSD:
Net Profit: $ 4371.57
Total number of trades: 94
Profitability: 32.98 %
Profit Factor: 1.749
Max Drawdown: $ 1409.96
The strategy didn't started well, producing its largest drawdown after only a few trades, the strategy still managed to recover. BTCUSD exhibited a strong downtrend, the strategy profited from that to recover, signals still occurred on ranging phases, and where mostly caused by a short term volatile move, unfortunately the CMA can converge toward ranging/flat price zones where false signals might occur at higher frequency.
AMD:
Net Profit: $ 16.09
Total number of trades: 95
Profitability: 29.47 %
Profit Factor: 1.288
Max Drawdown: $ 20.11
On AMD the strategy started relatively well with a raising balance, then the balance quickly fallen, this downtrend in the balance lasted quite some time (almost 48 trades), the strategy finally recovered in Nov 2019 and the balance made a new highest high at the end of February. AMD had numerous trends during the backtesting period, yet results are poor.
AAPL:
Net Profit: $ -28.17
Total number of trades: 89
Profitability: 28.09 %
Profit Factor: 0.894
Max Drawdown: $ 63.21
AAPL show the poorest results so far, with a stationary balance around the initial capital (in short the evolution of the balance is not showing any particular trend and oscillate around the initial capital value).
AAPL had some significant retracements in its up-trend, which triggered some trades (of course), and the ranging period from Jan 24 to Feb 13 heavily damaged the strategy performance, generating 6 significant loosing trades. AAPL show the worst results so far, mostly due by ranging phases.
Conclusions
The Uhl MA crossover system strategy has been tested and based on the results don't show particularly interesting performances, and might even be outperformed by simpler MA systems that prove to be more robust against ranging markets. The total number of executed trades are on average 94, and the profitability is on average 31%. The strategy might prove more interesting if we can correct the behavior of the CMA, who sometimes converged toward ranging/flat markets.
Backtesting & Trading Engine [PineCoders]The PineCoders Backtesting and Trading Engine is a sophisticated framework with hybrid code that can run as a study to generate alerts for automated or discretionary trading while simultaneously providing backtest results. It can also easily be converted to a TradingView strategy in order to run TV backtesting. The Engine comes with many built-in strats for entries, filters, stops and exits, but you can also add you own.
If, like any self-respecting strategy modeler should, you spend a reasonable amount of time constantly researching new strategies and tinkering, our hope is that the Engine will become your inseparable go-to tool to test the validity of your creations, as once your tests are conclusive, you will be able to run this code as a study to generate the alerts required to put it in real-world use, whether for discretionary trading or to interface with an execution bot/app. You may also find the backtesting results the Engine produces in study mode enough for your needs and spend most of your time there, only occasionally converting to strategy mode in order to backtest using TV backtesting.
As you will quickly grasp when you bring up this script’s Settings, this is a complex tool. While you will be able to see results very quickly by just putting it on a chart and using its built-in strategies, in order to reap the full benefits of the PineCoders Engine, you will need to invest the time required to understand the subtleties involved in putting all its potential into play.
Disclaimer: use the Engine at your own risk.
Before we delve in more detail, here’s a bird’s eye view of the Engine’s features:
More than 40 built-in strategies,
Customizable components,
Coupling with your own external indicator,
Simple conversion from Study to Strategy modes,
Post-Exit analysis to search for alternate trade outcomes,
Use of the Data Window to show detailed bar by bar trade information and global statistics, including some not provided by TV backtesting,
Plotting of reminders and generation of alerts on in-trade events.
By combining your own strats to the built-in strats supplied with the Engine, and then tuning the numerous options and parameters in the Inputs dialog box, you will be able to play what-if scenarios from an infinite number of permutations.
USE CASES
You have written an indicator that provides an entry strat but it’s missing other components like a filter and a stop strategy. You add a plot in your indicator that respects the Engine’s External Signal Protocol, connect it to the Engine by simply selecting your indicator’s plot name in the Engine’s Settings/Inputs and then run tests on different combinations of entry stops, in-trade stops and profit taking strats to find out which one produces the best results with your entry strat.
You are building a complex strategy that you will want to run as an indicator generating alerts to be sent to a third-party execution bot. You insert your code in the Engine’s modules and leverage its trade management code to quickly move your strategy into production.
You have many different filters and want to explore results using them separately or in combination. Integrate the filter code in the Engine and run through different permutations or hook up your filtering through the external input and control your filter combos from your indicator.
You are tweaking the parameters of your entry, filter or stop strat. You integrate it in the Engine and evaluate its performance using the Engine’s statistics.
You always wondered what results a random entry strat would yield on your markets. You use the Engine’s built-in random entry strat and test it using different combinations of filters, stop and exit strats.
You want to evaluate the impact of fees and slippage on your strategy. You use the Engine’s inputs to play with different values and get immediate feedback in the detailed numbers provided in the Data Window.
You just want to inspect the individual trades your strategy generates. You include it in the Engine and then inspect trades visually on your charts, looking at the numbers in the Data Window as you move your cursor around.
You have never written a production-grade strategy and you want to learn how. Inspect the code in the Engine; you will find essential components typical of what is being used in actual trading systems.
You have run your system for a while and have compiled actual slippage information and your broker/exchange has updated his fees schedule. You enter the information in the Engine and run it on your markets to see the impact this has on your results.
FEATURES
Before going into the detail of the Inputs and the Data Window numbers, here’s a more detailed overview of the Engine’s features.
Built-in strats
The engine comes with more than 40 pre-coded strategies for the following standard system components:
Entries,
Filters,
Entry stops,
2 stage in-trade stops with kick-in rules,
Pyramiding rules,
Hard exits.
While some of the filter and stop strats provided may be useful in production-quality systems, you will not devise crazy profit-generating systems using only the entry strats supplied; that part is still up to you, as will be finding the elusive combination of components that makes winning systems. The Engine will, however, provide you with a solid foundation where all the trade management nitty-gritty is handled for you. By binding your custom strats to the Engine, you will be able to build reliable systems of the best quality currently allowed on the TV platform.
On-chart trade information
As you move over the bars in a trade, you will see trade numbers in the Data Window change at each bar. The engine calculates the P&L at every bar, including slippage and fees that would be incurred were the trade exited at that bar’s close. If the trade includes pyramided entries, those will be taken into account as well, although for those, final fees and slippage are only calculated at the trade’s exit.
You can also see on-chart markers for the entry level, stop positions, in-trade special events and entries/exits (you will want to disable these when using the Engine in strategy mode to see TV backtesting results).
Customization
You can couple your own strats to the Engine in two ways:
1. By inserting your own code in the Engine’s different modules. The modular design should enable you to do so with minimal effort by following the instructions in the code.
2. By linking an external indicator to the engine. After making the proper selections in the engine’s Settings and providing values respecting the engine’s protocol, your external indicator can, when the Engine is used in Indicator mode only:
Tell the engine when to enter long or short trades, but let the engine’s in-trade stop and exit strats manage the exits,
Signal both entries and exits,
Provide an entry stop along with your entry signal,
Filter other entry signals generated by any of the engine’s entry strats.
Conversion from strategy to study
TradingView strategies are required to backtest using the TradingView backtesting feature, but if you want to generate alerts with your script, whether for automated trading or just to trigger alerts that you will use in discretionary trading, your code has to run as a study since, for the time being, strategies can’t generate alerts. From hereon we will use indicator as a synonym for study.
Unless you want to maintain two code bases, you will need hybrid code that easily flips between strategy and indicator modes, and your code will need to restrict its use of strategy() calls and their arguments if it’s going to be able to run both as an indicator and a strategy using the same trade logic. That’s one of the benefits of using this Engine. Once you will have entered your own strats in the Engine, it will be a matter of commenting/uncommenting only four lines of code to flip between indicator and strategy modes in a matter of seconds.
Additionally, even when running in Indicator mode, the Engine will still provide you with precious numbers on your individual trades and global results, some of which are not available with normal TradingView backtesting.
Post-Exit Analysis for alternate outcomes (PEA)
While typical backtesting shows results of trade outcomes, PEA focuses on what could have happened after the exit. The intention is to help traders get an idea of the opportunity/risk in the bars following the trade in order to evaluate if their exit strategies are too aggressive or conservative.
After a trade is exited, the Engine’s PEA module continues analyzing outcomes for a user-defined quantity of bars. It identifies the maximum opportunity and risk available in that space, and calculates the drawdown required to reach the highest opportunity level post-exit, while recording the number of bars to that point.
Typically, if you can’t find opportunity greater than 1X past your trade using a few different reasonable lengths of PEA, your strategy is doing pretty good at capturing opportunity. Remember that 100% of opportunity is never capturable. If, however, PEA was finding post-trade maximum opportunity of 3 or 4X with average drawdowns of 0.3 to those areas, this could be a clue revealing your system is exiting trades prematurely. To analyze PEA numbers, you can uncomment complete sets of plots in the Plot module to reveal detailed global and individual PEA numbers.
Statistics
The Engine provides stats on your trades that TV backtesting does not provide, such as:
Average Profitability Per Trade (APPT), aka statistical expectancy, a crucial value.
APPT per bar,
Average stop size,
Traded volume .
It also shows you on a trade-by-trade basis, on-going individual trade results and data.
In-trade events
In-trade events can plot reminders and trigger alerts when they occur. The built-in events are:
Price approaching stop,
Possible tops/bottoms,
Large stop movement (for discretionary trading where stop is moved manually),
Large price movements.
Slippage and Fees
Even when running in indicator mode, the Engine allows for slippage and fees to be included in the logic and test results.
Alerts
The alert creation mechanism allows you to configure alerts on any combination of the normal or pyramided entries, exits and in-trade events.
Backtesting results
A few words on the numbers calculated in the Engine. Priority is given to numbers not shown in TV backtesting, as you can readily convert the script to a strategy if you need them.
We have chosen to focus on numbers expressing results relative to X (the trade’s risk) rather than in absolute currency numbers or in other more conventional but less useful ways. For example, most of the individual trade results are not shown in percentages, as this unit of measure is often less meaningful than those expressed in units of risk (X). A trade that closes with a +25% result, for example, is a poor outcome if it was entered with a -50% stop. Expressed in X, this trade’s P&L becomes 0.5, which provides much better insight into the trade’s outcome. A trade that closes with a P&L of +2X has earned twice the risk incurred upon entry, which would represent a pre-trade risk:reward ratio of 2.
The way to go about it when you think in X’s and that you adopt the sound risk management policy to risk a fixed percentage of your account on each trade is to equate a currency value to a unit of X. E.g. your account is 10K USD and you decide you will risk a maximum of 1% of it on each trade. That means your unit of X for each trade is worth 100 USD. If your APPT is 2X, this means every time you risk 100 USD in a trade, you can expect to make, on average, 200 USD.
By presenting results this way, we hope that the Engine’s statistics will appeal to those cognisant of sound risk management strategies, while gently leading traders who aren’t, towards them.
We trade to turn in tangible profits of course, so at some point currency must come into play. Accordingly, some values such as equity, P&L, slippage and fees are expressed in currency.
Many of the usual numbers shown in TV backtests are nonetheless available, but they have been commented out in the Engine’s Plot module.
Position sizing and risk management
All good system designers understand that optimal risk management is at the very heart of all winning strategies. The risk in a trade is defined by the fraction of current equity represented by the amplitude of the stop, so in order to manage risk optimally on each trade, position size should adjust to the stop’s amplitude. Systems that enter trades with a fixed stop amplitude can get away with calculating position size as a fixed percentage of current equity. In the context of a test run where equity varies, what represents a fixed amount of risk translates into different currency values.
Dynamically adjusting position size throughout a system’s life is optimal in many ways. First, as position sizing will vary with current equity, it reproduces a behavioral pattern common to experienced traders, who will dial down risk when confronted to poor performance and increase it when performance improves. Second, limiting risk confers more predictability to statistical test results. Third, position sizing isn’t just about managing risk, it’s also about maximizing opportunity. By using the maximum leverage (no reference to trading on margin here) into the trade that your risk management strategy allows, a dynamic position size allows you to capture maximal opportunity.
To calculate position sizes using the fixed risk method, we use the following formula: Position = Account * MaxRisk% / Stop% [, which calculates a position size taking into account the trade’s entry stop so that if the trade is stopped out, 100 USD will be lost. For someone who manages risk this way, common instructions to invest a certain percentage of your account in a position are simply worthless, as they do not take into account the risk incurred in the trade.
The Engine lets you select either the fixed risk or fixed percentage of equity position sizing methods. The closest thing to dynamic position sizing that can currently be done with alerts is to use a bot that allows syntax to specify position size as a percentage of equity which, while being dynamic in the sense that it will adapt to current equity when the trade is entered, does not allow us to modulate position size using the stop’s amplitude. Changes to alerts are on the way which should solve this problem.
In order for you to simulate performance with the constraint of fixed position sizing, the Engine also offers a third, less preferable option, where position size is defined as a fixed percentage of initial capital so that it is constant throughout the test and will thus represent a varying proportion of current equity.
Let’s recap. The three position sizing methods the Engine offers are:
1. By specifying the maximum percentage of risk to incur on your remaining equity, so the Engine will dynamically adjust position size for each trade so that, combining the stop’s amplitude with position size will yield a fixed percentage of risk incurred on current equity,
2. By specifying a fixed percentage of remaining equity. Note that unless your system has a fixed stop at entry, this method will not provide maximal risk control, as risk will vary with the amplitude of the stop for every trade. This method, as the first, does however have the advantage of automatically adjusting position size to equity. It is the Engine’s default method because it has an equivalent in TV backtesting, so when flipping between indicator and strategy mode, test results will more or less correspond.
3. By specifying a fixed percentage of the Initial Capital. While this is the least preferable method, it nonetheless reflects the reality confronted by most system designers on TradingView today. In this case, risk varies both because the fixed position size in initial capital currency represents a varying percentage of remaining equity, and because the trade’s stop amplitude may vary, adding another variability vector to risk.
Note that the Engine cannot display equity results for strategies entering trades for a fixed amount of shares/contracts at a variable price.
SETTINGS/INPUTS
Because the initial text first published with a script cannot be edited later and because there are just too many options, the Engine’s Inputs will not be covered in minute detail, as they will most certainly evolve. We will go over them with broad strokes; you should be able to figure the rest out. If you have questions, just ask them here or in the PineCoders Telegram group.
Display
The display header’s checkbox does nothing.
For the moment, only one exit strategy uses a take profit level, so only that one will show information when checking “Show Take Profit Level”.
Entries
You can activate two simultaneous entry strats, each selected from the same set of strats contained in the Engine. If you select two and they fire simultaneously, the main strat’s signal will be used.
The random strat in each list uses a different seed, so you will get different results from each.
The “Filter transitions” and “Filter states” strats delegate signal generation to the selected filter(s). “Filter transitions” signals will only fire when the filter transitions into bull/bear state, so after a trade is stopped out, the next entry may take some time to trigger if the filter’s state does not change quickly. When you choose “Filter states”, then a new trade will be entered immediately after an exit in the direction the filter allows.
If you select “External Indicator”, your indicator will need to generate a +2/-2 (or a positive/negative stop value) to enter a long/short position, providing the selected filters allow for it. If you wish to use the Engine’s capacity to also derive the entry stop level from your indicator’s signal, then you must explicitly choose this option in the Entry Stops section.
Filters
You can activate as many filters as you wish; they are additive. The “Maximum stop allowed on entry” is an important component of proper risk management. If your system has an average 3% stop size and you need to trade using fixed position sizes because of alert/execution bot limitations, you must use this filter because if your system was to enter a trade with a 15% stop, that trade would incur 5 times the normal risk, and its result would account for an abnormally high proportion in your system’s performance.
Remember that any filter can also be used as an entry signal, either when it changes states, or whenever no trade is active and the filter is in a bull or bear mode.
Entry Stops
An entry stop must be selected in the Engine, as it requires a stop level before the in-trade stop is calculated. Until the selected in-trade stop strat generates a stop that comes closer to price than the entry stop (or respects another one of the in-trade stops kick in strats), the entry stop level is used.
It is here that you must select “External Indicator” if your indicator supplies a +price/-price value to be used as the entry stop. A +price is expected for a long entry and a -price value will enter a short with a stop at price. Note that the price is the absolute price, not an offset to the current price level.
In-Trade Stops
The Engine comes with many built-in in-trade stop strats. Note that some of them share the “Length” and “Multiple” field, so when you swap between them, be sure that the length and multiple in use correspond to what you want for that stop strat. Suggested defaults appear with the name of each strat in the dropdown.
In addition to the strat you wish to use, you must also determine when it kicks in to replace the initial entry’s stop, which is determined using different strats. For strats where you can define a positive or negative multiple of X, percentage or fixed value for a kick-in strat, a positive value is above the trade’s entry fill and a negative one below. A value of zero represents breakeven.
Pyramiding
What you specify in this section are the rules that allow pyramiding to happen. By themselves, these rules will not generate pyramiding entries. For those to happen, entry signals must be issued by one of the active entry strats, and conform to the pyramiding rules which act as a filter for them. The “Filter must allow entry” selection must be chosen if you want the usual system’s filters to act as additional filtering criteria for your pyramided entries.
Hard Exits
You can choose from a variety of hard exit strats. Hard exits are exit strategies which signal trade exits on specific events, as opposed to price breaching a stop level in In-Trade Stops strategies. They are self-explanatory. The last one labelled When Take Profit Level (multiple of X) is reached is the only one that uses a level, but contrary to stops, it is above price and while it is relative because it is expressed as a multiple of X, it does not move during the trade. This is the level called Take Profit that is show when the “Show Take Profit Level” checkbox is checked in the Display section.
While stops focus on managing risk, hard exit strategies try to put the emphasis on capturing opportunity.
Slippage
You can define it as a percentage or a fixed value, with different settings for entries and exits. The entry and exit markers on the chart show the impact of slippage on the entry price (the fill).
Fees
Fees, whether expressed as a percentage of position size in and out of the trade or as a fixed value per in and out, are in the same units of currency as the capital defined in the Position Sizing section. Fees being deducted from your Capital, they do not have an impact on the chart marker positions.
In-Trade Events
These events will only trigger during trades. They can be helpful to act as reminders for traders using the Engine as assistance to discretionary trading.
Post-Exit Analysis
It is normally on. Some of its results will show in the Global Numbers section of the Data Window. Only a few of the statistics generated are shown; many more are available, but commented out in the Plot module.
Date Range Filtering
Note that you don’t have to change the dates to enable/diable filtering. When you are done with a specific date range, just uncheck “Date Range Filtering” to disable date filtering.
Alert Triggers
Each selection corresponds to one condition. Conditions can be combined into a single alert as you please. Just be sure you have selected the ones you want to trigger the alert before you create the alert. For example, if you trade in both directions and you want a single alert to trigger on both types of exits, you must select both “Long Exit” and “Short Exit” before creating your alert.
Once the alert is triggered, these settings no longer have relevance as they have been saved with the alert.
When viewing charts where an alert has just triggered, if your alert triggers on more than one condition, you will need the appropriate markers active on your chart to figure out which condition triggered the alert, since plotting of markers is independent of alert management.
Position sizing
You have 3 options to determine position size:
1. Proportional to Stop -> Variable, with a cap on size.
2. Percentage of equity -> Variable.
3. Percentage of Initial Capital -> Fixed.
External Indicator
This is where you connect your indicator’s plot that will generate the signals the Engine will act upon. Remember this only works in Indicator mode.
DATA WINDOW INFORMATION
The top part of the window contains global numbers while the individual trade information appears in the bottom part. The different types of units used to express values are:
curr: denotes the currency used in the Position Sizing section of Inputs for the Initial Capital value.
quote: denotes quote currency, i.e. the value the instrument is expressed in, or the right side of the market pair (USD in EURUSD ).
X: the stop’s amplitude, itself expressed in quote currency, which we use to express a trade’s P&L, so that a trade with P&L=2X has made twice the stop’s amplitude in profit. This is sometimes referred to as R, since it represents one unit of risk. It is also the unit of measure used in the APPT, which denotes expected reward per unit of risk.
X%: is also the stop’s amplitude, but expressed as a percentage of the Entry Fill.
The numbers appearing in the Data Window are all prefixed:
“ALL:” the number is the average for all first entries and pyramided entries.
”1ST:” the number is for first entries only.
”PYR:” the number is for pyramided entries only.
”PEA:” the number is for Post-Exit Analyses
Global Numbers
Numbers in this section represent the results of all trades up to the cursor on the chart.
Average Profitability Per Trade (X): This value is the most important gauge of your strat’s worthiness. It represents the returns that can be expected from your strat for each unit of risk incurred. E.g.: your APPT is 2.0, thus for every unit of currency you invest in a trade, you can on average expect to obtain 2 after the trade. APPT is also referred to as “statistical expectancy”. If it is negative, your strategy is losing, even if your win rate is very good (it means your winning trades aren’t winning enough, or your losing trades lose too much, or both). Its counterpart in currency is also shown, as is the APPT/bar, which can be a useful gauge in deciding between rivalling systems.
Profit Factor: Gross of winning trades/Gross of losing trades. Strategy is profitable when >1. Not as useful as the APPT because it doesn’t take into account the win rate and the average win/loss per trade. It is calculated from the total winning/losing results of this particular backtest and has less predictive value than the APPT. A good profit factor together with a poor APPT means you just found a chart where your system outperformed. Relying too much on the profit factor is a bit like a poker player who would think going all in with two’s against aces is optimal because he just won a hand that way.
Win Rate: Percentage of winning trades out of all trades. Taken alone, it doesn’t have much to do with strategy profitability. You can have a win rate of 99% but if that one trade in 100 ruins you because of poor risk management, 99% doesn’t look so good anymore. This number speaks more of the system’s profile than its worthiness. Still, it can be useful to gauge if the system fits your personality. It can also be useful to traders intending to sell their systems, as low win rate systems are more difficult to sell and require more handholding of worried customers.
Equity (curr): This the sum of initial capital and the P&L of your system’s trades, including fees and slippage.
Return on Capital is the equivalent of TV’s Net Profit figure, i.e. the variation on your initial capital.
Maximum drawdown is the maximal drawdown from the highest equity point until the drop . There is also a close to close (meaning it doesn’t take into account in-trade variations) maximum drawdown value commented out in the code.
The next values are self-explanatory, until:
PYR: Avg Profitability Per Entry (X): this is the APPT for all pyramided entries.
PEA: Avg Max Opp . Available (X): the average maximal opportunity found in the Post-Exit Analyses.
PEA: Avg Drawdown to Max Opp . (X): this represents the maximum drawdown (incurred from the close at the beginning of the PEA analysis) required to reach the maximal opportunity point.
Trade Information
Numbers in this section concern only the current trade under the cursor. Most of them are self-explanatory. Use the description’s prefix to determine what the values applies to.
PYR: Avg Profitability Per Entry (X): While this value includes the impact of all current pyramided entries (and only those) and updates when you move your cursor around, P&L only reflects fees at the trade’s last bar.
PEA: Max Opp . Available (X): It’s the most profitable close reached post-trade, measured from the trade’s Exit Fill, expressed in the X value of the trade the PEA follows.
PEA: Drawdown to Max Opp . (X): This is the maximum drawdown from the trade’s Exit Fill that needs to be sustained in order to reach the maximum opportunity point, also expressed in X. Note that PEA numbers do not include slippage and fees.
EXTERNAL SIGNAL PROTOCOL
Only one external indicator can be connected to a script; in order to leverage its use to the fullest, the engine provides options to use it as either an entry signal, an entry/exit signal or a filter. When used as an entry signal, you can also use the signal to provide the entry’s stop. Here’s how this works:
For filter state: supply +1 for bull (long entries allowed), -1 for bear (short entries allowed).
For entry signals: supply +2 for long, -2 for short.
For exit signals: supply +3 for exit from long, -3 for exit from short.
To send an entry stop level with an entry signal: Send positive stop level for long entry (e.g. 103.33 to enter a long with a stop at 103.33), negative stop level for short entry (e.g. -103.33 to enter a short with a stop at 103.33). If you use this feature, your indicator will have to check for exact stop levels of 1.0, 2.0 or 3.0 and their negative counterparts, and fudge them with a tick in order to avoid confusion with other signals in the protocol.
Remember that mere generation of the values by your indicator will have no effect until you explicitly allow their use in the appropriate sections of the Engine’s Settings/Inputs.
An example of a script issuing a signal for the Engine is published by PineCoders.
RECOMMENDATIONS TO ASPIRING SYSTEM DESIGNERS
Stick to higher timeframes. On progressively lower timeframes, margins decrease and fees and slippage take a proportionally larger portion of profits, to the point where they can very easily turn a profitable strategy into a losing one. Additionally, your margin for error shrinks as the equilibrium of your system’s profitability becomes more fragile with the tight numbers involved in the shorter time frames. Avoid <1H time frames.
Know and calculate fees and slippage. To avoid market shock, backtest using conservative fees and slippage parameters. Systems rarely show unexpectedly good returns when they are confronted to the markets, so put all chances on your side by being outrageously conservative—or a the very least, realistic. Test results that do not include fees and slippage are worthless. Slippage is there for a reason, and that’s because our interventions in the market change the market. It is easier to find alpha in illiquid markets such as cryptos because not many large players participate in them. If your backtesting results are based on moving large positions and you don’t also add the inevitable slippage that will occur when you enter/exit thin markets, your backtesting will produce unrealistic results. Even if you do include large slippage in your settings, the Engine can only do so much as it will not let slippage push fills past the high or low of the entry bar, but the gap may be much larger in illiquid markets.
Never test and optimize your system on the same dataset , as that is the perfect recipe for overfitting or data dredging, which is trying to find one precise set of rules/parameters that works only on one dataset. These setups are the most fragile and often get destroyed when they meet the real world.
Try to find datasets yielding more than 100 trades. Less than that and results are not as reliable.
Consider all backtesting results with suspicion. If you never entertained sceptic tendencies, now is the time to begin. If your backtest results look really good, assume they are flawed, either because of your methodology, the data you’re using or the software doing the testing. Always assume the worse and learn proper backtesting techniques such as monte carlo simulations and walk forward analysis to avoid the traps and biases that unchecked greed will set for you. If you are not familiar with concepts such as survivor bias, lookahead bias and confirmation bias, learn about them.
Stick to simple bars or candles when designing systems. Other types of bars often do not yield reliable results, whether by design (Heikin Ashi) or because of the way they are implemented on TV (Renko bars).
Know that you don’t know and use that knowledge to learn more about systems and how to properly test them, about your biases, and about yourself.
Manage risk first , then capture opportunity.
Respect the inherent uncertainty of the future. Cleanse yourself of the sad arrogance and unchecked greed common to newcomers to trading. Strive for rationality. Respect the fact that while backtest results may look promising, there is no guarantee they will repeat in the future (there is actually a high probability they won’t!), because the future is fundamentally unknowable. If you develop a system that looks promising, don’t oversell it to others whose greed may lead them to entertain unreasonable expectations.
Have a plan. Understand what king of trading system you are trying to build. Have a clear picture or where entries, exits and other important levels will be in the sort of trade you are trying to create with your system. This stated direction will help you discard more efficiently many of the inevitably useless ideas that will pop up during system design.
Be wary of complexity. Experienced systems engineers understand how rapidly complexity builds when you assemble components together—however simple each one may be. The more complex your system, the more difficult it will be to manage.
Play! . Allow yourself time to play around when you design your systems. While much comes about from working with a purpose, great ideas sometimes come out of just trying things with no set goal, when you are stuck and don’t know how to move ahead. Have fun!
@LucF
NOTES
While the engine’s code can supply multiple consecutive entries of longs or shorts in order to scale positions (pyramid), all exits currently assume the execution bot will exit the totality of the position. No partial exits are currently possible with the Engine.
Because the Engine is literally crippled by the limitations on the number of plots a script can output on TV; it can only show a fraction of all the information it calculates in the Data Window. You will find in the Plot Module vast amounts of commented out lines that you can activate if you also disable an equivalent number of other plots. This may be useful to explore certain characteristics of your system in more detail.
When backtesting using the TV backtesting feature, you will need to provide the strategy parameters you wish to use through either Settings/Properties or by changing the default values in the code’s header. These values are defined in variables and used not only in the strategy() statement, but also as defaults in the Engine’s relevant Inputs.
If you want to test using pyramiding, then both the strategy’s Setting/Properties and the Engine’s Settings/Inputs need to allow pyramiding.
If you find any bugs in the Engine, please let us know.
THANKS
To @glaz for allowing the use of his unpublished MA Squize in the filters.
To @everget for his Chandelier stop code, which is also used as a filter in the Engine.
To @RicardoSantos for his pseudo-random generator, and because it’s from him that I first read in the Pine chat about the idea of using an external indicator as input into another. In the PineCoders group, @theheirophant then mentioned the idea of using it as a buy/sell signal and @simpelyfe showed a piece of code implementing the idea. That’s the tortuous story behind the use of the external indicator in the Engine.
To @admin for the Volatility stop’s original code and for the donchian function lifted from Ichimoku .
To @BobHoward21 for the v3 version of Volatility Stop .
To @scarf and @midtownsk8rguy for the color tuning.
To many other scripters who provided encouragement and suggestions for improvement during the long process of writing and testing this piece of code.
To J. Welles Wilder Jr. for ATR, used extensively throughout the Engine.
To TradingView for graciously making an account available to PineCoders.
And finally, to all fellow PineCoders for the constant intellectual stimulation; it is a privilege to share ideas with you all. The Engine is for all TradingView PineCoders, of course—but especially for you.
Look first. Then leap.






















