logo
Developers

Trading range display with Box

Script from: TradingViewSwingTrend following

This script displays the trading range, coloring it based on profitability. It’s a reference tool and not for actual trading. To visualize current trades, use process_orders_on_close=true, calc_on_every_tick=true, max_boxes_count=500. Avoid switching strategies within the same test period to ensure accurate range display. It involves repainting and is primarily for visual testing by copying from line 22 onwards in the script.

PAX Gold / TetherUS (PAXGUSDT)

+ Trading range display with Box

@ Daily

2.16

Risk Reward

70.71 %

Total ROI

57

Total Trades

Cronos/Tether (CROUSDT)

+ Trading range display with Box

@ Daily

1.33

Risk Reward

2,045.18 %

Total ROI

71

Total Trades

Toncoin (TONUSD)

+ Trading range display with Box

@ 4 h

1.31

Risk Reward

6.02 %

Total ROI

91

Total Trades

Zcash / TetherUS (ZECUSDT)

+ Trading range display with Box

@ 4 h

1.18

Risk Reward

992.66 %

Total ROI

490

Total Trades

Aptos (APTOUSD)

+ Trading range display with Box

@ 2 h

1.17

Risk Reward

4.31 %

Total ROI

136

Total Trades

Premium users only

Premium users can access all backtests with a Risk/Reward Ratio > 3

@ Daily

4.01

Risk Reward

25.48 %

Total ROI

18

Total Trades

Premium users only

Premium users can access all backtests with a Risk/Reward Ratio > 3

@ 2 h

3.45

Risk Reward

1,751.32 %

Total ROI

33

Total Trades

Bloom Energy Corporation (BE)

+ Trading range display with Box

@ Daily

2.08

Risk Reward

683.17 %

Total ROI

58

Total Trades

Goldman Sachs Group, Inc. (The) (GS)

+ Trading range display with Box

@ 4 h

1.95

Risk Reward

1,161.55 %

Total ROI

374

Total Trades

Spotify Technology S.A. (SPOT)

+ Trading range display with Box

@ 4 h

1.90

Risk Reward

540.55 %

Total ROI

124

Total Trades

AST SpaceMobile, Inc. (ASTS)

+ Trading range display with Box

@ 4 h

1.64

Risk Reward

1,496.04 %

Total ROI

87

Total Trades

IonQ, Inc. (IONQ)

+ Trading range display with Box

@ 4 h

1.57

Risk Reward

774.49 %

Total ROI

78

Total Trades
Create your account for free to see all 67+ backtests

Access filters, details, best timeframes, explore 100K+ backtests and more

Active Trades

Create your account to see on which symbols Trading range display with Box is currently trading on.

Guide

How does the Trading range display with Box strategy work ?

This script is designed to display the trading range and visually represent the performance of a trading strategy. It colors the trading ranges based on profitability, making it easier to see at a glance. The script includes specific scripting parameters:

  • process_orders_on_close=true
  • calc_on_every_tick=true
  • max_boxes_count=500

These parameters ensure the script updates accurately and displays ongoing trades. It's particularly recommended not to use this with switching strategies (e.g., immediately switching from a long to short position) as it may not display the range correctly. Additionally, the strategy has been marked as "Repainting Reference," meaning it may repaint historical data. For visual results of your strategy, you can copy and paste the code from line 22 in the provided script.

How to use the Trading range display with Box strategy ?

This trading strategy uses the crossover of two Simple Moving Averages (SMAs) to determine long entry and exit conditions. When the 14-period SMA crosses above the 20-period SMA, a long entry is triggered. The position is exited when the 14-period SMA crosses below the 20-period SMA.

To trade this strategy manually:

  • Add the 14-period SMA and the 20-period SMA indicators to your TradingView chart.
  • Entry Condition: Enter a long position when the 14-period SMA (white line) crosses above the 20-period SMA (blue line).
  • Exit Condition: Close the long position when the 14-period SMA (white line) crosses below the 20-period SMA (blue line).

How to optimize the Trading range display with Box trading strategy ?

