TraderRich
New member
- Platform
-
- Thinkorswim
Merry Christmas Ya'll
I came across this iteration of the VixFix (https://www.screencast.com/t/8SSpRpkBVH0o)VixFixand it seems to have some promise when the WVF crosses an the midpoint of the Upper and Lower Bands. The only issue is I cannot seem to make it plot a mid band. Maybe I've had too much eggnog or maybe I'm just not smart enough, but would anyone (ehhhhmm @barbaros ) know how to do this?
I came across this iteration of the VixFix (https://www.screencast.com/t/8SSpRpkBVH0o)VixFixand it seems to have some promise when the WVF crosses an the midpoint of the Upper and Lower Bands. The only issue is I cannot seem to make it plot a mid band. Maybe I've had too much eggnog or maybe I'm just not smart enough, but would anyone (ehhhhmm @barbaros ) know how to do this?
Code:
# Original study notation below:
#hint period: The number of bars used to calculate the VIX <b>(Default is 10)</b>
#hint Num_Dev_Up: The amount of stdev up. <b>(Default is 1.645</b>, 90% probability)
#hint Num_Dev_Dn: The amount of stdev down.<b>(Default is -1.645</b>, 90% probability)
declare lower;
input period = 10;
input Num_Dev_Up = 1.645;
input Num_Dev_Dn = -1.645;
def WVF = (Highest(close, period) - low) / (Highest(close, period)) * 100;
plot inv_WVF = - WVF;
inv_WVF.HideBubble();
def sDev = StDev(data = inv_WVF, period);
def MidLine = Average(data = inv_WVF, period);
plot LowerBand = MidLine + Num_Dev_Dn * sDev;
LowerBand.HideBubble();
plot UpperBand = MidLine + Num_Dev_Up * sDev;
UpperBand.HideBubble();
LowerBand.SetDefaultColor(CreateColor(0, 224, 0));
inv_WVF.SetDefaultColor(CreateColor(221, 18, 255));
inv_WVF.SetLineWeight(2);
UpperBand.SetDefaultColor(CreateColor(224, 0, 0));
AddCloud(UpperBand, LowerBand, Color.LIGHT_GRAY);# Set up arrows
input ltLB = 40;
input mtLB = 14;
input str = 3;
def upRange_Aggr = close > close[1] and close > open[1];
def filtered_Aggr = (inv_WVF <= LowerBand );
def alert4 = upRange_Aggr and close > close[str] and (close < close[ltLB] or close < close[mtLB]) and filtered_Aggr ;
plot up = if upRange_Aggr and close > close[str] and (close < close[ltLB] or close < close[mtLB]) and filtered_Aggr then alert4 else Double.NaN ;
up.SetDefaultColor(Color.UPTICK);
up.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
def downRange_Aggr = close < close[1] and close < open[1];
def filtereddwn_Aggr = (inv_WVF >= UpperBand );
def alertdw = downRange_Aggr and close < close[str] and (close > close[ltLB] or close > close[mtLB]) and filtereddwn_Aggr ;
plot down = if downRange_Aggr and close < close[str] and (close > close[ltLB] or close > close[mtLB]) and filtereddwn_Aggr then alertdw else Double.NaN ;
down.SetDefaultColor(Color.DOWNTICK);
down.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);