Pinescript to Aggr Script
00xSky opened this issue · 3 comments
Hi, I'm having trouble using pinescript coded indicators on Aggr-trade in Tradingview. I'm doing some simple operations, but I still haven't been able to get the coding logic in place. My English is not very good, I think I did not fully understand the document. I keep getting "Parameter error" and it doesn't show me where I went wrong. What I want to do is make an indicator similar to the bolinger band. Below are the Pinescript codes. I would be glad if you help.
indicator("luxTest",shorttitle = "LuxnaydaTest",overlay=true,max_bars_back=1000,max_lines_count=500,max_labels_count=500)
length = input.float(250,'Window Size',maxval=500,minval=0)
h = input.float(4.)
mult = input.float(3.)
src = input.source(close,'Source')
//----
n = bar_index
var k = 2
var upper = array.new_line(0)
var lower = array.new_line(0)
lset(l,x1,y1,x2,y2,col)=>
line.set_xy1(l,x1,y1)
line.set_xy2(l,x2,y2)
line.set_color(l,col)
line.set_width(l,2)
if barstate.isfirst
for i = 0 to length/k-1
array.push(upper,line.new(na,na,na,na))
array.push(lower,line.new(na,na,na,na))
//----
line up = na
line dn = na
if barstate.islast
y = array.new_float(0)
sum_e = 0.
for i = 0 to length-1
sum = 0.
sumw = 0.
for j = 0 to length-1
w = math.exp(-(math.pow(i-j,2)/(h*h*2)))
sum += src[j]*w
sumw += w
y2 = sum/sumw
sum_e += math.abs(src[i] - y2)
array.push(y,y2)
mae = sum_e/length*mult
for i = 1 to length-1
y2 = array.get(y,i)
y1 = array.get(y,i-1)
up := array.get(upper,i/k)
dn := array.get(lower,i/k)
lset(up,n-i+1,y1 + mae,n-i,y2 + mae,#14efff)
lset(dn,n-i+1,y1 - mae,n-i,y2 - mae,#14efff)
sorry to break it to you but you can't use pinescript on aggr
not sure where you read that
I think I phrased it wrong. I am trying to convert Pinescript code so that I can use it in "aggr.trade". So I don't know how to edit the above code to use on aggr.trade. You have created a document for this, I have been examining it for 2 days, but I am getting a "parameter error". Briefly, I am trying to convert the script written in pinescript code above to work in aggr-trade.
Well there is already a bollinger band script on aggr, you can add it and see what the code looks like !
not quite sure why your script is so damn complicated