Bar Color Change based on two condition


0
0

Hi Hahn,

Is possible that you can help me to create color bars based on two conditions.

Thinkorswim Indicators:

if the Acceleration and Deceleration Osc  + Awesome Oscillator  are green= then the color bar will be green

if the Acceleration and Deceleration Osc  is Green + Awesome Oscillator  is  red= then the color bar will be Yellow

 

Thank you so much for your help with this.

 

Marked as spam
Posted by (Questions: 5, Answers: 7)
Asked on February 9, 2019 4:46 pm
565 views
0
Private answer

Your request did not include a color for all possible conditions. So the price bars will be colored green or yellow, but when the other conditions are true the price bars will remain green for up-bar and red for down-bar.

def AO = Average(hl2, 5) - Average(hl2, 34);
def AC = AO - Average(AO, 5);
AssignPriceColor(if AO > AO[1] and AC > AC[1] then Color.GREEN else if AC > AC[1] and AO < AO[1] then Color.YELLOW else Color.CURRENT);

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on February 15, 2019 10:55 am