Multi-Time Frame True Momentum Oscillator (MTF) for ThinkorSwim

Never used FREMA. As far as I can tell it is a momentum oscillator. I think MACD or RSI or TRIX will give the same results.
 
@tomsk Can you please take a look at the code below...I am having difficulties making it work right...Here's what I am trying to do...
I want to add the Ultimate Oscillator from the CSA study to the TMO MTF...I think I did that right as it is displaying correctly. NEXT...I want to add one instance of Trend Magic but I want to be able to select the higher aggregation...That too I think I got to work correctly.

My issue is with the SuperTrend dots...for whatever reason the aggregation part does not work as its only reflecting the current timeframe the chart that you're working on despite setting the higher aggregation from the user interface. I want to test this method out in the ORB indicator that we discussed yesterday but I can't quite get it to how it needs to be...Thanks.


Code:
# filename: MR__EZ_TMO_MTF_Fisher_2Agg_
# source: https://usethinkscript.com/d/91-tmo-with-higher-agg-mobius-tsl

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

# Global Defs

input DotSize = 3;
input n = 3;

def n1 = n + 1;
def PosUp = 1; # Positive and Up
def PosDn = 2; # Positive and Down
def NegDn = 3; # Negative and Down
def NegUp = 4; # Negative and Up

# Ehlers Universal Oscillator
# LazyBear
# initial port by netarchitech
# 2019.11.05
# source: https://www.tradingview.com/script/ieFYbVdC-Ehlers-Universal-Oscillator-LazyBear/

input bandedge = 20;
input EUOLengthMA = 9;

def whitenoise = (close - close[2]) / 2;
def a1 = ExpAverage(-1.414 * 3.14159 / bandedge);
def b1 = 2.0 * a1 * Cos(1.414 * 180 / bandedge);
def c2 = b1;
def c3 = -a1 * a1;
def c1 = 1 - c2 - c3;

def filt = c1 * (whitenoise + (whitenoise[1])) / 2 + c2 * (filt[1]) + c3 * (filt[2]);
def filt1 = if TotalSum(1) == 0 then 0
else if TotalSum(1) == 2 then c2 * filt1[1]
else if TotalSum(1) == 3 then c2 * filt1[1] + c3 * (filt1[2])
else filt;

def pk = if TotalSum(1) == 2 then .0000001
else if AbsValue(filt1) > pk[1] then AbsValue(filt1)
else 0.991 * pk[1];
def denom = if pk == 0 then -1 else pk;
def euo = if denom == -1 then euo[1] else filt1 / pk;
def euoMA = ExpAverage(euo, EUOLengthMA);
def Universal_Diff = euo;
def Universal_State = if Universal_Diff >= 0
then if Universal_Diff > Universal_Diff[1]
then PosUp
else PosDn
else if Universal_Diff < Universal_Diff[1]
then NegDn
else NegUp;
plot Universal_Dot = if IsNaN(close) then Double.NaN else -18;
Universal_Dot.SetPaintingStrategy(PaintingStrategy.POINTS);
Universal_Dot.SetLineWeight(DotSize);
Universal_Dot.DefineColor("Positive and Up", Color.GREEN);
Universal_Dot.DefineColor("Positive and Down", Color.DARK_GREEN);
Universal_Dot.DefineColor("Negative and Down", Color.RED);
Universal_Dot.DefineColor("Negative and Up", Color.DARK_RED);
Universal_Dot.AssignValueColor(if Universal_State == PosUp then Universal_Dot.Color("Positive and Up")
else if Universal_State == PosDn then Universal_Dot.Color("Positive and Down")
else if Universal_State == NegDn then Universal_Dot.Color("Negative and Down")
else Universal_Dot.Color("Negative and Up"));
AddChartBubble(!IsNaN(close[n1]) and IsNaN(close[n]), -18, "Univ Osc", Color.YELLOW, yes);
# End Code Ehlers Universal Oscillator
# End CSA Trading Dashboard

declare lower;

input length = 14; # default -> 14;
def calcLength = 5;
def smoothLength = 3;
input agg = AggregationPeriod.FIVE_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);
Main.SetLineWeight(1);
Signal.SetLineWeight(1);
Signal.HideBubble();
Signal.HideTitle();


# JQ_FisherTransform_wLabels v02
# assistance provided by AlphaInvestor, amalia, randyr and nube

# v02 9.23.2018 JQ added arrows

input Fisherprice = hl2;
input FisherLength = 10;
input TriggerLineOffset = 1; # Ehler's value of choice is 1
input TriggerLine_Color_Choice = {"magenta", "cyan", "pink", default "gray", "Mustard", "red", "green", "dark_gray", "Pale Yellow", "white"};
input deBug = no;

def maxHigh = Highest(Fisherprice, FisherLength);
def minLow = Lowest(Fisherprice, FisherLength);
def range = maxHigh - minLow;
def value = if IsNaN(Fisherprice)
then Double.NaN
else if IsNaN(range)
then value[1]
else if range == 0
then 0
else 0.66 * ((Fisherprice - minLow) / range - 0.5) + 0.67 * value[1];
def truncValue = if value > 0.99 then 0.999 else if value < -0.99 then -0.999 else value;
def fish = 0.5 * (Log((1 + truncValue) / (1 - truncValue)) + fish[1]);
def FTOneBarBack = fish[TriggerLineOffset];
def FT = fish;

plot FisherBullCross = if FT crosses above FTOneBarBack then LowestAll(Main) else Double.NaN;
FisherBullCross.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
FisherBullCross.SetDefaultColor(Color.WHITE);

plot FisherBearCross = if FT crosses below FTOneBarBack then HighestAll(Main) else Double.NaN;
FisherBearCross.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
FisherBearCross.SetDefaultColor(Color.WHITE);


input length2 = 10; # default -> 14;
def calcLength2 = 5;
def smoothLength2 = 3;
input agg2 = AggregationPeriod.FIFTEEN_MIN;

def o2 = open(period = agg2);
def c2a = close(period = agg2);
def data2 = fold i2 = 0 to length2
           with s2
           do s2 + (if c2a > GetValue(o2, i2)
                   then 1
                   else if c2a < GetValue(o2, i2)
                        then - 1
                        else 0);
def EMA52 = ExpAverage(data2, calcLength2);
plot Main2 = ExpAverage(EMA52, smoothLength2);
plot Signal2 = ExpAverage(Main2, smoothLength2);
Main2.AssignValueColor(if Main2 > Signal2
                            then Color.UPTICK
                            else Color.DOWNTICK);
Signal2.AssignValueColor(if Main2 > Signal2
                            then Color.UPTICK
                            else Color.DOWNTICK);
Signal2.HideBubble();
Signal2.HideTitle();

AddCloud(Main, Signal, Color.GREEN, Color.RED);
AddCloud(Main2, Signal2, Color.UPTICK, Color.DOWNTICK);

plot ZeroLine = 0;
ZeroLine.SetDefaultColor(Color.MAGENTA);
ZeroLine.HideBubble();
ZeroLine.HideTitle();

plot ob = if IsNaN(c) then Double.NaN else Round(length * .7);
ob.SetDefaultColor(Color.DARK_ORANGE);
ob.HideBubble();
ob.HideTitle();
plot os = if IsNaN(c) then Double.NaN else -Round(length * .7);
os.SetDefaultColor(Color.CYAN);
os.HideBubble();
os.HideTitle();
AddCloud(ob, length, Color.DARK_ORANGE, Color.DARK_ORANGE, no);
AddCloud(-length, os, Color.CYAN, Color.CYAN);

# Trend Magic MTF
# tomsk
# 11.26.2019

# V1.0 - 08.08.2019 - Horserider - Added MTF to Trend Magic
# V1.1 - 11.26.2019 - tomsk      - Optimized code structure, removed duplicate variables
# V1.2 - 11.26.2019 - tomsk      - Converted this study to a lower study with MTF triangles

#declare lower;

