Here's the indicator for equities
study("AK FTM indicator_Equity") // 85 days provide best return for the system over 15 years len = input(85,title = " # days") // calculate the ROC for equity (SPY) and bonds (TLT) R2 = security("TLT","D",roc(close,len)) R1 = security("SPY","D",roc(close,len)) // Signals buy = (R1 > R2) sell =(R2 > R1) //Plot signals plot(R2,color= blue,linewidth=2,title="BOND") plot(R1,color= purple,linewidth=2,title="EQUITY") // Visual bgcolor(buy ? lime:red)