Ciao a tutti, vorrei se possibile modificare il codice (perfetto!) di Nicolas in quanto quando vado a creare il trading system mi da errore dicendo che non contiene valori validi. Vorrei poter modificare il codice in modo da darmi degli istogrammi, quando entrare long, valore 2 e quando entrare short, valore 1. E’ possibile? Ora incollo il codice originale di Nicolas e un codice mio di come vorrei poterlo trasformare. Grazie mille!!
//---external parameters
//cp = 20
once lastpoint = 0
if high[cp] >= highest[2*cp+1](high) then
LH = 1
else
LH = 0
endif
if low[cp] <= lowest[2*cp+1](low) then
LL = -1
else
LL = 0
endif
if LH = 1 then
TOPy = high[cp]
TOPx = barindex[cp]
endif
if LL = -1 then
BOTy = low[cp]
BOTx = barindex[cp]
endif
if LH>0 and (lastpoint=-1 or lastpoint=0) then
DRAWSEGMENT(lastX,lastY,TOPx,TOPy) COLOURED(200,0,0,255)
DRAWTEXT("■",TOPx,TOPy,Dialog,Bold,20) coloured(200,0,0,255)
lastpoint = 1
lastX = TOPx
lastY = TOPy
endif
if LL<0 and (lastpoint=1 or lastpoint=0) then
DRAWSEGMENT(lastX,lastY,BOTx,BOTy) COLOURED(0,200,0,255)
DRAWTEXT("■",BOTx,BOTy,Dialog,Bold,20) coloured(0,200,0,255)
lastpoint = -1
lastX = BOTx
lastY = BOTy
endif
RETURN
a = open
b = close
c1 = (a > b)
c2 = (a < b)
if c1 then
n1 = 2
r1 = 0
g1 = 255
b1 = 0
endif
if c2 then
n1 = 1
r1 = 255
g1 = 0
b1 = 0
endif
if not c1 and not c2 then
n1 = -1
r1 = 0
g1 = 0
b1 = 255
endif
return n1 coloured (r1,g1,b1) style (histogram)