OPEN-SOURCE SCRIPT

SMA Proximity Signal with Trend Table

ที่อัปเดต:
Key Features:
SMA Indicators:

The script calculates and plots three Simple Moving Averages (SMAs):
SMA1 (20-period)
SMA2 (200-period)
SMA3 (50-period)
Each SMA is plotted with configurable colors and line thicknesses.
SMA Crossover Signals:

The script detects crossovers between SMA1 and SMA2 and SMA1 and SMA3, marking them with green circles exactly at the crossover price level (not on the candles).
The crossover events are identified using ta.crossover and ta.crossunder functions.
A green circle appears at the crossover price level when:
SMA1 crosses above SMA2 (▲)
SMA1 crosses below SMA2 (▼)
Additional circles are drawn when other SMAs cross each other.
Proximity Condition:

The script checks whether the SMA1 and SMA2 are close to each other and have a flat slope (i.e., low rate of change), marking this condition with a green circle.
The proximity condition is calculated as the absolute difference between SMA1 and SMA2 relative to the current price, with a threshold for the proximity percentage (proximity_threshold).
The angle of each SMA is also checked to determine if the SMAs are flat (angle_threshold).
Support and Resistance Levels:

The script calculates support and resistance levels based on the lowest low and highest high over the last 20 bars, respectively.
It draws red dotted vertical lines when the current price is approaching these support or resistance levels (if the price is within a certain threshold).
Elephant Candle Pattern:

The script identifies "Elephant Candles" based on a large candle body relative to the overall size of the candle, using the condition where the candle body is at least 80% of the total candle size and at least 1.5 times the average candle size.
These candles are marked with an elephant emoji 🐘 at the top of the candle.
Trend Analysis Across Multiple Timeframes:

The script calculates the trend for different timeframes using the SMA20 of each timeframe:
5m, 15m, 1h, 4h, and 1D
It compares the current SMA20 to its previous value to determine whether the trend is Up, Down, or Flat.
A trend table is displayed at the top-right corner of the chart, showing the trend direction for each timeframe, with background colors indicating the trend (green for up, red for down, and gray for flat).
Customizable Inputs:

The script offers configurable input options for:
SMA lengths
Line colors and thicknesses
Proximity and angle thresholds
Support/resistance threshold for drawing lines
Alerts:

Alerts are set up for the proximity condition, allowing the user to be notified when the two SMAs are close and flat.
Visualization:
SMA Plots: The SMAs are plotted as lines with different colors.
Crossover Markers: Green circles are placed exactly at the price level of the SMA crossovers.
Proximity Signals: Green circles are used to indicate when the SMAs are flat and close.
Support/Resistance Lines: Red vertical lines are drawn when the price is near support or resistance levels.
Trend Table: A table in the top-right corner shows the trend across multiple timeframes, with color-coding for each trend direction.
Purpose of the Script:
The main objective of this script is to provide a comprehensive and visual way to track the behavior of Simple Moving Averages across multiple timeframes, detect SMA crossovers, and identify support/resistance levels, while also displaying trend analysis and other relevant market signals like proximity and candlestick patterns (e.g., Elephant Candles). This helps traders quickly interpret key market conditions and make informed decisions.

เอกสารเผยแพร่
SMA Indicators:
Displays three Simple Moving Averages (SMAs) on the chart: SMA1, SMA2, and SMA3 with customizable lengths and colors.
SMA Crossovers:
Marks SMA1 crossing above or below SMA2 and SMA3 with a green circle on the crossover price.

Elephant Bars:
Identifies large candles (elephant bars) based on size and body ratio.
Highlights elephant bars with an orange "🐘" label only if the close price is within a defined proximity of SMA1 or SMA2.
Trend Table:
Displays a table with trend information (Up, Down, or Flat) for multiple timeframes: 5m, 15m, 1h, 4h, and 1D.
The trend direction is based on the SMA20 for each timeframe.
SMA Proximity:

The elephant bar is only highlighted when it is within a user-defined percentage (e.g., 2%) of SMA1 or SMA2.
Color-coded Trends:

Green for upward trends, Red for downward trends, and Gray for flat trends.
These features aim to help visualize SMA crossovers, trend directions, and elephant bar formations that occur near the SMAs.
Candlestick analysisChart patternsCycles

สคริปต์โอเพนซอร์ซ

ด้วยเจตนารมณ์หลักของ TradingView ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถเข้าใจและตรวจสอบได้ ต้องขอบคุณผู้เขียน! ที่ให้คุณใช้ได้ฟรี แต่การนำโค้ดนี้ไปใช้ในการเผยแพร่ซ้ำจะต้องอยู่ภายใต้ กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?

คำจำกัดสิทธิ์ความรับผิดชอบ