TMO with Higher Agg_Mobius @ TSL

@BenTen I added the following piece of code to the strategy

Alert(sBuy , "BREAKOUT!", Alert.BAR, Sound);
Alert(sSell, "BREAKDOWN!", Alert.BAR, Sound);

However the chart is appearing all squished as there is signal line added for the Alert in the chart. Is there any way to get around this?
 
VEEDisg.jpg


Code:
input length = 14;
input calcLength = 5;
input smoothLength = 3;
input agg = AggregationPeriod.Week;

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);
     Signal.HideBubble();
     Signal.HideTitle();

plot OB = 10.5;
Plot ArrowDn = signal crosses below OB;
#Plot ArrowDn = Main crosses below Signal;

Hi @BenTen, request your assistance, i tried to modify this TMO indicator with the intention to ONLY plot an Down arrow when the Main Line crosses below the Signal line, and it must be in the Green Zone as shown in the attached pic.

I attempted and created an "OB zone" and used the conditions above to create a plot the down Arrow..but it was not close to what i would like to achieve.

Request your help or anyone can assist me.

Thank you
 
Hi @Nick I'm here for a few hours. I should have some samples for you to work with. Hopefully not too long. Markos

@Nick Below is an upper TMO with arrows (Coded by @wtf_dude) and a TMO below to compare it against. READ Notes in Studies.
Notice that the arrows come 1 bar later.
Something else, VEEV has been a leading stock. Notice how the highs & lows of the lower TMO are working towards the center as price marches up. That is a nuance that we spoke of a year ago.
I haven't come across the code yet for only showing only arrows at the cloud crossing. @BenTen I know that JQ has a study somewhere in the OneNote but I can't find it tonight. If this were to be done, @wtf_dude 's study would need to be re-tooled, I fear.
I wanted to get this to you as the sun was rising & before I go to bed.
Try this Chart w arrows: https://tos.mx/yDE3Ws8
Cc4r8Ke.png
 
Last edited:
Hi @markos, thank you once again. Hope u manage to get some rest too. I did go through the original TMO discussion and found @DeusMecanicus shared the script to identify cross over within the OB and OS zone. I have added them and I think it works fine.

"VEEV has been a leading stock. Notice how the highs & lows of the lower TMO are working towards the center as price marches up."
I am trying to recall what was our discussion with regards to this observation. I did a similar comparison with NOW/NVDA and try to capture my observation, and my assumption is that most of the leading stocks will likely to rebound as they approaches the 0 level ?? Pls correct me if i am wrong.

Thank u
 
@Nick remember what I have said in the past, indicators only indicate. They give clues. Price is the ultimate indicator. Approaching the 0 level really has no bearing. If the market goes down hard and the stock you watch goes down also, it might get into the red zone. Recall your IBD training and use the indicator to help you.
 
@markos Thank you for your advice. My understanding of IBD is that it focuses on momentum stocks and we shld look out for those what have high Relative strength. Is it then right that using the TMO indicator, on these momentum stocks will provide some indication of potential reversal?
 
Yes, @Nick now that's better. Potential Reversal is the key. Is the market or other stocks in its group week or strong? But, that's the idea.
 
Yes, @Nick now that's better. Potential Reversal is the key. Is the market or other stocks in its group week or strong? But, that's the idea.
@markos Thanks for that reminder!! Relative Strength !! There are few sharing of relative strength indicator here, if you are using any of them, may i request you to share again...thanks
 
Here you go friend...
These actually do match IBD's RS Line Number!

Code:
#IBD RS Label by markos 9-26-19
#Best used on 1Yr/1Day Agg
Declare Lower;
#declare real_size;
def Data = close / close("SPX");
def RS = Data;
input length = 252;
def RSLow = Lowest(RS, length);
def RSHigh = Highest(RS, length);
def RSRank = Round(100 * (RS - RSLow) / (RSHigh - RSLow), 0);
Addlabel(yes,"MYRS " + RSRANK,Color.DARK_GREEN);

That's the Label & below is the Line:
Code:
#IBD RS Line by markos 4-26-19
#Best used on 1Yr/1Day Agg
Declare Lower;
def Data = close / close("SPX");
def RS = data;
input length = 1; #Length of Hull for line smoothing
input displace = 0;
plot HMA = MovingAverage(AverageType.HULL, RS, length);

Lastly, this is my Watch List Column
Code:
#IBD RS Watchlist Code by markos 9-26-19
#Best used on 1Yr/1Day Agg
Declare Lower;
def Data = close / close("SPX");
def RS = Data;
input length = 252;
def RSLow = Lowest(RS, length);
def RSHigh = Highest(RS, length);
def RSRank = Round(99 * (RS - RSLow) / (RSHigh - RSLow), 0);
Addlabel(yes,RSRANK,Color.YELLOW);
#This is exact to IBD
 
Hi @MerryDay! When I searched the forum for backtests, I simply did not see the post you now refer me to. I appreciate the link. When I tried combining the code into a strategy, it told me that "lower" couldn't be used, so I deleted that line of code. Here's the code I ended up with:

Code:
# 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, tend reversals and divergence than momentum oscillators using price.

input length = 14;
input calcLength = 5;
input smoothLength = 3;
input agg = AggregationPeriod.FIFTEEN_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);
Signal.HideBubble();
Signal.HideTitle();
AddCloud(Main, Signal, 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);
# End Code TMO with Higher Aggregation

