YungTraderFromMontana
Well-known member
I haven't contributed anything to the community in the while and some of you guys gave me so much, so I'm deciding to share my relative volume study. As of now it will only work on a 1hr chart, although if any of you are willing you could make adaptations for other chart settings. What sets my version apart is that it makes each hour of the day a separate variable, which eliminates biases like market open and market close bias. It also makes extended hour volumes much better to understand.
Pink is normal volume, blue is my updated relative volume.
Enjoy.
Pink is normal volume, blue is my updated relative volume.
Enjoy.
Code:
input averageType4 = AverageType.WILDERS;
input nightSessionFromMidnight = 0100;
input firstHourTrading = 0850;
input mainSession = 0959;
input nightSessionFromMainSessionEnd = 1559;
input paintBars = yes;
def clause1 = SecondsFromTime(0359) >= 0 and SecondsFromTime(0459) <= 0;
def clause2 = SecondsFromTime(0459) >= 0 and SecondsFromTime(0559) <= 0;
def clause3 = (SecondsFromTime(0559) >= 0 and SecondsFromTime(0659) <= 0);
def clause4 = (SecondsFromTime(0659) >= 0 and SecondsFromTime(0759) <= 0);
def clause5 = SecondsFromTime(0759) >= 0 and SecondsFromTime(0859) <= 0;
def clause6 = SecondsFromTime(0859) >= 0 and SecondsFromTime(0959) <= 0;
def clause7 = (SecondsFromTime(0959) >= 0 and SecondsFromTime(1059) <= 0);
def clause8 = (SecondsFromTime(1059) >= 0 and SecondsFromTime(1159) <= 0);
def clause9 = SecondsFromTime(1159) >= 0 and SecondsFromTime(1259) <= 0;
def clause10 = SecondsFromTime(1259) >= 0 and SecondsFromTime(1359) <= 0;
def clause11 = (SecondsFromTime(1359) >= 0 and SecondsFromTime(1459) <= 0);
def clause12 = (SecondsFromTime(1459) >= 0 and SecondsFromTime(1559) <= 0);
def clause13 = (SecondsFromTime(1559) >= 0 and SecondsFromTime(1659) <= 0);
def clause14 = SecondsFromTime(1659) >= 0 and SecondsFromTime(1759) <= 0;
def clause15 = SecondsFromTime(1759) >= 0 and SecondsFromTime(1859) <= 0;
def clause16 = (SecondsFromTime(1859) >= 0 and SecondsFromTime(1959) <= 0);
def isNightSessionFromMidnight = SecondsFromTime(nightSessionFromMidnight) >= 0 and SecondsTillTime(firstHourTrading) > 0;
def isFirstHourTrading = SecondsFromTime(firstHourTrading) >= 0 and SecondsTillTime(mainSession) > 0;
def isMainSession = SecondsFromTime(mainSession) >= 0 and SecondsTillTime(nightSessionFromMainSessionEnd) > 0;
def ah = SecondsFromTime(1659) > 0;
def newNightSessionFromMidnight = isNightSessionFromMidnight and !isNightSessionFromMidnight[1];
def cOvernightVolume = if newNightSessionFromMidnight then volume else if isNightSessionFromMidnight then cOvernightVolume[1] + volume else cOvernightVolume[1];
def AVL1 = 60;
def AVL2 = 120;
def AVL3 = 250;
def AVL4 = 400;
def AVL5 = 600;
def AVL6 = 1500;
input VolAverageType = AverageType.WILDERS;
# Selling Volume
def Vol1 = if clause1 then volume * close else 0;
def Vol2 = if clause2 then volume * close else 0;
def Vol3 = if clause3 then volume * close else 0;
def Vol4 = if clause4 then volume * close else 0;
def Vol5 = if clause5 then volume * close else 0;
def Vol6 = if clause6 then volume * close else 0;
def Vol7 = if clause7 then volume * close else 0;
def Vol8 = if clause8 then volume * close else 0;
def Vol9 = if clause9 then volume * close else 0;
def Vol10 = if clause10 then volume * close else 0;
def Vol11 = if clause11 then volume * close else 0;
def Vol12 = if clause12 then volume * close else 0;
def Vol13 = if clause13 then volume * close else 0;
def Vol14 = if clause14 then volume * close else 0;
def Vol15 = if clause15 then volume * close else 0;
def Vol16 = if clause16 then volume * close else 0;
def VolAvg1 = MovingAverage(VolAverageType, Vol1, AVL1);
def VolAvg2 = MovingAverage(VolAverageType, Vol1, AVL2);
def VolAvg3 = MovingAverage(VolAverageType, Vol1, AVL3);
def VolAvg4 = MovingAverage(VolAverageType, Vol1, AVL4);
def VolAvg5 = MovingAverage(VolAverageType, Vol1, AVL5);
def VolAvg6 = MovingAverage(VolAverageType, Vol1, AVL6);
def VolAvg12 = MovingAverage(VolAverageType, Vol2, AVL1);
def VolAvg22 = MovingAverage(VolAverageType, Vol2, AVL2);
def VolAvg32 = MovingAverage(VolAverageType, Vol2, AVL3);
def VolAvg42 = MovingAverage(VolAverageType, Vol2, AVL4);
def VolAvg52 = MovingAverage(VolAverageType, Vol2, AVL5);
def VolAvg62 = MovingAverage(VolAverageType, Vol2, AVL6);
def VolAvg13 = MovingAverage(VolAverageType, Vol3, AVL1);
def VolAvg23 = MovingAverage(VolAverageType, Vol3, AVL2);
def VolAvg33 = MovingAverage(VolAverageType, Vol3, AVL3);
def VolAvg43 = MovingAverage(VolAverageType, Vol3, AVL4);
def VolAvg53 = MovingAverage(VolAverageType, Vol3, AVL5);
def VolAvg63 = MovingAverage(VolAverageType, Vol3, AVL6);
def VolAvg14 = MovingAverage(VolAverageType, Vol4, AVL1);
def VolAvg24 = MovingAverage(VolAverageType, Vol4, AVL2);
def VolAvg34 = MovingAverage(VolAverageType, Vol4, AVL3);
def VolAvg44 = MovingAverage(VolAverageType, Vol4, AVL4);
def VolAvg54 = MovingAverage(VolAverageType, Vol4, AVL5);
def VolAvg64 = MovingAverage(VolAverageType, Vol4, AVL6);
def VolAvg15 = MovingAverage(VolAverageType, Vol5, AVL1);
def VolAvg25 = MovingAverage(VolAverageType, Vol5, AVL2);
def VolAvg35 = MovingAverage(VolAverageType, Vol5, AVL3);
def VolAvg45 = MovingAverage(VolAverageType, Vol5, AVL4);
def VolAvg55 = MovingAverage(VolAverageType, Vol5, AVL5);
def VolAvg65 = MovingAverage(VolAverageType, Vol5, AVL6);
def VolAvg16 = MovingAverage(VolAverageType, Vol6, AVL1);
def VolAvg26 = MovingAverage(VolAverageType, Vol6, AVL2);
def VolAvg36 = MovingAverage(VolAverageType, Vol6, AVL3);
def VolAvg46 = MovingAverage(VolAverageType, Vol6, AVL4);
def VolAvg56 = MovingAverage(VolAverageType, Vol6, AVL5);
def VolAvg66 = MovingAverage(VolAverageType, Vol6, AVL6);
def VolAvg17 = MovingAverage(VolAverageType, Vol7, AVL1);
def VolAvg27 = MovingAverage(VolAverageType, Vol7, AVL2);
def VolAvg37 = MovingAverage(VolAverageType, Vol7, AVL3);
def VolAvg47 = MovingAverage(VolAverageType, Vol7, AVL4);
def VolAvg57 = MovingAverage(VolAverageType, Vol7, AVL5);
def VolAvg67 = MovingAverage(VolAverageType, Vol7, AVL6);
def VolAvg18 = MovingAverage(VolAverageType, Vol8, AVL1);
def VolAvg28 = MovingAverage(VolAverageType, Vol8, AVL2);
def VolAvg38 = MovingAverage(VolAverageType, Vol8, AVL3);
def VolAvg48 = MovingAverage(VolAverageType, Vol8, AVL4);
def VolAvg58 = MovingAverage(VolAverageType, Vol8, AVL5);
def VolAvg68 = MovingAverage(VolAverageType, Vol8, AVL6);
def VolAvg19 = MovingAverage(VolAverageType, Vol9, AVL1);
def VolAvg29 = MovingAverage(VolAverageType, Vol9, AVL2);
def VolAvg39 = MovingAverage(VolAverageType, Vol9, AVL3);
def VolAvg49 = MovingAverage(VolAverageType, Vol9, AVL4);
def VolAvg59 = MovingAverage(VolAverageType, Vol9, AVL5);
def VolAvg69 = MovingAverage(VolAverageType, Vol9, AVL6);
def VolAvg110 = MovingAverage(VolAverageType, Vol10, AVL1);
def VolAvg210 = MovingAverage(VolAverageType, Vol10, AVL2);
def VolAvg310 = MovingAverage(VolAverageType, Vol10, AVL3);
def VolAvg410 = MovingAverage(VolAverageType, Vol10, AVL4);
def VolAvg510 = MovingAverage(VolAverageType, Vol10, AVL5);
def VolAvg610 = MovingAverage(VolAverageType, Vol10, AVL6);
def VolAvg111 = MovingAverage(VolAverageType, Vol11, AVL1);
def VolAvg211 = MovingAverage(VolAverageType, Vol11, AVL2);
def VolAvg311 = MovingAverage(VolAverageType, Vol11, AVL3);
def VolAvg411 = MovingAverage(VolAverageType, Vol11, AVL4);
def VolAvg511 = MovingAverage(VolAverageType, Vol11, AVL5);
def VolAvg611 = MovingAverage(VolAverageType, Vol11, AVL6);
def VolAvg112 = MovingAverage(VolAverageType, Vol12, AVL1);
def VolAvg212 = MovingAverage(VolAverageType, Vol12, AVL2);
def VolAvg312 = MovingAverage(VolAverageType, Vol12, AVL3);
def VolAvg412 = MovingAverage(VolAverageType, Vol12, AVL4);
def VolAvg512 = MovingAverage(VolAverageType, Vol12, AVL5);
def VolAvg612 = MovingAverage(VolAverageType, Vol12, AVL6);
def VolAvg113 = MovingAverage(VolAverageType, Vol13, AVL1);
def VolAvg213 = MovingAverage(VolAverageType, Vol13, AVL2);
def VolAvg313 = MovingAverage(VolAverageType, Vol13, AVL3);
def VolAvg413 = MovingAverage(VolAverageType, Vol13, AVL4);
def VolAvg513 = MovingAverage(VolAverageType, Vol13, AVL5);
def VolAvg613 = MovingAverage(VolAverageType, Vol13, AVL6);
def VolAvg114 = MovingAverage(VolAverageType, Vol4, AVL1);
def VolAvg214 = MovingAverage(VolAverageType, Vol4, AVL2);
def VolAvg314 = MovingAverage(VolAverageType, Vol14, AVL3);
def VolAvg414 = MovingAverage(VolAverageType, Vol14, AVL4);
def VolAvg514 = MovingAverage(VolAverageType, Vol14, AVL5);
def VolAvg614 = MovingAverage(VolAverageType, Vol14, AVL6);
def VolAvg115 = MovingAverage(VolAverageType, Vol15, AVL1);
def VolAvg215 = MovingAverage(VolAverageType, Vol15, AVL2);
def VolAvg315 = MovingAverage(VolAverageType, Vol15, AVL3);
def VolAvg415 = MovingAverage(VolAverageType, Vol15, AVL4);
def VolAvg515 = MovingAverage(VolAverageType, Vol15, AVL5);
def VolAvg615 = MovingAverage(VolAverageType, Vol15, AVL6);
def VolAvg116 = MovingAverage(VolAverageType, Vol16, AVL1);
def VolAvg216 = MovingAverage(VolAverageType, Vol16, AVL2);
def VolAvg316 = MovingAverage(VolAverageType, Vol16, AVL3);
def VolAvg416 = MovingAverage(VolAverageType, Vol16, AVL4);
def VolAvg516 = MovingAverage(VolAverageType, Vol16, AVL5);
def VolAvg616 = MovingAverage(VolAverageType, Vol16, AVL6);
def VAL1 = ((VolAvg1 + VolAvg2 + VolAvg3 + VolAvg4 + VolAvg5 + VolAvg6) / 6);
def VAL2 = ((VolAvg12 + VolAvg22 + VolAvg32 + VolAvg42 + VolAvg52 + VolAvg62) / 6);
def VAL3 = ((VolAvg13 + VolAvg23 + VolAvg33 + VolAvg43 + VolAvg53 + VolAvg63) / 6);
def VAL4 = ((VolAvg14 + VolAvg24 + VolAvg34 + VolAvg44 + VolAvg54 + VolAvg64) / 6);
def VAL5 = ((VolAvg15 + VolAvg25 + VolAvg35 + VolAvg45 + VolAvg55 + VolAvg65) / 6);
def VAL6 = ((VolAvg16 + VolAvg26 + VolAvg36 + VolAvg46 + VolAvg56 + VolAvg66) / 6);
def VAL7 = ((VolAvg17 + VolAvg27 + VolAvg37 + VolAvg47 + VolAvg57 + VolAvg67) / 6);
def VAL8 = ((VolAvg18 + VolAvg28 + VolAvg38 + VolAvg48 + VolAvg58 + VolAvg68) / 6);
def VAL9 = ((VolAvg19 + VolAvg29 + VolAvg39 + VolAvg49 + VolAvg59 + VolAvg69) / 6);
def VAL10 = ((VolAvg110 + VolAvg210 + VolAvg310 + VolAvg410 + VolAvg510 + VolAvg610) / 6);
def VAL11 = ((VolAvg111 + VolAvg211 + VolAvg311 + VolAvg411 + VolAvg511 + VolAvg611) / 6);
def VAL12 = ((VolAvg112 + VolAvg212 + VolAvg312 + VolAvg412 + VolAvg512 + VolAvg612) / 6);
def VAL13 = ((VolAvg113 + VolAvg213 + VolAvg313 + VolAvg413 + VolAvg513 + VolAvg613) / 6);
def VAL14 = ((VolAvg114 + VolAvg214 + VolAvg314 + VolAvg414 + VolAvg514 + VolAvg614) / 6);
def VAL15 = ((VolAvg115 + VolAvg215 + VolAvg315 + VolAvg415 + VolAvg515 + VolAvg615) / 6);
def VAL16 = ((VolAvg116 + VolAvg216 + VolAvg316 + VolAvg416 + VolAvg516 + VolAvg616) / 6);
def q = StandardDeviation(Vol1, 650) / ExpAverage(Vol1, 650);
def qq = StandardDeviation(Vol1, 100) / ExpAverage(Vol1, 100);
def qqq = StandardDeviation(Vol1, 1000) / ExpAverage(Vol1, 1000);
def qa = (q + qq + qqq) / 3;
def w = StandardDeviation(Vol2, 650) / ExpAverage(Vol2, 650);
def ww = StandardDeviation(Vol2, 100) / ExpAverage(Vol2, 100);
def www = StandardDeviation(Vol2, 1000) / ExpAverage(Vol2, 1000);
def wa = (w + ww + www) / 3;
def e = StandardDeviation(Vol3, 650) / ExpAverage(Vol3, 650);
def ee = StandardDeviation(Vol3, 100) / ExpAverage(Vol3, 100);
def eee = StandardDeviation(Vol3, 1000) / ExpAverage(Vol3, 1000);
def ea = (e + ee + eee) / 3;
def r = StandardDeviation(Vol4, 650) / ExpAverage(Vol4, 650);
def rr = StandardDeviation(Vol4, 100) / ExpAverage(Vol4, 100);
def rrr = StandardDeviation(Vol4, 1000) / ExpAverage(Vol4, 1000);
def ra = (r + rr + rrr) / 3;
def t = StandardDeviation(Vol5, 650) / ExpAverage(Vol5, 650);
def tt = StandardDeviation(Vol5, 100) / ExpAverage(Vol5, 100);
def ttt = StandardDeviation(Vol5, 1000) / ExpAverage(Vol5, 1000);
def ta = (t + tt + ttt) / 3;
def y = StandardDeviation(Vol6, 650) / ExpAverage(Vol6, 650);
def yy = StandardDeviation(Vol6, 100) / ExpAverage(Vol6, 100);
def yyy = StandardDeviation(Vol6, 1000) / ExpAverage(Vol6, 1000);
def ya = (y + yy + yyy) / 3;
def u = StandardDeviation(Vol7, 650) / ExpAverage(Vol7, 650);
def uu = StandardDeviation(Vol7, 100) / ExpAverage(Vol7, 100);
def uuu = StandardDeviation(Vol7, 1000) / ExpAverage(Vol7, 1000);
def ua = (u + uu + uuu) / 3;
def i = StandardDeviation(Vol8, 650) / ExpAverage(Vol8, 650);
def ii = StandardDeviation(Vol8, 100) / ExpAverage(Vol8, 100);
def iii = StandardDeviation(Vol8, 1000) / ExpAverage(Vol8, 1000);
def ia = (i + ii + iii) / 3;
def o = StandardDeviation(Vol9, 650) / ExpAverage(Vol9, 650);
def oo = StandardDeviation(Vol9, 100) / ExpAverage(Vol9, 100);
def ooo = StandardDeviation(Vol9, 1000) / ExpAverage(Vol9, 1000);
def oa = (o + oo + ooo) / 3;
def p = StandardDeviation(Vol10, 650) / ExpAverage(Vol10, 650);
def pp = StandardDeviation(Vol10, 100) / ExpAverage(Vol10, 100);
def ppp = StandardDeviation(Vol10, 1000) / ExpAverage(Vol10, 1000);
def pa = (p + pp + ppp) / 3;
def a = StandardDeviation(Vol11, 650) / ExpAverage(Vol11, 650);
def aa = StandardDeviation(Vol11, 100) / ExpAverage(Vol11, 100);
def aaa = StandardDeviation(Vol11, 1000) / ExpAverage(Vol11, 1000);
def aaaa = (a + aa + aaa) / 3;
def s = StandardDeviation(Vol12, 650) / ExpAverage(Vol12, 650);
def ss = StandardDeviation(Vol2, 100) / ExpAverage(Vol12, 100);
def sss = StandardDeviation(Vol12, 1000) / ExpAverage(Vol12, 1000);
def sa = (s + ss + sss) / 3;
def d = StandardDeviation(Vol13, 650) / ExpAverage(Vol13, 650);
def dd = StandardDeviation(Vol13, 100) / ExpAverage(Vol13, 100);
def ddd = StandardDeviation(Vol13, 1000) / ExpAverage(Vol13, 1000);
def da = (d + dd + ddd) / 3;
def f = StandardDeviation(Vol14, 650) / ExpAverage(Vol14, 650);
def ff = StandardDeviation(Vol14, 100) / ExpAverage(Vol14, 100);
def fff = StandardDeviation(Vol14, 1000) / ExpAverage(Vol14, 1000);
def fa = (f + ff + fff) / 3;
def g = StandardDeviation(Vol15, 650) / ExpAverage(Vol15, 650);
def gg = StandardDeviation(Vol15, 100) / ExpAverage(Vol15, 100);
def ggg = StandardDeviation(Vol15, 1000) / ExpAverage(Vol15, 1000);
def ga = (g + gg + ggg) / 3;
def h = StandardDeviation(Vol16, 650) / ExpAverage(Vol16, 650);
def hh = StandardDeviation(Vol16, 100) / ExpAverage(Vol16, 100);
def hhh = StandardDeviation(Vol16, 1000) / ExpAverage(Vol16, 1000);
def ha = (h + hh + hhh) / 3;
def Num_Dev1 = (3 );
def Num_Dev2 = (3 );
def Num_Dev3 = (3 );
def Num_Dev4 = (3 );
def Num_Dev5 = (3 );
def Num_Dev6 = (3 );
def Num_Dev7 = (3 );
def Num_Dev8 = (3 );
def Num_Dev9 = (3 );
def Num_Dev10 = (3 );
def Num_Dev11 = (3 );
def Num_Dev12 = (3 );
def Num_Dev13 = (3 );
def Num_Dev14 = (3 );
def Num_Dev15 = (3 );
def Num_Dev16 = (3 );
#def Num_Dev1 = (5 * qa );
#def Num_Dev2 = (5 * wa );
#def Num_Dev3 = (5 * ea );
#def Num_Dev4 = (5 * ra );
#def Num_Dev5 = (5 * ta );
#def Num_Dev6 = (5 * ya );
#def Num_Dev7 = (5 * ua );
#def Num_Dev8 = (5 * ia );
#def Num_Dev9 = (5 * oa );
#def Num_Dev10 = (5 * pa );
#def Num_Dev11 = (5 * aaaa );
#def Num_Dev12 = (5 * sa );
#def Num_Dev14 = (5 * fa );
#def Num_Dev15 = (5 * ga );
#def Num_Dev16 = (5 * ha );
def sDev1 = StDev(data = Vol1, length = AVL1);
def sDev2 = StDev(data = Vol1, length = AVL2);
def sDev3 = StDev(data = Vol1, length = AVL3);
def sDev4 = StDev(data = Vol1, length = AVL4);
def sDev5 = StDev(data = Vol1, length = AVL5);
def sDev6 = StDev(data = Vol1, length = AVL6);
def sDev12 = StDev(data = Vol2, length = AVL1);
def sDev22 = StDev(data = Vol2, length = AVL2);
def sDev32 = StDev(data = Vol2, length = AVL3);
def sDev42 = StDev(data = Vol2, length = AVL4);
def sDev52 = StDev(data = Vol2, length = AVL5);
def sDev62 = StDev(data = Vol2, length = AVL6);
def sDev13 = StDev(data = Vol3, length = AVL1);
def sDev23 = StDev(data = Vol3, length = AVL2);
def sDev33 = StDev(data = Vol3, length = AVL3);
def sDev43 = StDev(data = Vol3, length = AVL4);
def sDev53 = StDev(data = Vol3, length = AVL5);
def sDev63 = StDev(data = Vol3, length = AVL6);
def sDev14 = StDev(data = Vol4, length = AVL1);
def sDev24 = StDev(data = Vol4, length = AVL2);
def sDev34 = StDev(data = Vol4, length = AVL3);
def sDev44 = StDev(data = Vol4, length = AVL4);
def sDev54 = StDev(data = Vol4, length = AVL5);
def sDev64 = StDev(data = Vol4, length = AVL6);
def sDev15 = StDev(data = Vol5, length = AVL1);
def sDev25 = StDev(data = Vol5, length = AVL2);
def sDev35 = StDev(data = Vol5, length = AVL3);
def sDev45 = StDev(data = Vol5, length = AVL4);
def sDev55 = StDev(data = Vol5, length = AVL5);
def sDev65 = StDev(data = Vol5, length = AVL6);
def sDev16 = StDev(data = Vol6, length = AVL1);
def sDev26 = StDev(data = Vol6, length = AVL2);
def sDev36 = StDev(data = Vol6, length = AVL3);
def sDev46 = StDev(data = Vol6, length = AVL4);
def sDev56 = StDev(data = Vol6, length = AVL5);
def sDev66 = StDev(data = Vol6, length = AVL6);
def sDev17 = StDev(data = Vol7, length = AVL1);
def sDev27 = StDev(data = Vol7, length = AVL2);
def sDev37 = StDev(data = Vol7, length = AVL3);
def sDev47 = StDev(data = Vol7, length = AVL4);
def sDev57 = StDev(data = Vol7, length = AVL5);
def sDev67 = StDev(data = Vol7, length = AVL6);
def sDev18 = StDev(data = Vol8, length = AVL1);
def sDev28 = StDev(data = Vol8, length = AVL2);
def sDev38 = StDev(data = Vol8, length = AVL3);
def sDev48 = StDev(data = Vol8, length = AVL4);
def sDev58 = StDev(data = Vol8, length = AVL5);
def sDev68 = StDev(data = Vol8, length = AVL6);
def sDev19 = StDev(data = Vol9, length = AVL1);
def sDev29 = StDev(data = Vol9, length = AVL2);
def sDev39 = StDev(data = Vol9, length = AVL3);
def sDev49 = StDev(data = Vol9, length = AVL4);
def sDev59 = StDev(data = Vol9, length = AVL5);
def sDev69 = StDev(data = Vol9, length = AVL6);
def sDev110 = StDev(data = Vol10, length = AVL1);
def sDev210 = StDev(data = Vol10, length = AVL2);
def sDev310 = StDev(data = Vol10, length = AVL3);
def sDev410 = StDev(data = Vol10, length = AVL4);
def sDev510 = StDev(data = Vol10, length = AVL5);
def sDev610 = StDev(data = Vol10, length = AVL6);
def sDev111 = StDev(data = Vol11, length = AVL1);
def sDev211 = StDev(data = Vol11, length = AVL2);
def sDev311 = StDev(data = Vol11, length = AVL3);
def sDev411 = StDev(data = Vol11, length = AVL4);
def sDev511 = StDev(data = Vol11, length = AVL5);
def sDev611 = StDev(data = Vol11, length = AVL6);
def sDev122 = StDev(data = Vol12, length = AVL1);
def sDev222 = StDev(data = Vol12, length = AVL2);
def sDev322 = StDev(data = Vol12, length = AVL3);
def sDev422 = StDev(data = Vol12, length = AVL4);
def sDev522 = StDev(data = Vol12, length = AVL5);
def sDev622 = StDev(data = Vol12, length = AVL6);
def sDev133 = StDev(data = Vol13, length = AVL1);
def sDev233 = StDev(data = Vol13, length = AVL2);
def sDev333 = StDev(data = Vol13, length = AVL3);
def sDev433 = StDev(data = Vol13, length = AVL4);
def sDev533 = StDev(data = Vol13, length = AVL5);
def sDev633 = StDev(data = Vol13, length = AVL6);
def sDev144 = StDev(data = Vol14, length = AVL1);
def sDev244 = StDev(data = Vol14, length = AVL2);
def sDev344 = StDev(data = Vol14, length = AVL3);
def sDev444 = StDev(data = Vol14, length = AVL4);
def sDev544 = StDev(data = Vol14, length = AVL5);
def sDev644 = StDev(data = Vol14, length = AVL6);
def sDev155 = StDev(data = Vol15, length = AVL1);
def sDev255 = StDev(data = Vol15, length = AVL2);
def sDev355 = StDev(data = Vol15, length = AVL3);
def sDev455 = StDev(data = Vol15, length = AVL4);
def sDev555 = StDev(data = Vol15, length = AVL5);
def sDev655 = StDev(data = Vol15, length = AVL6);
def sDev166 = StDev(data = Vol16, length = AVL1);
def sDev266 = StDev(data = Vol16, length = AVL2);
def sDev366 = StDev(data = Vol16, length = AVL3);
def sDev466 = StDev(data = Vol16, length = AVL4);
def sDev566 = StDev(data = Vol16, length = AVL5);
def sDev666 = StDev(data = Vol16, length = AVL6);
def allsdev1 = (sDev1 + sDev2 + sDev3 + sDev4 + sDev5 + sDev6) / 6;
def allsdev2 = (sDev12 + sDev22 + sDev32 + sDev42 + sDev52 + sDev62) / 6;
def allsdev3 = (sDev13 + sDev23 + sDev33 + sDev43 + sDev53 + sDev63) / 6;
def allsdev4 = (sDev14 + sDev24 + sDev34 + sDev44 + sDev54 + sDev64) / 6;
def allsdev5 = (sDev15 + sDev25 + sDev35 + sDev45 + sDev55 + sDev65) / 6;
def allsdev6 = (sDev16 + sDev26 + sDev36 + sDev46 + sDev56 + sDev66) / 6;
def allsdev7 = (sDev17 + sDev27 + sDev37 + sDev47 + sDev57 + sDev67) / 6;
def allsdev8 = (sDev18 + sDev28 + sDev38 + sDev48 + sDev58 + sDev68) / 6;
def allsdev9 = (sDev19 + sDev29 + sDev39 + sDev49 + sDev59 + sDev69) / 6;
def allsdev10 = (sDev110 + sDev210 + sDev310 + sDev410 + sDev510 + sDev610) / 6;
def allsdev11 = (sDev111 + sDev211 + sDev311 + sDev411 + sDev511 + sDev611) / 6;
def allsdev12 = (sDev122 + sDev222 + sDev322 + sDev422 + sDev522 + sDev622) / 6;
def allsdev13 = (sDev133 + sDev233 + sDev333 + sDev433 + sDev533 + sDev633) / 6;
def allsdev14 = (sDev144 + sDev244 + sDev344 + sDev444 + sDev544 + sDev644) / 6;
def allsdev15 = (sDev155 + sDev255 + sDev355 + sDev455 + sDev555 + sDev655) / 6;
def allsdev16 = (sDev166 + sDev266 + sDev366 + sDev466 + sDev566 + sDev666) / 6;
def vsig1 = VAL1 + Num_Dev1 * allsdev1;
def vsig2 = VAL2 + Num_Dev2 * allsdev2;
def vsig3 = VAL3 + Num_Dev3 * allsdev3;
def vsig4 = VAL4 + Num_Dev4 * allsdev4;
def vsig5 = VAL5 + Num_Dev5 * allsdev5;
def vsig6 = VAL6 + Num_Dev6 * allsdev6;
def vsig7 = VAL7 + Num_Dev7 * allsdev7;
def vsig8 = VAL8 + Num_Dev8 * allsdev8;
def vsig9 = VAL9 + Num_Dev9 * allsdev9;
def vsig10 = VAL10 + Num_Dev10 * allsdev10;
def vsig11 = VAL11 + Num_Dev11 * allsdev11;
def vsig12 = VAL12 + Num_Dev12 * allsdev12;
def vsig13 = VAL13 + Num_Dev13 * allsdev13;
def vsig14 = VAL14 + Num_Dev14 * allsdev14;
def vsig15 = VAL15 + Num_Dev15 * allsdev15;
def vsig16 = VAL16 + Num_Dev16 * allsdev16;
def canful = (low + close) / 2;
def canful2 = (high + close) / 2;
def volmult1 = if clause1 then ((Vol1 / (vsig1[8]) * (Vol1 / (vsig1[8]))) / (Vol1 / (vsig1[8]))) else 0;
def volmult2 = if clause2 then ((Vol2 / (vsig2[8]) * (Vol2 / (vsig2[8]))) / (Vol2 / (vsig2[8]))) else 0;
def volmult3 = if clause3 then ((Vol3 / (vsig3[8]) * (Vol3 / (vsig3[8]))) / (Vol3 / (vsig3[8]))) else 0;
def volmult4 = if clause4 then ((Vol4 / (vsig4[8]) * (Vol4 / (vsig4[8]))) / (Vol4 / (vsig4[8]))) else 0;
def volmult5 = if clause5 then ((Vol5 / (vsig5[8]) * (Vol5 / (vsig5[8]))) / (Vol5 / (vsig5[8]))) else 0;
def volmult6 = if clause6 then ((Vol6 / (vsig6[8]) * (Vol6 / (vsig6[8]))) / (Vol6 / (vsig6[8]))) else 0;
def volmult7 = if clause7 then ((Vol7 / (vsig7[8]) * (Vol7 / (vsig7[8]))) / (Vol7 / (vsig7[8]))) else 0;
def volmult8 = if clause8 then ((Vol8 / (vsig8[8]) * (Vol8 / (vsig8[8]))) / (Vol8 / (vsig8[8]))) else 0;
def volmult9 = if clause9 then ((Vol9 / (vsig9[8]) * (Vol9 / (vsig9[8]))) / (Vol9 / (vsig9[8]))) else 0;
def volmult10 = if clause10 then ((Vol10 / (vsig10[8]) * (Vol10 / (vsig10[8]))) / (Vol10 / (vsig10[8]))) else 0;
def volmult11 = if clause11 then ((Vol11 / (vsig11[8]) * (Vol11 / (vsig11[8]))) / (Vol11 / (vsig11[8]))) else 0;
def volmult12 = if clause12 then ((Vol12 / (vsig12[8]) * (Vol12 / (vsig12[8]))) / (Vol12 / (vsig12[8]))) else 0;
def volmult13 = if clause13 then ((Vol13 / (vsig13[8]) * (Vol13 / (vsig13[8]))) / (Vol13 / (vsig13[8]))) else 0;
def volmult14 = if clause14 then ((Vol14 / (vsig14[8]) * (Vol14 / (vsig14[8]))) / (Vol14 / (vsig14[8]))) else 0;
def volmult15 = if clause15 then ((Vol15 / (vsig15[8]) * (Vol15 / (vsig15[8]))) / (Vol15 / (vsig15[8]))) else 0;
def volmult16 = if clause16 then ((Vol16 / (vsig16[8]) * (Vol16 / (vsig16[8]))) / (Vol16 / (vsig16[8]))) else 0;
plot comb = (volmult1 + volmult2 + volmult3 + volmult4 + volmult5 + volmult6 + volmult7 + volmult8 + volmult9 + volmult10 + volmult11 + volmult12 + volmult13 + volmult14 + volmult15 + volmult16);
#simple rewrite