OPEN-SOURCE SCRIPT

TrigWave Suite [InvestorUnknown]

The TrigWave Suite combines Sine-weighted, Cosine-weighted, and Hyperbolic Tangent moving averages (HTMA) with a Directional Movement System (DMS) and a Relative Strength System (RSS).

Hyperbolic Tangent Moving Average (HTMA)
  • The HTMA smooths the price by applying a hyperbolic tangent transformation to the difference between the price and a simple moving average. It also adjusts this value by multiplying it by a standard deviation to create a more stable signal.




Sine-Weighted Moving Average (SWMA)
  • The SWMA applies sine-based weights to historical prices. This gives more weight to the central data points, making it responsive yet less prone to noise.




Cosine-Weighted Moving Average (CWMA)
  • The CWMA uses cosine-based weights for data points, which produces a more stable trend-following behavior, especially in low-volatility markets.




Directional Movement System (DMS)
  • DMS is used to identify trend direction and strength based on directional movement. It uses ADX to gauge trend strength and combines +DI and -DI for directional bias.




Relative Strength System (RSS)
  • RSS employs RSI and an adjustable moving average type (SMA, EMA, or HMA) to evaluate whether the market is in a bullish or bearish state.




ATR Adjustments
  • To minimize false signals, the HTMA, SWMA, and CWMA signals are adjusted with an Average True Range (ATR) filter:




  • This adjustment allows for better adaptation to varying market volatility, making the signal more reliable.


Signals and Trend Calculation
  • The indicator generates a Trend Signal by aggregating the output from each component. Each component provides a directional signal that is combined to form a unified trend reading. The trend value is then converted into a long (1), short (-1), or neutral (0) state.


Backtesting Mode and Performance Metrics
  • The Backtesting Mode includes a performance metrics table that compares the Buy and Hold strategy with the TrigWave Suite strategy. Key statistics like Sharpe Ratio, Sortino Ratio, and Omega Ratio are displayed to help users assess performance. Note that due to labels and plotchar use, automatic scaling may not function ideally in backtest mode.


Alerts and Visualization
  • Trend Direction Alerts: Set up alerts for long and short signals
  • Color Bars and Gradient Option: Bars are colored based on the trend direction, with an optional gradient for smoother visual feedback.


Important Notes
  • Customization: Default settings are experimental and not intended for trading/investing purposes. Users are encouraged to adjust and calibrate the settings to optimize results according to their trading style.
  • Backtest Results Disclaimer: Please note that backtest results are not indicative of future performance, and no strategy guarantees success.
Moving AveragesstatisticsTrend Analysis

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明