OPEN-SOURCE SCRIPT

FlexiSuperTrend - Strategy [presentTrading]

Updated
█ Introduction and How it is Different

The "FlexiSuperTrend - Strategy" by PresentTrading is a cutting-edge trading strategy that redefines market analysis through the integration of the SuperTrend indicator and advanced variance tracking.

BTC 6H L/S
snapshot

This strategy stands apart from conventional methods by its dynamic adaptability, capturing market trends and momentum shifts with increased sensitivity. It's designed for traders seeking a more responsive tool to navigate complex market movements.

Local
snapshot

█ Strategy, How It Works: Detailed Explanation

The "FlexiSuperTrend - Strategy" employs a multifaceted approach, combining the adaptability of the SuperTrend indicator with variance tracking. The strategy's core lies in its unique formulation and application of these components:

🔶 SuperTrend Polyfactor Oscillator:
- Basic Concept: The oscillator is a series of SuperTrend calculations with varying ATR lengths and multipliers. This approach provides a broader and more nuanced perspective of market trends.
- Calculation:
- For each iteration, `i`, the SuperTrend is calculated using:
- `ATR Length = indicatorLength * (startingFactor + i * incrementFactor)`.
- `Multiplier = dynamically adjusted based on market conditions`.
- The SuperTrend output for each iteration is compared with the indicator source (like hlc3), and the deviation is recorded.

SuperTrend Calculation:
- `Upper Band (UB) = hl2 + (ATR Length * Multiplier)`
- `Lower Band (LB) = hl2 - (ATR Length * Multiplier)`
- Where `hl2` is the average of high and low prices.

Deviation Calculation:
- `Deviation = indicatorSource - SuperTrend Value`
- This value is calculated for each SuperTrend setting in the oscillator series.

🔶 Indicator Source (`hlc3`):
- **Usage:** The strategy uses the average of high, low, and close prices, providing a balanced representation of market activity.

🔶 Adaptive ATR Lengths and Factors:
- Dynamic Adjustment: The strategy adjusts the ATR length and multiplier based on the `startingFactor` and `incrementFactor`. This adaptability is key in responding to changing market volatilities.
- Equation: ATR Length at each iteration `i` is given by `len = indicatorLength * (startingFactor + i * incrementFactor)`.

incrementFactor - 1
snapshot

incrementFactor - 2
snapshot

🔶 Normalization Methods:
Purpose: To standardize the deviations for comparability.
- Methods:
- 'Max-Min': Scales the deviation based on the range of values.
- 'Absolute Sum': Uses the sum of absolute deviations for normalization.

Normalization 'Absolute Sum'
snapshot

- For 'Max-Min': `Normalized Deviation = (Deviation - Min(Deviations)) / (Max(Deviations) - Min(Deviations))`
- For 'Absolute Sum': `Normalized Deviation = Deviation / Sum(Absolute(Deviations))`

🔶 Trading Logic:
The strategy integrates the SuperTrend indicator, renowned for its effectiveness in identifying trend direction and reversals. The SuperTrend's incorporation enhances the strategy's ability to filter out false signals and confirm genuine market trends. * The SuperTrend Toolkit is made by @QuantiLuxe
- Long Entry Conditions: A buy signal is generated when the current trend, as indicated by the SuperTrend Polyfactor Oscillator, turns positive.
- Short Entry Conditions: A sell signal is triggered when the current trend turns negative.
- Entry and Exit Strategy: The strategy opens or closes positions based on these signals, aligning with the selected trade direction (long, short, or both).


█ Trade Direction

The strategy is versatile, allowing traders to choose their preferred trading direction: long, short, or both. This flexibility enables traders to tailor their strategies to their market outlook and risk appetite.

█ Usage

The FlexiSuperTrend strategy is suitable for various market conditions and can be adapted to different asset classes and time frames. Traders should set the strategy parameters according to their risk tolerance and trading goals. It's particularly useful for capturing long-term movements, ideal for swing traders, yet adaptable for short-term trading strategies.

█ Default Settings

1. Trading Direction: Choose from "Long", "Short", or "Both" to define the trade type.
2. Indicator Source (HLC3): Utilizes the HLC3 as the primary price reference.
3. Indicator Length (Default: 10): Influences the moving average calculation and trend sensitivity.
4. Starting Factor (0.618): Initiates the ATR length, influenced by Fibonacci ratios.
5. Increment Factor (0.382): Adjusts the ATR length incrementally for dynamic trend tracking.
6. Normalization Method: Options include "None", "Max-Min", and "Absolute Sum" for scaling deviations.
7. SuperTrend Settings: Varied ATR lengths and multipliers tailor the indicator's responsiveness.
8. Additional Settings: Features mesh style plotting and customizable colors for visual distinction.

The default settings provide a balanced approach, but users are encouraged to adjust them based on their individual trading style and market analysis.
Release Notes
Revise:
// Entry/Exit conditions
LongEntry = st.d < 0 and medianValue > 0
LongExit = st.d > 0
ShortEntry = st.d > 0 and medianValue < 0
ShortExit = st.d < 0

1. Long Entry Conditions: Activated when SuperTrend direction is negative (downward) and the median oscillator value is above zero.
2. Short Entry Conditions: Triggered when SuperTrend direction is positive (upward) and the median oscillator value is below zero.
3. Long Exit Conditions: Initiated when the SuperTrend direction turns positive, signaling a potential end to the upward trend.
4. Short Exit Conditions: Occur when the SuperTrend direction switches to negative, indicating a possible reversal from a downward trend.
Average True Range (ATR)deviationhistogramnormalizedpresenttradingsentimentstrategysupertrendTrend Analysis

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Watch patiently/ then trade
Also on:

Disclaimer