Megabar Breakout (Range & Volume & RSI)

Hey there,

This strategy is based on the idea that certain events lead to what are called Megabars. Megabars are bars that have a very large range and volume. I wanted to verify whether these bars indicate the start of a trend and whether one should follow the trend.

Summary of the Code:
The code is based on three indicators: the range of the bar, the volume of the bar, and the RSI. When certain values of these indicators are met, a Megabar is identified. The direction of the Megabar indicates the direction in which we should trade.

Why do I combine these indicators?
I want to identify special bars that have the potential to mark the beginning of a breakout. Therefore, a bar needs to exhibit high volume, have a large range (huge price movement), and we also use the Relative Strength Index (RSI) to assess potential momentum. Only if all three criteria are met within one candle, do we use this as an identifier for a megabar.

Explanation of Drawings on the Chart:
As you can see, there is a green background on my chart. The green background symbolizes the time when I'm entering a trade. Only if a Megabar happens during that time, I'm ready to enter a trade. The time is between 6 AM and 4 PM CET. It's just because I prefer that time. Also, the strategy draws an error every time a Megabar happens based on VOL and Range only (not on the RSI). That makes it pretty easy to go through your chart and check the biggest bars manually. You can activate or deactivate these settings via the input data of the strategy.

When Do We Enter a Trade?
We wait for a Megabar to happen during our trading session. If the Megabar is bullish, we open a LONG trade at the opening price of the next candle. If the Megabar is bearish, we open a SHORT trade at the opening price of the next candle.

Where Do We Put Our Take Profit & Stop Loss?
The default setting is TP = 40 Pips and SL = 30 Pips. In that case, we are always trading with a risk-reward ratio of 1.33 by default. You can easily change these settings via the input data of the strategy.

Strategy Results
The criteria for Megabars were chosen by me in a way that makes Megabars something special. They are not intended to occur too frequently, as the fundamental idea of this strategy would otherwise not hold. This results in only 37 closed trades within the last 12 months. If you change the criterias for a megabar to a milder one, you will create more Megabars and therefore more trades. It's up to you. I have adapted this strategy to the 30-minute chart of the EURUSD. In the evaluation, we consider a period of 12 months, which I believe is sufficient.
My default settings for the indicators look like this:
Avg Length Vol 20
Avg Multiplier Vol 3
Avg Length Range 20
Avg Multiplier Range 4
Value SMA RSI for Long Trades 50
Value SMA RSI for Short Trades 70

IMPORTANT: The current performance overview does not display the results of these settings. Please change the settings to my default ones so that you can see how I use this strategy.

I do not recommend trading this strategy without further testing. The script is meant to reflect a basic idea and be used as a tool to identify Megabars. I have made this strategy completely public so that it can be further developed. One can take this framework and test it on different timeframes and different markets.

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。