Sure, here´s the modified TMO code i use with AlertDisplace added if you only want the alert to trigger after candle has closed. Remember to
uncheck all the boxes in plot settings as well.
Code:#True (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. #declare Lower; input length = 14; input calcLength = 5; input smoothLength = 3; input AlertDisplace = 0; def o = open; def c = close; def data = fold i = 0 to length with s do s + (if c > getValue(o, i) then 1 else if c < getValue(o, i) then - 1 else 0); def EMA5 = ExpAverage(data, calcLength); plot Main = ExpAverage(EMA5, smoothLength); plot Signal = ExpAverage(Main, smoothLength); Main.AssignValueColor(if Main > Signal then color.green else color.light_red); Signal.AssignValueColor(if Main > Signal then color.green else color.light_red); Signal.HideBubble(); Signal.HideTitle(); #addCloud(Main, Signal, color.green, color.light_red); plot zero = if isNaN(c) then double.nan else 0; zero.SetDefaultColor(Color.gray); zero.hideBubble(); zero.hideTitle(); plot ob = if isNaN(c) then double.nan else round(length * .7); ob.SetDefaultColor(Color.gray); ob.HideBubble(); ob.HideTitle(); plot os = if isNaN(c) then double.nan else -round(length * .7); os.SetDefaultColor(Color.gray); os.HideBubble(); os.HideTitle(); #addCloud(ob, length, color.light_red, color.light_red, no); #addCloud(-length, os, color.light_green, color.light_green); def BUYsignal =Main < OS and Main crosses above Signal; def SELLsignal = Main > OB and Main crosses below Signal; addverticalline(BUYsignal,"Buy",color.green,curve.short_dash); addverticalline(SELLsignal,"Sell",color.red,curve.short_dash); # Alerts Alert(BuySignal[AlertDisplace], " ", Alert.Bar, Sound.ding); Alert(SellSignal[AlertDisplace], " ", Alert.Bar, Sound.chimes);
Thank you very much for this; it looks great! I read through the past posts, but don't understand how I can create a Scan based on this idea. I got the grey "ok" button that someone mentioned before, and you told them only 1 item can be TRUE. I commented out 3 of the 4, but get no results when I run the Scan. I'm new to TOS scans and scripts, so any help is very appreciated!