OPEN-SOURCE SCRIPT

Multi-Step FlexiSuperTrend - Strategy [presentTrading]

Diupdate
At the heart of this endeavor is a passion for continuous improvement in the art of trading

█ Introduction and How it is Different

The "Multi-Step FlexiSuperTrend - Strategy [presentTrading]" is an advanced trading strategy that integrates the well-known SuperTrend indicator with a nuanced and dynamic approach to market trend analysis. Unlike conventional SuperTrend strategies that rely on static thresholds and fixed parameters, this strategy introduces multi-step take profit mechanisms that allow traders to capitalize on varying market conditions in a more controlled and systematic manner.

What sets this strategy apart is its ability to dynamically adjust to market volatility through the use of an incremental factor applied to the SuperTrend calculation. This adjustment ensures that the strategy remains responsive to both minor and major market shifts, providing a more accurate signal for entries and exits. Additionally, the integration of multi-step take profit levels offers traders the flexibility to scale out of positions, locking in profits progressively as the market moves in their favor.

BTC 6hr Long/Short Performance
cuplikan

█ Strategy, How it Works: Detailed Explanation

The Multi-Step FlexiSuperTrend strategy operates on the foundation of the SuperTrend indicator, but with several enhancements that make it more adaptable to varying market conditions. The key components of this strategy include the SuperTrend Polyfactor Oscillator, a dynamic normalization process, and multi-step take profit levels.

🔶 SuperTrend Polyfactor Oscillator

The SuperTrend Polyfactor Oscillator is the heart of this strategy. It is calculated by applying a series of SuperTrend calculations with varying factors, starting from a defined "Starting Factor" and incrementing by a specified "Increment Factor." The indicator length and the chosen price source (e.g., HLC3, HL2) are inputs to the oscillator.

The SuperTrend formula typically calculates an upper and lower band based on the average true range (ATR) and a multiplier (the factor). These bands determine the trend direction. In the FlexiSuperTrend strategy, the oscillator is enhanced by iteratively applying the SuperTrend calculation across different factors. The iterative process allows the strategy to capture both minor and significant trend changes.

For each iteration (indexed by `i`), the following calculations are performed:

1. ATR Calculation: The Average True Range (ATR) is calculated over the specified `indicatorLength`:

ATR_i = ATR(indicatorLength)

2. Upper and Lower Bands Calculation: The upper and lower bands are calculated using the ATR and the current factor:

Upper Band_i = hl2 + (ATR_i * Factor_i)

Lower Band_i = hl2 - (ATR_i * Factor_i)

Here, `Factor_i` starts from `startingFactor` and is incremented by `incrementFactor` in each iteration.

3. Trend Determination: The trend is determined by comparing the indicator source with the upper and lower bands:

Trend_i = 1 (uptrend) if IndicatorSource > Upper Band_i

Trend_i = 0 (downtrend) if IndicatorSource < Lower Band_i

Otherwise, the trend remains unchanged from the previous value.

4. Output Calculation: The output of each iteration is determined based on the trend:

Output_i = Lower Band_i if Trend_i = 1

Output_i = Upper Band_i if Trend_i = 0

This process is repeated for each iteration (from 0 to 19), creating a series of outputs that reflect different levels of trend sensitivity.

Local
cuplikan

🔶 Normalization Process

To make the oscillator values comparable across different market conditions, the deviations between the indicator source and the SuperTrend outputs are normalized. The normalization method can be one of the following:

1. Max-Min Normalization: The deviations are normalized based on the range of the deviations:

Normalized Value_i = (Deviation_i - Min Deviation) / (Max Deviation - Min Deviation)

2. Absolute Sum Normalization: The deviations are normalized based on the sum of absolute deviations:

Normalized Value_i = Deviation_i / Sum of Absolute Deviations

This normalization ensures that the oscillator values are within a consistent range, facilitating more reliable trend analysis.

For more details:
https://www.tradingview.com/script/y9noW915-FlexiSuperTrend-Strategy-presentTrading/

🔶 Multi-Step Take Profit Mechanism

One of the unique features of this strategy is the multi-step take profit mechanism. This allows traders to lock in profits at multiple levels as the market moves in their favor. The strategy uses three take profit levels, each defined as a percentage increase (for long trades) or decrease (for short trades) from the entry price.

