millionchart
English

داده و درخواست‌ها

خواندن تایم‌فریمی دیگر و ارقام روز قبل با یک درخواست، در برنامه‌هایی که کامپایل و اجرا می‌شوند.

یک درخواست عبارتی را روی تایم‌فریمی دیگر حساب می‌کند و مقدارش را روی کندل‌های همین نمودار می‌دهد. دادهٔ مصنوعی مستندات، تایم‌فریم‌های بالاتر را از تایم‌فریم پایین‌تر می‌سازد.

میانگین تایم‌فریم بالاتر#

درخواستی برای تایم‌فریمی دیگر با data.series، که کنار همان میانگین روی این نمودار رسم می‌شود.

Cuprel
// A request for another timeframe: the 4-hour EMA of the close, drawn on whatever chart the script is on.
// `data.series` evaluates the expression on the other timeframe and gives back its last closed value.
indicator "Higher timeframe average"
    edition = 1
    display = price

input tf: tf = "240", name = "Timeframe"
input length: int = 20, name = "Length", min = 2
let other = data.series(tf, tech.ema(close, length), symbol = symbol.id)
plot(other, name = "EMA on the other timeframe", color = color.orange, width = 2)
plot(tech.ema(close, length), name = "EMA on this chart", color = color.gray)

سطح‌های پیوت روزانه#

پیوت‌های کلاسیک از روز قبل، که با prior(day, 1) خوانده می‌شوند.

Cuprel
// Classic floor pivots from the previous day: P = (H + L + C) / 3, R1 = 2P - L, S1 = 2P - H.
// `prior(day, 1)` reads the last finished day, so the levels are known from the first bar of the new day.
indicator "Daily pivot levels"
    edition = 1
    display = price

let prior_high = prior(day, 1).high
let prior_low = prior(day, 1).low
let prior_close = prior(day, 1).close
let pivot = (prior_high + prior_low + prior_close) / 3
plot(pivot, name = "Pivot", color = color.gray)
plot(2 * pivot - prior_low, name = "R1", color = color.red)
plot(2 * pivot - prior_high, name = "S1", color = color.green)