OPEN-SOURCE SCRIPT

Scalping with Williams %R, MACD, and SMA (1m)

Overview:
This trading strategy is designed for scalping in the 1-minute timeframe. It uses a combination of the Williams %R, MACD, and SMA indicators to generate buy and sell signals. It also includes alert functionalities to notify users when trades are executed or closed.

Indicators Used:
  1. Williams %R: A momentum indicator that measures overbought and oversold conditions. The Williams %R values range from -100 to 0.
    Length: 140 bars (i.e., 140-period).

  2. MACD (Moving Average Convergence Divergence): A trend-following momentum indicator that shows the relationship between two moving averages of a security's price.
    Fast Length: 24 bars
    Slow Length: 52 bars
    MACD Length: 9 bars (signal line)

  3. SMA (Simple Moving Average): A trend-following indicator that smooths out price data to create a trend-following indicator.
    Length: 7 bars


Conditions and Logic:
  1. Timeframe Check:
    The strategy is designed specifically for the 1-minute timeframe. If the current chart is not on the 1-minute timeframe, a warning label is displayed on the chart instructing the user to switch to the 1-minute timeframe.

  2. Williams %R Conditions:
    Buy Condition: The strategy looks for a crossover of Williams %R from below -94 to above -94. This indicates a potential buying opportunity when the market is moving out of an oversold condition.
    Sell Condition: The strategy looks for a crossunder of Williams %R from above -6 to below -6. This indicates a potential selling opportunity when the market is moving out of an overbought condition.
    Deactivate Buy: If Williams %R crosses above -40, the buy signal is deactivated, suggesting that the buying condition is no longer valid.
    Deactivate Sell: If Williams %R crosses below -60, the sell signal is deactivated, suggesting that the selling condition is no longer valid.

  3. MACD Conditions:
    MACD Histogram: Used to identify the momentum and the direction of the trend.
    Long Entry: The strategy initiates a buy order if the MACD histogram shows a positive bar after a negative bar while a buy condition is active and Williams %R is above -94.
    Long Exit: The strategy exits the buy position if the MACD histogram turns negative and is below the previous histogram bar.
    Short Entry: The strategy initiates a sell order if the MACD histogram shows a negative bar after a positive bar while a sell condition is active and Williams %R is below -6.
    Short Exit: The strategy exits the sell position if the MACD histogram turns positive and is above the previous histogram bar.

  4. Trend Confirmation (Using SMA):
    Bullish Trend: The strategy considers a bullish trend if the current price is above the 7-bar SMA. A buy signal is only considered if this condition is met.
    Bearish Trend: The strategy considers a bearish trend if the current price is below the 7-bar SMA. A sell signal is only considered if this condition is met.


Alerts:
Long Entry Alert: An alert is triggered when a buy order is executed.
Long Exit Alert: An alert is triggered when the buy order is closed.
Short Entry Alert: An alert is triggered when a sell order is executed.
Short Exit Alert: An alert is triggered when the sell order is closed.

Summary:
Buy Signal: Activated when Williams %R crosses above -94 and the price is above the 7-bar SMA. A buy order is placed if the MACD histogram shows a positive bar after a negative bar. The buy order is closed when the MACD histogram turns negative and is below the previous histogram bar.

Sell Signal: Activated when Williams %R crosses below -6 and the price is below the 7-bar SMA. A sell order is placed if the MACD histogram shows a negative bar after a positive bar. The sell order is closed when the MACD histogram turns positive and is above the previous histogram bar.

This strategy combines momentum (Williams %R), trend-following (MACD), and trend confirmation (SMA) to identify trading opportunities in the 1-minute timeframe. It is designed for short-term trading or scalping.
Moving Average Convergence / Divergence (MACD)scalpingSimple Moving Average (SMA)Williams %R (%R)

Script de código abierto

Siguiendo fielmente el espíritu de TradingView, el autor de este script lo ha publicado en código abierto, permitiendo que otros traders puedan entenderlo y verificarlo. ¡Olé por el autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la reutilización de este código en la publicación se rige por las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

¿Quiere utilizar este script en un gráfico?

Exención de responsabilidad