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.
Информация о релизе
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.
Moving AveragesVolume Weighted Average Price (VWAP)

Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Хотите использовать этот скрипт на графике?

Отказ от ответственности