lonestar108

SMI Bars

Uses SMI (Stochastic Momentum Index) to set bar colors:

When SMI above overbought, bar color is red.
When SMI is between 0 and overbought, bar color is maroon
When SMI is between oversold and 0, bar color is green
When SMI is below oversold, bar color is lime.
When SMI crosses above or below 0, bar color is orange.

סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יכולים להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אך שימוש חוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.

רוצה להשתמש בסקריפ זה בגרף?
//Stochastic Momentum Index
//SMI Code by UCSgears, adapted to bars by lonestar108
study("SMI Bars", shorttitle = "SMI_Bars", overlay=true)
a = input(5, "Percent K Length")
b = input(3, "Percent D Length")
ob = input(40, "Overbought")
os = input(-40, "Oversold")
// Range Calculation
ll = lowest (low, a)
hh = highest (high, a)
diff = hh - ll
rdiff = close - (hh+ll)/2
// Nested Moving Average for smoother curves
avgrel = ema(ema(rdiff,b),b)
avgdiff = ema(ema(diff,b),b)
// SMI calculations
SMI = avgdiff != 0 ? (avgrel/(avgdiff/2)*100) : 0
SMIsignal = ema(SMI,b)


barcolor(cross(SMI,0) and SMI > 0 ? orange : na)
barcolor(cross(SMI,0) and SMI < 0 ? orange : na)
barcolor(SMI > ob ? red : na)
barcolor((SMI > 0 and SMI <=ob) ? maroon : na)
barcolor((SMI <= 0 and SMI >=os) ? green : na)
barcolor(SMI < os ? lime : na)


//END