stockfella
Member
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?
##################################################
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);
you do not need to change the code,Is it recommend to change the settings on this indicator for the one minute chart?
I don't know of anyone that has done it but that doesn't mean that you can't give it a try.Does anyone know if this can be ported to NinjaTrader?
Did you get it working? If not, please post a picture using imgur.com. Thanks@markos how do you flip the volume bar color as the same as the chart Bar color can't find it on the link
TMO is the only one I use and yes I do watch for divergenceHello,
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
Try your theory,....let us know,..only you can understand what you see for now.....KISS....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