True Momentum Oscillator for ThinkorSwim

BenTen

BenTen

Administrative
Staff
VIP
The following thinkScript of the true momentum oscillator was created by Mobius.

It calculates momentum using the delta of price. Giving a much better picture of trend, tend reversals and divergence than momentum oscillators using price.


thinkScript Code

Rich (BB code):
declare Lower;

input length = 14;
input calcLength = 5;
input smoothLength = 3;

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.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

Shareable Link

http://tos.mx/yXqNwi
 
Last edited:
markos

markos

Well-known member
VIP
This one runs under my RSI Laguerre on a daily chart. Mobius recently put it on his trading chart.
Turn off after and before market hours. Delta of price is really only calculated during RTH. Unless you're trading futures, then if there's option trading, there's Delta of Price, as I understand it.
*It is traded at the polarity change signal, not the zero line. I love this indicator.
 
Last edited:
tenacity11

tenacity11

Member
VIP
@markos
This looks like a good fit with the RSI Laguerre. Definitely worth testing. Thanks for the heads up on the combo.
 
markos

markos

Well-known member
VIP
@markos
This looks like a good fit with the RSI Laguerre. Definitely worth testing. Thanks for the heads up on the combo.
@tenacity11 you're welcome. My mods to the indicator are swapping the red/green ob/os lines. I like green on top because if the stock is moving up, it will be in the green. Because I use this on daily and weekly charts, for me, I use 21,5,3. I don't recommend anyone changing that on less than daily, imo. Markos
 
tenacity11

tenacity11

Member
VIP
@markos When using the trend Momentum and the RSI Laguerre do you use regular candles or heiken ashi? I'm wondering since heiken ashi is lagging if it would make a difference or if the parameters would need to be changed.
thanks
 
markos

markos

Well-known member
VIP
@markos When using the trend Momentum and the RSI Laguerre do you use regular candles or heiken ashi? I'm wondering since heiken ashi is lagging if it would make a difference or if the parameters would need to be changed.
thanks
@tenacity11 If I am able, I'll reshare my main chart later tonight. Hieken Ashi with SlimRibbons with lots of color.... bad eyes. Heiken ashi don't actually lag but people can debate that; Whether I use Bars, Candles or HACandles, the indicators math/parameters are kept the same. (EDITED by me >>) Oops, I may have spoke to soon, need to check later but I think RSILg I never change but the TMO should match the chart's time frame...... more later.
 
Last edited:
tenacity11

tenacity11

Member
VIP
@markos. thanks. I really like heiken ashi smoothness but getting used to what I think is lag of price will take some getting used to.
 
markos

markos

Well-known member
VIP
I edited the post above but I need to check the code to see if MY TMO is set to time periods or actual days.
@tenacity11 switch your chart between an HAshi and a bar chart and look closely at the little amount of difference there is and then see if that is important for you at the time frames you choose.

You must be able to believe in your system in order to pull the trigger to get in and out without 2nd guessing. :)
 
Last edited:
markos

markos

Well-known member
VIP
@tenacity11
I am going to share my daily chart and my short term chart, therefore, the individual codes for the studies will not be posted but in the chart itself.
  • Please note that the daily chart has candles and the 30 day 1 hour chart is a Heiken Ashi.
  • About time frames: the TMO on the 30 day chart changes with the chart and there is no need to adjust anything. The same goes for the RSI Laguerre on any chart.
  • Please note that the daily chart has both a daily and weekly TMO and if you use that particular study, you will need to change the Agg to match your chart.
  • The colors of the candles and volume bars are controlled by the Slim Ribbon study. Those colors are in the color bar tab of the settings.
  • Also, if you minimize the plots, you will see alarm settings. Turn on or shut them off here so that you do not have to comment anything out.
 
Last edited:
markos

markos

Well-known member
VIP

TMO w Higher Agg as Shown in Daily Chart

08:43 Mobius: Well, give it a few days to get altered, munched, distorted and twisted. Then when it gets 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 times higher.
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, munched, 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);
# End Code TMO with Higher Aggregation
 
Last edited:
tenacity11

tenacity11

Member
VIP
@markos This was tremendously helpful being visual. I initially changed the W to 21,5,3 as you had originally suggested so I put the W with the 14,5,3 code underneath and it appears the 21,5,3 is smoother. Any particular reason you use candles on the daily and heiken ashi on the smaller time frames?I definitely see the worth of the gamma FE with the TMO
 
tenacity11

tenacity11

Member
VIP
I have to make an adjustment to the observation on the 21,5,3. I had it on regular candles(W) but when I put it on heiken ashi the 14,5,3 was a better fit.
 
MBF

MBF

New member
VIP
Marcos, I have a question. When I open this it opens in a separate window in TOS. When I close out, how do I reopen it into my main screen in TOS? I've seen this type of sharing a lot but never knew where to find it to switch over. Thanks!
 
markos

markos

Well-known member
VIP
@MBF welcome back! In my mind, this is the best way to share.
When it is open, click Style, Save Style, Give it a name you will remember e.g. 1Y1D719, Check the box to Include Patterns and Study sets, and save it. To open it, click Style, Load Style, and load the file with the name you just saved.
Doing that will save all of the studies that are on the chart in the same form as presented. Hope that helps, Markos
 
  • Love
Reactions: MBF
markos

markos

Well-known member
VIP
@markos This was tremendously helpful being visual. I initially changed the W to 21,5,3 as you had originally suggested so I put the W with the 14,5,3 code underneath and it appears the 21,5,3 is smoother. Any particular reason you use candles on the daily and heiken ashi on the smaller time frames?I definitely see the worth of the gamma FE with the TMO
Hi @tenacity11 Concerning your question about the candles and the HA on the one year VS 30 day: there is no particular reason, I posted that way so that the difference could be seen.

I rarely use Candles, having been trained on Bar charts. My one year chart I use bars on and the 30 day I use HA, just because… I'm different.

With the TMO, when using the original as shown on the 30 day chart, there is no Agg to change, my suggestion is 14, 5, 3 because that's the way Mobius created it. My understanding is that's what he uses all the way down to five minute charts.

Here is a video from the slim ribbon creator: https://askslim.com/slim-ribbon/
 
Last edited:
markos

markos

Well-known member
VIP
@tenacity11 I have made edits all the way through this thread. Please read from the top, sorry for the extra reading.

A number of questions: have you had a platform tour? Have you been to MyTrade on ToS? If you have not had your tour, please schedule one by clicking the support button at the top. Have 10 questions specific to what you want to know.
 

Top