OPEN-SOURCE SCRIPT

Price Action Strategy

Atualizado
The **Price Action Strategy** is a tool designed to capture potential market reversals by utilizing classic reversal candlestick patterns such as Hammer, Shooting Star, Doji, and Pin Bar near dinamic support and resistance levels.

***Note to moderators
- The moving average was removed from the strategy because it was not suitable for the strategy and not participating in the entry or exit criteria.

- The moving average length has been replaced/renamed by the support/resistance lenght.

- The bullish engulfing and bearish engulfing patterns were also removed because in practice they were not working as entry criteria, since the candle price invariably closes far from the support/resistance level even considering the sensitivity range. There was no change in the backtest results after removing these patterns.


### Key Elements of the Strategy

1. Support and Resistance Levels
- Support and resistance are pivotal price levels where the asset has previously struggled to move lower (support) or higher (resistance). These levels act as psychological barriers where buying interest (at support) or selling interest (at resistance) often increases, potentially causing price reversals.
- In this strategy, support is calculated as the lowest low and resistance as the highest high over a 16-period length. When the price nears these levels, it indicates possible zones for a reversal, and the strategy looks for specific candlestick patterns to confirm an entry.

2. Candlestick Patterns
- This strategy uses classic reversal patterns, including:
- **Hammer**: Indicates a buy signal, suggesting rejection of lower prices.
- **Shooting Star**: Suggests a sell signal, showing rejection of higher prices.
- **Doji**: Reflects indecision and potential reversal.
- **Pin Bar**: Represents price rejection with a long shadow, often signaling a reversal.

By combining these reversal patterns with the proximity to dinamic support or resistance levels, the strategy aims to capture potential reversal movements.

3. Sensitivity Level
- The sensitivity parameter adjusts the acceptable range (Default 0.018 = 1.8%) around support and resistance levels within which reversal patterns can trigger trades (i.e. the closing price of the candle must occur within the specified range defined by the sensitivity parameter). A higher sensitivity value expands this range, potentially leading to less accurate signals, as it may allow for more false positives.

4. Entry Criteria
- **Buy (Long)**: A Hammer, Doji, or Pin Bar pattern near support.
- **Sell (Short)**: A Shooting Star, Doji, or Pin Bar near resistance.

5. Exit criteria
- Take profit = 9.5%
- Stop loss = 16%

6. No Repainting
- The Price Action Strategy is not subject to repainting.

7. Position Sizing by Equity and risk management
- This strategy has a default configuration to operate with 35% of the equity. The stop loss is set to 16% from the entry price. This way, the strategy is putting at risk about 16% of 35% of equity, that is, around 5.6% of equity for each trade. The percentage of equity and stop loss can be adjusted by the user according to their risk management.

8. Backtest results
- This strategy was subjected to deep backtest and operations in replay mode on **1000000MOGUSDT.P**, with the inclusion of transaction fees at 0.12% and slipagge of 5 ticks, and the past results have shown consistent profitability. Past results are no guarantee of future results. The strategy's backtest results may even be due to overfitting with past data.

9. Chart Visualization
- Support and resistance levels are displayed as green (support) and red (resistance) lines.
- Only the candlestick pattern that generated the entry signal to triger the trade is identified and labeled on the chart. During the operation, the occurrence of new Doji, Pin Bar, Hammer and Shooting Star patterns will not be demonstrated on the chart, since the exit criteria are based on percentage take profit and stop loss.

Doji:
snapshot

Pin Bar and Doji
snapshot

Shooting Star and Doji
snapshot

Hammer
snapshot


10. Default settings
Chart timeframe: 20 min
Moving average lenght: 16
Sensitivity: 0.018
Stop loss (%): 16
Take Profit (%): 9.5

11000000MOGUSDT.P
Notas de Lançamento
- The moving average was removed from the strategy because it was not suitable for the strategy and not participating in the entry or exit criteria.

- The moving average length has been replaced/renamed by the support/resistance lenght.

- The bullish engulfing and bearish engulfing patterns were also removed because in practice they were not working as entry criteria, since the candle price invariably closes far from the support/resistance level even considering the sensitivity range. There was no change in the backtest results after removing these patterns.
Bearish EngulfingBullish EngulfingCandlestick analysisDojiHammerMoving AveragesPin BarreversalShooting StarsupportSupport and Resistance

Script de código aberto

No verdadeiro espírito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam compreendê-lo e analisá-lo. Parabéns ao autor! Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Quer usar esse script no gráfico?

Aviso legal