Archived: TMO True Momentum Oscillator

Status
Not open for further replies.

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

Got the TMO (including MTF) working in EasyLanguage / Tradestation for anyone interested. To setup multiple time frames in TradeStation see this post: https://futures.io/easylanguage-pro...rame-programming-easylanguage.html#post154004

If you prefer not to have the MTF, just delete everything below {Data2}.
Code:
{TMO ((T)rue (M)omentum (O)scilator) - Universal Edition with Multiple Time Frames
originally created by Mobius, modified by hCaostrader, and ported to EasyLanguage with Multiple Time Frame capability added by TraderKevin
V12.8.2020
TMO calculates momentum using the delta of price. Giving a much better picture of trend, tend reversals and divergence than momentum oscillators using price.}

inputs:
    Length( 14 ) [
        DisplayName = "Length",
        ToolTip = "Enter the number of bars to be used in the calculation of the TMO."],
   
    calcLength( 5 ) [
        DisplayName = "calcLength",
        ToolTip = "Enter the number of bars to be used in the calculation of the calcLength."],
       
    smoothLength( 3 ) [
        DisplayName = "smoothLength",
        ToolTip = "Enter the number of bars to be used in the calculation of the smoothLength."],
    Cloud(False) [
        DisplayName = "Cloud",
        ToolTip = "True to display cloud, false to disable."];

variables:
    x( 0, data1 ),
    normdata(0, data1),
    ema(0, data1),
    main(0, data1),
    signal(0, data1),
    ob(0, data1),
    os(0, data1),
    dat(0, data1),
    y(0, data1),
    intrabarpersist double uptrans(0),
    intrabarpersist double downtrans(0),
    intrabarpersist double span(0, data1),
    gap(0, data1),
    x2( 0, data2 ),
    normdata2(0, data2),
    ema2(0, data2),
    main2(0, data2),
    signal2(0, data2),
    dat2(0, data2),
    y2(0, data2),
    intrabarpersist double uptrans2(0),
    intrabarpersist double downtrans2(0),
    intrabarpersist double span2(0, data2),
    gap2(0, data2);;
   
{Data1}
dat = 0;
               
for x = 1 to Length Begin
if c > c[x] Then y = 1
            else if c < c[x] Then y = -1
                else y = 0;
    dat = dat + y ;
    end;
               
normdata = dat * 100 / length;
ema = XAverage(normdata, calcLength);
main = XAverage(ema, smoothLength);
signal = XAverage(main, smoothLength);
ob = 70;
os = -70;
uptrans = ARGB( 100, 0, 128, 0 );
downtrans = ARGB( 100, 255, 0, 0 );

plot1(main, "Main", iff(main > signal, Green, Red));
plot2(signal, "Signal", iff(main > signal, green, red));
plot3(0, "Zero", Lightgray);
plot4(ob, "OB", Darkred);
plot5(os, "OS", Darkgreen);

span = 0.5 * (main + signal);
gap = main - signal;

if cloud then
    plot6(span, "Cloud", iff(main > signal, uptrans, downtrans), default, iff(gap > 10, 13, 11));

   

{Data2}
dat2 = 0;

               
for x2 = 1 to Length Begin
if c of data2 > c[x2] of data2 Then y2 = 1
            else if c of data2 < c[x2] of data2 Then y2 = -1
                else y2 = 0;
    dat2 = dat2 + y2 ;
    end;
               
normdata2 = dat2 * 100 / length;
ema2 = XAverage(normdata2, calcLength);
main2 = XAverage(ema2, smoothLength);
signal2 = XAverage(main2, smoothLength);


plot7(main2, "Main2", iff(main2 > signal2, darkcyan, Darkmagenta));
plot8(signal2, "Signal2", iff(main2 > signal2, darkcyan, Darkmagenta));

span2 = 0.5 * (main2 + signal2);
gap2 = main2 - signal2;

if cloud then
    plot9(span2, "Cloud", iff(main2 > signal2, uptrans, downtrans), default, iff(gap2 > 10, 13, 11));
Does anyone know how to add this to Multicharts.net platform? I know you can import easylanguage according to their website
 
Here is my version. I have some similar ones with different indicators that act like histogram colors too.


3AIGgWP.png


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 = 21;
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);
def Main = ExpAverage(EMA5, smoothLength);
def Signal = ExpAverage(Main, smoothLength);
assignBackgroundColor(if Main > Signal
                           then color.dark_green
                           else color.Dark_red);


def ob = if isNaN(c) then double.nan else round(length * .7);

def os = if isNaN(c) then double.nan else -round(length * .7);

