Linked Questions

Popular Questions

Pine Script receiving an "Syntax error at input"

Asked by At

I'm coding ML script using a library, and it gives syntax error, i'm trying to manipulate data from single array

//@version=5
indicator("My script")
import E5Trading/E5TradingLibrary/1 as auto
import kaigouthro/into/2 as boof

price=hlc3
srce1=1
srce2=2
srce3=3
srce4=5
srce5=8
srce6=13
srce7=21
srce8=34
srce90=55
srce10=84
srce11=139

basis =ta.sma(price,srce1)
basis2 =ta.sma(price,srce2)
basisA =ta.sma(price,srce3)
basis2A =ta.sma(price,srce4)
basisB =ta.sma(price,srce5)
basis2B =ta.sma(price,srce6)
basisC =ta.sma(price,srce7)
basis2C =ta.sma(price,srce8)
basisD =ta.sma(price,srce90)
basis2D =ta.sma(price,srce10)
basisE =ta.sma(price,srce11)

arrsig=array.from(basis,basis2,basisA,basis2A,basisB,basis2B,basisC,basis2C,basisD,basis2D,basisE)
N=array.size(arrsig) - 1
funcml(data) =>
     
     grarry=array.new_float(0)
     rdarry=array.new_float(0)
     for i = 0 to N-1 by 1
         for j = 0 to N-1 by 1
             while i!=j        
                 
          gchk=auto.isReversalUpTrend(array.get(data,i),array.get(data,j)
                 grchkv=boof.f(gchk)
                 array.push(grarry,grchkv)
                 
                 
        rchk=auto.isReversalDownTrend(array.get(data,i,array.get(data,j)
                 rdchkv=boof.f(rchk)
                 array.push(rdarry,rdchkv)
 [grarry,rdarry]
                 

                
[smacumgr,smacumrd]=funml(arrsig)
cumresgr=array.sum(smacumgr)
cumresrd=array.sum(smacumrd)
vuptrnd=cumresgr>math.abs(cumresrd)
vdwntrnd=cumresgr<math.abs(cumresrd)

plotchar(vuptrnd,char="",color=color.green,location = location.top,size = size.tiny)
plotchar(vdwntrnd,char="",color=color.red,location = location.top,size=size.tiny)

//end



the error message is: :Syntax error at input 'rdarry'

im using nester for loops to test sma cross ; whether its up trend or down trend; nested loop function im trying here for first time; thanks for your kind help

Related Questions