LastBattle

Single Timeframe Moving Average

Provides Moving average of 200 and 50 at the specific timeframe regardless of what interval you're looking at.
Saving the need to change it manually each time you switch the interval.

In this chart, I am looking at 4H interval with EMA of 50/200 of daily timeframe.

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

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

כתב ויתור

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

רוצה להשתמש בסקריפ זה בגרף?
study(title="Single Timeframe Moving Average", shorttitle="Single TF MA", overlay=true)

len_sma_long = input(200, minval=1, title="Long Simple Moving Average")
len_sma_short = input(50, minval=1, title="Short Simple Moving Average")
resCustom = input(title="Time interval (W, D, [min])", type=string, defval="D")

sma_long = security(tickerid, resCustom, sma(close, len_sma_long))
sma_short = security(tickerid, resCustom, sma(close, len_sma_short))
src = security(tickerid, resCustom, close)

s2 = cross(sma_long, sma_short) ? src : na
plot(sma_long, color=green)
plot(sma_short, color=red)

plotshape(cross(sma_long, sma_short) ? sma_long  : na, style=shape.xcross, text="ALERT")