OPEN-SOURCE SCRIPT
Updated

Dskyz Adaptive Futures Elite (DAFE)

1 930
Dskyz Adaptive Futures Edge (DAFE)

https://imgur.com/a/pnDDMqJ

A Dynamic Futures Trading Strategy

DAFE adapts to market volatility and price action using technical indicators and advanced risk management. It’s built for high-stakes futures trading (e.g., MNQ, BTCUSDT.P), offering modular logic for scalpers and swing traders alike.

Key Features

Adaptive Moving Averages
Dynamic Logic: Fast and slow SMAs adjust lengths via ATR, reacting to momentum shifts and smoothing in calm markets.
Signals: Long entry on fast SMA crossing above slow SMA with price confirmation; short on cross below.

RSI Filtering (Optional)
Momentum Check: Confirms entries with RSI crossovers (e.g., above oversold for longs). Toggle on/off with custom levels.
Fine-Tuning: Adjustable lookback and thresholds (e.g., 60/40) for precision.

Candlestick Pattern Recognition
Eng|Enhanced Detection: Identifies strong bullish/bearish engulfing patterns, validated by volume and range strength (vs. 10-period SMA).
Conflict Avoidance: Skips trades if both patterns appear in the lookback window, reducing whipsaws.

Multi-Timeframe Trend Filter
15-Minute Alignment: Syncs intrabar trades with 15-minute SMA trends; optional for flexibility.

Dollar-Cost Averaging (DCA) New!
Scaling: Adds up to a set number of entries (e.g., 4) on pullbacks/rallies, spaced by ATR multiples.
Control: Caps exposure and resets on exit, enhancing trend-following potential.

Trade Execution & Risk Management
Entry Rules: Prioritizes moving averages or patterns (user choice), with volume, volatility, and time filters.
Stops & Trails:
Initial Stop: ATR-based (2–3.5x, volatility-adjusted).
Trailing Stop: Locks profits with configurable ATR offset and multiplier.

Discipline
Cooldown: Pauses post-exit (e.g., 0–5 minutes).
Min Hold: Ensures trades last a set number of bars (e.g., 2–10).

Visualization & Tools
Charts: Overlays MAs, stops, and signals; trend shaded in background.
Dashboard: Shows position, P&L, win rate, and more in real-time.
Debugging: Logs signal details for optimization.

Input Parameters
Parameter Purpose Suggested Use
Use RSI Filter - Toggle RSI confirmation *Disable 4 price-only
trading
RSI Length - RSI period (e.g., 14) *7–14 for sensitivity
RSI Overbought/Oversold - Adjust for market type *Set levels (e.g., 60/40)
Use Candlestick Patterns - Enables engulfing signals *Disable for MA focus
Pattern Lookback - Pattern window (e.g., 19) *10–20 bars for balance
Use 15m Trend Filter - Align with 15-min trend *Enable for trend trades
Fast/Slow MA Length - Base MA lengths (e.g., 9/19) *10–25 / 30–60 per
timeframe
Volatility Threshold - Filters volatile spikes *Max ATR/close (e.g., 1%)
Min Volume - Entry volume threshold *Avoid illiquid periods
(e.g., 10)
ATR Length - ATR period (e.g., 14) *Standard volatility
measure
Trailing Stop ATR Offset - Trail distance (e.g., 0.5) *0.5–1.5 for tightness
Trailing Stop ATR Multi - Trail multiplier (e.g., 1.0) *1–3 for trend room
Cooldown Minutes - Post-exit pause (e.g., 0–5) *Prevents overtrading
Min Bars to Hold - Min trade duration (e.g., 2) *5–10 for intraday
Trading Hours - Active window (e.g., 9–16) *Focus on key sessions
Use DCA - Toggle DCA *Enable for scaling
Max DCA Entries - Cap entries (e.g., 4) *Limit risk exposure
DCA ATR Multiplier Entry spacing (e.g., 1.0) *1–2 for wider gaps

Pine Script®
Compliance

Realistic Testing: Fixed quantities, capital, and slippage for accurate backtests.
Transparency: All logic is user-visible and adjustable.
Risk Controls: Cooldowns, stops, and hold periods ensure stability.
Flexibility: Adapts to various futures and timeframes.

Summary
DAFE excels in volatile futures markets with adaptive logic, DCA scaling, and robust risk tools. Currently in prop account testing, it’s a powerful framework for precision trading.

Caution
DAFE is experimental, not a profit guarantee. Futures trading risks significant losses due to leverage. Backtest, simulate, and monitor actively before live use. All trading decisions are your responsibility.
Release Notes
────────────────────────────── Dskyz Adaptive Futures Edge (DAFE) Summary

DAFE is a dynamic futures trading strategy designed for high-stakes instruments (e.g., MNQ, BTCUSDT.P) that adapts to market volatility and price action with advanced technical indicators and risk controls. It caters to both scalpers and swing traders by offering modular logic and detailed input parameters.

Adaptive Technical Indicators and Signal Generation

Adaptive Moving Averages: Uses fast and slow SMAs whose lengths adjust dynamically based on ATR. A long signal is generated when the fast SMA crosses above the slow SMA with price confirmation, while a short signal occurs on the reverse.

RSI Filtering (Optional): Provides momentum checks through RSI crossovers (e.g., confirmations above oversold levels for longs). Traders can toggle the filter and customize RSI lookback and thresholds (e.g., 60/40) for precision.

Candlestick Pattern Recognition: Detects strong bullish or bearish engulfing patterns confirmed by volume and strength relative to a 10-period SMA. It avoids conflicts by skipping trades if multiple patterns occur in the lookback window.

Multi-Timeframe Trend Filter: Optionally aligns intrabar signals with a 15-minute SMA trend, adding another layer of confirmation.

Risk Management and Trade Execution

Entry Rules: Prioritizes either the moving average signals or candlestick patterns, supplemented by filters on volume, volatility, and time.

Stops & Trailing Stops:

Initial Stop: Set using ATR (typically 2–3.5×, adjusted for volatility) applied from the entry bar.

Trailing Stop: Employs an ATR-based offset and multiplier that tightens as the trade becomes profitable (e.g., shifts to a 0.3–0.5 multiplier based on profit thresholds) to lock in gains.

Dollar-Cost Averaging (DCA):

Implements scaling into positions by adding up to a set number of entries (e.g., 4) on pullbacks or rallies, spaced by ATR multiples.

Ensures that exposure is capped and DCA variables reset on exit, maintaining clear state management.

Visualization, Debugging, and Compliance

Charts and Dashboard: Overlays include adaptive moving averages, stop levels, and entry signals (displayed as “Buy”/“Sell” labels), with a background trend indicator. A performance dashboard shows live position data, P&L, and win rate.

Debugging: Signal details are logged for systematic optimization.

Risk Controls and Discipline: Cooldown periods after exits and minimum hold durations help manage entry frequency and avoid overtrading.

Comparison of Old and New Code Improvements

ATR Calculation: Instead of a fixed ATR (period 14), the new system offers dynamic ATR adjustments based on chart timeframe (e.g., 5 for 2-minute, 7 for 5-minute) or a user-defined default, enhancing market responsiveness.

Volume Spike Filter: The new version adds a condition to check for a volume spike (volume > 1.2 * ta.sma(volume, 10)), ensuring entries are made during significant volume surges, unlike the old minimum volume threshold.

Stop-Loss & Trailing Stop Enhancements:

Introduces a wider initial stop (fixedStopMultiplier = 1.3) on the entry bar and adds a profit target (profitTargetATRMult = 1.2) to secure gains.

Implements dynamic trailing stops that adjust based on profit levels (tightening when profit exceeds certain ATR thresholds), preventing premature exits.

Enhanced Exit Logic and DCA Reset: Improves exit strategies by combining fixed stops, profit targets, and dynamically adjusted trailing stops, while ensuring that DCA variables reset properly, avoiding logic conflicts.

Visualization Enhancements: Upgraded debugging tables with better color coding and a comprehensive performance dashboard add clarity and ease of use.

────────────────────────────── Final Note:
While DAFE offers a robust framework for adaptive futures trading, it is experimental and not a profit guarantee. Detailed backtesting, simulation, and active monitoring are essential due to inherent trading risks with leveraged instruments.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.