OPEN-SOURCE SCRIPT
מעודכן MA Slope Indicator

a complete Pine Script (version 5) indicator for TradingView that implements what you're describing. It calculates Simple Moving Averages (SMAs) for four lengths (10, 20, 200, and 400 bars by default—these are configurable via inputs). For each SMA, it computes a "slope" value by comparing the current SMA value to the average of the previous X SMA values (where X is also a configurable input, defaulting to 5 bars).
The slope is calculated as: current_SMA - avg_of_previous_X_SMAs.
A positive slope indicates an upward trend (e.g., the MA is rising relative to its recent history).
A negative slope indicates a downward trend.
Zero means flat.
The script plots:
The four SMAs as lines on the chart (for reference).
Four histograms below the chart showing the slope values for each SMA, colored green for positive, red for negative, and gray for zero/flat.
This uses only simple moving averages (ta.sma() in Pine Script).
The slope is calculated as: current_SMA - avg_of_previous_X_SMAs.
A positive slope indicates an upward trend (e.g., the MA is rising relative to its recent history).
A negative slope indicates a downward trend.
Zero means flat.
The script plots:
The four SMAs as lines on the chart (for reference).
Four histograms below the chart showing the slope values for each SMA, colored green for positive, red for negative, and gray for zero/flat.
This uses only simple moving averages (ta.sma() in Pine Script).
הערות שחרור
Simple Moving Averages (SMAs) for four lengths (10, 20, 200, and 400 bars by default—these are configurable via inputs). For each SMA, it computes a "slope" value by comparing the current SMA value to the average of the previous X SMA values (where X is also a configurable input, defaulting to 5 bars).The slope is calculated as: current_SMA - avg_of_previous_X_SMAs.
A positive slope indicates an upward trend (e.g., the MA is rising relative to its recent history).
A negative slope indicates a downward trend.
Zero means flat.
The script plots:
The four SMAs as lines on the chart (for reference).
Four histograms below the chart showing the slope values for each SMA, colored green for positive, red for negative, and gray for zero/flat.
This uses only simple moving averages (ta.sma() in Pine Script).
סקריפט קוד פתוח
ברוח TradingView אמיתית, היוצר של הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יכולים לבדוק ולאמת את הפונקציונליות שלו. כל הכבוד למחבר! למרות שאתה יכול להשתמש בו בחינם, זכור שפרסום מחדש של הקוד כפוף לכללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.
סקריפט קוד פתוח
ברוח TradingView אמיתית, היוצר של הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יכולים לבדוק ולאמת את הפונקציונליות שלו. כל הכבוד למחבר! למרות שאתה יכול להשתמש בו בחינם, זכור שפרסום מחדש של הקוד כפוף לכללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.