# GLOBAL DEFINITIONS

DefineGlobalColor("TrendUp", CreateColor(0, 254, 30));
DefineGlobalColor("TrendDown", CreateColor(255, 3, 2));

input agg1 = AggregationPeriod.HOUR;

input lengthCCI = 50;
input lengthATR = 5;
input AtrFactor = 0.7;

input TRIANGLESize = 3;
input m = 3;

def m1  = m + 1;

# AGGREGATION 1

def c4 = close(period = agg1);
def h4 = high(period = agg1);
def l4 = low(period = agg1);
def pricedata4 = hl2(period = agg1);
def ATRcci4 = Average(TrueRange(h4, c4, l4), lengthATR) * AtrFactor;
def price4 = c4 + l4 + h4;
def linDev4 = LinDev(price4, lengthCCI);
def CCI4 = if linDev4 == 0 then 0 else (price4 - Average(price4, lengthCCI)) / linDev4 / 0.015;
def MT4 = if CCI4 > 0
          then Max(MT4[1], pricedata4 - ATRcci4)
          else Min(MT4[1], pricedata4 + ATRcci4);
plot MT4_TRIANGLE = if IsNaN(close) then Double.NaN else -20;
MT4_TRIANGLE.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
MT4_TRIANGLE.SetLineWeight(TRIANGLESize);
MT4_TRIANGLE.AssignValueColor(if c4 < MT4 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(close[m1]) and IsNaN(close[m]), -20, (agg1 / 1000 / 60) + " min", Color.YELLOW, yes);

# End Trend Magic MTF

# SuperTrend Multiple Time Frames
# Mobius with mods by tomsk to replace the script() function for secondary aggs with "standard" code
# V03.01.2016
# 11.4.2019

input agg5 = AggregationPeriod.HOUR;
input AtrMult = .70;
input nATR = 4;
input AvgType = AverageType.HULL;

def Fh = FundamentalType.HIGH;
def Fl = FundamentalType.LOW;
def Fc = FundamentalType.CLOSE;
def Fhl2 = FundamentalType.HL2;

def cl = close;
def x = IsNaN(cl[2]) and !IsNaN(cl[3]);
def ATR = MovingAverage(AvgType, TrueRange(high, close, low), nATR);
def UP = hl2 + (AtrMult * ATR);
def DN = hl2 + (-AtrMult * ATR);
def Sa = if close < Sa[1]
then Round(UP / TickSize(), 0) * TickSize()
else Round(DN / TickSize(), 0) * TickSize();
def FithAgg = if close > Sa then 1 else 0;
plot FithAggPlot = if IsNaN(cl)
then Double.NaN
else -22;
FithAggPlot.SetStyle(Curve.POINTS);
FithAggPlot.SetLineWeight(3);
FithAggPlot.AssignValueColor(if FithAgg == 1
then Color.GREEN
else Color.RED);
AddChartBubble(x, 1, (GetAggregationPeriod() / 1000 / 60) + " min", Color.WHITE, yes);

# End Code ST MTF
 
@tomsk I would also want to incorporate the following CCI ATR SuperTrend into the above TMO Ultimate Oscillator Trend Magic and SuperTrend...this is way beyond my knowledge...

Code:
# SUPERTREND BY MOBIUS AND CCI ATR TREND COMBINED INTO ONE CHART INDICATOR, BOTH IN AGREEMENT IS A VERY POWERFUL SIGNAL IF TRENDING. VERY GOOD AT CATCHING REVERSALS. WORKS WELL ON 1 AND 5 MIN CHARTS. PLOT IS THE COMBINATION LOWEST FOR UPTREND AND HIGHEST OF THE DOWNTREND. DOTS COLORED IF BOTH IN AGREEMENT OR GREY IF NOT -  08/10/19 DTEK


def c = close;
def h = high;
def l = low;
def pricedata = hl2;

#SUPERTREND
input ST_Atr_Mult = 1.0;
input ST_Length = 4;
input ST_AvgType = AverageType.HULL;

def ATR = MovingAverage(ST_AvgType, TrueRange(high, close, low), ST_Length);
def UP = HL2 + (ST_Atr_Mult* ATR);
def DN = HL2 + (-ST_Atr_Mult * ATR);
def ST = if close < ST[1] then UP else DN;

def SuperTrend = ST;


#CCI_ATR
input lengthCCI = 50;
input lengthATR = 21;
input AtrFactor = 1.0;

def ATRcci = Average(TrueRange(h, c, l), lengthATR) * AtrFactor;
def price = c + l + h;
def linDev = LinDev(price, lengthCCI);
def CCI = if linDev == 0
          then 0
          else (price - Average(price, lengthCCI)) / linDev / 0.015;

def MT1 = if CCI > 0
          then Max(MT1[1], pricedata - ATRcci)
          else Min(MT1[1], pricedata + ATRcci);
def CCI_ATR_TREND = MT1;

plot ST_ATR_COMBO = if C> ST and C>CCI_ATR_TREND then min(CCI_ATR_TREND, ST) else if c< ST and c<CCI_ATR_TREND then max(CCI_ATR_TREND, ST) else CCI_ATR_TREND;

ST_ATR_COMBO.AssignValueColor(if c < MT1 and c <ST then color.cyan else if C > MT1 and c >ST then color.magenta else color.yellow);
ST_ATR_COMBO.setPaintingStrategy(paintingStrategy.LINE_VS_POINTS);
 
@tomsk I would also want to incorporate the following CCI ATR SuperTrend into the above TMO Ultimate Oscillator Trend Magic and SuperTrend...this is way beyond my knowledge...

Code:
# SUPERTREND BY MOBIUS AND CCI ATR TREND COMBINED INTO ONE CHART INDICATOR, BOTH IN AGREEMENT IS A VERY POWERFUL SIGNAL IF TRENDING. VERY GOOD AT CATCHING REVERSALS. WORKS WELL ON 1 AND 5 MIN CHARTS. PLOT IS THE COMBINATION LOWEST FOR UPTREND AND HIGHEST OF THE DOWNTREND. DOTS COLORED IF BOTH IN AGREEMENT OR GREY IF NOT -  08/10/19 DTEK


def c = close;
def h = high;
def l = low;
def pricedata = hl2;

#SUPERTREND
input ST_Atr_Mult = 1.0;
input ST_Length = 4;
input ST_AvgType = AverageType.HULL;

def ATR = MovingAverage(ST_AvgType, TrueRange(high, close, low), ST_Length);
def UP = HL2 + (ST_Atr_Mult* ATR);
def DN = HL2 + (-ST_Atr_Mult * ATR);
def ST = if close < ST[1] then UP else DN;

def SuperTrend = ST;


#CCI_ATR
input lengthCCI = 50;
input lengthATR = 21;
input AtrFactor = 1.0;

def ATRcci = Average(TrueRange(h, c, l), lengthATR) * AtrFactor;
def price = c + l + h;
def linDev = LinDev(price, lengthCCI);
def CCI = if linDev == 0
          then 0
          else (price - Average(price, lengthCCI)) / linDev / 0.015;

def MT1 = if CCI > 0
          then Max(MT1[1], pricedata - ATRcci)
          else Min(MT1[1], pricedata + ATRcci);
def CCI_ATR_TREND = MT1;

plot ST_ATR_COMBO = if C> ST and C>CCI_ATR_TREND then min(CCI_ATR_TREND, ST) else if c< ST and c<CCI_ATR_TREND then max(CCI_ATR_TREND, ST) else CCI_ATR_TREND;

ST_ATR_COMBO.AssignValueColor(if c < MT1 and c <ST then color.cyan else if C > MT1 and c >ST then color.magenta else color.yellow);
ST_ATR_COMBO.setPaintingStrategy(paintingStrategy.LINE_VS_POINTS);
@HighBredCloud Please type multicolinearity into the search above. The post is also in Tutorials. Please read it.

