@rad14733 gave that a go...needs a source for that...but I think being more then one agg period it wont work...
# 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.
declare Lower;
input length = 14;
input calcLength = 5;
input smoothLength = 3;
input agg1 = AggregationPeriod.FIFTEEN_MIN;
input agg2 = AggregationPeriod.FIVE_MIN;
def o = open(period = agg1);
def o1 = open(period = agg2);
def c = close(period = agg1);
def c1 = close(period = agg2);
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 data1 = fold i1 = 0 to length
with s1
do s1 + (if c1 > getValue(o1,i1)
then 1
else if c1 < getValue(o1,i1)
then - 1 else 0);
def EMA5 = ExpAverage(data, calcLength);
def EMA5_1 = ExpAverage(data1, calcLength);
plot Main = ExpAverage(EMA5, smoothLength);
plot Main_1 = ExpAverage(EMA5_1, smoothLength);
plot Signal = ExpAverage(Main, smoothLength);
plot Signal_1 = ExpAverage(Main_1, smoothLength);
Main.AssignValueColor(if Main > Signal
then color.green
else color.red);
Main_1.AssignValueColor(if Main_1 > Signal_1
then color.green
else color.red);
Signal.AssignValueColor(if Main > Signal
then color.green
else color.red);
Signal_1.AssignValueColor(if Main_1 > Signal_1
then color.green
else color.red);
Signal.HideBubble();
Signal.HideTitle();
Signal_1.HideBubble();
Signal_1.HideTitle();
addCloud(Main, Signal, color.green, color.red);
addCloud(Main_1, Signal_1, color.green, color.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);
plot buydot = if Main > Signal and Main_1 > Signal_1 then -length - 1 else double.nan;
buydot.SetPaintingStrategy(paintingStrategy = PaintingStrategy.ARROW_UP);
buydot.SetDefaultColor(Color.GREEN);
plot selldot = if Main < Signal and Main_1 < Signal_1 then length + 1 else double.nan;
selldot.SetPaintingStrategy(paintingStrategy = PaintingStrategy.ARROW_DOWN);
selldot.SetDefaultColor(Color.RED);
def BUYsignal = Main crosses above Signal;
def SELLsignal = Main crosses below Signal;
addverticalline(BUYsignal,"Buy",color.green,curve.firm);
addverticalline(SELLsignal,"Sell",color.red,curve.firm);
# Alerts
Alert(BuySignal, " ", Alert.Bar, Sound.Chimes);
Alert(SellSignal, " ", Alert.Bar, Sound.Bell);
# End Code TMO
The voice of reason.@HighBredCloud If you know how to simply read price and use one indicator, maybe Tilson,.....then you have 3/4's battle won. What is your set up, do you have one, because indicators don't help you find the set up, unless you know what you are looking for?
Is there a way to add a 12-hour time frame? I tried editing the "input agg1" with no luck. Sorry in advance if I posted my request incorrectly still getting the swing of things on the forum.Someone modified the TMO MTF script for me to alert me audibly and visually when the 5 and 15 minute are in synch and it works really well. Simply go long or short when it tells you to. I've learned that it works best to go long when the 5 and 15 minute are coming up from -10, and go short when the 5 and 15 minute are coming down from +10.
Code:# 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. declare Lower; input length = 14; input calcLength = 5; input smoothLength = 3; input agg1 = AggregationPeriod.FIFTEEN_MIN; input agg2 = AggregationPeriod.FIVE_MIN; def o = open(period = agg1); def o1 = open(period = agg2); def c = close(period = agg1); def c1 = close(period = agg2); 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 data1 = fold i1 = 0 to length with s1 do s1 + (if c1 > getValue(o1,i1) then 1 else if c1 < getValue(o1,i1) then - 1 else 0); def EMA5 = ExpAverage(data, calcLength); def EMA5_1 = ExpAverage(data1, calcLength); plot Main = ExpAverage(EMA5, smoothLength); plot Main_1 = ExpAverage(EMA5_1, smoothLength); plot Signal = ExpAverage(Main, smoothLength); plot Signal_1 = ExpAverage(Main_1, smoothLength); Main.AssignValueColor(if Main > Signal then color.green else color.red); Main_1.AssignValueColor(if Main_1 > Signal_1 then color.green else color.red); Signal.AssignValueColor(if Main > Signal then color.green else color.red); Signal_1.AssignValueColor(if Main_1 > Signal_1 then color.green else color.red); Signal.HideBubble(); Signal.HideTitle(); Signal_1.HideBubble(); Signal_1.HideTitle(); addCloud(Main, Signal, color.green, color.red); addCloud(Main_1, Signal_1, color.green, color.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); plot buydot = if Main > Signal and Main_1 > Signal_1 then -length - 1 else double.nan; buydot.SetPaintingStrategy(paintingStrategy = PaintingStrategy.ARROW_UP); buydot.SetDefaultColor(Color.GREEN); plot selldot = if Main < Signal and Main_1 < Signal_1 then length + 1 else double.nan; selldot.SetPaintingStrategy(paintingStrategy = PaintingStrategy.ARROW_DOWN); selldot.SetDefaultColor(Color.RED); def BUYsignal = Main crosses above Signal; def SELLsignal = Main crosses below Signal; addverticalline(BUYsignal,"Buy",color.green,curve.firm); addverticalline(SELLsignal,"Sell",color.red,curve.firm); # Alerts Alert(BuySignal, " ", Alert.Bar, Sound.Chimes); Alert(SellSignal, " ", Alert.Bar, Sound.Bell); # End Code TMO
Is there a way to add a 12-hour time frame? I tried editing the "input agg1" with no luck. Sorry in advance if I posted my request incorrectly still getting the swing of things on the forum.
I came across that last night! I was trying to build a custom one out of that with no luck. Thanks for letting me know that it is not possible.No, Thinkorswim does not offer the ability to create custom aggregation periods... For more information please refer to Chapter 11. Referencing Secondary Aggregation in the Thinkorswim Learning Center...
Multi-Timeframe True Momentum Oscillator - Two Timeframe version:
Code:# filename: MR__EZ_TMO_MTF_Fisher_2Agg_ # source: https://usethinkscript.com/d/91-tmo-with-higher-agg-mobius-tsl # TMO ((T)rue (M)omentum (O)scillator) With Higher Aggregation # Mobius # V01.05.2018 #hint: TMO calculates momentum using the DELTA of price. Giving a much better picture of trend, trend reversals and divergence than momentum oscillators using price. declare lower; input length = 10; # default -> 14; def calcLength = 5; def smoothLength = 3; input agg = AggregationPeriod.FIVE_MIN; def o = open(period = agg); def c = close(period = agg); 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.RED); Signal.AssignValueColor(if Main > Signal then color.GREEN else color.RED); Main.SetLineWeight(3); Signal.SetLineWeight(3); Signal.HideBubble(); Signal.HideTitle(); # JQ_FisherTransform_wLabels v02 # assistance provided by AlphaInvestor, amalia, randyr and nube # v02 9.23.2018 JQ added arrows input Fisherprice = hl2; input FisherLength = 10; input TriggerLineOffset = 1; # Ehler's value of choice is 1 input TriggerLine_Color_Choice = {"magenta", "cyan", "pink", default "gray", "Mustard", "red", "green", "dark_gray", "Pale Yellow", "white"}; input deBug = no; def maxHigh = Highest(Fisherprice, FisherLength); def minLow = Lowest(Fisherprice, FisherLength); def range = maxHigh - minLow; def value = if IsNaN(Fisherprice) then Double.NaN else if IsNaN(range) then value[1] else if range == 0 then 0 else 0.66 * ((Fisherprice - minLow) / range - 0.5) + 0.67 * value[1]; def truncValue = if value > 0.99 then 0.999 else if value < -0.99 then -0.999 else value; def fish = 0.5 * (Log((1 + truncValue) / (1 - truncValue)) + fish[1]); def FTOneBarBack = fish[TriggerLineOffset]; def FT = fish; plot FisherBullCross = if FT crosses above FTOneBarBack then lowestall(Main) else Double.NaN; FisherBullCross.SetPaintingStrategy(PaintingStrategy.ARROW_UP); FisherBullCross.SetDefaultColor(Color.UPTICK); plot FisherBearCross = if FT crosses below FTOneBarBack then highestall(Main) else Double.NaN; FisherBearCross.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); FisherBearCross.SetDefaultColor(Color.DOWNTICK); input length2 = 10; # default -> 14; def calcLength2 = 5; def smoothLength2 = 3; input agg2 = AggregationPeriod.FIFTEEN_MIN; def o2 = open(period = agg2); def c2 = close(period = agg2); def data2 = fold i2 = 0 to length2 with s2 do s2 + (if c2 > getValue(o2, i2) then 1 else if c2 < getValue(o2, i2) then - 1 else 0); def EMA52 = ExpAverage(data2, calcLength2); plot Main2 = ExpAverage(EMA52, smoothLength2); plot Signal2 = ExpAverage(Main2, smoothLength2); Main2.AssignValueColor(if Main2 > Signal2 then color.UPTICK else color.DOWNTICK); Signal2.AssignValueColor(if Main2 > Signal2 then color.UPTICK else color.DOWNTICK); Signal2.HideBubble(); Signal2.HideTitle(); addCloud(Main, Signal, color.GREEN, color.RED); addCloud(Main2, Signal2, color.UPTICK, color.DOWNTICK); plot ZeroLine = 0; ZeroLine.SetDefaultColor(Color.ORANGE); ZeroLine.HideBubble(); ZeroLine.HideTitle(); plot ob = if isNaN(c) then double.nan else round(length * .7); ob.SetDefaultColor(Color.dark_red); ob.HideBubble(); ob.HideTitle(); plot os = if isNaN(c) then double.nan else -round(length * .7); os.SetDefaultColor(Color.dark_green); os.HideBubble(); os.HideTitle(); addCloud(ob, length, color.dark_red, color.dark_red, no); addCloud(-length, os, color.dark_green, color.dark_green);
Nvm, figured it out.Is there a way to setup a scan that only shows tickers that have 2 active Fisher green reversal, and 2 new green plots on the 5 and 15 min?
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.