OPEN-SOURCE SCRIPT

Sine-Weighted MA ATR [InvestorUnknown]

업데이트됨
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.


스냅샷

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.
릴리즈 노트
Added option to use Custom Timeframes on current chart for SWMA and ATR.

릴리즈 노트
Fixed issue with custom SWMA source not being passed correctly into the calculation.
CyclesMoving AveragesTrend Analysis

오픈 소스 스크립트

진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?

면책사항