• The price of VIP membership is increasing to $199 beginning June 1. Click here to lock in the current rate of $149.

True Momentum Oscillator for ThinkorSwim

Curious if any one knows if there is a script to add to the True Momentum Osc that picks up on divergence between price and the TMO lines?
 

henry1224

Active member
VIP
Here is an indicator that adds labels for the TMO indicator
add several of them to the same chart section to get the outlook from several higher timeframes

Code:
##################################################

declare lower;
input period = AggregationPeriod.DAY;
input length = 14;
input calcLength = 5;
input smoothLength = 3;
DefineGlobalColor("Long", Color.Green);
DefineGlobalColor("Short", Color.RED);
DefineGlobalColor("Neutral", Color.Yellow);
DefineGlobalColor("arrow Buy", Color.Cyan);
DefineGlobalColor("arrow Sell", Color.Orange);

Script SymbolTMO{
input period = AggregationPeriod.DAY;
def OP = Open(period= period);
def CP = Close(Period= period);
input length = 14;
input calcLength = 5;
input smoothLength = 3;
def data = fold i = 0 to length
           with s
           do s + (if cp > getValue(op, i)
                   then 1
                   else if cp < getValue(op, i)
                        then - 1
                        else 0);
def EMA5 = ExpAverage(data, calcLength);
Def Main = ExpAverage(EMA5, smoothLength);
Def Signal = ExpAverage(Main, smoothLength);
Plot Result = If main > Signal then 1 else if Main <  Signal then -1 else 0;}
Script SymbolTMOArrow{
input period = AggregationPeriod.DAY;
def OP = Open(period= period);
def CP = Close(Period= period);
input length = 14;
input calcLength = 5;
input smoothLength = 3;
def data = fold i = 0 to length
           with s
           do s + (if cp > getValue(op, i)
                   then 1
                   else if cp < getValue(op, i)
                        then - 1
                        else 0);
def EMA5 = ExpAverage(data, calcLength);
Def Main = ExpAverage(EMA5, smoothLength);
Def Signal = ExpAverage(Main, smoothLength);
Plot Result = If main Crosses Above Signal then 1 else if Main Crosses Below Signal then -1 else 0;}
def currentPeriod = GetAggregationPeriod();
def s1;
def h1;

if period >= currentPeriod {
    s1 = SymbolTMO(period = period ,Length = Length, calclength = calcLength,SmoothLength = smoothLength);
    h1 = SymbolTMOArrow(period = period ,Length = Length, calclength = calcLength,SmoothLength = smoothLength);
} else {
    s1 = Double.NaN;
    h1 = DOuble.Nan;
}
AddLabel(!IsNaN(s1), "TMO:" + (if period == AggregationPeriod.MONTH then "M"
else
if period == AggregationPeriod.WEEK then "W"
else
if period == AggregationPeriod.FOUR_DAYS then "4D"
else
if period == AggregationPeriod.THREE_DAYS then "3D"
else
if period == AggregationPeriod.TWO_DAYS then "2D"
else
if period  == AggregationPeriod.DAY then "D"
else
if period == AggregationPeriod.FOUR_HOURS then "4H"
else
if period == AggregationPeriod.TWO_HOURS then "2H"
else
if period == AggregationPeriod.HOUR then "60m"
else
if period == AggregationPeriod.THIRTY_MIN then "30m"
else
if period == AggregationPeriod.TWENTY_MIN then "20m"
else
if period  == AggregationPeriod.FIFTEEN_MIN then "15m"
else
if period == AggregationPeriod.TEN_MIN then "10m"
else
if period == AggregationPeriod.FIVE_MIN then "5m"
else
if period == AggregationPeriod.FOUR_MIN then "4m"
else
if period  == AggregationPeriod.THREE_MIN then "3m"
else
if period == AggregationPeriod.TWO_MIN then "2m"
else
if period  == AggregationPeriod.MIN then "1m"
else ""), if s1 == 1 then GlobalColor("Long") else if s1 == -1 then GlobalColor("Short") else GlobalColor("Neutral"));
AddLabel(!IsNaN(h1) and h1 != 0, If h1 == 1 then "B" else if h1 == -1 then "S" else "-", if h1 == 1 then GlobalColor("arrow Buy") else if h1 == -1 then GlobalColor("arrow Sell") else color.gray);
 

MarinaMargarita

New member
Hi, new member here. Awesome oscillator. Would it be possible to add up/down arrows when the signal changes, but only when above or below the ob/os level?
 

SugarTrader

Member
VIP
Hello,
Playing with TMO. Anyone use it to detect divergence in combination with price action? i.e. similar to Stochatic/MACD to detect price movement divergence. Thanks
 

dmillz

Member
VIP
I found that using this with trend reversal indicator works really well. Wondering if anyone implemented the two together for a scan?
 

tenacity11

Active member
2019 Donor
An example of TMO divergence with Trend Reversal

K6a35EC.png
 

Similar threads

Top