PINE LIBRARY
업데이트됨 waves

█ OVERVIEW
This library intended for use in Bar Replay provides functions to generate various wave forms (sine, cosine, triangle, square) based on time and customizable parameters. Useful for testing and in creating oscillators, indicators, or visual effects.
█ FUNCTIONS
• getSineWave()
• getCosineWave()
• getTriangleWave()
• getSquareWave()
█ USAGE EXAMPLE
█ NOTES
* barsPerSecond defaults to 10. Adjust this if not using 10x in Bar Replay.
* Phase shift is in degrees.
---
Library "waves"
getSineWave(cyclesPerMinute, bar, barsPerSecond, amplitude, verticalShift, phaseShift)
`getSineWave`
> Calculates a sine wave based on bar index, cycles per minute (BPM), and wave parameters.
Parameters:
cyclesPerMinute (float): (float) The desired number of cycles per minute (BPM). Default is 30.0.
bar (int): (int) The current bar index. Default is bar_index.
barsPerSecond (float): (float) The number of bars per second. Default is 10.0 for Bar Replay
amplitude (float): (float) The amplitude of the sine wave. Default is 1.0.
verticalShift (float): (float) The vertical shift of the sine wave. Default is 0.0.
phaseShift (float): (float) The phase shift of the sine wave in radians. Default is 0.0.
Returns: (float) The calculated sine wave value.
getCosineWave(cyclesPerMinute, bar, barsPerSecond, amplitude, verticalShift, phaseShift)
`getCosineWave`
> Calculates a cosine wave based on bar index, cycles per minute (BPM), and wave parameters.
Parameters:
cyclesPerMinute (float): (float) The desired number of cycles per minute (BPM). Default is 30.0.
bar (int): (int) The current bar index. Default is bar_index.
barsPerSecond (float): (float) The number of bars per second. Default is 10.0 for Bar Replay
amplitude (float): (float) The amplitude of the cosine wave. Default is 1.0.
verticalShift (float): (float) The vertical shift of the cosine wave. Default is 0.0.
phaseShift (float): (float) The phase shift of the cosine wave in radians. Default is 0.0.
Returns: (float) The calculated cosine wave value.
getTriangleWave(cyclesPerMinute, bar, barsPerSecond, amplitude, verticalShift, phaseShift)
`getTriangleWave`
> Calculates a triangle wave based on bar index, cycles per minute (BPM), and wave parameters.
Parameters:
cyclesPerMinute (float): (float) The desired number of cycles per minute (BPM). Default is 30.0.
bar (int): (int) The current bar index. Default is bar_index.
barsPerSecond (float): (float) The number of bars per second. Default is 10.0 for Bar Replay
amplitude (float): (float) The amplitude of the triangle wave. Default is 1.0.
verticalShift (float): (float) The vertical shift of the triangle wave. Default is 0.0.
phaseShift (float): (float) The phase shift of the triangle wave in radians. Default is 0.0.
Returns: (float) The calculated triangle wave value.
getSquareWave(cyclesPerMinute, bar, barsPerSecond, amplitude, verticalShift, dutyCycle, phaseShift)
`getSquareWave`
> Calculates a square wave based on bar index, cycles per minute (BPM), and wave parameters.
Parameters:
cyclesPerMinute (float): (float) The desired number of cycles per minute (BPM). Default is 30.0.
bar (int): (int) The current bar index. Default is bar_index.
barsPerSecond (float): (float) The number of bars per second. Default is 10.0 for Bar Replay
amplitude (float): (float) The amplitude of the square wave. Default is 1.0.
verticalShift (float): (float) The vertical shift of the square wave. Default is 0.0.
dutyCycle (float): (float) The duty cycle of the square wave (0.0 to 1.0). Default is 0.5 (50% duty cycle).
phaseShift (float): (float) The phase shift of the square wave in radians. Default is 0.0.
Returns: (float) The calculated square wave value.
This library intended for use in Bar Replay provides functions to generate various wave forms (sine, cosine, triangle, square) based on time and customizable parameters. Useful for testing and in creating oscillators, indicators, or visual effects.
█ FUNCTIONS
• getSineWave()
• getCosineWave()
• getTriangleWave()
• getSquareWave()
█ USAGE EXAMPLE
Pine Script®
//@version=6
indicator("Wave Example")
import kaigouthro/waves/1
plot(waves.getSineWave(cyclesPerMinute=15))
indicator("Wave Example")
import kaigouthro/waves/1
plot(waves.getSineWave(cyclesPerMinute=15))
█ NOTES
* barsPerSecond defaults to 10. Adjust this if not using 10x in Bar Replay.
* Phase shift is in degrees.
---
Library "waves"
getSineWave(cyclesPerMinute, bar, barsPerSecond, amplitude, verticalShift, phaseShift)
`getSineWave`
> Calculates a sine wave based on bar index, cycles per minute (BPM), and wave parameters.
Parameters:
cyclesPerMinute (float): (float) The desired number of cycles per minute (BPM). Default is 30.0.
bar (int): (int) The current bar index. Default is bar_index.
barsPerSecond (float): (float) The number of bars per second. Default is 10.0 for Bar Replay
amplitude (float): (float) The amplitude of the sine wave. Default is 1.0.
verticalShift (float): (float) The vertical shift of the sine wave. Default is 0.0.
phaseShift (float): (float) The phase shift of the sine wave in radians. Default is 0.0.
Returns: (float) The calculated sine wave value.
getCosineWave(cyclesPerMinute, bar, barsPerSecond, amplitude, verticalShift, phaseShift)
`getCosineWave`
> Calculates a cosine wave based on bar index, cycles per minute (BPM), and wave parameters.
Parameters:
cyclesPerMinute (float): (float) The desired number of cycles per minute (BPM). Default is 30.0.
bar (int): (int) The current bar index. Default is bar_index.
barsPerSecond (float): (float) The number of bars per second. Default is 10.0 for Bar Replay
amplitude (float): (float) The amplitude of the cosine wave. Default is 1.0.
verticalShift (float): (float) The vertical shift of the cosine wave. Default is 0.0.
phaseShift (float): (float) The phase shift of the cosine wave in radians. Default is 0.0.
Returns: (float) The calculated cosine wave value.
getTriangleWave(cyclesPerMinute, bar, barsPerSecond, amplitude, verticalShift, phaseShift)
`getTriangleWave`
> Calculates a triangle wave based on bar index, cycles per minute (BPM), and wave parameters.
Parameters:
cyclesPerMinute (float): (float) The desired number of cycles per minute (BPM). Default is 30.0.
bar (int): (int) The current bar index. Default is bar_index.
barsPerSecond (float): (float) The number of bars per second. Default is 10.0 for Bar Replay
amplitude (float): (float) The amplitude of the triangle wave. Default is 1.0.
verticalShift (float): (float) The vertical shift of the triangle wave. Default is 0.0.
phaseShift (float): (float) The phase shift of the triangle wave in radians. Default is 0.0.
Returns: (float) The calculated triangle wave value.
getSquareWave(cyclesPerMinute, bar, barsPerSecond, amplitude, verticalShift, dutyCycle, phaseShift)
`getSquareWave`
> Calculates a square wave based on bar index, cycles per minute (BPM), and wave parameters.
Parameters:
cyclesPerMinute (float): (float) The desired number of cycles per minute (BPM). Default is 30.0.
bar (int): (int) The current bar index. Default is bar_index.
barsPerSecond (float): (float) The number of bars per second. Default is 10.0 for Bar Replay
amplitude (float): (float) The amplitude of the square wave. Default is 1.0.
verticalShift (float): (float) The vertical shift of the square wave. Default is 0.0.
dutyCycle (float): (float) The duty cycle of the square wave (0.0 to 1.0). Default is 0.5 (50% duty cycle).
phaseShift (float): (float) The phase shift of the square wave in radians. Default is 0.0.
Returns: (float) The calculated square wave value.
릴리즈 노트
v2Float input for bar ( Just because )
Updated:
getSineWave(cyclesPerMinute, bar, barsPerSecond, amplitude, verticalShift, phaseShift)
`getSineWave`
> Calculates a sine wave based on bar index, cycles per minute (BPM), and wave parameters.
Parameters:
cyclesPerMinute (float): (float) The desired number of cycles per minute (BPM). Default is 30.0.
bar (float): (int) The current bar index. Default is bar_index.
barsPerSecond (float): (float) The number of bars per second. Default is 10.0 for Bar Replay
amplitude (float): (float) The amplitude of the sine wave. Default is 1.0.
verticalShift (float): (float) The vertical shift of the sine wave. Default is 0.0.
phaseShift (float): (float) The phase shift of the sine wave in radians. Default is 0.0.
Returns: (float) The calculated sine wave value.
getCosineWave(cyclesPerMinute, bar, barsPerSecond, amplitude, verticalShift, phaseShift)
`getCosineWave`
> Calculates a cosine wave based on bar index, cycles per minute (BPM), and wave parameters.
Parameters:
cyclesPerMinute (float): (float) The desired number of cycles per minute (BPM). Default is 30.0.
bar (float): (int) The current bar index. Default is bar_index.
barsPerSecond (float): (float) The number of bars per second. Default is 10.0 for Bar Replay
amplitude (float): (float) The amplitude of the cosine wave. Default is 1.0.
verticalShift (float): (float) The vertical shift of the cosine wave. Default is 0.0.
phaseShift (float): (float) The phase shift of the cosine wave in radians. Default is 0.0.
Returns: (float) The calculated cosine wave value.
getTriangleWave(cyclesPerMinute, bar, barsPerSecond, amplitude, verticalShift, phaseShift)
`getTriangleWave`
> Calculates a triangle wave based on bar index, cycles per minute (BPM), and wave parameters.
Parameters:
cyclesPerMinute (float): (float) The desired number of cycles per minute (BPM). Default is 30.0.
bar (float): (int) The current bar index. Default is bar_index.
barsPerSecond (float): (float) The number of bars per second. Default is 10.0 for Bar Replay
amplitude (float): (float) The amplitude of the triangle wave. Default is 1.0.
verticalShift (float): (float) The vertical shift of the triangle wave. Default is 0.0.
phaseShift (float): (float) The phase shift of the triangle wave in radians. Default is 0.0.
Returns: (float) The calculated triangle wave value.
getSquareWave(cyclesPerMinute, bar, barsPerSecond, amplitude, verticalShift, dutyCycle, phaseShift)
`getSquareWave`
> Calculates a square wave based on bar index, cycles per minute (BPM), and wave parameters.
Parameters:
cyclesPerMinute (float): (float) The desired number of cycles per minute (BPM). Default is 30.0.
bar (float): (int) The current bar index. Default is bar_index.
barsPerSecond (float): (float) The number of bars per second. Default is 10.0 for Bar Replay
amplitude (float): (float) The amplitude of the square wave. Default is 1.0.
verticalShift (float): (float) The vertical shift of the square wave. Default is 0.0.
dutyCycle (float): (float) The duty cycle of the square wave (0.0 to 1.0). Default is 0.5 (50% duty cycle).
phaseShift (float): (float) The phase shift of the square wave in radians. Default is 0.0.
Returns: (float) The calculated square wave value.
파인 라이브러리
진정한 트레이딩뷰 정신에 따라 작성자는 이 파인 코드를 오픈 소스 라이브러리로 공개하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 건배! 이 라이브러리는 개인적으로 또는 다른 오픈 소스 출판물에서 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰의 적용을 받습니다.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
파인 라이브러리
진정한 트레이딩뷰 정신에 따라 작성자는 이 파인 코드를 오픈 소스 라이브러리로 공개하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 건배! 이 라이브러리는 개인적으로 또는 다른 오픈 소스 출판물에서 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰의 적용을 받습니다.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.