OPEN-SOURCE SCRIPT

4-Hour Range Scalping [v6.3]

120
User Guide: 4-Hour Range Scalping Strategy
Hello! Here is the guide for the Pine Script strategy. Please read it carefully to get the best results.

📈 This script automates the "4-Hour Range Scalping Strategy" from the video.

The main idea is that the first four hours of a major trading day (like New York) set up a "trap zone." The strategy waits for the price to break out of this zone and then fail, giving us a signal that the breakout was false and the price is likely to reverse.

Here’s the simple logic:

  1. Define the Range: It precisely calculates the highest high and lowest low during the first four hours of the selected trading session (e.g., 00:00 to 04:00 New York Time).

  2. Wait for a Breakout: It then monitors the 5-minute chart for a price breakout where a candle fully closes outside of this established range.

  3. Identify the Reversal: The trade trigger occurs when the price fails to continue its breakout and a subsequent 5-minute candle closes back inside the range. This signals a potential reversal or "failed breakout."

  4. Execute the Trade:

    ]A Short (Sell) trade is triggered after a failed breakout above the range high.
    A Long (Buy) trade is triggered after a failed breakout below the range low.

  5. Manage the Risk: The Stop Loss is automatically placed at the peak (for shorts) or trough (for longs) of the breakout move, and the Take Profit is set to a default 2:1 Risk/Reward Ratio.


How to Use the Script (Step-by-Step) ⚙️
Follow these instructions to get it running perfectly.

1. Set Your Chart Timeframe This is the most important step. The strategy is designed to run on a 5-minute (5m) chart. Open your TradingView chart and make sure the timeframe is set to "5m".

2. Add the Script to Your Chart Open the Pine Editor tab at the bottom of TradingView, paste the entire script, and click the "Add to chart" button.

3. Configure the Settings On your chart, find the strategy's name (e.g., "4-Hour Range Scalping [v6.3]") and click the gear icon ⚙️ to open its settings.

Trading Session: Choose the session for the range. New York is the default and the one from the video.

Risk/Reward Ratio: The default is 2.0, meaning your potential profit is twice your potential loss. You can adjust this to test other targets.

Backtesting Period: To see how the strategy performed on all historical data, go to the "Strategy Tester" panel, click its own gear icon ⚙️, and uncheck the boxes for "Start Date" and "End Date."

4. Understand the Visuals on Your Chart

Blue Background Area: This is the 4-hour calculation window. The script is identifying the day's high and low during this time. No trades will ever happen here.

Red Line (Range High): The highest price of the 4-hour window. This is the upper boundary of the "trap zone."

Green Line (Range Low): The lowest price of the 4-hour window. This is the lower boundary.

Green Triangle (▲): Shows where a Long (Buy) trade was entered.

Red Triangle (▼): Shows where a Short (Sell) trade was entered.

A Very Important Note on Timezones 🕒
This is critical for you in the Philippines (PHT).

The script is based on the New York session, which is 12 hours behind you. Your TradingView chart will still show your local time, but the script works on NY time in the background.

The New York "day" begins at 12:00 PM (Noon) your time.

The script's blue calculation window will be from 12:00 PM to 4:00 PM your local time.

The red and green range lines will appear on your chart only after 4:00 PM your time.

So, if you look at your chart in the morning or early afternoon, you will not see today's range yet. This is normal! The script is just waiting for the New York session to start.

How to Set Up Trade Alerts 🔔
You can have TradingView send you a notification whenever the script enters a trade.

Click the "Alert" button (looks like a clock) in the right-hand toolbar of TradingView.

In the "Condition" dropdown, select the name of the script (e.g., "4-Hour Range Scalping...").

You will then see two options: "Long Signal" and "Short Signal".

Select one (e.g., "Long Signal") and configure how you want to be notified (e.g., "Notify on app").

Click "Create". Repeat the process to create an alert for the other signal.

⚠️ Important Disclosure
For Educational and Research Purposes Only.

This script and all accompanying information are provided for educational and research purposes only. The strategy demonstrated is a technical concept and should not be misconstrued as financial, investment, legal, or tax advice.

Trading financial markets involves substantial risk and is not suitable for every investor. There is a possibility that you could sustain a loss of some or all of your initial investment. Therefore, you should not invest money that you cannot afford to lose.

Past performance is not indicative of future results. The backtesting results shown by this script are historical and do not guarantee future performance. Market conditions are constantly changing.

By using this script, you acknowledge that you are solely responsible for any and all trading decisions you make. You should conduct your own thorough research and, if necessary, seek advice from an independent financial advisor before making any investment decisions. The creators of this script assume no liability for any of your trading results.

Exención de responsabilidad

La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.