1. First Take Profit Level: Calculated as a percentage increase/decrease from the entry price:

TP_Level1 = Entry Price * (1 + tp_level1 / 100) for long trades

TP_Level1 = Entry Price * (1 - tp_level1 / 100) for short trades

The strategy exits a portion of the position (defined by `tp_percent1`) when this level is reached.

2. Second Take Profit Level: Similar to the first level, but with a higher percentage:

TP_Level2 = Entry Price * (1 + tp_level2 / 100) for long trades

TP_Level2 = Entry Price * (1 - tp_level2 / 100) for short trades

The strategy exits another portion of the position (`tp_percent2`) at this level.

3. Third Take Profit Level: The final take profit level:

TP_Level3 = Entry Price * (1 + tp_level3 / 100) for long trades

TP_Level3 = Entry Price * (1 - tp_level3 / 100) for short trades

The remaining portion of the position (`tp_percent3`) is exited at this level.

This multi-step approach provides a balance between securing profits and allowing the remaining position to benefit from continued favorable market movement.


█ Trade Direction

The strategy allows traders to specify the trade direction through the `tradeDirection` input. The options are:

1. Both: The strategy will take both long and short positions based on the entry signals.
2. Long: The strategy will only take long positions.
3. Short: The strategy will only take short positions.

This flexibility enables traders to tailor the strategy to their market outlook or current trend analysis.

█ Usage

To use the Multi-Step FlexiSuperTrend strategy, traders need to set the input parameters according to their trading style and market conditions. The strategy is designed for versatility, allowing for various market environments, including trending and ranging markets.

Traders can also adjust the multi-step take profit levels and percentages to match their risk management and profit-taking preferences. For example, in highly volatile markets, traders might set wider take profit levels with smaller percentages at each level to capture larger price movements.

The normalization method and the incremental factor can be fine-tuned to adjust the sensitivity of the SuperTrend Polyfactor Oscillator, making the strategy more responsive to minor market shifts or more focused on significant trends.

█ Default Settings

The default settings of the strategy are carefully chosen to provide a balanced approach between risk management and profit potential. Here is a breakdown of the default settings and their effects on performance:

1. Indicator Length (10): This parameter controls the lookback period for the ATR calculation. A shorter length makes the strategy more sensitive to recent price movements, potentially generating more signals. A longer length smooths out the ATR, reducing sensitivity but filtering out noise.

2. Starting Factor (0.618): This is the initial multiplier used in the SuperTrend calculation. A lower starting factor makes the SuperTrend bands closer to the price, generating more frequent trend changes. A higher starting factor places the bands further away, filtering out minor fluctuations.

3. Increment Factor (0.382): This parameter controls how much the factor increases with each iteration of the SuperTrend calculation. A smaller increment factor results in more gradual changes in sensitivity, while a larger increment factor creates a wider range of sensitivity across the iterations.

4. Normalization Method (None): The default is no normalization, meaning the raw deviations are used. Normalization methods like Max-Min or Absolute Sum can make the deviations more consistent across different market conditions, improving the reliability of the oscillator.

5. Take Profit Levels (2%, 8%, 18%): These levels define the thresholds for exiting portions of the position. Lower levels (e.g., 2%) capture smaller profits quickly, while higher levels (e.g., 18%) allow positions to run longer for more significant gains.

6. Take Profit Percentages (30%, 20%, 15%): These percentages determine how much of the position is exited at each take profit level. A higher percentage at the first level locks in more profit early, reducing exposure to market reversals. Lower percentages at higher levels allow for a portion of the position to benefit from extended trends.
Catatan Rilis
Try to update to problem about the qty_type, mentioned by some users.
Average True Range (ATR)cryptomarkethistogramnormalizedpresenttradingsentimentalanalysisStandard DeviationStocksstrategysupertrendtradingstrategiesTrend Analysis

Skrip open-source

Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menerbitkannya sebagai sumber terbuka, sehingga para trader dapat memahami dan memverifikasinya. Hormat untuk penulisnya! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart

Inggin menggunakan skrip ini pada chart?


Watch patiently/ then trade
Juga di:

Pernyataan Penyangkalan