To manually enhance this TradingView strategy, you can use additional indicators and techniques to confirm trade entries and exits, ultimately increasing its reliability. Below is a step-by-step plan to improve the strategy:

1. Combine with Additional Indicators:

  • Relative Strength Index (RSI): Use the RSI to confirm entry and exit signals. Enter long positions only when RSI is above 50 and showing an upward trend. Exit the position when RSI falls below 50.
  • Volume: Monitor trading volume to confirm signals. Higher volume during SMA crossovers adds validity to the signals, suggesting stronger momentum.
  • Bollinger Bands: Use Bollinger Bands to capture the volatility of the asset. Enter when a confirmed crossover happens near or below the lower Bollinger Band, and exit near the upper Bollinger Band for better price targets.

2. Incorporate Support and Resistance Levels:

  • Identify Key Levels: Manually draw horizontal lines to mark strong support and resistance levels on your chart. These levels will act as additional confirmation for entry and exit points.
  • Confirm Signals: Only take trades when the SMA crossover happens near a significant support level, and plan to exit near resistance levels.

3. Use Multiple Time Frame Analysis:

  • Check Higher Time Frames: Before entering a trade, confirm the trend on a higher time frame (e.g., if trading on the 15-minute chart, confirm the trend on the 1-hour chart). This alignment increases the probability of a successful trade.

4. Optimize Trade Management:

  • Set Stop-Loss Orders: Always place a stop-loss order below the recent swing low (for long positions) to protect your capital in case the trade goes against you.
  • Use Trailing Stop-Loss: As the trade moves in your favor, adjust the stop-loss level to lock in profits and minimize potential losses.
  • Define Profit Targets: Set realistic profit targets based on nearby resistance levels or a risk-to-reward ratio of at least 1:2.

5. Monitor Market News:

  • Stay Informed: Keep an eye on economic calendars and news events that could impact the asset you’re trading. Avoid entering new positions before major news releases to reduce the risk of unexpected volatility.

For which kind of traders is the Trading range display with Box strategy suitable ?

This strategy is ideal for beginner to intermediate traders who prefer a systematic, rules-based approach to trading. Specifically, it's designed for:

  • Trend Followers: The strategy relies on Simple Moving Averages (SMA) crossover to identify and follow market trends.
  • Positional Traders: Suitable for traders looking to hold positions for multiple days or weeks, capturing more significant market moves.
  • Manual Traders: Individuals who are comfortable executing trades manually and can benefit from additional confirmation indicators like RSI, Bollinger Bands, and Volume.

This strategy is particularly beneficial for those who trade in:

  • Moderate Volatility Markets: It performs best in markets that have moderate price movements, allowing the SMAs to signal clear entry and exit points.
  • Highly Liquid Assets: Using this strategy on highly liquid assets like major forex pairs, blue-chip stocks, or popular cryptocurrencies ensures smoother execution and reduced slippage.

Key Takeaways of Trading range display with Box

Key Takeaways:

  • Strategy Basics: The strategy uses SMA crossovers to determine long entry and exit points, ideal for capturing market trends.
  • How it Works: Enter a long position when the 14-period SMA crosses above the 20-period SMA, and exit when the 14-period SMA crosses below the 20-period SMA.
  • Trading Style: Best for trend followers and positional traders who can manually execute trades or use TradingView alerts for automation.
  • Enhancing the Strategy: Combine with indicators like RSI, Volume, and Bollinger Bands to confirm signals and improve trade reliability.
  • Support and Resistance: Use key support and resistance levels as additional confirmation for entries and exits.
  • Time Frame Analysis: Confirm trends on higher time frames to increase the probability of successful trades.
  • Trade Management: Set stop-loss orders below recent swing lows and use trailing stops to lock in profits.
  • Profit Targets: Define clear profit targets based on risk-to-reward ratios and resistance levels.
  • Market News: Stay informed about economic events and news to avoid unexpected volatility impacting trades.
Explore the best Trading & TradingView strategies

Stop trading blindly. Explore the best strategies among 100K+ backtests and improve your trading skills with data.

Start for free