It seems you can't decide on what you are looking for. There only 5 types of indicators, with multiple variations of each.
TOS has many hundreds built in and there are many more here: https://1drv.ms/u/s!AnkeHrrRM_cvgxQTl1xckINYlKhZ

As @horserider said above: MACD or RSI or TRIX will give the same results. You are in danger of Analysis Paralysis.

Please review the "school" at stockcharts dot com. It's free and is one of just a few I know of written by CMT's. That will help you decide what you are looking for. Once you find something, live with it for a while so when you move on, you'll be better able to compare. Thank you.
 
@markos Very well said. Toward that, one particular comment that Mobius said regarding indicators sticks to my mind even till today.

He said traders that use any indicator and are successful have a real passion for that indicator and know precisely when, how and why it works. They can explain to their grandmother every aspect of it in terms she can grasp. They also trade equities they know inside and out. Those that start trading without that depth of knowledge fail. Something to that order.
 
@markos Very well said. Toward that, one particular comment that Mobius said regarding indicators sticks to my mind even till today.
He said traders that use any indicator and are successful have a real passion for that indicator and know precisely when, how and why it works. They can explain to their grandmother every aspect of it in terms she can grasp. They also trade equities they know inside and out. Those that start trading without that depth of knowledge fail. Something to that order.
@tomsk you know, I should probably stick with round number SMA's then. :ROFLMAO::ROFLMAO:
Maybe in 10 - 15 years Mobius' granddaughter will write a little book about how she made a pile of cash one summer, when she was 5 or 6, learning to trade the ORB with grandpa. That would be a gift to us all!
 
@markos I totally understand what you're saying...I realize that having too many indicators and or too many charts one is prone to analysis paralysis...That is not my intention here...IF anything I want to cut down on indicators but mostly I want to cut down on the number of charts that I am looking at...Hence why I asked @tomsk to help me out with my request as I am not a coder...

I found that some indicators work better than others on different timeframes...that's why I wanted those specific indicators with higher aggregation paired onto one indicator...

The particular example that comes to mind is MTF TMO...although its good there are some short comings to it...For example...Mobius says to use the second aggregation 5-10 its original timeframe...Well that's great and all...BUT I have seen first hand trends repaint on lower timeframes when using TMO indicator lets say on 5 min with the second TMO set to 30 min...Its not as clear cut live trading as it is staring at closed market chart.

I have noticed similar things with Trend Magic indicator...The key thing that I wanted to try out was different time aggregation to eliminate potential repaint of the trend on a smaller timeframe...That's all...

I mean realistically speaking one could just use a Tillson T3 MA and just trade in that direction using just that indicator.
 
@tomsk In regards to what Mobius said in your post...I would agree. I personally have a live watchlist of the same 14 stocks that I watch daily and ONLY trade those stocks daily...Getting to know the behavior and characteristic of each stock will determines one's success...If you have time can you please let me know or help me out what I am doing wrong in particular with the SuperTrend dots and the aggregation portion not working? The Trend Magic that you made works great...and I can set higher aggregation on it no problem...I also wanted to see if the SuperTrend CCI ATR would look like in the same format as the others so I can take it off my chart and pay attention more to the candles and price action...This is beyond my abilities.
 
@markos As funny as your statement is about round number SMA's...here's what I found out. We have so many variations of moving averages...SMA...EMA...WMA..etc...That its hard to determine which is best as quite frankly each type of MA will give you different plots for a specific period in mind. @tomsk shared a Heiken Ashi SuperTrend that Mobius made...anyways in that particular trend is based on a moving average line...ANYTHING above or below it is either UP or DOWN trend...IF you just pair that particular MA with a Tillson T3 or HULL MA...I don't think you will need another indicator...ORB from what I have tested also has its short comings...it just hits too late...BUT when it does you can have a more "guaranteed" entry or exit. I am still playing around with everything trying to see what works best with what...But in all honesty the best thing is catching a trend and hitting your daily goal and most importantly not overtrading and being greedy...
 
After reading your various posts, here are my observations. In the last couple of months appear to be shifting your focus from indicator to indicator and making ad hoc requests to combine them. I'll wager that if you see yet some other indicator that is being posted you'll soon want to add that to the mix. Some of the indicators that are being combined are already measuring trend. Hence it makes no sense to combine two or more separate trend indicators. I've also noticed that among the set of of indicators you've requested are two CCI based indicators. Again, no sense in combining two similar indicators. What would you be seeing differently?

At the end of the day, whoever is going to end up putting this together will have a very complex system and the signals will no longer become clear. I don't personally have the cycles to undertake this. Perhaps someone with the interest level may. But whatever you do, you'll need to come up with a single paragraph description of the desired end state of your "ideal indicator" rather than send fragmented pieces of information. That will help any interested parties to assess feasibility of the request

I wish you best of luck in pursuing your ideal indicator.
 
After reading your various posts, here are my observations. In the last couple of months appear to be shifting your focus from indicator to indicator and making ad hoc requests to combine them. I'll wager that if you see yet some other indicator that is being posted you'll soon want to add that to the mix. Some of the indicators that are being combined are already measuring trend. Hence it makes no sense to combine two or more separate trend indicators. I've also noticed that among the set of of indicators you've requested are two CCI based indicators. Again, no sense in combining two similar indicators. What would you be seeing differently?

At the end of the day, whoever is going to end up putting this together will have a very complex system and the signals will no longer become clear. I don't personally have the cycles to undertake this. Perhaps someone with the interest level may. But whatever you do, you'll need to come up with a single paragraph description of the desired end state of your "ideal indicator" rather than send fragmented pieces of information. That will help any interested parties to assess feasibility of the request

I wish you best of luck in pursuing your ideal indicator.
@tomsk
You have been a very valuable source not only to me but to many on here. For that I would like to thank you.
 
@tomsk
You have been a very valuable source not only to me but to many on here. For that I would like to thank you.


@Jimmy Glad that my work helped you, it takes a while to get to grips with ThinkScript and after some time it all just gels together. Keep looking at examples and see how things are strung together. In my case it took me over 2 years before I started to be comfortable with ThinkScript. After 6 years, I'm still learning new techniques.
 
@tomsk For your review my attempt to do what I asked to be done. Maybe you can clean it up a bit for me as you see fit but here is the general idea of what I asked for. From my experience just because you have the same indicator measuring trend does not mean that trend is plotted the same way at the same time intervals...Hence I like to use an indicator that confirms the same indicator...Maybe stupid...maybe not...BUT I personally don't enjoy sitting through pain and being in RED hence why all my silly requests...Besides that's up to the end user to determine the effectiveness of such indicators method. As always...my requests have been very user friendly so the end user can take off what they don't want and leave what they see fit and most importantly are clear to read IMO...

And you're probably right...IF a new indicator comes out that catches my eye...I'll probably want to combine that too in a way where I can save space on my chart...For me its trail and error...until I find that perfect indicator that suits my trading style.

For anyone that is interested here's the code below for MTF TMO that @netarchitech enhanced with Fisher Transform and 2 aggregations combined with MTF Trend Magic and MTF ATR based SuperTrend enhanced by @tomsk

Because I am not a coder you will have to turn off certain aggregations from the user interface to reflect the picture posted below of how I intended this indicator to function...

This indicator is broken up to 3 sections.

Section 1 is the ATR SuperTrend that is represented by the Dots...and Trend Magic that is represented by the Triangles...any questions on the functionality should be addressed to @tomsk as I used his source codes to combine everything.

Section 2 is Plot 6 of the ATR SuperTrend. Plot 6 combines 5 different types of ATR SuperTrend aggregations and when the dots reflect GREEN or RED that means in this particular time all 5 aggregations are in confluence and you should base your trade in the direction of the trend.
PLEASE NOTE that this particular aggregation seems to ONLY work up to 30 min...so you can set the aggregations for example 5, 10, 15, 20, 30 min...and Plot 6 will show the dots in confluence based on the aggregations selected. I am working on something that will work on higher time frames...Again I think @tomsk might have the solution for this as this is originally his code source that I used.

