Multi-timeframe (MTF) Moving Average Indicator for ThinkorSwim

S

SuryaKiranC

Member
@lindosskier Please note, I have 4 colors defined here in the modified code, and they are as following, difference is both Momentum_UP and Momentum_Down were using "Yellow" as a color in original code and that has changed.

DefineGlobalColor("Buy", Color.GREEN);
DefineGlobalColor("Sell", Color.RED);
DefineGlobalColor("MomentumDown", Color.YELLOW);
DefineGlobalColor("MomentumUp", Color.CYAN);



 
Last edited by a moderator:
L

lindosskier

Member
@SuryaKiranC thank you so very much for your help, I really do. But I have no coding experience whatsoever, so when I add the piece of code you wrote, nothing really changes in my chart. In addition, I noticed that on the chart above, only the 1min. label is colored red, but the other timeframes are not colored at all. Can you please help me understand further, how to be able to fix these 2 items? Thank you again, much appreciated!
 
S

SuryaKiranC

Member
@lindosskier this is supposes to show the Buy/Sell Signal along with MomentumUp/Down Signals when appeared in the respective time frames. Though it is acting fine in the current timeframe, I am not too exited about this is working overall. Specially when I am in the lower timeframes as 1m and 3m.

I am still working on, might have to change/add more conditioning on logic to determine and retain the color of the alert candle till it changes.

Rest assured. I am still on it.
 
I

Ictheeuss

New member
@wcsharron Here you go...

Code:
input aP = AggregationPeriod.DAY;
input length1 = 20;
input length2 = 100;
input length3 = 200;

plot ema_1 = expaverage(close(period = aP), length1);
plot ema_2 = expaverage(close(period = aP), length2);
plot ema_3 = expaverage(close(period = aP), length3);

It won't work on tick charts though.
Thank you for the code. Any way to make this work on mobile? When I set it up in my studies, I don't get the correct moving average values. Am I missing something?
 
BenTen

BenTen

Administrative
Staff
VIP
@Ictheeuss The mobile app does not support MTF indicator.
 
R

RDX17

New member
VIP
Hello forum!!

I wanted to start off with one important request. I am looking to do a multi timeframe study on the HULL EMA where I can plot the 12 HMA on 3/5/15 min time frames on a 2 min chart on TOS. I see numerous MTF indicator scripts in various forums, however, they all seem to be jumbled up with other things.
 
L

lindosskier

Member
Thank you @SuryaKiranC. Much appreciated and I will be definitely be waiting and looking forward to what you come up with.
 
horserider

horserider

Well-known member
VIP
@RDX17

Code:
input price = close;
input length = 12;
input Period = aggregationPeriod.THREE_MIN;
input Period2 = AggregationPeriod.FIVE_MIN;
input Period3 = AggregationPeriod.FIFTEEN_MIN;

def halflength = Ceil(length / 2);
def sqrtlength = Ceil(Sqrt(length));

def val = 2 * ExpAverage(close(period = Period), halflength) - ExpAverage(close(period = Period), sqrtlength);
plot EHMA = ExpAverage(val, sqrtlength);
ehma.setdefaultcolor(color.yellow);

def val2 = 2 * ExpAverage(close(period = Period2), halflength) - ExpAverage(close(period = Period2), sqrtlength);
plot EHMA2 = ExpAverage(val2, sqrtlength);

def val3 = 2 * ExpAverage(close(period = Period3), halflength) - ExpAverage(close(period = Period3), sqrtlength);
plot EHMA3 = ExpAverage(val3, sqrtlength);
ehma3.setdefaultcolor(color.PLUM);
 
G

GetRichOrDieTrying

Member
I added this on the mobile app. It looks like it doesn't work on mobile. Can you confirm?
 
L

lindosskier

Member
Hi @SuryaKiranC. First of all, thank you for not forgetting about me and trying to help me. Much appreciated. Unfortunately it did not work. It only worked on the 1min chart, where it only showed the Daily Chart bubble/label, but nothing on the 5min, 15min. etc. Even on the 1min. it shows just the Daily. Any other ideas? thanks again.
 
S

SuryaKiranC

Member
@lindosskier it is supposed to show the signal in each of the timeframes if they occur on their respective candle. there are 4 candle colors for Buy/MomUp/MomDown and Sell signals. when there is no active signal in the other timeframes they are blank.

what is it you are expecting to do?

-Surya
 
L

lindosskier

Member
@lindosskier it is supposed to show the signal in each of the timeframes if they occur on their respective candle. there are 4 candle colors for Buy/MomUp/MomDown and Sell signals. when there is no active signal in the other timeframes they are blank.

what is it you are expecting to do?

-Surya
@SuryaKiranC thank you. What I am trying to see, is let's say that i am on the 1min. chart, I want to be able to see the bubbles/labels, for all the timeframes above that (5m, 15m, 30m, 60m, 240m, D, 2D, 3D, 4D, W and M) and what color they are, based on where the 8EMA is in relation to the 13 and 21 EMAs. So, if the 60min chart has a yellow candle and the 2D candle is Green, as I am on the 1min. chart, the bubble/label will show the 60m with a yellow background and the 2D with a green background. Does that make sense? Thanks again.
 
S

SuryaKiranC

Member
And this is doing that. But just on the candle. Say 1m momentum is down you see the purple/red on min but at the same time it 30m says buy on that candle you would see florescent green. @lindosskier
 
Last edited:
S

SuryaKiranC

Member
@lindosskier look at the attachment. You see left one is 1m time frame and the right is 30m timeframe, even in 1M timeframe the 30M label is indicating Long signal in 30m. and you can see the long signal in 30m chart.

 
S

SuryaKiranC

Member
@lindosskier here is another one. 1M chart showing multiple Sell and momentum down on NIO.

 
L

lindosskier

Member
Hi @SuryaKiranC , it is only showing me the D Bubble on the 1min chart. I don't know why I am not getting to see what you are seeing.
I am trying to paste a picture of it, but it won't let me do it.
 
S

SuryaKiranC

Member
@lindosskier use imgur, all you need is drag and drop the screenshot. and in comment use the link attachment, not image.

Are you adding it multiple times and each one is different timeframe? like 1m,2m,3m and so on all the way up to whatever frame you want to track?
 

Similar threads

Top