@BenTen I found this in my archives for TMO scan...but I think the top portion is not necessary...Plus I edited the LONG portion below...I hope its right...anyway you can edit the rest to make sure it makes sense?
# TMO_AlphaHisto # # AlphaHisto_JQ_v2018_08_21b # input Correlation_Index = "SPY"; def close_index = close(Correlation_Index); def RS = if close_index == 0 then 0 else close / close_index; rec SR = CompoundValue("historical data" = RS, "visible data" = if IsNaN(SR) then RS else SR); def SRatio = SR; def new_rs = (((RS / SRatio) - 1) * 100); #...... new_rs is the histogram bars def delta_rs = (new_rs - new_rs) / AbsValue(new_rs); #.... Changed formula to include absvalue on 2018-03-02 # TMO ((T)rue (M)omentum (O)scilator) # Mobius # V01.05.2018 #hint: TMO calculates momentum using the delta of price. Giving a much better picture of trend, tend reversals and divergence than momentum oscillators using price. input length = 14; input calcLength = 5; input smoothLength = 3; def o_TMO = new_rs; def c_TMO = new_rs; def data = fold i = 0 to length with s do s + (if c_TMO > GetValue(o_TMO, i) then 1 else if c_TMO < GetValue(o_TMO, i) then - 1 else 0); def EMA5 = ExpAverage(data, calcLength); def Main = ExpAverage(EMA5, smoothLength); def Signal = ExpAverage(Main, smoothLength); # Note Comment-Out (#) whichever scan not being used. S # Short Scan plot Short = (Main crosses below signal) within 2 bar; # Long Scan plot Long = (Main crosses above signal) within 2 bar; # End Code TMO