Section 3 is the same as Section 1 except it is intended to run a second set of higher aggregations.

The way I have this indicator set up is for a 5 min chart and in section 1 I have aggregation set to 5 on both the ATR SuperTrend and Trend Magic.

Section 3 I have the aggregation set to 10 min on both the ATR Super Trend and Trend Magic...again to be used on a 5 min time frame chart.

TMO is also set to 5 min and 10 min secondary aggregation.

You can set to whatever timeframe that you want as long as its 30 min or under with this particular code. All you need to do is make sure that the other indicators match your time frame in the according sequence as the example I showed above. I will post a version for higher timeframes as soon as I am done testing as the combination of all of these indicators into one caused a glitch on higher timeframe at certain times...Not sure if TOS or something in the code that I did...again...I am not a coder just a HellBent trader on a quest to find his perfect indicator...Full Disclosure.
Code:
#MTF True Momentum Oscillator MTF Trend Magic and MTF ATR SuperTrend
#combined enhancements by HighBredCloud
#V12.14.2019

# filename: MR__EZ_TMO_MTF_Fisher_2Agg_
# source: https://usethinkscript.com/d/91-tmo-with-higher-agg-mobius-tsl

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

declare lower;

input length = 14; # default -> 14;
def calcLength = 5;
def smoothLength = 3;
input aggA = AggregationPeriod.FIVE_MIN;

def o = open(period = aggA);
def c = close(period = aggA);
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);
Main.SetLineWeight(1);
Signal.SetLineWeight(1);
Signal.HideBubble();
Signal.HideTitle();


# JQ_FisherTransform_wLabels v02
# assistance provided by AlphaInvestor, amalia, randyr and nube

# v02 9.23.2018 JQ added arrows

input Fisherprice = hl2;
input FisherLength = 10;
input TriggerLineOffset = 1; # Ehler's value of choice is 1
input TriggerLine_Color_Choice = {"magenta", "cyan", "pink", default "gray", "Mustard", "red", "green", "dark_gray", "Pale Yellow", "white"};
input deBug = no;

def maxHigh = Highest(Fisherprice, FisherLength);
def minLow = Lowest(Fisherprice, FisherLength);
def range = maxHigh - minLow;
def value = if IsNaN(Fisherprice)
then Double.NaN
else if IsNaN(range)
then value[1]
else if range == 0
then 0
else 0.66 * ((Fisherprice - minLow) / range - 0.5) + 0.67 * value[1];
def truncValue = if value > 0.99 then 0.999 else if value < -0.99 then -0.999 else value;
def fish = 0.5 * (Log((1 + truncValue) / (1 - truncValue)) + fish[1]);
def FTOneBarBack = fish[TriggerLineOffset];
def FT = fish;

plot FisherBullCross = if FT crosses above FTOneBarBack then LowestAll(Main) else Double.NaN;
FisherBullCross.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
FisherBullCross.SetDefaultColor(Color.WHITE);

plot FisherBearCross = if FT crosses below FTOneBarBack then HighestAll(Main) else Double.NaN;
FisherBearCross.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
FisherBearCross.SetDefaultColor(Color.WHITE);


input length2 = 14; # default -> 14;
def calcLength2 = 5;
def smoothLength2 = 3;
input aggB = AggregationPeriod.FIFTEEN_MIN;

def o2 = open(period = aggB);
def c2AA = close(period = aggB);
def data2 = fold i2 = 0 to length2
           with s2
           do s2 + (if c2AA > GetValue(o2, i2)
                   then 1
                   else if c2AA < GetValue(o2, i2)
                        then - 1
                        else 0);
def EMA52 = ExpAverage(data2, calcLength2);
plot Main2 = ExpAverage(EMA52, smoothLength2);
plot Signal2 = ExpAverage(Main2, smoothLength2);
Main2.AssignValueColor(if Main2 > Signal2
                            then Color.UPTICK
                            else Color.DOWNTICK);
Signal2.AssignValueColor(if Main2 > Signal2
                            then Color.UPTICK
                            else Color.DOWNTICK);
Signal2.HideBubble();
Signal2.HideTitle();

AddCloud(Main, Signal, Color.GREEN, Color.RED);
AddCloud(Main2, Signal2, Color.UPTICK, Color.DOWNTICK);

plot ZeroLine = 0;
ZeroLine.SetDefaultColor(Color.MAGENTA);
ZeroLine.HideBubble();
ZeroLine.HideTitle();

plot ob = if IsNaN(c) then Double.NaN else Round(length * .7);
ob.SetDefaultColor(Color.DARK_ORANGE);
ob.HideBubble();
ob.HideTitle();
plot os = if IsNaN(c) then Double.NaN else -Round(length * .7);
os.SetDefaultColor(Color.CYAN);
os.HideBubble();
os.HideTitle();
AddCloud(ob, length, Color.DARK_ORANGE, Color.DARK_ORANGE, no);
AddCloud(-length, os, Color.CYAN, Color.CYAN);
#
# Trend Magic MTF
# tomsk
# 11.26.2019

# V1.0 - 08.08.2019 - Horserider - Added MTF to Trend Magic
# V1.1 - 11.26.2019 - tomsk      - Optimized code structure, removed duplicate variables
# V1.2 - 11.26.2019 - tomsk      - Converted this study to a lower study with MTF triangles

#declare lower;

# GLOBAL DEFINITIONS

DefineGlobalColor("TrendUp", CreateColor(0, 254, 30));
DefineGlobalColor("TrendDown", CreateColor(255, 3, 2));

input agg1TM = AggregationPeriod.FIFTEEN_MIN;
input agg2TM = AggregationPeriod.THIRTY_MIN;
input agg3TM = AggregationPeriod.HOUR;

input lengthCCI = 50;
input lengthATR = 5;
input AtrFactor = 0.7;

input DotSize = 3;
input n = 3;

def n1  = n + 1;

# AGGREGATION 1

def c1A = close(period = agg1TM);
def h1A = high(period = agg1TM);
def l1A = low(period = agg1TM);
def pricedata1A = hl2(period = agg1TM);
def ATRcci1A = Average(TrueRange(h1A, c1A, l1A), lengthATR) * AtrFactor;
def price1A = c1A + l1A + h1A;
def linDev1A = LinDev(price1A, lengthCCI);
def CCI1A = if linDev1A == 0 then 0 else (price1A - Average(price1A, lengthCCI)) / linDev1A / 0.015;
def MT1 = if CCI1A > 0
          then Max(MT1[1], pricedata1A - ATRcci1A)
          else Min(MT1[1], pricedata1A + ATRcci1A);
plot MT1_Dot = if IsNaN(close) then Double.NaN else -19;
MT1_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
MT1_Dot.SetLineWeight(DotSize);
MT1_Dot.AssignValueColor(if c1A < MT1 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(close[n1]) and IsNaN(close[n]), -19, (agg1TM / 1000 / 60) + " min", Color.YELLOW, yes);

# AGGREGATION 2

def c2A = close(period = agg2TM);
def h2A = high(period = agg2TM);
def l2A = low(period = agg2TM);
def pricedata2A = hl2(period = agg2TM);
def ATRcci2A = Average(TrueRange(h2A, c2A, l2A), lengthATR) * AtrFactor;
def price2A = c2A + l2A + h2A;
def linDev2A = LinDev(price2A, lengthCCI);
def CCI2A = if linDev2A == 0 then 0 else (price2A - Average(price2A, lengthCCI)) / linDev2A / 0.015;
def MT2 = if CCI2A > 0
          then Max(MT2[1], pricedata2A - ATRcci2A)
          else Min(MT2[1], pricedata2A + ATRcci2A);
plot MT2_Dot = if IsNaN(close) then Double.NaN else 19;
MT2_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
MT2_Dot.SetLineWeight(DotSize);
MT2_Dot.AssignValueColor(if c2A < MT2 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(close[n1]) and IsNaN(close[n]), 19, (agg2TM / 1000 / 60) + " min", Color.YELLOW, yes);