# Backtesting Code
def buy = Main crosses above Signal;
def sell = Main crosses below Signal;

AddOrder(OrderType.BUY_AUTO, condition = buy, price = close, 100, tickcolor = Color.GREEN, arrowcolor = Color.GREEN);
AddOrder(OrderType.SELL_AUTO, condition = sell, price = close, 100, tickcolor = Color.RED, arrowcolor = Color.RED);
 
Turned this into an upper indicator with breakout arrows and it's amazing for reversals. You'll get alot of fakeouts in choppy markets, so look for confirmations elsewhere. Quickest reversal alert I've found.

Code:
# TMO ((T)rue (M)omentum (O)scillator) With Higher Aggregation breakouts only
# Mobius
# custom by WTF_Dude based off 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 upper;

input length = 21;
input calcLength = 5;
input smoothLength = 3;
input agg = AggregationPeriod.DAY;


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);
def Main = ExpAverage(EMA5, smoothLength);
def 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);
    # Signal.HideBubble();
     #Signal.HideTitle();
#addCloud(Main, Signal, color.green, color.red);



plot Bull = Crosses(main, signal, CrossingDirection.ABOVE);
plot Bear = Crosses(main, signal, CrossingDirection.BELOW);
Bull.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Bull.SetDefaultColor(Color.CYAN);
Bull.SetLineWeight(2);
Bear.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Bear.SetDefaultColor(Color.MAGENTA);
Bear.SetLineWeight(2);
Ive been looking all over for this indicator. Thank you for adding the arrows! To avoid false signals, any chance we can make the arrows appear when the Main crosses the Signal in OB or OS territory only? That would be amazing if that was possible.
 
Not sure if this is the place to put this but it is about TMO so..

I created a watch list column to show when the stock is in the oversold area. I used the TMO study and in put main is equal to os area using the wizard.

It runs very slow even on 20 symbols. It works I do get a 1 when it is true. Would it run faster if I coded it directly? If yes how is that done?
Any videos, or guides, or something close to copy and modify would be great.

Thanks
 
Hey everyone, This is by far one of my favorite indicators- really nothing rivals it for me. I have made an edit to this code that will color the bars.

The rules are as follows:

It will only paint the bars green if trend momentum is above the zero line and will only paint bars red if trend momentum is below the zero line. It will paint the bars a different gradient if the signal sits within the Overbought or Oversold criteria. If none of those requirements are met the bars will be painted plum.

The code looks silly but I wrote it like that so it's easier to edit for those that may want to change the parameters and are more new to thinkscript. If you have any questions please ask!


35XXFWY.png


Code:
#TMO True Momentum Oscillator with Higher Aggregation _Mobius
#Tuesday, May 15, 2018 12:36 PM

## OneNote Archive Name: TMO True Momentum Oscillator with Higher Aggregation _Mobius
## Archive Section: Momentum
## Suggested Tos Name: TrueMomentumOscillator_w_HigherAggregation_Mobius
## Archive Date: 5.15.2018
## Archive Notes:
## 08:43 Mobius: Well give it a few days to get altered, muched, distorted and twisted. Then when it get back to being used as intended someone will start making money with it.
## 08:45 Mobius: Oh and in my view - It's highest and best use is as designed with a secondary aggregation plotted either on it or with it around 5 to 10 time higher.

## "##" indicates an addition or adjustment by the OneNote Archivist
## Original Code Follows

# 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, tend reversals and divergence than momentum oscillators using price.

declare Lower;

input length = 14;
input calcLength = 5;
input smoothLength = 3;
input agg = AggregationPeriod.weeK;

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);
     Signal.HideBubble();
     Signal.HideTitle();
addCloud(Main, Signal, Color.LIGHT_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 * .8);
     ob.SetDefaultColor(Color.gray);
     ob.HideBubble();
     ob.HideTitle();
plot os = if isNaN(c) then double.nan else -round(length * .8);
     os.SetDefaultColor(Color.gray);
     os.HideBubble();
     os.HideTitle();
addCloud(ob, length, Color.GREEN, Color.GREEN, Yes);
addCloud(-length, os, Color.LIGHT_RED, Color.LIGHT_RED, showBorder = Yes);

def A = Main > Signal and main > zero;
def B = signal > Main and signal < zero ;

def X = main > OB;
def Z = signal < OS ;

def XX = signal > OB;
def ZZ = main < OS ;

def Y = A==0 and B==0 and X==0 and Z==0 and XX==0 and ZZ==0;


assignpriceColor(if A then color.dark_GREEN else color.CURRENT);
assignpriceColor(if B then color.RED else color.current);
assignpriceColor(if X then color.green else color.current);
assignpriceColor(if Z then color.pink else color.current);
assignpriceColor(if XX then color.green else color.current);
assignpriceColor(if ZZ then color.pink else color.current);
assignpriceColor(if Y then color.plum else color.current);


# End Code TMO with Higher Aggregation
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Thread starter Similar threads Forum Replies Date
tenacity11 Archived: TMO True Momentum Oscillator Indicators 346
BenTen TMO True Momentum Oscillator For ThinkOrSwim Indicators 124

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
415 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

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.

How do I get started?

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.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top