Seungdori_

Moving Average SAR

Seungdori_ Güncellendi   
Hello Traders,

Today, I have brought to you an indicator that utilizes the Parabolic SAR.

To begin with, the Parabolic SAR is an indicator that trails the price in the form of a parabola, seeking out Stop And Reverse points.

The indicator I present merges the calculation formula of the Parabolic SAR with the Moving Average.

One aspect I pondered over was how to determine the starting point of this SAR. Trailing the price flow with the logic set by the moving average was fine, but the question was where to begin.

My approach involves a variable I call 'sensitiveness,' which automatically adjusts the length according to the timeframe you are observing. Using pinescript's math.ceil, I formulated:

interval_to_len = timeframe.multiplier * (timeframe.isdaily ? 1440 : timeframe.isweekly ? 1440 * 7 : timeframe.ismonthly ? 1440 * 30 : 1)

main_len = math.ceil(sensitiveness / interval_to_len)

This formula represents the length, and through variables like:
_highest = math.min(ta.highest(high, main_len), close + ta.atr(46)*4)
_lowest = math.max(ta.lowest(low, main_len), close - ta.atr(46)*4)

I have managed to set the risk at a level that does not impose too great a burden.

Moreover, the 'Trend Strength Parameter' allows you to choose how strongly to trail the current price.

Lastly, think of the Band Width as a margin for accepting changes in the trend. As the value increases, the Band Width expands, measured through the ATR.

This indicator is particularly useful for holding positions and implementing trailing stops. It will be especially beneficial for those interested in price tracking of trends, like with Parabolic SAR or Supertrend.

I hope you find this tool useful.
Sürüm Notları:
I've added an option for signals that I initially overlooked.

If you select 'Show Signals', it is set to display the signals.
Sürüm Notları:
Fixed Overlay
Açık kaynak kodlu komut dosyası

Gerçek TradingView ruhuyla, bu betiğin yazarı, yatırımcının anlayabilmesi ve doğrulayabilmesi için onu açık kaynak olarak yayınladı. Yazarın eline sağlık! Bunu ücretsiz olarak kullanabilirsiniz, ancak bu kodun bir yayında yeniden kullanımı Kullanım Koşulları ile yönetilir. Bir grafikte kullanmak için favorilere ekleyebilirsiniz.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.

Bu komut dosyasını bir grafikte kullanmak ister misiniz?