# AGGREGATION 3

def c3A = close(period = agg3TM);
def h3A = high(period = agg3TM);
def l3A = low(period = agg3TM);
def pricedata3A = hl2(period = agg3TM);

def ATRcci3A = Average(TrueRange(h3A, c3A, l3A), lengthATR) * AtrFactor;
def price3A = c3A + l3A + h3A;
def linDev3A = LinDev(price3A, lengthCCI);
def CCI3A = if linDev3A == 0 then 0 else (price3A - Average(price3A, lengthCCI)) / linDev3A / 0.015;
def MT3 = if CCI3A > 0
          then Max(MT3[1], pricedata3A - ATRcci3A)
          else Min(MT3[1], pricedata3A + ATRcci3A);
plot MT3_Dot = if IsNaN(close) then Double.NaN else -23;
MT3_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
MT3_Dot.SetLineWeight(DotSize);
MT3_Dot.AssignValueColor(if c3A < MT3 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(close[n1]) and IsNaN(close[n]), -23, (agg3TM / 1000 / 60) + " min", Color.YELLOW, yes);
# End Trend Magic MTF
#
# SuperTrend Multiple Time Frames
# Mobius with mods by tomsk to replace the script() function for secondary aggs with "standard" code
# V03.01.2016
# 11.4.2019

#declare lower;

input agg1ST = AggregationPeriod.Five_Min;
input agg2ST = AggregationPeriod.Ten_Min;
input agg3ST = AggregationPeriod.Fifteen_Min;
input agg4ST = AggregationPeriod.Thirty_Min;
input agg5ST = AggregationPeriod.Hour;
input AtrMult = .70;
input nATR = 4;
input AvgType = AverageType.HULL;

def Fh = FundamentalType.High;
def Fl = FundamentalType.Low;
def Fc = FundamentalType.Close;
def Fhl2 = FundamentalType.HL2;

def cl = close;
def x = isNaN(cl[2]) and !isNaN(cl[3]);
def ATR = MovingAverage(AvgType, TrueRange(high, close, low), nATR);
def UP = hl2 + (AtrMult * ATR);
def DN = hl2 + (-AtrMult * ATR);
def S1A = if close < S1A[1]
then Round(UP / tickSize(), 0) * tickSize()
else Round(DN / tickSize(), 0) * tickSize();
def FirstAgg = if close > S1A then 1 else 0;
plot FirstAggPlot = if isNaN(cl)
then double.nan
else -21;
FirstAggPlot.SetStyle(Curve.Points);
FirstAggPlot.SetLineWeight(3);
FirstAggPlot.AssignValueColor(if FirstAgg == 1
then color.green
else color.red);
AddChartBubble(x, 1, (GetAggregationPeriod()/1000/60) + " min", color.white, yes);

# SecondAgg
def h2 = Fundamental(Fh, period = agg2ST)[1];
def l2 = Fundamental(Fl, period = agg2ST)[1];
def c2 = Fundamental(Fc, period = agg2ST)[1];
def hl2 = Fundamental(Fhl2, period = agg2ST)[1];
def ATR2 = MovingAverage(AvgType, TrueRange(h2, c2, l2), nATR);
def UP2 = hl2 + (AtrMult * ATR2);
def DN2 = hl2 + (-AtrMult * ATR2);
def S2A = if c2 < S2A[1]
then Round(UP2 / tickSize(), 0) * tickSize()
else Round(DN2 / tickSize(), 0) * tickSize();
def SecondAgg = if c2 > S2A then 1 else 0;
plot SecondAggPlot = if isNaN(cl)
then double.nan
else 21;
SecondAggPlot.SetStyle(Curve.Points);
SecondAggPlot.SetLineWeight(3);
SecondAggPlot.AssignValueColor(if SecondAgg == 1
then color.green
else color.red);
AddChartBubble(x, 2, (agg2ST/1000/60) + " min", color.white, yes);

# ThirdAgg
def h3 = Fundamental(Fh, period = agg3ST)[1];
def l3 = Fundamental(Fl, period = agg3ST)[1];
def c3 = Fundamental(Fc, period = agg3ST)[1];
def hl3 = Fundamental(Fhl2, period = agg3ST)[1];
def ATR3 = MovingAverage(AvgType, TrueRange(h3, c3, l3), nATR);
def UP3 = hl3 + (AtrMult * ATR3);
def DN3 = hl3 + (-AtrMult * ATR3);
def S3 = if c3 < S3[1]
then Round(UP3 / tickSize(), 0) * tickSize()
else Round(DN3 / tickSize(), 0) * tickSize();
def ThirdAgg = if c3 > S3 then 1 else 0;
plot ThirdAggPlot = if isNaN(cl)
then double.nan
else 23;
ThirdAggPlot.SetStyle(Curve.Points);
ThirdAggPlot.SetLineWeight(3);
ThirdAggPlot.AssignValueColor(if ThirdAgg == 1
then color.green
else color.red);
AddChartBubble(x, 3, (agg3ST/1000/60) + " min", color.white, yes);

# FourthAgg
def h4 = Fundamental(Fh, period = agg4ST)[1];
def l4 = Fundamental(Fl, period = agg4ST)[1];
def c4 = Fundamental(Fc, period = agg4ST)[1];
def hl4 = Fundamental(Fhl2, period = agg4ST)[1];
def ATR4 = MovingAverage(AvgType, TrueRange(h4, c4, l4), nATR);
def UP4 = hl4 + (AtrMult * ATR4);
def DN4 = hl4 + (-AtrMult * ATR4);
def S4 = if c4 < S4[1]
then Round(UP4 / tickSize(), 0) * tickSize()
else Round(DN4 / tickSize(), 0) * tickSize();
def FourthAgg = if c4 > S4 then 1 else 0;
plot FourthAggPlot = if isNaN(cl)
then double.nan
else 25;
FourthAggPlot.SetStyle(Curve.Points);
FourthAggPlot.SetLineWeight(3);
FourthAggPlot.AssignValueColor(if FourthAgg == 1
then color.green
else color.red);
AddChartBubble(x, 4, (agg4ST/1000/60) + " min", color.white, yes);

# FifthAgg
def h5 = Fundamental(Fh, period = agg5ST)[1];
def l5 = Fundamental(Fl, period = agg5ST)[1];
def c5 = Fundamental(Fc, period = agg5ST)[1];
def hl5 = Fundamental(Fhl2, period = agg5ST)[1];
def ATR5 = MovingAverage(AvgType, TrueRange(h5, c5, l5), nATR);
def UP5 = hl5 + (AtrMult * ATR5);
def DN5 = hl5 + (-AtrMult * ATR5);
def S5 = if c5 < S5[1]
then Round(UP5 / tickSize(), 0) * tickSize()
else Round(DN5 / tickSize(), 0) * tickSize();
def FifthAgg = if c5 > S5 then 1 else 0;
plot FifthAggPlot = if isNaN(cl)
then double.nan
else 27;
FifthAggPlot.SetStyle(Curve.Points);
FifthAggPlot.SetLineWeight(3);
FifthAggPlot.AssignValueColor(if FifthAgg == 1
then color.green
else color.red);
AddChartBubble(x, 5, (agg5ST/1000/60)+ " min", color.white, yes);
plot Six = if isNaN(cl)
then double.nan
else 0;
Six.SetStyle(Curve.Points);
Six.SetLineWeight(3);
Six.AssignValueColor(if FirstAgg and
SecondAgg and
ThirdAgg and
FourthAgg and
FifthAgg
then color.green
else if !FirstAgg and
!SecondAgg and
!ThirdAgg and
!FourthAgg and
!FifthAgg
then color.red
else color.black);
# End Code ST MTF

