How can I draw an arrow up on the minimum and an arrow down of the last n bars?
For example: I would like to draw an arrow up and an arrow down of the last 10000 bars that shows the lower and the higher value. (see attached)
There you go:
Defparam DrawOnLastBarOnly = true
ONCE hh = 0
ONCE ll = 0
p = 10000
n = 0.003
hh = highest[p](high)
ll = lowest[p](low)
IF (hh <> hh[1]) OR (ll <> ll[1]) THEN
FOR i = 0 TO (p - 1)
IF hh = high[i] THEN
BarHH = BarIndex[i]
ENDIF
IF ll = low[i] THEN
BarLL = BarIndex[i]
ENDIF
NEXT
ENDIF
DrawArrowUP(BarLL,ll * (1 - N)) coloured(0,255,0,255)
DrawArrowDOWN(BarHH,hh * (1 + N)) coloured(255,0,0,255)
RETURN
but 10000 is such a high number that your chart will almost get stuck.
Thank you very much Roberto