wtf_dude
Well-known member
So this is something I've followed for years. When you have the market up or down you may or may have heard there are other stocks or indices you want to check to see if the market fundamentals or leading indicators support the move. Transports, high yield bonds, etc. This draft version just gives you the ability to choose labels that you want to see at a glance. It's got Junk bonds , transports, russell 2000, equal weight sp500, advance decline line change, CAT stock, crude oil, and copper to gold ratio for now. If there are any other support indicators you want labeled, let me know. Some of you may not understand why some of these are available. Either look it up or just turn the label off. This is called crash because when you see a bunch of red on an up day, you can be pretty sure there's gonna be a (fairly big) drop with the divergence. In bigger market dumps, it can really save your butt by signaling ahead of time.
Code:
#written JunkyTrannyCrash v1.0 by WTF_Dude
#leading indicators and discrepancy signals
declare upper;
def agg = AggregationPeriod.DAY;
#def currentTimeFrame = getAggregationPeriod();
input showJunk = yes; #show Junk label
input showTrans = yes; #show Trans label
input showEquals = yes; #show Equals label
input showRussell2000 = yes; #shows small caps move
input showAdvDec = yes; #show advance/decline line
input showCrude = yes; #show Crude label
input showCAT = yes; #show CAT as leading indicator
input showCopper_to_Gold = yes;
#CoppertoGold doesn't show an accurate percentage because its using futures. Just look for down or up to indicate future treasury rate moves.
def junkp = close("HYG");
def JPercentChg = 100 * (junkp / junkp[1] - 1);
def value = round(JPercentChg, 2);
AddLabel( showJunk, "Junk: " + value + "%", if Junkp >= Junkp[1]
then color.GREEN else color.RED );
def transp = close("IYT");
def TPercentChg = 100 * (transp / transp[1] - 1);
def value2 = round(TPercentChg, 2);
AddLabel(showTrans, "Trans: " + value2 + "%", if transp >= transp[1]
then color.GREEN else color.RED );
def equalp = close("RSP");
def EPercentChg = 100 * (equalp / equalp [1] - 1);
def value3 = round(EPercentChg, 2);
AddLabel(showEquals, "Equal: " + value3 + "%", if equalp >= equalp[1]
then color.GREEN else color.RED );
def small = close("IWM");
def RussPercentChange = 100 * (small / small[1] - 1);
def value8 = round(RussPercentChange, 2);
AddLabel(showRussell2000, "SmallCaps: " + value8 + "%", if RussPercentChange >= RussPercentChange[1]
then color.GREEN else color.RED );
def level;
def Advances = close("$ADVN");
def Declines = close("$DECN");
def advnDecl = advnDecl[1] + if !IsNaN(Advances - Declines) then Advances - Declines else 0;
def ADDNfinal = 100 * (advnDecl / advnDecl[1] - 1);
def value4 = round(ADDNfinal, 2);
AddLabel( showADVDEC, "A/D Line: " + value4 + "%", if ADDNfinal >= ADDNfinal[1]
then color.GREEN else color.RED );level = 0;
def crudep = close("/CL");
def cPercentChg = 100 * (crudep / crudep [1] - 1);
def value5 = round(cPercentChg, 2);
AddLabel( showCrude, "Crude: " + value5 + "%", if crudep >= crudep[1]
then color.GREEN else color.rED );
def catmove = close("CAT");
def cATPercentChg = 100 * (catmove / catmove [1] - 1);
def value6 = round(cATPercentChg, 2);
AddLabel( showCAT, "CAT: " + value6 + "%", if CATMOVE >= CATMOVE[1]
then color.GREEN else color.rED );
def Copper = close("/HG");
def Gold = close("/GC");
def cgr = cgr[1] + if !IsNaN(copper / gold) then copper / gold else 0;
def copgoldratio = 100 * (cgr / cgr[1] - 1);
def value7 = round(copgoldratio, 2);
AddLabel( showCopper_to_Gold, "Copper/Gold: " + value7 + "%", if copgoldratio >= copgoldratio[1]
then color.GREEN else color.RED );
Last edited by a moderator: