OPEN-SOURCE SCRIPT

VIDYA ProTrend Multi-Tier Profit

Hello! This time is about a trend-following system.

VIDYA is quite an interesting indicator that adjusts dynamically to market volatility, making it more responsive to price changes compared to traditional moving averages. Balancing adaptability and precision, especially with the more aggressive short trade settings, challenged me to fine-tune the strategy for a variety of market conditions.

█ Introduction and How it is Different

The "VIDYA ProTrend Multi-Tier Profit" strategy is a trend-following system that combines the VIDYA (Variable Index Dynamic Average) indicator with Bollinger Bands and a multi-step take-profit mechanism.

Unlike traditional trend strategies, this system allows for more adaptive profit-taking, adjusting for long and short positions through distinct ATR-based and percentage-based targets. The innovation lies in its dynamic multi-tier approach to profit-taking, especially for short trades, where more aggressive percentages are applied using a multiplier. This flexibility helps adapt to various market conditions by optimizing trade management and profit allocation based on market volatility and trend strength.

BTCUSD 6hr performance
תמונת-בזק

█ Strategy, How it Works: Detailed Explanation

The core of the "VIDYA ProTrend Multi-Tier Profit" strategy lies in the dual VIDYA indicators (fast and slow) that analyze price trends while accounting for market volatility. These indicators work alongside Bollinger Bands to filter trade entries and exits.

🔶 VIDYA Calculation

The VIDYA indicator is calculated using the following formula:

Smoothing factor (𝛼):
alpha = 2 / (Length + 1)

VIDYA formula:
VIDYA(t) = alpha * k * Price(t) + (1 - alpha * k) * VIDYA(t-1)

Where:
k = |Chande Momentum Oscillator (MO)| / 100

🔶 Bollinger Bands as a Volatility Filter

Bollinger Bands are calculated using a rolling mean and standard deviation of price over a specified period:

Upper Band:
BB_upper = MA + (K * stddev)

Lower Band:
BB_lower = MA - (K * stddev)

Where:
MA is the moving average,
K is the multiplier (typically 2), and
stddev is the standard deviation of price over the Bollinger Bands length.

These bands serve as volatility filters to identify potential overbought or oversold conditions, aiding in the entry and exit logic.

🔶 Slope Calculation for VIDYA

The slopes of both fast and slow VIDYAs are computed to assess the momentum and direction of the trend. The slope for a given VIDYA over its length is:

Slope = (VIDYA(t) - VIDYA(t-n)) / n

Where:
n is the length of the lookback period. Positive slope indicates bullish momentum, while negative slope signals bearish momentum.

LOCAL picture
תמונת-בזק

🔶 Entry and Exit Conditions

- Long Entry: Occurs when the price moves above the slow VIDYA and the fast VIDYA is trending upward. Bollinger Bands confirm the signal when the price crosses the upper band, indicating bullish strength.
- Short Entry: Happens when the price drops below the slow VIDYA and the fast VIDYA trends downward. The signal is confirmed when the price crosses the lower Bollinger Band, showing bearish momentum.
- Exit: Based on VIDYA slopes flattening or reversing, or when the price hits specific ATR or percentage-based profit targets.

🔶 Multi-Step Take Profit Mechanism

The strategy incorporates three levels of take profit for both long and short trades:
- ATR-based Take Profit: Each step applies a multiple of the ATR (Average True Range) to the entry price to define the exit point.

The first level of take profit (long):
TP_ATR1_long = Entry Price + (2.618 * ATR)
etc.

█ Trade Direction

The strategy offers flexibility in defining the trading direction:
- Long: Only long trades are considered based on the criteria for upward trends.
- Short: Only short trades are initiated in bearish trends.
- Both: The strategy can take both long and short trades depending on the market conditions.

█ Usage

To use the strategy effectively:
- Adjust the VIDYA lengths (fast and slow) based on your preference for trend sensitivity.
- Use Bollinger Bands as a filter for identifying potential breakout or reversal scenarios.
- Enable the multi-step take profit feature to manage positions dynamically, allowing for partial exits as the price reaches specified ATR or percentage levels.
- Leverage the short trade multiplier for more aggressive take profit levels in bearish markets.

This strategy can be applied to different asset classes, including equities, forex, and cryptocurrencies. Adjust the input parameters to suit the volatility and characteristics of the asset being traded.

█ Default Settings

The default settings for this strategy have been designed for moderate to trending markets:

- Fast VIDYA Length (10): A shorter length for quick responsiveness to price changes. Increasing this length will reduce noise but may delay signals.
- Slow VIDYA Length (30): The slow VIDYA is set longer to capture broader market trends. Shortening this value will make the system more reactive to smaller price swings.
- Minimum Slope Threshold (0.05): This threshold helps filter out weak trends. Lowering the threshold will result in more trades, while raising it will restrict trades to stronger trends.

Multi-Step Take Profit Settings
- ATR Multipliers (2.618, 5.0, 10.0): These values define how far the price should move before taking profit. Larger multipliers widen the profit-taking levels, aiming for larger trend moves. In higher volatility markets, these values might be adjusted downwards.
- Percentage Levels (3%, 8%, 17%): These percentage levels define how much the price must move before taking profit. Increasing the percentages will capture larger moves, while smaller percentages offer quicker exits.
- Short TP Multiplier (1.5): This multiplier applies more aggressive take profit levels for short trades. Adjust this value based on the aggressiveness of your short trade management.

Each of these settings directly impacts the performance and risk profile of the strategy. Shorter VIDYA lengths and lower slope thresholds will generate more trades but may result in more whipsaws. Higher ATR multipliers or percentage levels can delay profit-taking, aiming for larger trends but risking partial gains if the trend reverses too early.
ATRBollinger Bands (BB)crossovertradingpresenttradingslopestrategytakeprofittradingstrategiesTrend AnalysistrendtradingVariable Index Dynamic Average (VIDYA)

סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יוכלו להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אבל השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

רוצה להשתמש בסקריפ זה בגרף?


Watch patiently/ then trade
גם על:

כתב ויתור