Repaints Multi-timeframe (MTF) Moving Average Indicator for ThinkorSwim

Repaints
@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.
 

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

@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?
 
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.
 
@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);
 
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.
 
@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
 
@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.
 
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:
@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.

OCegv8M.png
 
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.
 
@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?
 
@SuryaKiranC that's probably it. I have not added the code multiple times. I tried starting to do it, but when I change the aggregation period, do i change it in both places, or just one? Check out the code you provided and the aggregation period I changed. The problem now is, that I do not see the Daily Bubble/Label. Any idea why?


Also, @SuryaKiranC I see the 5m and 15m bubbles that I input already, but they have a black background, when it should have been green now. Any idea why for that as well?

Thank you.
 
@lindosskier you don't change the "input period = AggregationPeriod.DAY;" it's an input parameter. Just add the script to studies multiple times, and go to properties of each instance and select a different time period. Look at my screenshot in the original response.
 
@SuryaKiranC tried that, but it does now show the color of the background yet. It is pre-market, but this is the ES, so it should plot all day long right?
And secondly, it does not show the W and M time frame bubbles at all.

Thank you once again for your help. I feel like we are almost there.

 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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