Dear,
I would like to build my own indicator that uses the “islastbarupdate” to draw an arrow (upward or downward) according to the trend during the creating of the last candle. In addition to that I would like to change the color of that arrow during the last bar in this way:
when the new bar open and the price stays above the closing of the previous one the arrow is yellow, after having the yellow arrow (and only after having this first condition satisied) if the price goes below the close of the previous one the arrow shall become red.
Is it possible? I try different way but without success, I’m not able to control the sequence with the flag variable
flag=0
if islastbarupdate then
while (low >= close[1]-1 and close[1]>open[1] and flag=0) do
DRAWARROWDOWN(barindex, high+5) COLOURED(255,215,0)
flag=1
break
wend
while (flag=1 and close<open-1) do
DRAWARROWDOWN(barindex, high+5) COLOURED(255,0,0)
flag=3
break
wend
endif
JSParticipant
Senior
Hi @Pippone1987
Maybe you can use this as a starting point…
DefParam DrawOnLastBarOnly=True
If Close > Close[1] and Close > Open[1] then
DrawArrowUp(BarIndex, High+5) Coloured("Yellow")
EndIf
If Close < Open then
DrawArrowDown(BarIndex,High+5) Coloured("Red")
EndIf
Return
Ok
I’m going to perform some test to understand if it fits the intended behavior.
Thanks
@JS