MACD, RSI, CCI indicators with different time frames, coding help?

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:

We are here to help. Just let us know what you need.

We work extremely hard to keep things positive in our community.

We do not tolerate rude behavior, trolling, or vendors advertising in posts.

We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.

We expect our members to participate and become a part of the community. Help yourself by helping others.

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.

MACD, RSI, CCI indicators with different time frames, coding help?

I was wondering if anyone knows how to code something that could be beneficial to everyone. Currently there is an indicator called Visual EMA and one called Visual SMA. These indicators allow you to see the moving averages of another time frame on the same chart that you have up. Example if you have a 5 minute chart up you can apply one these indicators to get a moving average from a 15 minute chart. I was thinking that maybe someone could code the same concept but have parameters that would let you choose another indicator like a MACD, RSI, CCI or the like. So you could have a 15 minute RSI on your 5 minute chart. Just wondering if this can be done. If anyone could help, it would be appreciated.

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help? 1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first. 2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses. 3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make. 4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance. 5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers. 6) Help using the forum? Watch this video to learn general tips on using the site.

Favorite Futures: Gameplay Klownbine® Trading of Globex

Posts: 1,338 since Jul 2009

Thanks: 1,246 given,
2,687
received

Idea for using 1 period VSMA to feed indicators

Using a 1 period VISUAL SMA in the desired higher time frame as the input of your RSI or whatever DOES NOT seem to work.

I think you would need to call the methods of the AccessVisualSMA indicator from within the RSI etc. Maybe I will fool around with that at some point.

"If we don't loosen up some money, this sucker is going down." -GW Bush, 2008
“Lack of proof that something is true does not prove that it is not true - when you want to believe.” -Humpty Dumpty, 2014
“The greatest shortcoming of the human race is our inability to understand the exponential function.” Prof. Albert Bartlett

Last edited by Zondor; January 7th, 2013 at 02:36 AM.

This post has been selected as an answer to the original posters question

@Zondor: The VisualSMA repaints back to the last node, if it used in Visual mode. The number of bars that it repaints are exposed, so you can access it via an access indicator. In One-Tick-Correction mode, it repaints 1 bar, in strategy mode it does not repaint at all, which leads to a lag of one bar and does not allow for visual interpolation.

Let us remind that MTF indicators are only needed to avoid non-equidistant bar spacing. Otherwise you can add a transparent secondary bar series to your chart and use it for calculating indicator values.

If you want to avoid non-equidistant bar spacing, there are three paths that lead to the desired outcome:

(1) a multi-timeframe indicator that loads a secondary bar series (type XavMTF or VisualSMA)
(2) a multi-timeframe indicator that first calculates composite bars from N consecutive bars and then calculates the indicator values for those composite bars
(3) directly tweaking the formula

Let us for example take a MACD. The chart below shows a 5 min chart with the MACD calculated for 5 min bars (1x Cornflower), 15 min bars (3x white), 30 min bars (6x, orange), 60 min bars (12x violet red). The MACDs on the midpanel are calculated from composite bars - as MetaTrader does. The MACDs on the lower panel is built from tweaked moving averages. The tweaking was obtained by replacing the period N_old of the EMA for a timeframe multiplier M with the period N_new

You can tweak the formulae of many indicators, the period can be calculated in OnStartUp(), therefore the tweaked indicator is faster to calculate than the one built from composite bars. None of them is a genuine MTF indicator, but they can be used for the same purpose. And both of them can be easily used as a trendfilter in a strategy.

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

The following 4 users say Thank You to Fat Tails for this post:

Is there an easy way to take for example a MACD plot from mutliple MACDs and average them into 1 plot then smooth em and post them to the chart as an ema??

example

Fast1 = 1
Slow1 = 4
Smooth1 = 8

Take the plot of the MACD = macd0

Fast2 = 4
Slow2 = 8
Smooth2 = 8

Take plot from macd = int macd1

etc take 4 plots then average them into 1 int output as EMA in an indicator?