The reason why I wanted this done in such a particular way is that I have seen false signals generated by each of these single indicators that are meant to measure the same thing...Trend and Momentum...Hopefully with confirming indicators, false trends can be filtered out allowing you to stay in the trade longer.

scXEdle.png


The upper section of my chart consists of Heikin Ashi Trend on regular candle sticks...I have also set the CCI ATR SuperTrend to Bolean instead of Numerical to display a dot at close of candle...I am also using Tillson T3 set to 13 and Heiken Ashi Moving Average...

These are NOT part of the code shared here tho...
 
@tomsk For your review my attempt to do what I asked to be done. Maybe you can clean it up a bit for me as you see fit but here is the general idea of what I asked for. From my experience just because you have the same indicator measuring trend does not mean that trend is plotted the same way at the same time intervals...Hence I like to use an indicator that confirms the same indicator...Maybe stupid...maybe not...BUT I personally don't enjoy sitting through pain and being in RED hence why all my silly requests...Besides that's up to the end user to determine the effectiveness of such indicators method. As always...my requests have been very user friendly so the end user can take off what they don't want and leave what they see fit and most importantly are clear to read IMO...

And you're probably right...IF a new indicator comes out that catches my eye...I'll probably want to combine that too in a way where I can save space on my chart...For me its trail and error...until I find that perfect indicator that suits my trading style.

For anyone that is interested here's the code below for MTF TMO that @netarchitech enhanced with Fisher Transform and 2 aggregations combined with MTF Trend Magic and MTF ATR based SuperTrend enhanced by @tomsk

Because I am not a coder you will have to turn off certain aggregations from the user interface to reflect the picture posted below of how I intended this indicator to function...

This indicator is broken up to 3 sections.

Section 1 is the ATR SuperTrend that is represented by the Dots...and Trend Magic that is represented by the Triangles...any questions on the functionality should be addressed to @tomsk as I used his source codes to combine everything.

Section 2 is Plot 6 of the ATR SuperTrend. Plot 6 combines 5 different types of ATR SuperTrend aggregations and when the dots reflect GREEN or RED that means in this particular time all 5 aggregations are in confluence and you should base your trade in the direction of the trend.
PLEASE NOTE that this particular aggregation seems to ONLY work up to 30 min...so you can set the aggregations for example 5, 10, 15, 20, 30 min...and Plot 6 will show the dots in confluence based on the aggregations selected. I am working on something that will work on higher time frames...Again I think @tomsk might have the solution for this as this is originally his code source that I used.

Section 3 is the same as Section 1 except it is intended to run a second set of higher aggregations.

The way I have this indicator set up is for a 5 min chart and in section 1 I have aggregation set to 5 on both the ATR SuperTrend and Trend Magic.

Section 3 I have the aggregation set to 10 min on both the ATR Super Trend and Trend Magic...again to be used on a 5 min time frame chart.

TMO is also set to 5 min and 10 min secondary aggregation.

You can set to whatever timeframe that you want as long as its 30 min or under with this particular code. All you need to do is make sure that the other indicators match your time frame in the according sequence as the example I showed above. I will post a version for higher timeframes as soon as I am done testing as the combination of all of these indicators into one caused a glitch on higher timeframe at certain times...Not sure if TOS or something in the code that I did...again...I am not a coder just a HellBent trader on a quest to find his perfect indicator...Full Disclosure.
Code:
#MTF True Momentum Oscillator MTF Trend Magic and MTF ATR SuperTrend
#combined enhancements by HighBredCloud
#V12.14.2019

# filename: MR__EZ_TMO_MTF_Fisher_2Agg_
# source: https://usethinkscript.com/d/91-tmo-with-higher-agg-mobius-tsl

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

declare lower;

input length = 14; # default -> 14;
def calcLength = 5;
def smoothLength = 3;
input aggA = AggregationPeriod.FIVE_MIN;

def o = open(period = aggA);
def c = close(period = aggA);
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);
Main.SetLineWeight(1);
Signal.SetLineWeight(1);
Signal.HideBubble();
Signal.HideTitle();


# JQ_FisherTransform_wLabels v02
# assistance provided by AlphaInvestor, amalia, randyr and nube

# v02 9.23.2018 JQ added arrows

input Fisherprice = hl2;
input FisherLength = 10;
input TriggerLineOffset = 1; # Ehler's value of choice is 1
input TriggerLine_Color_Choice = {"magenta", "cyan", "pink", default "gray", "Mustard", "red", "green", "dark_gray", "Pale Yellow", "white"};
input deBug = no;

def maxHigh = Highest(Fisherprice, FisherLength);
def minLow = Lowest(Fisherprice, FisherLength);
def range = maxHigh - minLow;
def value = if IsNaN(Fisherprice)
then Double.NaN
else if IsNaN(range)
then value[1]
else if range == 0
then 0
else 0.66 * ((Fisherprice - minLow) / range - 0.5) + 0.67 * value[1];
def truncValue = if value > 0.99 then 0.999 else if value < -0.99 then -0.999 else value;
def fish = 0.5 * (Log((1 + truncValue) / (1 - truncValue)) + fish[1]);
def FTOneBarBack = fish[TriggerLineOffset];
def FT = fish;

plot FisherBullCross = if FT crosses above FTOneBarBack then LowestAll(Main) else Double.NaN;
FisherBullCross.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
FisherBullCross.SetDefaultColor(Color.WHITE);

plot FisherBearCross = if FT crosses below FTOneBarBack then HighestAll(Main) else Double.NaN;
FisherBearCross.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
FisherBearCross.SetDefaultColor(Color.WHITE);


input length2 = 14; # default -> 14;
def calcLength2 = 5;
def smoothLength2 = 3;
input aggB = AggregationPeriod.FIFTEEN_MIN;

def o2 = open(period = aggB);
def c2AA = close(period = aggB);
def data2 = fold i2 = 0 to length2
           with s2
           do s2 + (if c2AA > GetValue(o2, i2)
                   then 1
                   else if c2AA < GetValue(o2, i2)
                        then - 1
                        else 0);
def EMA52 = ExpAverage(data2, calcLength2);
plot Main2 = ExpAverage(EMA52, smoothLength2);
plot Signal2 = ExpAverage(Main2, smoothLength2);
Main2.AssignValueColor(if Main2 > Signal2
                            then Color.UPTICK
                            else Color.DOWNTICK);
Signal2.AssignValueColor(if Main2 > Signal2
                            then Color.UPTICK
                            else Color.DOWNTICK);
Signal2.HideBubble();
Signal2.HideTitle();

AddCloud(Main, Signal, Color.GREEN, Color.RED);
AddCloud(Main2, Signal2, Color.UPTICK, Color.DOWNTICK);

plot ZeroLine = 0;
ZeroLine.SetDefaultColor(Color.MAGENTA);
ZeroLine.HideBubble();
ZeroLine.HideTitle();

plot ob = if IsNaN(c) then Double.NaN else Round(length * .7);
ob.SetDefaultColor(Color.DARK_ORANGE);
ob.HideBubble();
ob.HideTitle();
plot os = if IsNaN(c) then Double.NaN else -Round(length * .7);
os.SetDefaultColor(Color.CYAN);
os.HideBubble();
os.HideTitle();
AddCloud(ob, length, Color.DARK_ORANGE, Color.DARK_ORANGE, no);
AddCloud(-length, os, Color.CYAN, Color.CYAN);
#
# Trend Magic MTF
# tomsk
# 11.26.2019

# V1.0 - 08.08.2019 - Horserider - Added MTF to Trend Magic
# V1.1 - 11.26.2019 - tomsk      - Optimized code structure, removed duplicate variables
# V1.2 - 11.26.2019 - tomsk      - Converted this study to a lower study with MTF triangles

#declare lower;

# GLOBAL DEFINITIONS

DefineGlobalColor("TrendUp", CreateColor(0, 254, 30));
DefineGlobalColor("TrendDown", CreateColor(255, 3, 2));

