#///INDICATOR WBORSA - V1 - COMPLEX -
#study("nonoiraq", shorttitle="never loss")
#Converted to thinkscript by svanoy
declare lower;
#//area 2
input a2_top_input = 4.5;
input a2_input = 4;
plot a2_top = a2_top_input;
a2_top.setdefaultcolor(color.white);
plot a2 = a2_input;
a2.setdefaultcolor(color.white);
addcloud(a2_top, a2, color.white);
#//area 1
input a1_top_input = 3.5;
input a1_input = 2.5;
plot a1_top = a1_top_input;
a1_top.setdefaultcolor(color.light_red);
plot a1 = a1_input;
a1.setdefaultcolor(color.light_red);
addcloud(a1_top,a1, color.light_red);
#//area -1
input am1_top_input = -2.5;
input am1_input = -3.5;
plot am1_top = am1_top_input;
am1_top.setdefaultcolor(color.dark_green);
plot am1 = am1_input;
am1.setdefaultcolor(color.dark_green);
addcloud(am1_top,am1, color.dark_green);
#//area -2
input am2_top_input = -4;
input am2_input = -4.5;
plot am2_top = am2_top_input;
am2_top.setdefaultcolor(color.white);
plot am2 = am2_input;
am2.setdefaultcolor(color.white);
addcloud(am2_top,am2, color.white);
#// Math formula / VWAP Z-SCORE
#vwapScore(pds) =>
def mean48 = sum(volume*close,48)/sum(volume,48);
def vwap48 = sqrt(simpleMovingAvg (power(close-mean48,2), 48));
def result48 = (close-mean48)/vwap48;
def mean199 = sum(volume*close,199)/sum(volume,199);
def vwap199 = sqrt(simpleMovingAvg (power(close-mean199,2), 199));
def result199 = (close-mean199)/vwap199;
def mean484 = sum(volume*close,484)/sum(volume,484);
def vwap484 = sqrt(simpleMovingAvg (power(close-mean484,2), 484));
def result484 = (close-mean484)/vwap484;
plot vwapScore48 = result48;
vwapScore48.setpaintingstrategy(paintingstrategy.line);
vwapScore48.setdefaultcolor(color.yellow);
vwapScore48.setlineweight(2);
plot vwapScore199 = result199;
vwapScore199.setpaintingstrategy(paintingstrategy.points);
vwapScore199.setdefaultcolor(color.violet);
vwapScore199.setlineweight(2);
plot vwapScore484 = result484;
vwapScore484.setpaintingstrategy(paintingstrategy.points);
vwapScore484.setdefaultcolor(color.red);
vwapScore484.setlineweight(2);