OPEN-SOURCE SCRIPT

BarRange Strategy

Hello,

This is a long-only, volatility-based strategy that analyzes the range of the previous bar (high - low).

If the most recent bar’s range exceeds a threshold based on the last X bars, a trade is initiated.

You can customize the lookback period, threshold value, and exit type.

For exits, you can choose to exit after X bars or when the close price exceeds the previous bar’s high.

The strategy is designed for instruments with a long-term upward-sloping curves, such as ES1! or NQ1!. It may not perform well on other instruments.

Commissions are set to $2.50 per side ($5.00 per round trip).

Recommended timeframes are 1h and higher. With adjustments to the lookback period and threshold, it could potentially achieve similar results on lower timeframes as well.
statisticsVolatility

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer