Hola a todos tengo un problema con un codigo , en v10 funciona en v11 no funciona , mensaje error:(a positive integer field is expected with barindex) “enter/spacebear”key
EL CODIGO :
period=30
vmstop=1
hismax=max(hismax,high)
maxim=highest[barindex](low)
//indicador maximos minimos 52 periodos
maxma=highest[52](close)
minma=lowest[52](close)
//media ponderada y % stoploss
mp=weightedaverage [period](close)
vm=mp-((mp*((vmstop+100)/100))-mp)-0.00
//puntos
atr=averagetruerange[20]
topy=high
topx=barindex
topy2=vm
boty=low
botx=barindex
if close>maxim[1]then
drawtext(“☺”,botx,boty+atr*1.66,dialog,standard,14)coloured(0,100,255,180)
endif
//semaforo alcista alfayate
mm30=weightedaverage[30](close)
cap=volume*close
maxi=highest[52](close)
volmax=highest[52](cap)
vol=((cap*100/volmax)*4/5)
volpmed=exponentialaverage[52](vol)
mycpm=(vol-volpmed)
cpm5=(mycpm+mycpm[1]+mycpm[2]+mycpm[3]+mycpm[4])/5
cpm20=(mycpm+mycpm[1]+mycpm[2]+mycpm[3]+mycpm[4]+mycpm[5]+mycpm[6]+mycpm[7]+mycpm[8]+mycpm[9]+mycpm[10]+mycpm[11]+mycpm[12]+mycpm[13]+mycpm[14]+mycpm[15]+mycpm[16]+mycpm[17]+mycpm[18]+mycpm[19])/20
distanciamax=abs((close[0]-maxi)/close*100)
riesgostop=abs((close-mm30)/close*100)
//verificacion y representacion de condiciones //verifica estado si comprable “memoria” 52s
if comprado=0and(distanciamax<2and riesgostop<9and riesgostop>3and cap>1000000and cpm5>0and cpm20>-15and fr>=0.1)then
compra=1
comprado=1
venta=0
drawtext(“↑”,topx,topy+atr*0.66,dialog,standard,14)coloured(0,100,255,220)
drawtext(“———————-“,topx,topy2+atr*0.00,dialog,standard,11)coloured(255,0,100,180)
else
compra=0
endif
if comprado=1and(riesgostop>=30or cpm20<=-15or fr<=-0.9)then
venta=1
compra=0
comprado=0
drawtext(“↓”,botx,boty-atr+0.66,dialog,standard,14)coloured(255,0,100,180)
else
venta=0
endif
//indicador rscmansfield2
ignored, fr=call “rscmansfield2″
return mp as”media ponderada”,vm coloured(255,153,51)as “media ponderada % stoploss”, maxma coloured(0,125,255)as “maximos anuales”,minma coloured(255,125,125)as “minimos anuales”, compra coloured(0,153,0)as “compra”,venta coloured(255,0,0)as “venta”, fr as “mansfield”