plot IntheGreen = (Signal < os);
AddLabel(IntheGreen, "OS", Color.White);
plot IntheRed = (Signal > ob);
AddLabel(IntheRed, "OB", Color.White);
plot IntheMIddle = (Signal < ob and Signal > OS);
AddLabel(IntheMIddle, "--", Color.black);
what is OB,OS stand for
 
GM, is the above code for the above scan?
Yes the above code is for the above scan. I saw in one column he put TMO_4 TMO_D TMO_W. SO HE modified the code to show momentum for those time frames. I am looking for a way to modify the code to show me where the momentum is by the 1min 3 and 5min charts.
 
Yes the above code is for the above scan. I saw in one column he put TMO_4 TMO_D TMO_W. SO HE modified the code to show momentum for those time frames. I am looking for a way to modify the code to show me where the momentum is by the 1min 3 and 5min charts.
Click on the gear icon to the right of the timeframe, then click customize and double click the TMO and change the timeframe on the top of the page to whatever you choose. I would also change the label of the column name
 
Click on the gear icon to the right of the timeframe, then click customize and double click the TMO and change the timeframe on the top of the page to whatever you choose. I would also change the label of the column name
thank you, didn't realize the time frame was right next to the title.
 
This is hand down my favorite indicator in TOS. I have made quite a few customizations. Can someone explain exactly what this part of the code means:

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);

I use both ThinkorSwim & TradeStation. I am looking to translate this TMO indicator to EasyLanguage. I dont expect anyone to code this for me in EL, but was just curious if anyone could explain this as simply as possible in order for me to write my own code.

Thanks in advance.
 
This is hand down my favorite indicator in TOS. I have made quite a few customizations. Can someone explain exactly what this part of the code means:

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);

I use both ThinkorSwim & TradeStation. I am looking to translate this TMO indicator to EasyLanguage. I dont expect anyone to code this for me in EL, but was just curious if anyone could explain this as simply as possible in order for me to write my own code.

Thanks in advance.
Read the thread or use the search function and you may be rewarded :)
 
This is hand down my favorite indicator in TOS. I have made quite a few customizations. Can someone explain exactly what this part of the code means:

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);

I use both ThinkorSwim & TradeStation. I am looking to translate this TMO indicator to EasyLanguage. I dont expect anyone to code this for me in EL, but was just curious if anyone could explain this as simply as possible in order for me to write my own code.

Thanks in advance.
@martinstocks87 fold is used to count forward from starting point to a end point as long as the variable(study) is true then it will do (perform) the specified study(expression). That final "expression" can be a loop if you want it to, its up to you.

in your example:
fold is used to count forward from 0 to the defined "length"... and as long as "S" is true then it will do (perform) the following study of
(if c > getValue(o, i)
then 1
else if c < getValue(o, i)
then - 1
which seeks to see if the study returns a value of 1 or -1 and if neither then it returns 0
 
@martinstocks87 fold is used to count forward from starting point to a end point as long as the variable(study) is true then it will do (perform) the specified study(expression). That final "expression" can be a loop if you want it to, its up to you.

in your example:
fold is used to count forward from 0 to the defined "length"... and as long as "S" is true then it will do (perform) the following study of
(if c > getValue(o, i)
then 1
else if c < getValue(o, i)
then - 1
which seeks to see if the study returns a value of 1 or -1 and if neither then it returns 0
@XeoNoX Is the start position the current bar - length making the range covered by fold in this example current bar - length thru and including the current bar?
 
I have looked under 21 pages but might have gotten missed, is there a scanner which populates values when the momentum is at lowest level and starting with green upward momentum.
 
@unkownriver
TMO ((T)rue (M)omentum (O)scilator) Scan Scanner
Mobius, with modifications by tomsk, 1.1.2020

Ruby:
# TMO ((T)rue (M)omentum (O)scilator) Scan
# Mobius, with modifications by tomsk, 1.1.2020
# 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 level = -15;   ##Bullish Scan
#input level = 10;   ##Bearish Scan

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);
def Signal = ExpAverage(Main, smoothLength);
addchartBubble(close,close,main);
plot sell = main crosses below 10 ;
#hint: Comment out using # below to scan for Bullish or Bearish.  Please note that ## applies to conditional scan with parameters -10 (over sold condition) Bullish Scan) and 10 (over bought condition) Bearish Scan) Default is set to a Bullish TMO Scan without any conditions.

##***Bullish Scan***
plot scan = main crosses above level;
#plot scan = main < level and signal < level and main > signal;
#plot scan = main < main[1] and signal < signal[1];

##***Bearish Scan***

##plot scan = main > level and signal > level and main < signal;
#plot scan = main > main[1] and signal > signal[1];
 
Status
Not open for further replies.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
492 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