OPEN-SOURCE SCRIPT
업데이트됨 SMA, VWAP with Buy/Sell Signals - First Signal Only

Indicator: SMA, VWAP with First Buy/Sell Signals
Overview:
This indicator plots two Simple Moving Averages (SMA 20 and SMA 200) and the Volume-Weighted Average Price (VWAP) on the chart, with fully customizable colors and line thickness. Additionally, it provides buy and sell signals based on the price action relative to these indicators.
Buy Signal:
A buy signal is generated when a green candle (bullish candle) closes above the SMA 20, SMA 200, and VWAP without touching them (i.e., the low of the candle is above all three). This signal will only be plotted for the first such candle of the day to avoid signal clutter.
Sell Signal:
A sell signal is generated when a candle closes below the SMA 20, SMA 200, and VWAP without touching them (i.e., the high of the candle is below all three). Similar to the buy signal, it will only be plotted for the first qualifying candle of the day.
Customization:
SMAs and VWAP: Users can adjust the lengths, colors, and line thickness of the SMAs and VWAP to suit their preferences.
Signal Shape: You can choose from different shapes (arrow, circle, or cross) to represent the buy and sell signals on the chart.
Key Features:
First Candle Only: Both buy and sell signals are generated only for the first candle that satisfies the conditions, ensuring clean and actionable signals.
Visual Customization: Full control over the appearance of the indicator, including signal shapes and line properties.
Works Across Assets: This indicator is applicable to any asset (stocks, forex, crypto) where price action relative to moving averages and VWAP is important.
Overview:
This indicator plots two Simple Moving Averages (SMA 20 and SMA 200) and the Volume-Weighted Average Price (VWAP) on the chart, with fully customizable colors and line thickness. Additionally, it provides buy and sell signals based on the price action relative to these indicators.
Buy Signal:
A buy signal is generated when a green candle (bullish candle) closes above the SMA 20, SMA 200, and VWAP without touching them (i.e., the low of the candle is above all three). This signal will only be plotted for the first such candle of the day to avoid signal clutter.
Sell Signal:
A sell signal is generated when a candle closes below the SMA 20, SMA 200, and VWAP without touching them (i.e., the high of the candle is below all three). Similar to the buy signal, it will only be plotted for the first qualifying candle of the day.
Customization:
SMAs and VWAP: Users can adjust the lengths, colors, and line thickness of the SMAs and VWAP to suit their preferences.
Signal Shape: You can choose from different shapes (arrow, circle, or cross) to represent the buy and sell signals on the chart.
Key Features:
First Candle Only: Both buy and sell signals are generated only for the first candle that satisfies the conditions, ensuring clean and actionable signals.
Visual Customization: Full control over the appearance of the indicator, including signal shapes and line properties.
Works Across Assets: This indicator is applicable to any asset (stocks, forex, crypto) where price action relative to moving averages and VWAP is important.
릴리즈 노트
Overview:This indicator plots two Simple Moving Averages (SMA 20 and SMA 200) and the Volume-Weighted Average Price (VWAP) on the chart, with fully customizable colors and line thickness. Additionally, it provides buy and sell signals based on the price action relative to these indicators.
Buy Signal:
A buy signal is generated when a green candle (bullish candle) closes above the SMA 20, SMA 200, and VWAP without touching them (i.e., the low of the candle is above all three). This signal will only be plotted for the first such candle of the day to avoid signal clutter.
Sell Signal:
A sell signal is generated when a candle closes below the SMA 20, SMA 200, and VWAP without touching them (i.e., the high of the candle is below all three). Similar to the buy signal, it will only be plotted for the first qualifying candle of the day.
Customization:
SMAs and VWAP: Users can adjust the lengths, colors, and line thickness of the SMAs and VWAP to suit their preferences.
Signal Shape: You can choose from different shapes (arrow, circle, or cross) to represent the buy and sell signals on the chart.
Key Features:
First Candle Only: Both buy and sell signals are generated only for the first candle that satisfies the conditions, ensuring clean and actionable signals.
Visual Customization: Full control over the appearance of the indicator, including signal shapes and line properties.
Works Across Assets: This indicator is applicable to any asset (stocks, forex, crypto) where price action relative to moving averages and VWAP is important.
릴리즈 노트
User Inputs:Allows customization of parameters like SMA lengths, colors, and line thickness for SMA 20, SMA 200, and VWAP.
Enables setting target points for three profit levels.
Calculations:
Calculates SMA 20, SMA 200, and VWAP based on the close price.
Determines the minimum and maximum points for targets to ensure user inputs are within a specific range.
Signal Logic:
buySignal and sellSignal are initialized as false and reset daily.
Defines stop-loss levels based on the lowest (for long trades) or highest (for short trades) value among VWAP, SMA 20, and SMA 200.
Buy Signal:
A buy signal occurs if a green candle (close > open) is above all three indicators (SMA 20, SMA 200, and VWAP).
Sets the entry price, stop loss, and three target levels based on input values.
Creates labels and lines for the entry, stop loss, and each target on the chart.
Sell Signal:
A sell signal occurs if a red candle (close < open) is below all three indicators.
Similar to buy signals, it sets entry, stop loss, and target levels for short trades.
Plotting:
Plots the SMA 20, SMA 200, and VWAP on the chart using user-defined colors and thickness.
This code provides clear buy/sell points and visually marks entry, stop-loss, and target levels, which is useful for trend-following strategies based on moving averages and VWAP.
릴리즈 노트
Inputs and Customization OptionsSMA and VWAP lengths, colors, and line thickness:
sma20_length: Length of the Simple Moving Average (SMA).
sma20_color: Color of the SMA line.
sma20_thickness: Thickness of the SMA line.
vwap_color: Color of the Volume Weighted Average Price (VWAP) line.
vwap_thickness: Thickness of the VWAP line.
Target Points:
Enables the user to input target points for three levels.
showTargets: A checkbox to enable or disable targets.
Calculations
SMA and VWAP:
Calculates a 20-period SMA.
Calculates the VWAP.
Trading Signals
Buy Conditions:
The script checks if a green candle closes above both the 20-period SMA and the VWAP.
When the condition is met, it generates a buy signal with an entry point, stop loss (previous candle's low), and three target points.
Sell Conditions:
The script checks if a red candle closes below both the 20-period SMA and the VWAP.
When the condition is met, it generates a sell signal with an entry point, stop loss (previous candle's high), and three target points.
Signal Plotting
Labels and Lines:
Plots labels and lines for entry points, stop loss, and target levels when the conditions are met.
Customizable labels for "Entry," "Stop Loss," "Target 1," "Target 2," and "Target 3."
Plotting Indicators
SMA and VWAP:
Plots the 20-period SMA and VWAP on the chart based on the user-specified colors and thickness.
The script is designed to provide clear buy and sell signals based on price action relative to the SMA and VWAP, with customizable targets for better visualization and trading decisions.
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.