input agg1TM = AggregationPeriod.FIFTEEN_MIN;
input agg2TM = AggregationPeriod.THIRTY_MIN;
input agg3TM = AggregationPeriod.HOUR;

input lengthCCI = 50;
input lengthATR = 5;
input AtrFactor = 0.7;

input DotSize = 3;
input n = 3;

def n1  = n + 1;

# AGGREGATION 1

def c1A = close(period = agg1TM);
def h1A = high(period = agg1TM);
def l1A = low(period = agg1TM);
def pricedata1A = hl2(period = agg1TM);
def ATRcci1A = Average(TrueRange(h1A, c1A, l1A), lengthATR) * AtrFactor;
def price1A = c1A + l1A + h1A;
def linDev1A = LinDev(price1A, lengthCCI);
def CCI1A = if linDev1A == 0 then 0 else (price1A - Average(price1A, lengthCCI)) / linDev1A / 0.015;
def MT1 = if CCI1A > 0
          then Max(MT1[1], pricedata1A - ATRcci1A)
          else Min(MT1[1], pricedata1A + ATRcci1A);
plot MT1_Dot = if IsNaN(close) then Double.NaN else -19;
MT1_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
MT1_Dot.SetLineWeight(DotSize);
MT1_Dot.AssignValueColor(if c1A < MT1 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(close[n1]) and IsNaN(close[n]), -19, (agg1TM / 1000 / 60) + " min", Color.YELLOW, yes);

# AGGREGATION 2

def c2A = close(period = agg2TM);
def h2A = high(period = agg2TM);
def l2A = low(period = agg2TM);
def pricedata2A = hl2(period = agg2TM);
def ATRcci2A = Average(TrueRange(h2A, c2A, l2A), lengthATR) * AtrFactor;
def price2A = c2A + l2A + h2A;
def linDev2A = LinDev(price2A, lengthCCI);
def CCI2A = if linDev2A == 0 then 0 else (price2A - Average(price2A, lengthCCI)) / linDev2A / 0.015;
def MT2 = if CCI2A > 0
          then Max(MT2[1], pricedata2A - ATRcci2A)
          else Min(MT2[1], pricedata2A + ATRcci2A);
plot MT2_Dot = if IsNaN(close) then Double.NaN else 19;
MT2_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
MT2_Dot.SetLineWeight(DotSize);
MT2_Dot.AssignValueColor(if c2A < MT2 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(close[n1]) and IsNaN(close[n]), 19, (agg2TM / 1000 / 60) + " min", Color.YELLOW, yes);

# AGGREGATION 3

def c3A = close(period = agg3TM);
def h3A = high(period = agg3TM);
def l3A = low(period = agg3TM);
def pricedata3A = hl2(period = agg3TM);

def ATRcci3A = Average(TrueRange(h3A, c3A, l3A), lengthATR) * AtrFactor;
def price3A = c3A + l3A + h3A;
def linDev3A = LinDev(price3A, lengthCCI);
def CCI3A = if linDev3A == 0 then 0 else (price3A - Average(price3A, lengthCCI)) / linDev3A / 0.015;
def MT3 = if CCI3A > 0
          then Max(MT3[1], pricedata3A - ATRcci3A)
          else Min(MT3[1], pricedata3A + ATRcci3A);
plot MT3_Dot = if IsNaN(close) then Double.NaN else -23;
MT3_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
MT3_Dot.SetLineWeight(DotSize);
MT3_Dot.AssignValueColor(if c3A < MT3 then GlobalColor("TrendDown") else GlobalColor("TrendUp"));
AddChartBubble(!IsNaN(close[n1]) and IsNaN(close[n]), -23, (agg3TM / 1000 / 60) + " min", Color.YELLOW, yes);
# End Trend Magic MTF
#
# SuperTrend Multiple Time Frames
# Mobius with mods by tomsk to replace the script() function for secondary aggs with "standard" code
# V03.01.2016
# 11.4.2019

#declare lower;

input agg1ST = AggregationPeriod.Five_Min;
input agg2ST = AggregationPeriod.Ten_Min;
input agg3ST = AggregationPeriod.Fifteen_Min;
input agg4ST = AggregationPeriod.Thirty_Min;
input agg5ST = AggregationPeriod.Hour;
input AtrMult = .70;
input nATR = 4;
input AvgType = AverageType.HULL;

def Fh = FundamentalType.High;
def Fl = FundamentalType.Low;
def Fc = FundamentalType.Close;
def Fhl2 = FundamentalType.HL2;

def cl = close;
def x = isNaN(cl[2]) and !isNaN(cl[3]);
def ATR = MovingAverage(AvgType, TrueRange(high, close, low), nATR);
def UP = hl2 + (AtrMult * ATR);
def DN = hl2 + (-AtrMult * ATR);
def S1A = if close < S1A[1]
then Round(UP / tickSize(), 0) * tickSize()
else Round(DN / tickSize(), 0) * tickSize();
def FirstAgg = if close > S1A then 1 else 0;
plot FirstAggPlot = if isNaN(cl)
then double.nan
else -21;
FirstAggPlot.SetStyle(Curve.Points);
FirstAggPlot.SetLineWeight(3);
FirstAggPlot.AssignValueColor(if FirstAgg == 1
then color.green
else color.red);
AddChartBubble(x, 1, (GetAggregationPeriod()/1000/60) + " min", color.white, yes);

# SecondAgg
def h2 = Fundamental(Fh, period = agg2ST)[1];
def l2 = Fundamental(Fl, period = agg2ST)[1];
def c2 = Fundamental(Fc, period = agg2ST)[1];
def hl2 = Fundamental(Fhl2, period = agg2ST)[1];
def ATR2 = MovingAverage(AvgType, TrueRange(h2, c2, l2), nATR);
def UP2 = hl2 + (AtrMult * ATR2);
def DN2 = hl2 + (-AtrMult * ATR2);
def S2A = if c2 < S2A[1]
then Round(UP2 / tickSize(), 0) * tickSize()
else Round(DN2 / tickSize(), 0) * tickSize();
def SecondAgg = if c2 > S2A then 1 else 0;
plot SecondAggPlot = if isNaN(cl)
then double.nan
else 21;
SecondAggPlot.SetStyle(Curve.Points);
SecondAggPlot.SetLineWeight(3);
SecondAggPlot.AssignValueColor(if SecondAgg == 1
then color.green
else color.red);
AddChartBubble(x, 2, (agg2ST/1000/60) + " min", color.white, yes);

# ThirdAgg
def h3 = Fundamental(Fh, period = agg3ST)[1];
def l3 = Fundamental(Fl, period = agg3ST)[1];
def c3 = Fundamental(Fc, period = agg3ST)[1];
def hl3 = Fundamental(Fhl2, period = agg3ST)[1];
def ATR3 = MovingAverage(AvgType, TrueRange(h3, c3, l3), nATR);
def UP3 = hl3 + (AtrMult * ATR3);
def DN3 = hl3 + (-AtrMult * ATR3);
def S3 = if c3 < S3[1]
then Round(UP3 / tickSize(), 0) * tickSize()
else Round(DN3 / tickSize(), 0) * tickSize();
def ThirdAgg = if c3 > S3 then 1 else 0;
plot ThirdAggPlot = if isNaN(cl)
then double.nan
else 23;
ThirdAggPlot.SetStyle(Curve.Points);
ThirdAggPlot.SetLineWeight(3);
ThirdAggPlot.AssignValueColor(if ThirdAgg == 1
then color.green
else color.red);
AddChartBubble(x, 3, (agg3ST/1000/60) + " min", color.white, yes);

