Need Help Coding A Box Based on Volume

B

blakedipp

New member
Hello all,

I am trying to code an info box to convert average daily volume into a Tick count for tick charts. I am not well versed in coding or thinkscript.



Basically, if the volLast30DayAvg meets a certaincriteria, then it will show one of the calculations A through F in the Tick Counter Box on my chart. Any tips? Thanks.

Code:
plot Data = close;
declare lower;


input TickCounter = yes;

#Volume Data
def volLast30DayAvg = (volume(period = "DAY")[1] + volume(period = "DAY")[2] + volume(period = "DAY")[3] + volume(period = "DAY")[4] + volume(period = "DAY")[5] + volume(period = "DAY")[6] + volume(period = "DAY")[7] + volume(period = "DAY")[8] + volume(period = "DAY")[9] + volume(period = "DAY")[10] + volume(period = "DAY")[11] + volume(period = "DAY")[12] + volume(period = "DAY")[13] + volume(period = "DAY")[14] + volume(period = "DAY")[15] + volume(period = "DAY")[16] + volume(period = "DAY")[17] + volume(period = "DAY")[18] + volume(period = "DAY")[19] + volume(period = "DAY")[20] + volume(period = "DAY")[21] + volume(period = "DAY")[22] + volume(period = "DAY")[23] + volume(period = "DAY")[24] + volume(period = "DAY")[25] + volume(period = "DAY")[26] + volume(period = "DAY")[27] + volume(period = "DAY")[28] + volume(period = "DAY")[29] + volume(period = "DAY")[30]) / 30;



# Variables:
def a;
def b;
def c;
def d;
def e;
def f;

# Calculations
a = 144;
b = 333;
c = 800;
d = 1600;
e = 3200;
f = 10000;

def SHowTickNumber = if VolLast30DayAvg < 5000000 then plot a;



AddLabel (TickCounter, "TICK: " + ShowTickNumber);
 

Similar threads

Top