## Overview
This strategy is a quantitative trading system based on the Supertrend indicator, combined with precise risk management mechanisms. The core of the strategy uses the crossover relationship between price and the Supertrend line to determine entry timing, while setting a 1% take profit and 1% stop loss for each trade, achieving precise control of risk and reward. The Supertrend indicator is calculated using the Average True Range (ATR) and a custom factor, effectively identifying market trend changes, helping traders enter at the early stages of trend formation and exit promptly when trends reverse, thereby improving the success rate and stability of trades.
The core principles of this strategy are based on the calculation and application of the Supertrend indicator:
Supertrend Indicator Calculation:
Entry Signal Generation:
Risk Management Mechanism:
Visual Assistance:
This strategy is written in Pine Script 5.0, using the ta.supertrend function to directly obtain Supertrend indicator values and direction, simplifying code structure and improving computational efficiency.
Trend Following Advantages:
Precise Risk Management:
Adjustable Parameters:
Visualized Trading Process:
Concise and Efficient Code:
Range-Bound Market Risk:
Fixed Percentage Risk:
Trend Reversal Delay:
Parameter Sensitivity:
Close Take Profit Level:
Dynamic Stop Loss and Take Profit:
Multi-Period Confirmation:
Intelligent Position Management:
Add Filtering Conditions:
Optimize Supertrend Parameters:
The “Multi-Period Supertrend Percentage Risk Management Strategy” is a quantitative trading system that combines trend following with precise risk management. The strategy captures market trend changes through the Supertrend indicator and controls risk using fixed percentage take profit and stop loss levels.
The main advantages of this strategy include clear operational rules, controllable risk, and adjustable parameters, making it suitable for use as a basic trading system. At the same time, the strategy also has disadvantages such as poor performance in oscillating markets and inflexible fixed percentage risk.
To further enhance strategy performance, consider introducing dynamic stop loss and take profit, multi-period confirmation, intelligent position management, and other optimization measures. Through these improvements, the strategy has the potential to further increase win rate and risk-adjusted returns while maintaining its original advantages.
This strategy is suitable for medium to long-term trend traders, especially those who value risk management and pursue stable returns. With reasonable parameter adjustments and strategy optimization, it can become a reliable trading system component.
/*backtest
start: 2024-12-04 00:00:00
end: 2025-02-25 15:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_CTP","currency":"FUTURES"}]
*/
//@version=5
strategy("Supertrend with 1% Target and 1% Stoploss", overlay=true)
// Input parameters
atr_length = input.int(14, title="ATR Length")
factor = input.float(3.0, title="Factor")
target_pct = input.float(1.0, title="Target Percentage", minval=0.1) / 100
stoploss_pct = input.float(1.0, title="Stop Loss Percentage", minval=0.1) / 100
// Supertrend calculation
[supertrend, direction] = ta.supertrend(factor, atr_length)
// Plot the Supertrend line
plot(supertrend, color=color.blue, linewidth=2, title="Supertrend")
// Long and Short conditions
long_condition = ta.crossover(close, supertrend)
short_condition = ta.crossunder(close, supertrend)
// Calculate stop loss and take profit levels
long_stop_loss = close * (1 - stoploss_pct)
long_take_profit = close * (1 + target_pct)
short_stop_loss = close * (1 + stoploss_pct)
short_take_profit = close * (1 - target_pct)
// Long position entry
if long_condition
strategy.entry("Long", strategy.long, stop=long_stop_loss, limit=long_take_profit)
// Short position entry
if short_condition
strategy.entry("Short", strategy.short, stop=short_stop_loss, limit=short_take_profit)
// Plot stoploss and take profit levels for visual reference
plot(long_condition ? long_take_profit : na, color=color.green, style=plot.style_line, linewidth=1, title="Long Take Profit")
plot(long_condition ? long_stop_loss : na, color=color.red, style=plot.style_line, linewidth=1, title="Long Stop Loss")
plot(short_condition ? short_take_profit : na, color=color.green, style=plot.style_line, linewidth=1, title="Short Take Profit")
plot(short_condition ? short_stop_loss : na, color=color.red, style=plot.style_line, linewidth=1, title="Short Stop Loss")