PROTECTED SOURCE SCRIPT

自适应移动平均线通道策略

23
This strategy leverages the Fractal Adaptive Moving Average (FRAMA) to construct dynamic price channels, generating buy (long) and sell (short) signals based on price breakouts.

Signal Generation: Buy Signal: Triggered when price crosses above the upper band (▲).
Sell Signal: Triggered when price crosses below the lower band (▼).

Trading Logic: Long Entry: Opens a position when price breaks above the upper band.
Close Position: Closes long position on a short signal or when the 3% stop-loss is hit.

Visualization: FRAMA line displayed in green (bullish) or orange (bearish).
Candles colored based on trend (green for bullish, red for bearish).
Upper and lower bands plotted in semi-transparent green/orange.
Buy/sell signals marked with arrows (▲ for buy, ▼ for sell).

Use Cases Ideal for trending markets (e.g., stocks, futures, forex).
Applicable across timeframes (e.g., 1-minute, 1-hour, daily), with parameter tuning recommended.

Operating InstructionsAdding the Strategy Copy and paste the code into TradingView’s Pine Script editor and save.
Add to chart: Click “Add to Chart” to overlay the strategy on the price chart.

Parameter Settings Source: Select the price data type (e.g., “close,” “hl2,” default: “close”).
Average Length: Set the FRAMA calculation period (default: 50, adjust based on timeframe).
RAA Multiplier: Controls channel width (default: 1.15, higher values widen the channel).
Show Trend Signals: Enable to display buy/sell signals on the chart (default: enabled).
Color Candles Based on Trend: Enable to color candles by trend (default: enabled).
Bullish/Bearish Candle Color: Customize candle colors (default: green for bullish, red for bearish).

Chart Output FRAMA Line: Shows the adaptive average, green for bullish trends, orange for bearish.
Upper/Lower Bands: Semi-transparent green (upper) and orange (lower) bands indicate price range.
Signal Markers: Buy signals (green ▲ below bars) and sell signals (red ▼ above bars).
Candle Coloring: Bullish candles in green, bearish in red.

Trading Execution Automated Trading: Enable in TradingView’s Strategy Tester to execute trades based on signals.
Stop-Loss: Fixed at 3% below entry price for long positions.
Initial Capital: Default set to 100,000 (adjustable as needed).

Backtesting and Optimization Review performance metrics (win rate, profit factor, drawdown) in the Strategy Tester.
Optimize parameters based on market and timeframe: Short timeframes (e.g., 1-minute): Reduce length (e.g., 10–20).
High-volatility markets: Increase raa_mult (e.g., 1.5–2.0).



Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.