OPEN-SOURCE SCRIPT

# Strategic Multi-Step Supertrend - Strategy [presentTrading]

The code is mainly developed for me to stimulate the multi-step taking profit function for strategies. The result shows the drawdown can be reduced but at the same time reduced the profit as well. It can be a heuristic for futures leverage traders.

█ Introduction and How it is Different

The "Strategic Multi-Step Supertrend" is a trading strategy designed to leverage the power of multiple steps to optimize trade entries and exits across the Supertrend indicator. Unlike traditional strategies that rely on single entry and exit points, this strategy employs a multi-step approach to take profit, allowing traders to lock in gains incrementally. Additionally, the strategy is adaptable to both long and short trades, providing a comprehensive solution for dynamic market conditions.

This template strategy lies in its dual Supertrend calculation, which enhances the accuracy of trend detection and provides more reliable signals for trade entries and exits. This approach minimizes false signals and increases the overall profitability of trades by ensuring that positions are entered and exited at optimal points.

BTC 6h L/S Performance

█ Strategy, How It Works: Detailed Explanation

The "Strategic Multi-Step Supertrend Trader" strategy utilizes two Supertrend indicators calculated with different parameters to determine the direction and strength of the market trend. This dual approach increases the robustness of the signals, reducing the likelihood of entering trades based on false signals. Here is a detailed breakdown of how the strategy operates:

🔶 Supertrend Indicator Calculation

The Supertrend indicator is a trend-following overlay on the price chart, typically used to identify the direction of the trend. It is calculated using the Average True Range (ATR) to ensure that the indicator adapts to market volatility. The formula for the Supertrend indicator is:

Upper Band = (High + Low) / 2 + (Factor * ATR)
Lower Band = (High + Low) / 2 - (Factor * ATR)

Where:
- High and Low are the highest and lowest prices of the period.
- Factor is a user-defined multiplier.
- ATR is the Average True Range over a specified period.

The Supertrend changes its direction based on the closing price in relation to these bands.

🔶 Entry-Exit Conditions

The strategy enters long positions when both Supertrend indicators signal an uptrend, and short positions when both indicate a downtrend. Specifically:
- Long Condition: Supertrend1 < 0 and Supertrend2 < 0
- Short Condition: Supertrend1 > 0 and Supertrend2 > 0

- Long Exit Condition: Supertrend1 > 0 and Supertrend2 > 0
- Short Exit Condition: Supertrend1 < 0 and Supertrend2 < 0

🔶 Multi-Step Take Profit Mechanism

The strategy features a multi-step take profit mechanism, which allows traders to lock in profits incrementally. This is achieved through four user-configurable take profit levels. For each level, the strategy specifies a percentage increase (for long trades) or decrease (for short trades) in the entry price at which a portion of the position is exited:
- Step 1: Exit a portion of the trade at Entry Price * (1 + Take Profit Percent1 / 100)
- Step 2: Exit a portion of the trade at Entry Price * (1 + Take Profit Percent2 / 100)
- Step 3: Exit a portion of the trade at Entry Price * (1 + Take Profit Percent3 / 100)
- Step 4: Exit a portion of the trade at Entry Price * (1 + Take Profit Percent4 / 100)

This staggered exit strategy helps in locking profits at multiple levels, thereby reducing risk and increasing the likelihood of capturing the maximum possible profit from a trend.

BTC Local

The strategy is highly flexible, allowing users to specify the trade direction. There are three options available:
- Long Only: The strategy will only enter long trades.
- Short Only: The strategy will only enter short trades.
- Both: The strategy will enter both long and short trades based on the Supertrend signals.

This flexibility allows traders to adapt the strategy to various market conditions and their own trading preferences.

█ Usage
2. Configure the take profit settings under the "Take Profit Settings" group.
4. Adjust the Supertrend settings in the "Supertrend Settings" group to fine-tune the indicator calculations.
5. Monitor the chart for entry and exit signals as indicated by the strategy.

█ Default Settings

- Use Take Profit: True
- Take Profit Percentages: Step 1 - 6%, Step 2 - 12%, Step 3 - 18%, Step 4 - 50%
- Take Profit Amounts: Step 1 - 12%, Step 2 - 8%, Step 3 - 4%, Step 4 - 0%
- Number of Take Profit Steps: 3