Is this doable?

Thanks guys

This is my first post... so if i am in the wrong place just let me know... thanks

@SirNicolaus: The MACD is an oscillator. You cannot average an oscillator into EMAs.

Also, I doubt that if you take a collection of EMAs and calculate the average of those EMAs that you will get a better EMA.

And then the EMA will only tell you what happened in the past. It is a bad predictor. For details see that book by David Aronson : Evidence Based Technical Analysis.

The following user says Thank You to Fat Tails for this post:

well i know when i put 4 MACD on a chart and only show the macd plot i can see it trending and was hoping to combine and average those macd plots into 1 plot... if the plot is a ma EMA HMA i don't care i just want the visual movement and or bar painting

i am looking for divergence across multiple macds but less clutter

Thanks for the Recommended book i will look into it...

Last edited by SirNicolaus; January 22nd, 2013 at 09:30 PM.

I was trying to modify/tweak MACD indicator based on your formula, but I'm not able to find out what is 'k_old' and 'n_old'. I was trying to change MACD indicator directly from ninjatrader 7. Can you please help me what to exactly change (I'm primary using 5min ES and I want to access MACD of 15min ES) or can you please send me source code of indicator which generated your picture (with tweaked) MACDs?

I can't submit post with links(your image submitted in your post January 7th, 2013 11:39 PM) , because of forum rules - this is my the first post.

Maybe that my description was not very clear. I will take your example. You wish to access a MACD calculated from a 15 min chart on a 5 min chart. This means that there is a timeframe multiplier of M = 3. The MACD is basically built from two exponential moving averages. The signal line itself is an exponential moving average of the MACD. As we know, exponential moving averages use a smoothing constant of

k = 2/(1+n)

where n is the period of the moving average. It is also possible to use a smoothing constant of k= 1/n. This was the solution adopted by Welles Wilder and is known as Wilder's Average. The now prevailing formula of k= 2/(1+n) was chosen by Jack Hutson (see Stocks & Commodities, Volume 2, Issue March 1984) to harmoize the average age of data for simple and exponential moving averages. The coefficient k is used to calculate the current value of the exponential moving average via a recursive formula

(1) ...... EMA[0] = k*Close[0] + (1-k)*EMA[1]

where EMA[0] is the current value of the moving average and EMA[1] is the previous value of the moving average. Now let us come back to the task to calculate an EMA from the 15 min bars. In this case you would need to take every third bar to perform the calculations

(2) ...... EMA[0] = k*Close[0] + (1-k)*EMA[3]

Now I look for an appropriate q to replace (2) with (1):

The 15 minute chart does not have the resolution of the 5 min chart, hence I replace Close[1] and Close[2] with Close[0]. However, I am mostly interested in the last term (1-q)*(1-q)*(1-q)*EMA[3], because this term tells me to what extent prior price action is taken into account. Therefore to obtain the 5 min smoothing constant q from my 15 min smoothing constant k, it is necessary that

This is the equation that allows me to obtain the smoothing constant required to display the 15-min EMA on a 5-min chart. Now let us take a MACD(12,26,9) on a 15 min chart. We wish to display this MACD on a 5-min chart.

q1, q2 and q3 are the three smoothing constants which you need to use to calculate the 3 exponential moving averages. With q = 2/(n+1) you may also calculate the periods as n = 2/q - 1

The solution of the puzzle is that you can approximate your MACD (12,26,9) calculated from 15 min bars with a MACD(35.90, 78.05, 26.89) calculated from a 5 min chart. Please note that broken (non-integer) periods are allowed for exponential moving averages, but that the default EMA/MACD do not support them.

Now let us compare the outcome. The chart below has loaded a secondary bar series of 15-min bars which I have set to transparent. You will find the tweaked (high definition) MACD calculated from 5 minute data and below the original MACD calculated from 15 min data. As you can see, the tweaked version is an excellent approximation of the original MACD and is fit for all practical purposes.

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

The following user says Thank You to Fat Tails for this post: