OPEN-SOURCE SCRIPT

Sine-Weighted MA ATR [InvestorUnknown]

Diupdate
The Sine-Weighted MA ATR is a technical analysis tool designed to emphasize recent price data using sine-weighted calculations, making it particularly well-suited for analyzing cyclical markets with repetitive patterns. The indicator combines the Sine-Weighted Moving Average (SWMA) and a Sine-Weighted Average True Range (SWATR) to enhance price trend detection and volatility analysis.

Sine-Weighted Moving Average (SWMA):
  • Unlike traditional moving averages that apply uniform or exponentially decaying weights, the SWMA applies Sine weights to the price data.
  • Emphasis on central data points: The Sine function assigns more weight to the middle of the lookback period, giving less importance to the beginning and end points. This helps capture the main trend more effectively while reducing noise from recent volatility or older data.


cuplikan

Sine-Weighted ATR:
  • This is a variation of the Average True Range (ATR), which measures market volatility. Like the SWMA, the ATR is smoothed using Sine-based weighting, where central values are more heavily considered compared to the extremities. This improves sensitivity to changes in volatility while maintaining stability in highly volatile markets.




ATR Bands:
  • Upper and lower bands are created by adding/subtracting the Sine-Weighted ATR from the SWMA. These bands help identify overbought or oversold conditions, and when the price crosses these levels, it may generate long or short trade signals.




Signal Logic:
  • Long/Short Signals are triggered when the price crosses above or below the Sine-Weighted ATR bands


Backtest Mode and Equity Calculation
To evaluate its effectiveness, the indicator includes a backtest mode, allowing users to test its performance on historical data:
  • Backtest Equity: A detailed equity curve is calculated based on the generated signals over a user-defined period (startDate to endDate).
  • Buy and Hold Comparison: Alongside the strategy’s equity, a Buy-and-Hold equity curve is plotted for performance comparison.


Alerts
The indicator includes built-in alerts for both long and short signals, ensuring users are promptly notified when market conditions meet the criteria for an entry or exit.
Catatan Rilis
Added option to use Custom Timeframes on current chart for SWMA and ATR.

Catatan Rilis
Fixed issue with custom SWMA source not being passed correctly into the calculation.
CyclesMoving AveragesTrend Analysis

Skrip open-source

Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menerbitkannya sebagai sumber terbuka, sehingga para trader dapat memahami dan memverifikasinya. Hormat untuk penulisnya! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart

Inggin menggunakan skrip ini pada chart?

Pernyataan Penyangkalan