Can I please have help with colouring price bars as per my indicator below
If I=1 then price bar should be coloured blue
If i=0 then price bar should be coloured black
If i=-1 the price bar should be coloured red.
Changing colors of bars is only possible with version 10.3 and the new instruction DRAWCANDLE or DRAWBARCHART.
What version or broker are you using right now?
Thank you for the reply Nicholas.I am currently using the 10.2 on the IG brker platform.
Ok, so it’s not possible to draw custom bars then. The only possibility would be to draw dots of different colors above or below the price or maybe coloured histogram in a custom indicator below the price chart. What’s your preference?
Can you please then write me the code for both options.
Many thanks.
It would be much easier with your indicator code, for a direct implementation. So please provide it, thanks.
A1=AVERAGE[X]
A2=AVERAGE[X][1]
B1=AVERAGE[Y]
B2=AVERAGE[Y][1]
IF A1>B1 AND A1>A2 AND B1>B2 THEN
I=1
ELSIF A1<B1 AND A1<A2 AND B1<B2 THEN
I=-1
ELSE
I=0
ENDIF
RETURN I AS “INDICATOR”
Ok, so you already have everything needed to draw a cool histogram indicator to show your buy/sell signals :
X = 10
Y = 20
A1=AVERAGE[X]
A2=AVERAGE[X][1]
B1=AVERAGE[Y]
B2=AVERAGE[Y][1]
IF A1>B1 AND A1>A2 AND B1>B2 THEN
I=1
ELSIF A1<B1 AND A1<A2 AND B1<B2 THEN
I=-1
ELSE
I=0
ENDIF
RETURN I coloured by I AS "INDICATOR"
How about this being shown on the price bar above & below as dots as you mentioned.
You just have to change yourself the colours in the indicator parameters window (see screenshot attached).