簡體   English   中英

Pine Script 從 v1 到 v3 或 v4 或 v5 的轉換

[英]Pine Script from v1 to v3 or v4 or v5 conversion

我一直在嘗試轉換為 v3、v4 和 v5 一段時間,並在對話指南中進行了查找,但沒有成功。 我總是遇到相同或相似的錯誤,有人可以幫我轉換它。 提前感謝您的幫助。

study(title = "[ACCUMULATOR] BOTTOM BUYER STUDY", overlay=false, precision=1)
pctile = input(95, title="Percentile Threshold Extreme Value, Exceeding Creates Colored Histogram")
wrnpctile = input(85, title="Percentile Threshold Warning Value, Exceeding Creates Colored Histogram")
Short = input(0.4, title="PPO Fast Setting")
Long = input(0.8, title="PPO Slow Setting")
lkbT = input(1000,title="Look Back Period For Tops Rank")
lkbB = input(1000,title="Look Back Period For Bottom Rank")
sl=input(true,title="Show Threshold Line?")
swl=input(true,title="Show Warning Threshold Line?")

//Laguerre PPO Code from TheLark
lag(g, p) =>
    L0 = (1 - g)*p+g*nz(L0[1])
    L1 = -g*L0+nz(L0[1])+g*nz(L1[1])
    L2 = -g*L1+nz(L1[1])+g*nz(L2[1])
    L3 = -g*L2+nz(L2[1])+g*nz(L3[1])
    f = (L0 + 2*L1 + 2*L2 + L3)/6
    f
lmas = lag(Short, hl2)
lmal = lag(Long, hl2)

pctileB = pctile * -1
wrnpctileB = wrnpctile * -1

//PPO Plot
ppoT = (lmas-lmal)/lmal*100
ppoB = (lmal - lmas)/lmal*100
//PercentRank of PPO 
pctRankT = percentrank(ppoT, lkbT)
pctRankB = percentrank(ppoB, lkbB) * -1
//Color Definition of Columns
colT = pctRankT >= pctile ? red : pctRankT >= wrnpctile and pctRankT < pctile ? orange : gray
colB = pctRankB <= pctileB ? lime : pctRankB <= wrnpctileB and pctRankB > pctileB ? green : silver
//Plot Statements.
plot(pctRankT,title="Sell Percentile Rank Columns", color=colT, style=columns, linewidth=2)
plot(sl and pctile ? pctile : na, title="Extreme Move Percentile Threshold Line", color=red, style=linebr, linewidth=4)
plot(swl and wrnpctile ? wrnpctile : na, title="Warning Percentile Threshold Line", color=orange, style=line, linewidth=4)

plot(pctRankB,title="Buy Percentile Rank Columns", color=colB, style=columns, linewidth=2)
plot(sl and pctileB ? pctileB : na, title="Extreme Move Percentile Threshold Line", color=lime, style=linebr, linewidth=4)
plot(swl and wrnpctileB ? wrnpctileB : na, title="Warning Percentile Threshold Line", color=green, style=line, linewidth=4)
plot(0, title="0 Line Circles Plot", style=circles, linewidth=4, color=silver)
plot(0, title="0 Line-Line Plot", style=linebr, linewidth=4, color=gray)

buy_alert_good = (pctRankB <= pctileB) or (pctRankB <= wrnpctileB and pctRankB > pctileB)
sell_alert_good = (pctRankT >= pctile) or (pctRankT >= wrnpctile and pctRankT < pctile)

alertcondition(buy_alert_good, title="BUY CONDITION", message="BUY CONDITION")
alertcondition(sell_alert_good, title="SELL CONDITION", message="SELL CONDITION")
//@version=5
indicator(title='[ACCUMULATOR] BOTTOM BUYER STUDY', overlay=false, precision=1)
pctile = input(95, title='Percentile Threshold Extreme Value, Exceeding Creates Colored Histogram')
wrnpctile = input(85, title='Percentile Threshold Warning Value, Exceeding Creates Colored Histogram')
Short = input(0.4, title='PPO Fast Setting')
Long = input(0.8, title='PPO Slow Setting')
lkbT = input(1000, title='Look Back Period For Tops Rank')
lkbB = input(1000, title='Look Back Period For Bottom Rank')
sl = input(true, title='Show Threshold Line?')
swl = input(true, title='Show Warning Threshold Line?')

//Laguerre PPO Code from TheLark
lag(g, p) =>
    L0 = 0.
    L0 := (1 - g) * p + g * nz(L0[1])
    L1 = 0.
    L1 := -g * L0 + nz(L0[1]) + g * nz(L1[1])
    L2 = 0.
    L2 := -g * L1 + nz(L1[1]) + g * nz(L2[1])
    L3 = 0.
    L3 := -g * L2 + nz(L2[1]) + g * nz(L3[1])
    f = (L0 + 2 * L1 + 2 * L2 + L3) / 6
    f
lmas = lag(Short, hl2)
lmal = lag(Long, hl2)

pctileB = pctile * -1
wrnpctileB = wrnpctile * -1

//PPO Plot
ppoT = (lmas - lmal) / lmal * 100
ppoB = (lmal - lmas) / lmal * 100
//PercentRank of PPO 
pctRankT = ta.percentrank(ppoT, lkbT)
pctRankB = ta.percentrank(ppoB, lkbB) * -1
//Color Definition of Columns
colT = pctRankT >= pctile ? color.red : pctRankT >= wrnpctile and pctRankT < pctile ? color.orange : color.gray
colB = pctRankB <= pctileB ? color.lime : pctRankB <= wrnpctileB and pctRankB > pctileB ? color.green : color.silver
//Plot Statements.
plot(pctRankT, title='Sell Percentile Rank Columns', color=colT, style=plot.style_columns, linewidth=2)
plot(sl and pctile ? pctile : na, title='Extreme Move Percentile Threshold Line', color=color.new(color.red, 0), style=plot.style_linebr, linewidth=4)
plot(swl and wrnpctile ? wrnpctile : na, title='Warning Percentile Threshold Line', color=color.new(color.orange, 0), style=plot.style_line, linewidth=4)

plot(pctRankB, title='Buy Percentile Rank Columns', color=colB, style=plot.style_columns, linewidth=2)
plot(sl and pctileB ? pctileB : na, title='Extreme Move Percentile Threshold Line', color=color.new(color.lime, 0), style=plot.style_linebr, linewidth=4)
plot(swl and wrnpctileB ? wrnpctileB : na, title='Warning Percentile Threshold Line', color=color.new(color.green, 0), style=plot.style_line, linewidth=4)
plot(0, title='0 Line Circles Plot', style=plot.style_circles, linewidth=4, color=color.new(color.silver, 0))
plot(0, title='0 Line-Line Plot', style=plot.style_linebr, linewidth=4, color=color.new(color.gray, 0))

buy_alert_good = pctRankB <= pctileB or pctRankB <= wrnpctileB and pctRankB > pctileB
sell_alert_good = pctRankT >= pctile or pctRankT >= wrnpctile and pctRankT < pctile

alertcondition(buy_alert_good, title='BUY CONDITION', message='BUY CONDITION')
alertcondition(sell_alert_good, title='SELL CONDITION', message='SELL CONDITION')

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM