OPEN-SOURCE SCRIPT
Zaktualizowano

Strategia Bystrego - Swing Break + FVG + EMA 200 + Entry Alerts

554
BYSTRY STRATEGY — SWING BREAKOUT, FAIR VALUE GAP AND EMA 200 FILTER

Overview

This strategy is designed specifically for the 2-minute chart and is intended for short-term trading on Nasdaq and Gold.

The system combines:

• Confirmed Swing High and Swing Low levels
• Break of Structure confirmation
• The first Fair Value Gap formed after the breakout
• A 50% Fair Value Gap retracement entry
• EMA 200 trend confirmation
• Previous Day, Previous Week and Asian Session liquidity filters
• Fixed Take Profit and Stop Loss levels
• Entry alerts generated only after the position is actually filled

The strategy does not open a position immediately after a structure breakout. It waits for the first valid Fair Value Gap and places a limit order at the midpoint of that imbalance.

TIMEFRAME

The strategy is designed exclusively for the 2-minute timeframe.

If the script is added to a different timeframe, it will generate an error and will not operate.

SUPPORTED MARKETS

The strategy contains two predefined market configurations:

NASDAQ

• Take Profit: 50 points
• Stop Loss: 50 points

GOLD

• Take Profit: 10 points
• Stop Loss: 10 points

The strategy uses a fixed 1:1 reward-to-risk ratio.

MARKET STRUCTURE

The strategy detects confirmed Swing High and Swing Low levels using pivot calculations.

Default pivot settings:

• Two candles on the left side
• Two candles on the right side

A Swing High or Swing Low becomes valid only after the required number of candles on the right side has closed.

LONG BREAK OF STRUCTURE

A bullish Break of Structure occurs when:

1. A confirmed Swing High exists.
2. The current candle closes above the Swing High.
3. The previous candle closed at or below that Swing High.
4. The strategy is not already in a trade.
5. There is no active pending order.
6. Long positions are enabled.
7. The price is above the EMA 200.

SHORT BREAK OF STRUCTURE

A bearish Break of Structure occurs when:

1. A confirmed Swing Low exists.
2. The current candle closes below the Swing Low.
3. The previous candle closed at or above that Swing Low.
4. The strategy is not already in a trade.
5. There is no active pending order.
6. Short positions are enabled.
7. The price is below the EMA 200.

FAIR VALUE GAP

After a valid Break of Structure, the strategy searches for the first Fair Value Gap.

By default, the Fair Value Gap must appear within three candles after the breakout. This value can be changed in the strategy settings.

Bullish Fair Value Gap:

A bullish Fair Value Gap is detected when the current candle’s low is above the high from two candles earlier.

Bullish FVG condition:

Current Low > High two candles earlier

Bearish Fair Value Gap:

A bearish Fair Value Gap is detected when the current candle’s high is below the low from two candles earlier.

Bearish FVG condition:

Current High < Low two candles earlier

ENTRY PRICE

The entry is placed at the 50% midpoint of the first valid Fair Value Gap.

Bullish entry:

Entry = Bullish FVG midpoint

Bearish entry:

Entry = Bearish FVG midpoint

The strategy uses a limit order. Therefore, the position is opened only when the market retraces back to the calculated entry price.

EMA 200 TREND FILTER

The EMA 200 is used as the main trend filter.

Long positions are allowed only when:

• The breakout candle closes above the EMA 200.
• The Fair Value Gap is formed while the price remains above the EMA 200.
• The planned limit entry is above the EMA 200.
• The market does not lose the EMA 200 while the limit order is pending.

Short positions are allowed only when:

• The breakout candle closes below the EMA 200.
• The Fair Value Gap is formed while the price remains below the EMA 200.
• The planned limit entry is below the EMA 200.
• The market does not move back above the EMA 200 while the limit order is pending.

The purpose of this filter is to prevent positions from being opened against the dominant 2-minute trend.

LIQUIDITY FILTER

Before placing a limit order, the strategy checks whether an important liquidity level is located between the planned entry and the Take Profit.

The following levels are monitored:

• Previous Day High
• Previous Day Low
• Previous Week High
• Previous Week Low
• Asian Session High
• Asian Session Low

A long setup is rejected when one of the following levels is located between the entry and Take Profit:

• Previous Day High
• Previous Week High
• Asian Session High

A short setup is rejected when one of the following levels is located between the entry and Take Profit:

• Previous Day Low
• Previous Week Low
• Asian Session Low

The purpose of this filter is to avoid entering directly into a nearby liquidity level that could stop or reverse the price before the target is reached.

PENDING ORDER CANCELLATION

A pending limit order can be cancelled when:

• The order has not been filled within the selected number of candles.
• The EMA 200 trend condition is no longer valid.
• A new liquidity level blocks the path to the target.
• The price reaches the theoretical Take Profit before retracing to the entry.
• The planned entry moves to the wrong side of the EMA 200.

The default pending order lifetime is 30 candles.

POSITION MANAGEMENT

The strategy allows only one active position at a time.

Pyramiding is disabled.

After the entry is filled, the strategy automatically places:

• A fixed Take Profit order
• A fixed Stop Loss order

The Take Profit and Stop Loss are calculated from the actual average position entry price.

ENTRY ALERTS

Alerts are generated only after the position is actually opened.

The strategy does not send an entry alert when:

• A Swing High or Swing Low appears.
• A Break of Structure appears.
• A Fair Value Gap appears.
• A pending limit order is created.

The alert is sent only when the limit order is filled and the strategy position changes from zero to either long or short.

The alert message includes:

• Direction
• Symbol
• Timeframe
• Entry price
• Take Profit
• Stop Loss
• EMA 200 filter confirmation

VISUAL ELEMENTS

The strategy can display:

• Confirmed Swing High levels
• Confirmed Swing Low levels
• EMA 200
• Previous Day High and Low
• Previous Week High and Low
• Asian Session High and Low
• Fair Value Gap area
• Profit area
• Risk area
• Entry level
• Take Profit level
• Stop Loss level
• Break of Structure markers
• Diagnostic rejection markers

IMPORTANT LIMITATIONS

This strategy does not predict future market direction.

The EMA 200 is a trend filter, but it does not eliminate false breakouts or losing positions.

The system may perform poorly during:

• Low-volume consolidation
• Rapidly changing market conditions
• Major economic announcements
• Whipsaw conditions around the EMA 200
• Sessions with limited liquidity
• Markets with unusually high volatility

Historical results do not guarantee future performance.

Real trading results may differ from backtest results because of commissions, spread, slippage, latency and differences between simulated and real order execution.

This strategy is provided for educational and research purposes only. It does not constitute financial or investment advice.
Informacje o Wersji
up
Informacje o Wersji
up

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.