我收到错误"internal server pine compilation error"但我不知道在哪里查找代码中的错误



我开发的这个指标一直工作良好,直到最后一次修改,现在它告诉我";内部服务器pine编译错误";但我不知道怎么了。我只是把我用来调试的很多输入转换成了实际的变量,因为我不需要配置它们。我不知道该添加什么,因为保存时会显示:

正在处理脚本。。。脚本"Aleznox Entrypoints"已保存

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// By FishoJr
//@version=5
indicator(title          = "Aleznox Entrypoints [FishoJr] + EMA + VPVR", 
shorttitle      = "Aleznox Entrypoints", 
overlay         = true)

vp_lookback = 200
vp_max_bars = 500
vp_bar_mult = 50
vp_bar_offset = 30
vp_bar_width = 2
vp_delta_type = 'Both'
vp_poc_show = true
vp_bar_color = color.new(color.blue, 60)
vp_poc_color = color.new(color.white, 10)
lengthKC = 20
adxlen = 14
dilen = 14
transparency = 85
//upperTimeframe = input.timeframe("1D", "Upper timeframe trend", options = ["1", "3", "15", "60", "240", "1D", "1W", "1M"])
//isAutomated = input.bool(true, title="Automated Set UpperTimeFrame")
// VP VARIABLES
float vp_Vmax = 0.0
int vp_VmaxId = 0
int vp_N_BARS = vp_max_bars
var int vp_first = time
vp_a_P = array.new_float(vp_N_BARS + 1, 0.0)
vp_a_V = array.new_float(vp_N_BARS, 0.0)
vp_a_D = array.new_float(vp_N_BARS, 0.0)
vp_a_W = array.new_int(vp_N_BARS, 0)
// VP CALCULATIONS
float vp_HH = ta.highest(high, vp_lookback)
float vp_LL = ta.lowest(low, vp_lookback)
if barstate.islast
float vp_HL = (vp_HH - vp_LL) / vp_N_BARS
for j = 1 to vp_N_BARS + 1 by 1
array.set(vp_a_P, j - 1, vp_LL + vp_HL * j)
for i = 0 to vp_lookback - 1 by 1
int Dc = 0
array.fill(vp_a_D, 0.0)
for j = 0 to vp_N_BARS - 1 by 1
float Pj = array.get(vp_a_P, j)
if low[i] < Pj and high[i] > Pj and (vp_delta_type == 'Bullish' ? close[i] >= open[i] : vp_delta_type == 'Bearish' ? close[i] <= open[i] : true)
float Dj = array.get(vp_a_D, j)
float dDj = Dj + nz(volume[i])
array.set(vp_a_D, j, dDj)
Dc += 1
Dc
for j = 0 to vp_N_BARS - 1 by 1
float Vj = array.get(vp_a_V, j)
float Dj = array.get(vp_a_D, j)
float dVj = Vj + (Dc > 0 ? Dj / Dc : 0.0)
array.set(vp_a_V, j, dVj)
vp_Vmax := array.max(vp_a_V)
vp_VmaxId := array.indexof(vp_a_V, vp_Vmax)
for j = 0 to vp_N_BARS - 1 by 1
float Vj = array.get(vp_a_V, j)
int Aj = math.round(vp_bar_mult * Vj / vp_Vmax)
array.set(vp_a_W, j, Aj)
// Timeframe corrections                    
currentTimeframeMultiplier = switch timeframe.period
"1" => 1
"3" => 3
"5" => 5
"15" => 15
"30" =>30
"60" => 60
"240" => 240
"D" => 1440
"W" => 10080
=>
runtime.error("Timeframe not supported :" + timeframe.period)
0

upperTimeframeMultiplier = switch currentTimeframeMultiplier
1 => 3
3 => 15
5 => 15
15 => 60
30 =>240
60 => 240
240 => 1440
1440 => 10080
10080 => 40320
=>
runtime.error("Timeframe not supported")
0

