Before I begin, here is a disclaimer: None of this is financial advice, and I'll recommend you to do your own research or talk to your financial advisor, if you want to use this. And also make sure you understand the risks properly before taking any trades. This particular indicator is a work of experiment, and I am publishing the optimized code. Please leave a comment below if you have any queries.
As per the logic, I am taking the highest point in a particular time window (used the in built ta.highest function) , and the lowest point in a particular time window (used the ta.lowest), and averaged it using the in built function ( RMA(which is the B33 Mean.)
For the offset, I am simply calculating and adding some values (which can also be input by the user.) and this user input is in percentage.
So if you observe the lines, the Red line in between is the mean, and the Yellow lines are the offsets. (Everything can be changed in settings) In simple layperson terms, if the price goes above the Red line, it's an uptrend, and if the price goes below the Red line, it is in a downtrend.
Now I just wanted to keep the offset because I wanted more confirmation before actually entering a trade. (the offset can be changed again, from the settings, and the offset is in percentage) A lot of times, you will see that the price is kind of going sideways, where, a lot of traders get trapped, as there is no clear trend. So in order to eliminate that choppy price action and stay out, I'm using this offset. This should probably save a lot of bad trades.
So basically, if the price goes and closes above the higher offset, it will confirm a trend change, and a possible bull market. Similarly, if the price goes and closes below the lower offset, it will confirm the end of the bull market, or a corrective phase, or a bear market.
A few things to note, however... If you change the timeframe, you will see that the lines are not shifting/changing that much. This is because, it will consider the highest and the lowest points and average it. So, basically, if you do the math, you will understand why,... and this logic is purely for a higher timeframe analysis/confirmation.
I'll personally recommend this kind of a setup for swing trading/confirmation on the daily or the 4H charts, mostly for longer timeframes. (If you are on the pro/pro+ or premium, you can try out 6H or 12H timeframes as well) If you are looking for scalping, setups and indicators, this is not the right one. If you liked it, don't forget to give a follow :)
Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai sumber terbuka supaya pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara percuma, tetapi penggunaan semula kod dalam penerbitan ini adalah dikawal oleh Peraturan dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.