Skip to content

Instantly share code, notes, and snippets.

@tarnus
Last active August 28, 2020 17:13
Show Gist options
  • Save tarnus/8d67cc43e78644c7dd24c171758988fe to your computer and use it in GitHub Desktop.
Save tarnus/8d67cc43e78644c7dd24c171758988fe to your computer and use it in GitHub Desktop.
TOS R-Vol color code
input length = 21;
input offset = 1;
def ADV = Average(volume, length)[offset];
def rVol = volume /ADV;
def rVolmult = rVol * 5;
# remove "#" infront of Addlabels to select prefer choice
#AddLabel(yes, round(rVol,2));
#AddLabel(yes, asPercent(rVol));
def value2 = round(rVol,2);
def value1 = RoundUp(rVolmult,0);
plot alert = value2;
alert.AssignValueColor(color.BLACK);
alert.setDefaultColor(color.BLACK);
alert.DefineColor("c1",CreateColor(31, 81, 183));
alert.DefineColor("c2",CreateColor(45, 98, 199));
alert.DefineColor("c3",CreateColor(60, 116, 215));
alert.DefineColor("c4",CreateColor(75, 133, 231));
alert.DefineColor("c5",CreateColor(97, 159, 255));
alert.DefineColor("c6",CreateColor(19, 150, 0));
alert.DefineColor("c7",CreateColor(21, 170, 0));
alert.DefineColor("c8",CreateColor(23, 190, 0));
alert.DefineColor("c9",CreateColor(25, 210, 0));
alert.DefineColor("c10",CreateColor(29, 240, 0));
alert.DefineColor("c11",CreateColor(228, 213, 36));
alert.DefineColor("c12",CreateColor(228, 213, 36));
alert.DefineColor("c13",CreateColor(235, 219, 59));
alert.DefineColor("c14",CreateColor(241, 225, 82));
alert.DefineColor("c15",CreateColor(251, 234, 116));
alert.DefineColor("c16",CreateColor(219, 103, 0));
alert.DefineColor("c17",CreateColor(226, 111, 10));
alert.DefineColor("c18",CreateColor(237, 125, 25));
alert.DefineColor("c19",CreateColor(244, 133, 35));
alert.DefineColor("c20",CreateColor(255, 147, 51));
alert.DefineColor("c21",CreateColor(219, 66, 0));
alert.DefineColor("c22",CreateColor(226, 63, 12));
alert.DefineColor("c23",CreateColor(237, 58, 31));
alert.DefineColor("c24",CreateColor(247, 54, 49));
alert.DefineColor("c25",CreateColor(255, 51, 62));
alert.DefineColor("c26",CreateColor(173, 0, 39));
alert.DefineColor("c27",CreateColor(189, 23, 74));
alert.DefineColor("c28",CreateColor(214, 58, 127));
alert.DefineColor("c29",CreateColor(238, 93, 179));
alert.DefineColor("c30",CreateColor(255, 117, 215));
alert.setDefaultColor(getcolor(9));
AssignBackgroundColor(if value1 == 1 then alert.Color("c1")
else if value1 == 2 then alert.Color("c1")
else if value1 == 3 then alert.Color("c2")
else if value1 == 4 then alert.Color("c2")
else if value1 == 5 then alert.Color("c3")
else if value1 == 6 then alert.Color("c3")
else if value1 == 7 then alert.Color("c4")
else if value1 == 8 then alert.Color("c5")
else if value1 == 9 then alert.Color("c6")
else if value1 == 10 then alert.Color("c7")
else if value1 == 11 then alert.Color("c8")
else if value1 == 12 then alert.Color("c9")
else if value1 == 13 then alert.Color("c10")
else if value1 == 14 then alert.Color("c11")
else if value1 == 15 then alert.Color("c12")
else if value1 == 16 then alert.Color("c13")
else if value1 == 17 then alert.Color("c14")
else if value1 == 18 then alert.Color("c15")
else if value1 == 19 then alert.Color("c16")
else if value1 == 20 then alert.Color("c17")
else if value1 == 21 then alert.Color("c18")
else if value1 == 22 then alert.Color("c19")
else if value1 == 23 then alert.Color("c20")
else if value1 == 24 then alert.Color("c21")
else if value1 == 25 then alert.Color("c22")
else if value1 == 26 then alert.Color("c23")
else if value1 == 27 then alert.Color("c23")
else if value1 == 28 then alert.Color("c23")
else if value1 == 29 then alert.Color("c24")
else if value1 == 30 then alert.Color("c24")
else if value1 == 31 then alert.Color("c24")
else if value1 == 32 then alert.Color("c24")
else if value1 == 33 then alert.Color("c25")
else if value1 == 34 then alert.Color("c25")
else if value1 == 35 then alert.Color("c25")
else if value1 == 36 then alert.Color("c26")
else if value1 == 37 then alert.Color("c26")
else if value1 == 38 then alert.Color("c26")
else if value1 == 39 then alert.Color("c27")
else if value1 == 40 then alert.Color("c27")
else if value1 == 41 then alert.Color("c27")
else if value1 == 42 then alert.Color("c28")
else if value1 == 43 then alert.Color("c28")
else if value1 == 44 then alert.Color("c28")
else if value1 == 45 then alert.Color("c29")
else if value1 == 46 then alert.Color("c29")
else if value1 == 47 then alert.Color("c29")
else if value1 == 48 then alert.Color("c30")
else if value1 == 49 then alert.Color("c30")
else if value1 == 50 then alert.Color("c30")
else if value1 > 50 then color.WHITE
else
color.DARK_GRAY);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment