April 9, 2021
Pine有什麼新功能？

• 新常數 math.pimath.phi、math.rphi、math.e
• 新的 round() 功能 — 該函數現在允許您指定舍入的精度，而不必始終舍入為最接近的整數
• median()
• mode()
• range()
• todegrees()
• random()

```//@version=4
strategy("I’m feeling lucky", overlay=true)
seed = input(1, "Seed, increase to recalculate the strategy", minval=1)
entryPerc = input(20.0, "Entry chance, %", minval=0.0, maxval=100.0)
exitPerc = input(10.0, "Exit chance, %", minval=0.0, maxval=100.0)
roll = random(0, 100, seed)
positionSize = floor(random(1, (strategy.equity / close), seed))
if roll < entryPerc
strategy.entry("My Long Entry Id", strategy.long, qty=positionSize)
if roll < exitPerc
strategy.close_all()```

```//@version=4
study("My SMAs", overlay=true)
sma_lengths = input("5, 10, 20, 30, 50", title = "SMA Lengths (separated by comma)")
sma_lengths_array = str.split(str.replace_all(sma_lengths, " ", ""), ",")
sma_len(index) =>
index > array.size(sma_lengths_array) - 1 ? 10 :
int(tonumber(array.get(sma_lengths_array, index)))
sma0 = sma(close, sma_len(0))
sma1 = sma(close, sma_len(1))
sma2 = sma(close, sma_len(2))
sma3 = sma(close, sma_len(3))
sma4 = sma(close, sma_len(4))
plot(sma0, color=color.blue)
plot(sma1, color=color.red)
plot(sma2, color=color.green)
plot(sma3, color=color.orange)
plot(sma4, color=color.purple)```

```//@version=4
study(title="Aroon", shorttitle="Aroon", overlay=false, format=format.percent, precision=2, resolution="")
length = input(14, minval=1)
upper = 100 * (highestbars(high, length+1) + length)/length
lower = 100 * (lowestbars(low, length+1) + length)/length
plot(upper, "Aroon Up", color=#FF6A00)
plot(lower, "Aroon Down", color=#0094FF)```

session.ismarket、session.ispremarketsession.ispostmarket 這三個新變數，使您可以檢查日內交易時段與當前K線相關的部分。請注意，延長時段僅顯示在日內圖表上，並且僅在透過設置明確啟用了該選項時才會顯示。