ch
Feedback
PineCoders Squawk Box

PineCoders Squawk Box

前往频道在 Telegram

News & Tips on TradingView's Pine programming language

显示更多
3 493
订阅者
无数据24 小时
+157
+4730
帖子存档
🌲 #newfeature Improvements to request.security() were rolled out. Its expression parameter now supports arguments of "string" type, and int[]/float[]/bool[]/color[]/string[] arrays, including in tuples:
//@version=5
indicator("")

bool     barUp       = close > open
color    barColor    = barUp ? color.green : color.red
string   barDesc     = barUp ? "Bar is UP" : "Bar is DOWN"
bool[]   arrayBool   = array.from(barUp,    barUp[1])
color[]  arrayColor  = array.from(barColor, barColor[1])
string[] arrayString = array.from(barDesc,  barDesc[1])
float[]  arrayFloat  = array.from(close, open)
sBool        = request.security(syminfo.tickerid, "1M", close > open)
sColor       = request.security(syminfo.tickerid, "1M", barColor)
sString      = request.security(syminfo.tickerid, "1M", timeframe.period)
sArrayBool   = request.security(syminfo.tickerid, "1M", arrayBool)
sArrayColor  = request.security(syminfo.tickerid, "1M", arrayColor)
sArrayString = request.security(syminfo.tickerid, "1M", arrayString)
sArrayFloat  = request.security(syminfo.tickerid, "1M", arrayFloat)
[tArrayBool, tArrayColor, tArrayFloat] = request.security(syminfo.tickerid, "1M", [arrayBool, arrayColor, arrayFloat])

if barstate.islast
    label.new(bar_index, 0, 
      sString                    + "\n" + 
      str.tostring(sBool)        + "\n" +
      str.tostring(sArrayBool)   + "\n" +
      str.tostring(sArrayString) + "\n" +
      str.tostring(sArrayFloat)  + "\n",
      color = array.get(tArrayColor, 0))

🌲 #newfeature You can now use placeholders of the form {{strategy.*}} in the string used with the alert_message parameter of strategy.*() functions. This make realtime information available in alert messages generated from scripts, just as can be done when using the placeholders from the "Create Alert" dialog box's "Message" field:
//@version=5
strategy("My strategy", overlay=true, margin_long=100, margin_short=100)

alertString = '{{strategy.order.action}} {{strategy.position_size}} {{ticker}} \nMarket position was {{strategy.prev_market_position}} and is now {{strategy.market_position}}'

longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))
if (longCondition)
    strategy.entry("My Long Entry Id", strategy.long, alert_message = alertString)

shortCondition = ta.crossunder(ta.sma(close, 14), ta.sma(close, 28))
if (shortCondition)
    strategy.entry("My Short Entry Id", strategy.short, alert_message = alertString)

🌲 #newfeature Dear quants, please welcome Pine Script™ matrices! https://www.tradingview.com/blog/en/matrices-come-to-pine-script-30693/

🌲 #newfeature A new index keyword can now be used in for...in structures to refer to the index of the current iteration: htt
🌲 #newfeature A new index keyword can now be used in for...in structures to refer to the index of the current iteration: https://www.tradingview.com/pine-script-reference/v5/#op_for{dot}{dot}{dot}in

🌲 #newfeature New array functions We have added 8 new array functions that allow you to sort, search and do other useful stu
🌲 #newfeature New array functions We have added 8 new array functions that allow you to sort, search and do other useful stuff with arrays: https://www.tradingview.com/pine-script-docs/en/v5/Release_notes.html#march-2022

🌲 #newfeature You can now merge table cells to created headers, and add a tooltip to any table cell. See the recent blog post: https://www.tradingview.com/blog/en/pine-tables-now-support-headers-and-tooltips-29924/

🔈 #news We have updated the text in the Community Scripts page's "About" box. Many Pine coders use Pine to develop their own
🔈 #news We have updated the text in the Community Scripts page's "About" box. Many Pine coders use Pine to develop their own indicators/strategies. That's great, and why TV develops Pine. A few of those authors also publish their work for the benefit of all TradingViewers. We never miss a chance to thank them because they bring tremendous value to traders all around the world. We think it's safe to say that TradingView has become the hotbed of new developments in indicators concepts. We owe this to the creativity and generosity of our authors. Warm thanks go to all of you who publish useful scripts. 💙

🌲 #newfeature A new `input.text_area()` function now provides a large input field for long text.
🌲 #newfeature A new `input.text_area()` function now provides a large input field for long text.

🌲 #newfeature A new timeframe.in_seconds(timeframe) function provides a unified way to more easily compare timeframes. This will be useful in error-checking code, to disable indicators using request.security() when their timeframe would be lower than the chart's, or when deriving secondary timeframes from the chart's TF. You can use it without an argument to get the chart's TF in seconds: timeframe.in_seconds(): https://www.tradingview.com/pine-script-reference/v5/#fun_timeframe{dot}in_seconds

🌲 #newfeature The ta.valuewhen() function can now return the state of "bool" and "color" variables when its condition argument is true. For example, you can now use:
ta.valuewhen(condition, boolVariable, 0)

to find the value of boolVariable the last time condition was true.

🔈 #news Many categories were added to better identify the scripts you publish through the "Publish Script" window.
🔈 #news Many categories were added to better identify the scripts you publish through the "Publish Script" window.

🌲 #newfeature A new line.copy() function now allows line IDs to be copied. Note that the line is not copied; only its reference ID: https://www.tradingview.com/pine-script-reference/v5/#fun_line{dot}copy

🌲 #newfeature Our selection team for Editors' Picks now includes the best Pine libraries in its picks. Picked libraries are
🌲 #newfeature Our selection team for Editors' Picks now includes the best Pine libraries in its picks. Picked libraries are hidden from the default EPs page because they tend to confuse script users who are not Pine programmers. To see the selected libraries, use the new "Libraries" item in the dropdown menu.

🐞⚔️ #bugfix On some symbols such as BINANCE:BNBUSDT it was not possible to issue strategy orders on fractional sizes. The problem was fixed.

🌲 #newfeature We can now edit our scripts in a detached window: https://www.tradingview.com/blog/en/edit-your-pine-code-on-a-separate-page-28522/

🌲 #newfeature The new last_bar_index and last_bar_time built-in variables return the index and time of the chart's last bar. This allows you to know in advance the number of bars in the dataset, and where it ends.

🌲 #newfeature Don't miss the most important new additions to Pine: https://www.tradingview.com/blog/en/new-in-pine-overloads-new-string-functions-and-more-28453/

🌲 #newfeature A new hlcc4 built-in variable was added. It averages the high and low values with the double-weighted close.

🔈 #news The time limit for the execution of any single loop has been extended from 200 to 500ms. More processing power to you, Pine coders!