Multiple Timeframe for MACD - futures io
futures io futures trading



Multiple Timeframe for MACD


Discussion in ThinkOrSwim

Updated
    1. trending_up 4,809 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 1 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Multiple Timeframe for MACD

(login for full post details)
  #1 (permalink)
Puerto Rico
 
 
Posts: 1 since Jan 2014
Thanks: 1 given, 0 received

Hi, This is the first time I participate in your forum (and to be honest a newby on TOS ThinkScripts Programming).

I want to add a thinkscript code for a Multiple Time Frame for MACD. My main chart is 5 minutes and wanted to have MACD for 15 and 60 minute on my 5 minutes chart.

So far, this is what my 5 min TOS Chart currently has:

input averagefastLength = 9;
input averageslowLength = 27;
input macdLength = 7;
input averageType = {SMA, default EMA};

def diff = reference MACD(averagefastLength, averageslowLength, macdLength, averageType).Diff;
def exit = EntryPrice();


Your help on this type of aggregation will be very appreciated.

Thanks

Reply With Quote

Can you help answer these questions
from other members on futures io?
COTbase for quant trading?
Elite Algorithmic NinjaTrader Trading
NT8 indicator to simulate a Funding Evaluation where to …
NinjaTrader
Indicators for pair trading MES and M2K
Platforms and Indicators
ZigZag with Depth and Backstep
EasyLanguage Programming
Webinar: Finding your own way in trading w/Adam Grimes
The Elite Circle
 
 
(login for full post details)
  #2 (permalink)
Puerto Rico
 
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: ES
 
rmejia's Avatar
 
Posts: 377 since Oct 2010
Thanks: 3,600 given, 432 received

Gave it a shot; it gets a bit fugly the higher the timeframe. The lines in bold were added/edited from the default MACD.
 
Code
declare lower;

input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
input TimeFrame = AggregationPeriod.Day;

plot Value = MovingAverage(averageType, close(period = TimeFrame), fastLength) - MovingAverage(averageType, close(period = TimeFrame), slowLength);
plot Avg = MovingAverage(averageType, Value, MACDLength);

plot Diff = Value - Avg;
plot ZeroLine = 0;

Value.SetDefaultColor(GetColor(1));
Avg.SetDefaultColor(GetColor(8));
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(3);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.DARK_GREEN);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.DARK_RED);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color("Positive and Up") else Diff.color("Positive and Down") else if Diff < Diff[1] then Diff.color("Negative and Down") else Diff.color("Negative and Up"));
ZeroLine.SetDefaultColor(GetColor(0));

https://tlc.thinkorswim.com/center/charting/thinkscript/tutorials/Chapter-12---Referencing-Secondary-Aggregation.html

https://tlc.thinkorswim.com/center/charting/thinkscript/reference/Constants/AggregationPeriod.html

Attached Files
Register to download File Type: ts _MACDmultipletimeframesSTUDY.ts (1.1 KB, 76 views)
Reply With Quote
The following user says Thank You to rmejia for this post:
 
(login for full post details)
  #3 (permalink)
Vidor, TX/USA
 
 
Posts: 15 since Jan 2015


I've used TOS. And I've used MacD and several variations of it on TOS. I believe it automatically changes when you change your time frame.

So I don't get why you are trying to recreate the wheel?

Reply With Quote
 
(login for full post details)
  #4 (permalink)
Puerto Rico
 
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: ES
 
rmejia's Avatar
 
Posts: 377 since Oct 2010
Thanks: 3,600 given, 432 received


LorraineP View Post
I've used TOS. And I've used MacD and several variations of it on TOS. I believe it automatically changes when you change your time frame.

So I don't get why you are trying to recreate the wheel?

He wants to be able to have a different timeframe on the MACD from the chart:


gcorrea View Post
My main chart is 5 minutes and wanted to have MACD for 15 and 60 minute on my 5 minutes chart.


Reply With Quote


futures io Trading Community Platforms and Indicators ThinkOrSwim > Multiple Timeframe for MACD


Last Updated on August 16, 2015


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts