OPEN-SOURCE SCRIPT

Fractal Runner Strategy [LuxAlgo]

262
Follow these exact rules and logic step-by-step:

1. Inputs & Core Components
EMA 1: Length 36 (Source: Close)
EMA 2: Length 100 (Source: Close)
Fractals: Standard Williams Fractals (5-bar period: 2 bars before, 1 center, 2 bars after).
2. Multi-Timeframe Trend Filter (4-Hour Chart)
The indicator must track the trend on the 4-Hour (240 min) timeframe using Market Structure.
4H Uptrend: Higher Highs and Higher Lows.
4H Downtrend: Lower Highs and Lower Lows.
Signals on the current timeframe should only trigger if they align with the 4H trend direction.
3. Entry Conditions
LONG Signal (Buy)
Trigger a "Buy" signal when ALL of the following are true on the 15-minute chart:

Trend Alignment: The 4-Hour trend is Bullish (Higher Highs/Higher Lows).
EMA Alignment: The 36 EMA is strictly ABOVE the 100 EMA.
Pullback Rule: Identify the two most recent Fractal Highs. The most recent Fractal High must be LOWER than the previous Fractal High.
Trigger: Plot a "Buy Stop" level 1 pip ABOVE that most recent Fractal High.
SHORT Signal (Sell)
Trigger a "Sell" signal when ALL of the following are true on the 15-minute chart:

Trend Alignment: The 4-Hour trend is Bearish (Lower Highs/Lower Lows).
EMA Alignment: The 36 EMA is strictly BELOW the 100 EMA.
Pullback Rule: Identify the two most recent Fractal Lows. The most recent Fractal Low must be HIGHER than the previous Fractal Low.
Trigger: Plot a "Sell Stop" level 1 pip BELOW that most recent Fractal Low.
4. Trade Management Visuals (Levels)
When a signal triggers, plot the following levels dynamically on the chart for visual reference:

Entry Price: 1 pip above/below the triggering fractal.
Stop Loss (SL): 1 pip below/above the most recent opposite fractal.
Take Profit (TP): Fixed 1:1 Risk-to-Reward ratio based on the distance between Entry and SL.
5. Visuals & Alerts
Plot a green "▲" shape below the bar for a Buy Setup.
Plot a red "▼" shape above the bar for a Sell Setup.
Include alertcondition() functions for both Buy and Sell setups so I can set up real-time notifications.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.