upperTimeframe = switch upperTimeframeMultiplier
3 => "3"
5 => "5"
15 => "15"
60 => "60"
240 => "240"
1440 => "1D"
10080 => "1W"
40320 => "1M"
=> 
"1M"
timeframeMultiplier = upperTimeframeMultiplier / currentTimeframeMultiplier

//Functions 
//adx       
dirmov(len) =>
up = ta.change(high)
down = -ta.change(low)
truerange = ta.rma(ta.tr, len)
plus = fixnan(100 * ta.rma(up > down and up > 0 ? up : 0, len) / truerange)
minus = fixnan(100 * ta.rma(down > up and down > 0 ? down : 0, len) / truerange)
[plus, minus]
adx(dilen, adxlen) => 
[plus, minus] = dirmov(dilen)
sum = plus + minus
adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)
adx
//Entrypoints using adx, sqz, uppertimeframe    
entryPoints(val, sig, step, trendBool) =>
if (val > 0 and val < nz(val[step]) and nz(val[step]) > nz(val[step+1]) and sig < sig[step] and trendBool == false)
l = label.new(bar_index, na)
label.set_text(l, "short")
label.set_color(l, color.red)
label.set_yloc(l, yloc.abovebar)
label.set_style(l, label.style_label_down)
if (val < 0 and val > nz(val[step]) and nz(val[step]) < nz(val[step+1]) and sig < sig[step] and trendBool == true)
l = label.new(bar_index, na)
label.set_text(l, "long")
label.set_color(l, color.green)
label.set_yloc(l, yloc.belowbar)
label.set_style(l, label.style_label_up)

//Uppertimeframe trend gauging using sqz
fillTrends(sqz, timeframeMultiplier) =>
trend = sqz < nz(sqz[timeframeMultiplier]) ? false : true
trend
//sqz
sqz() =>
ta.linreg(close - math.avg(math.avg(ta.highest(high, lengthKC), ta.lowest(low, lengthKC)),ta.sma(close,lengthKC)), lengthKC,0)

//fetching series needed
sqz = sqz()
adx = adx(dilen, adxlen)
upperAdx = request.security(symbol=syminfo.tickerid, timeframe=upperTimeframe, expression=adx(dilen, adxlen))
upperSqz = request.security(symbol=syminfo.tickerid, timeframe=upperTimeframe, expression=sqz())
//Trends
trendBool = fillTrends(upperSqz, timeframeMultiplier)
bgcolor(trendBool ? color.new(color.green, transparency) : color.new(color.red, transparency))
//Entrypoints
entryPoints(sqz, adx, 1, trendBool)
//Adding 2 EMAs
//ADD EMA >>
iEma = input(10, title="EMA1")
iEma1 = input(55, title="EMA2")
iEmaColor = input.color(color.blue, title="EMA1 Color")
iEmaColor1 = input.color(color.orange, title="EMA2 Color")
src = close
ema10 = ta.ema(src,iEma)
ema55 = ta.ema(src,iEma1)
plot(ema10, color = iEmaColor, style=plot.style_line, linewidth=2, title="EMA_1")
plot(ema55, color = iEmaColor1, style=plot.style_line, linewidth=2, title="EMA_2")

Internal server pine compilation error是一个包罗万象的错误,因为编译器没有正确编译脚本,但原因没有得到处理。这很可能是Pine编译器本身的错误。我向松树队报告了,他们会看一看的。

这个问题似乎与runtime.error()request.security()一起使用有关,因此从switch语句中提取runtime.error()可以使一切正常:

// Timeframe corrections                    
currentTimeframeMultiplier = switch timeframe.period
"1" => 1
"3" => 3
"5" => 5
"15" => 15
"30" =>30
"60" => 60
"240" => 240
"D" => 1440
"W" => 10080
=> 0
if currentTimeframeMultiplier == 0
runtime.error("Timeframe not supported :" + timeframe.period)
upperTimeframeMultiplier = switch currentTimeframeMultiplier
1 => 3
3 => 15
5 => 15
15 => 60
30 =>240
60 => 240
240 => 1440
1440 => 10080
10080 => 40320
=> 0
if upperTimeframeMultiplier == 0
runtime.error("Timeframe not supported")

相关内容

最新更新