Bar Strength For ThinkOrSwim
This study measures bar strength compared to an adjustable period of previous bars. The length you set this period will affect the signals. Play around with it on different time frames to see what looks best.
Color coding: Light green / light red = STRONG, green / red = STRONGER, cyan / magenta = STRONGEST.
This study measures bar strength compared to an adjustable period of previous bars. The length you set this period will affect the signals. Play around with it on different time frames to see what looks best.
Color coding: Light green / light red = STRONG, green / red = STRONGER, cyan / magenta = STRONGEST.
Code:
declare upper;
input length = 10;
input paintbars = yes;
def BarStrength = (close - open) * volume;
def VolAvg = Average(volume, length);
def BarStrengthAvg = (close - open) * VolAvg;
def PositiveBarStrength = BarStrength > BarStrengthAvg;
def NegativeBarStrength = BarStrength < BarStrengthAvg;
def PositiveBarStrength2 = BarStrength > BarStrengthAvg*1.5;
def NegativeBarStrength2 = BarStrength < BarStrengthAvg*1.5;
def PositiveBarStrength3 = BarStrength > BarStrengthAvg*2;
def NegativeBarStrength3 = BarStrength < BarStrengthAvg*2;
AssignPriceColor( if paintbars and PositiveBarStrength3 and open<close then Color.CYAN else if paintbars and NegativeBarStrength3 and close<open then Color.Magenta else if paintbars and PositiveBarStrength2 and open<close then Color.Green else if paintbars and NegativeBarStrength2 and close<open then Color.Red else if paintbars and PositiveBarStrength and open<close then Color.LIGHT_GREEN else if paintbars and NegativeBarStrength and close<open then Color.LIGHT_RED else if paintbars then Color.Gray else Color.CURRENT);
Last edited by a moderator: