קבל נתונים נוספים מהסקריפטים שלך

May 31, 2022

ושיפורים לפונקציית Pine Script™, request.security_lower_tf() ו-request.economic() שתי פונקציות חדשות של
.הקיימת מאפשרים לסקריפטים שלך לגשת לנתונים נוספים request.security()

request.security_lower_tf()

 .מקלה על בקשת נתונים ממסגרת זמן נמוכה מזו של הגרף  request.security_lower_tf() הפונקציה החדשה
לפני הפונקציה החדשה הזו, גישה לכל סרגלי תוך 1 דקות המרכיבים בר של 60 דקות דרשה פונקציות מורכבות המוגדרות על ידי
החדש הופך אותו לדוגל על ​​ידי החזרת מערך המכיל request.security() ה-request.security_lower_tf() המשתמש וקריאות
.עשוי להשתנות עבור כל בר גרף ערך אחד של הביטוי שסופק עבור כל בר תוך. שים לב שמספר תוך הברים

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

//@version=5
indicator("Polarity Divergences", overlay = true)
// Fetch an array containing the +1/0/-1 direction of each 1min intrabar.
array<float> directionsArray = request.security_lower_tf(syminfo.tickerid, "1", math.sign(close - open))
// Color the chart bar orange when the majority of 
// intrabar directions does not match the chart bar's direction.
barcolor(math.sign(array.sum(directionsArray)) != math.sign(close - open) ? color.orange : na)
// Plot the number of intrabars in indicator values and the Data Window.
plotchar(array.size(directionsArray), "Intrabars", "", location.top)

request.economic()

מביאה נתונים כלכליים עבור מדינה או אזור. נתונים כלכליים כוללים מידע כגון מצב  request.economic() הפונקציה
:(‘תוצר, שיעור אינפלציה וכו) כלכלת המדינה או של תעשייה מסוימת (ייצור פלדה, מיטות נמרץ וכו’)

//@version=5
indicator("Gross domestic product of the US")
plot(request.economic("US", "GDP"))

המאמר שלנו במרכז התמיכה מפרט את כל המדינות/אזורים והערכים הזמינים. מאמר נוסף במרכז העזרה עבור כל מדד מתאר
.אותו ומפרט את המדינות/אזורים שעבורם הוא זמין. זה האחד לתוצר

request.security().שיפורים של 

:יכול כעת להחזיר מערכים, מחרוזות, בוליאנים, צבעים מסוגים אלה request.security()

//@version=5
indicator("")

// Create an array containing OHLC values.
array<float>  ohlc = array.from(open, high, low, close)

// Request a tuple evaluated in the context of the "NASDAQ:TSLA" symbol at the chart's timeframe.
// The tuple contains:
//   - The array of OHLC values.
//   - A string representation of the OHLC values using the symbol's tick precision.
//   - The currency string of the symbol.
[ohlcArray, ohlcString, curString]  = request.security("NASDAQ:TSLA", timeframe.period, [ohlc, str.tostring(ohlc, format.mintick), syminfo.currency])

if barstate.islastconfirmedhistory
    label.new(bar_index, high, 
      "OHLC values: " + str.tostring(ohlcArray) +
      "\nFormatted OHLC values: " + ohlcString +
      "\nCurrency: " + curString)

PineCoders כדי להישאר מעודכן לגבי תכונות חדשות של פיין, אנא עקוב אחר הערות הגרסה של מדריך למשתמש. חשבון
“Pine Script™ Q&A” שלו, חשבון טוויטר ומהצ’אט הציבורי Squawk Box משדר גם עדכונים מערוץ טלגרם
.TradingView-ב

עבור TradingView אנו מקווים שתמצאו שיפורים אלו שימושיים. אנא המשך לשלוח לנו את המשוב שלך. אנו בונים
.המשתמשים שלנו ואנו אוהבים לשמוע מכם

Look first Then leap

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