TradingView
peacefulLizard50262
8 de Fev de 2023 05:14

Wave Generator (WG) 

Descrição

Pine Script Wave Generator Utility


Introduction:
The Pine Script Wave Generator Utility is a versatile tool that creates different wave patterns. The script provides the user with four different wave styles to choose from (Sine, Triangle, Saw, Square) with customizable parameters for the wave height, duration, number of harmonics, and phase shift.

Technical Details:
The script utilizes the mathematical functions sin, pi, and array.avg to generate wave patterns. The wave height and duration are the main inputs, and the number of harmonics and phase shift are additional inputs that add fine-tuning to the wave pattern.
The wave styles are created using different combinations of sine waves and are normalized so that the resulting wave always lies within a range of -1 to 1.

Usage:
The user can adjust the wave parameters using the input options in the script. The user can choose the wave style from the “Wave Select” option and set the wave height, wave duration, number of harmonics and phase shift by adjusting the corresponding input options.

Conclusion:
The Pine Script Wave Generator Utility is an efficient and effective tool for generating wave patterns. It can be used for a variety of purposes such as creating wave patterns for technical analysis, simulation, and testing purposes. The user can easily adjust the wave parameters to create custom wave patterns, making it a flexible and valuable tool.

Notas de Lançamento

added phase shift for the shapes and I added ramp saw

Notas de Lançamento

fixed the saw wave length
Comentários
Trendoscope
Good work. But, may be if should be a library instead of indicator so that can be used with any script.
peacefulLizard50262
@HeWhoMustNotBeNamed, thank you very much for noticing me! I will do this right away!!
peacefulLizard50262
@HeWhoMustNotBeNamed, let me know if this works for you :) or if this is what you had in mind.
tradingview.com/script/Sq8W8Jhr-Wave-Generator-Library-WGL/
Trendoscope
@peacefulLizard50262, like good. Well done again 👍
peacefulLizard50262
@HeWhoMustNotBeNamed, if you have any requests just let me know :) I always love a coding task. I've been a bit uninspired lately so this was nice.
xmd1979
awesome code, thank you man )
Mais