Friday, March 22, 2013

dWbBreadth thinkScript


To Apply to ThinkorSwim by TDAmeritrade
Choose 'New' in the Edit Studies Dialog Box
Name the Study Appropriately
Paste Code
Apply, Ok

Done!

dWbBreadth

#NYSE Breath ratio
def NYSEratio =  if (close("$UVOL") >= close("$DVOL")) then (close("$UVOL") / close("$DVOL")) else -( close("$DVOL") / close("$UVOL")) ;
plot NYratio = Round(NYSEratio, length);


NYratio.DefineColor("NYSEup", Color.UPTICK);
NYratio.DefineColor("NYSEdown", Color.DOWNTICK);
NYratio.AssignValueColor(if NYSEratio >= 0 then NYratio.Color("NYSEup") else NYratio.Color("NYSEdown"));

AddLabel(yes, Concat(NYratio, " :1 NYSE"), (if NYSEratio >= 0 then NYratio.Color("NYSEup") else NYratio.Color("NYSEdown")));



#Nasdaq Breath ratio
def NASDratio =  if (close("$UVOL/Q") >= close("$DVOL/Q")) then (close("$UVOL/Q") / close("$DVOL/Q")) else -( close("$DVOL/Q") / close("$UVOL/Q")) ;
plot Qratio = Round(NASDratio, length);

Qratio.DefineColor("NASup", Color.UPTICK);
Qratio.DefineColor("NASdown", Color.DOWNTICK);
Qratio.AssignValueColor(if NASDratio >= 0 then Qratio.Color("NASup") else Qratio.Color("NASdown"));

AddLabel(yes, Concat(Qratio, " :1 NASD"), (if NASDratio >= 0 then Qratio.Color("NASup") else Qratio.Color("NASdown")));


#ZeroLine

plot zeroline = 0;
zeroline.AssignValueColor(if NYSEratio > NYSEratio[1] then Color.GREEN else Color.RED);
zeroline.SetLineWeight(1);
zeroline.HideTitle();
zeroline.HideBubble();

No comments:

Post a Comment