# FourthAgg
def h4 = Fundamental(Fh, period = agg4ST)[1];
def l4 = Fundamental(Fl, period = agg4ST)[1];
def c4 = Fundamental(Fc, period = agg4ST)[1];
def hl4 = Fundamental(Fhl2, period = agg4ST)[1];
def ATR4 = MovingAverage(AvgType, TrueRange(h4, c4, l4), nATR);
def UP4 = hl4 + (AtrMult * ATR4);
def DN4 = hl4 + (-AtrMult * ATR4);
def S4 = if c4 < S4[1]
then Round(UP4 / tickSize(), 0) * tickSize()
else Round(DN4 / tickSize(), 0) * tickSize();
def FourthAgg = if c4 > S4 then 1 else 0;
plot FourthAggPlot = if isNaN(cl)
then double.nan
else 25;
FourthAggPlot.SetStyle(Curve.Points);
FourthAggPlot.SetLineWeight(3);
FourthAggPlot.AssignValueColor(if FourthAgg == 1
then color.green
else color.red);
AddChartBubble(x, 4, (agg4ST/1000/60) + " min", color.white, yes);

# FifthAgg
def h5 = Fundamental(Fh, period = agg5ST)[1];
def l5 = Fundamental(Fl, period = agg5ST)[1];
def c5 = Fundamental(Fc, period = agg5ST)[1];
def hl5 = Fundamental(Fhl2, period = agg5ST)[1];
def ATR5 = MovingAverage(AvgType, TrueRange(h5, c5, l5), nATR);
def UP5 = hl5 + (AtrMult * ATR5);
def DN5 = hl5 + (-AtrMult * ATR5);
def S5 = if c5 < S5[1]
then Round(UP5 / tickSize(), 0) * tickSize()
else Round(DN5 / tickSize(), 0) * tickSize();
def FifthAgg = if c5 > S5 then 1 else 0;
plot FifthAggPlot = if isNaN(cl)
then double.nan
else 27;
FifthAggPlot.SetStyle(Curve.Points);
FifthAggPlot.SetLineWeight(3);
FifthAggPlot.AssignValueColor(if FifthAgg == 1
then color.green
else color.red);
AddChartBubble(x, 5, (agg5ST/1000/60)+ " min", color.white, yes);
plot Six = if isNaN(cl)
then double.nan
else 0;
Six.SetStyle(Curve.Points);
Six.SetLineWeight(3);
Six.AssignValueColor(if FirstAgg and
SecondAgg and
ThirdAgg and
FourthAgg and
FifthAgg
then color.green
else if !FirstAgg and
!SecondAgg and
!ThirdAgg and
!FourthAgg and
!FifthAgg
then color.red
else color.black);
# End Code ST MTF

The reason why I wanted this done in such a particular way is that I have seen false signals generated by each of these single indicators that are meant to measure the same thing...Trend and Momentum...Hopefully with confirming indicators, false trends can be filtered out allowing you to stay in the trade longer.

scXEdle.png


The upper section of my chart consists of Heikin Ashi Trend on regular candle sticks...I have also set the CCI ATR SuperTrend to Bolean instead of Numerical to display a dot at close of candle...I am also using Tillson T3 set to 13 and Heiken Ashi Moving Average...

These are NOT part of the code shared here tho...
"....tomsk For your review my attempt to do what I asked to be done."
@HighBredCloud R U NUTS?? Have you read what we have written for you??? Selfish and boorish doesn't work well here.
Some of us have businesses to run, and little time for ourselves. Still, we come here and give of ourselves. You are not taking the hint.
Some of us no longer have the time to work on your incessant requests. Especially when you do not respect the sheer amount of time that goes into doing what has been done for you already. Yet, you come back for more.
Please figure it out as mentioned in the previous pages.
 
"....tomsk For your review my attempt to do what I asked to be done."
@HighBredCloud R U NUTS?? Have you read what we have written for you??? Selfish and boorish doesn't work well here.
Some of us have businesses to run, and little time for ourselves. Still, we come here and give of ourselves. You are not taking the hint.
Some of us no longer have the time to work on your incessant requests. Especially when you do not respect the sheer amount of time that goes into doing what has been done for you already. Yet, you come back for more.
Please figure it out as mentioned in the previous pages.
@markos The code is done to the best of my ability and is working. Check it out for yourself and let me know what you think. I am not asking anyone to write a new code as @tomsk insinuated in his post. I simply asked for a review. Nothing more...I never put a deadline on ANY of my requests BECAUSE I respect what you have mentioned above SO I don't know why the need for such comment on your end.

Respectfully I have read what you wrote on multicollinearity and I have to disagree with you. Perhaps the difference in opinion comes from the timeframe that we trade on but I can tell you that even on a 5 min chart the same indicator that both of you two claim I am trying to combine do show different signals at different time intervals. You can be the judge for yourself...This may not be noticeable as much on higher timeframes.

ALSO...by combining an ATR SuperTrend into the mix...it frees up the upper study to run regular candlesticks or Heiken Ashi or any other type of an additional SuperTrend of your choice...There's so many to choose from.

LASTLY...I was not aware that I needed an approval from for a particular indicator to be made from anyone here...I can't recall who said this...maybe it was @tomsk that he has worked on several pointless indicators before based on others requests...or something to this nature. IF you or anyone else thinks what I am trying to do is pointless and ineffective than simply DON'T USE IT! I can remove it from here if that is really what you want me to do...BUT perhaps someone might find a use for this like I do.

I fail to see how taking an initiative to improve and come up with new indicators for the community to use as being selfish and boorish. I never put anyone down or been disrespectful to anyone here...So I really don't know where you are coming from when you say this. This was never my intention if you still believe that somehow I was.

IF memory serves correctly @tomsk helped me out personally on 1 code and that was Trend Magic...which I am very grateful for it. The other request for the CSA study that @netarchitech asked for help. I don't believe ANYONE ever did anything else that I asked for other than @netarchitech and he never seemed to mind my incessant requests.

I am not good at hints...as you can tell...IF you want to say something than say it directly.
 
@pk1729 IF you need me to post original script for the SuperTrend and or Trend Magic please let me know...The code does work...but I do have some issues as sometimes I get some errors somewhere and the "!" is displayed on my chart and the indicator does not work...in particular has a trouble with "S4" and that is the aggregation for the SuperTrend...not sure if its because of something I did or perhaps a conflict with other indicators that I am running...Let me know what you think first...see if its even worth dealing with this as I have no idea how long something like this will take as suggest by what tomsk wrote...Like I said...the code works...I am just not sure IF there is a way to make it do what I want it to do...
 
@netarchitech Hello, I wanted to tell you thank you and bravo in regards to your scripting! I'm using your 2 time frame TMO, and i'm curious if you might have any recommendations for the lengths (or just leave them as default - 10). I noticed the original TMO has 14 input length. I've also seen other people increase the lengths for higher time frames. I'm trying the 2hr chart with 2hr & 4hr aggs, and also the day chart with 1d & 2d aggs. I may try shorter time frames for entry. I've seen mentioned that the aggregations should be multiple times (like 1hr and 4 hr) but when I try that it doesn't seem intuitive. Anyways i'm still testing and playing with it and curious if you had any opinions. Thanks again!
 
@HighBredCloud I inserted the Fisher Transform code...Does it look right to you?

e.png
Following this thread, just opinion: what turns out to be one excellent indicator possibly is now a minutia of gobbly gook. One arrow signalling, and Mobius original instructions, as I did a daily/ weekly, when the weekly up, look for the daily to come from the bottom turning green,....otherwise the instructions are just confusing, but you are building it with your understanding. Is it better?
 
If you are looking for a similar indicator, Try the RSI LaGuerre with FE. JQ and I are both guilty of putting both on a chart. Just drag one over the other. What would really go well, otherwise, is just the Fractal Energy or the Chop indicator. (Different math, same result) That is, Single TMO and RSI Laguerre in the same lower just to see how they lay over each other. I believe that I placed all three indicators in the Tutorials section.
So you put the TMO over LaGuerre,........interesting
 
@HighBredCloud If you know how to simply read price and use one indicator, maybe Tilson,.....then you have 3/4's battle won. What is your set up, do you have one, because indicators dont help you find the set up, unless you know what you are looking for?
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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