Here's the indicator for bonds
study("AK FTM indicator_Bonds") len = input(85,title = " # days") R2 = security("TLT","D",roc(close,len)) R1 = security("SPY","D",roc(close,len)) sell = (R1 > R2) buy =(R2 > R1) plot(R2,color= blue,linewidth=2,title="BOND") plot(R1,color= purple,linewidth=2,title="EQUITY") bgcolor(buy ? lime:red)