Baluda Indicators

Includes an archive of all previous Bob stuff
Post Reply
User avatar
mobthehop
Trader
Posts: 362
Joined: Wed Nov 16, 2011 12:16 am

TMA True calculation

Post by mobthehop »

Guys,

couple of weeks ago, I spent some hours to investigate the same and would like to share the following links / thoughts:

1. Based on my research, the tma true is somehow based on TMA centered which was originally coded by mladen at TSD in the Elite forum - see attached triangular moving average.pdf

2. In this post http://www.forexfactory.com/showthread. ... ost4133207, zznbrm explains the differences to TMA centered and his coding of tma true. I can not find any source code for tma true coming from zznbrm directly, so really not sure whether the mq4 version everybody uses is actually same as his ex4....

3. Then there is this thread on FF http://www.forexfactory.com/showthread.php?t=299019 with these posts to consider:
http://www.forexfactory.com/showthread. ... ost4699105
http://www.forexfactory.com/showthread. ... ost5474168
http://www.forexfactory.com/showthread. ... ost5531278

at the end of same thread, there is also some interesting discussion between zznbrm and Neotrader....lol

4. According to NB's documentation, page 2 some modifications were made to the TMA true see attached page from the manual, which should help to explain the difference between zznbrm true calculation and the one used in NB's 10.2 system...
You do not have the required permissions to view the files attached to this post.
User avatar
NeoTrader
Trader
Posts: 436
Joined: Wed Apr 04, 2012 2:52 pm
Location: small Village at Lake Chiemsee, Bavaria, Germany

Re: TMA True calculation

Post by NeoTrader »

Hi mobthehop,
mobthehop wrote:couple of weeks ago, I spent some hours to investigate the same and would like to share the following links / thoughts:
Thanks for sharing your thoughts and links...
mobthehop wrote:1. Based on my research, the tma true is somehow based on TMA centered which was originally coded by mladen at TSD in the Elite forum - see attached triangular moving average.pdf
this is true...i actually have also the code from mladen...and he uses a sma and not lwma in his code
And he also uses the atr the same way, 10 bars back.
Actually the tma related code looks almost identical only the SMA/LWMA change) but i did not compared it to intensively..;)
mobthehop wrote:2. In this post http://www.forexfactory.com/showthread. ... ost4133207, zznbrm explains the differences to TMA centered and his coding of tma true. I can not find any source code for tma true coming from zznbrm directly, so really not sure whether the mq4 version everybody uses is actually same as his ex4....
In the tread TMA Reality Tour @ Forex Factory Colt45 posted "Currency Slope Strength v1.0.0 current.mq4" that was modified by me and zznbrm was so kind to add the TMAtrue calculation to it one post later. I have a decompiled version of this and the code is the same that baluda used in his indicators for the "ignoreFuture" Parameter and i also used in my indicator for the "tmaTrueMode".
mobthehop wrote:at the end of same thread, there is also some interesting discussion between zznbrm and Neotrader....lol
hehe...couldn't resist.. ;)
mobthehop wrote:4. According to NB's documentation, page 2 some modifications were made to the TMA true see attached page from the manual, which should help to explain the difference between zznbrm true calculation and the one used in NB's 10.2 system...
The major adjustments i see is that the tmaPeriod is now 20 and not 56 and at the slopeindicators the atr Multiplier is 0.1 and not 2.0 as in the original. But this is by no means a in depth analysis...i didn't check all code variations side by side.

happy Sunday,

NeoTrader,

-
User avatar
Zypip
Trader
Posts: 148
Joined: Thu Apr 26, 2012 9:44 am

Re: Baluda Indicators

Post by Zypip »

Thunder123 wrote:Wow amazing indicators Baluda. :shock:

Another possible idea for an indicator you may consider.. How about having an indicator in the same format as the Slope Strength, but it tells distance to nearest S/R/Piviot in pips. Near resistance at the top, near support at the bottom.

Just an idea... May help in quickly seeing which pair may be ready for a trade just by looking at one indicator.
Thunder, I think that is a brilliant idea, you have my vote :D
rattyo

Re: Baluda Indicators

Post by rattyo »

with this baluda slope strength indicator,

what does the red and green dots illustrate?
also the arrows
User avatar
NeoTrader
Trader
Posts: 436
Joined: Wed Apr 04, 2012 2:52 pm
Location: small Village at Lake Chiemsee, Bavaria, Germany

Re: Baluda Indicators

Post by NeoTrader »

rattyo wrote:with this baluda slope strength indicator,
what does the red and green dots illustrate?
also the arrows
please read the info about the indicator on the first page...then you will know...;)
little tip... check the parameter info.. ;)

happy Sunday,

NeoTrader
User avatar
Baluda
Trader
Posts: 330
Joined: Mon Feb 06, 2012 2:00 pm
Location: An insignificant village in the Netherlands

Re: Baluda Indicators

Post by Baluda »

Gary and others,

TMA
garyfritz wrote:TMA appears to be a simple weighted average -- (21 * Close[0] + 20 * Close[1] + ...) / (21 + 20 + ...)
Not quite correct. Remember TMA is a triangluar moving average. The formula above only looks at the bars on the left (past) side of the bar we are calculating the TMA for. For a true TMA we also need to take account of the bars on the right (future) side of that bar. (Triangular, get it?) So the formula in simple form:

Code: Select all

(21 * Close[0] + 20 * Close[1] + 20 * Close[-1] + 19 * Close[2] + 19 * Close[-2] +  ...) / (21 + 20 +20 +19 +19 + ...)
This is the TMA, a double smoothed average of the closing prices of bars to the left and right.

But this value is still a price. And we can not compare prices of different instruments. The TMA of the EURUSD at some point could be something like 124.0129, the TMA for the USDJPY at the same time could be 80.32. Hardly comparable.

To compare TMA values for different instruments wo we need to get to the pips of the TMA instead of the price. One way to do this is to determine the change in the TMA by subtracting the TMA of the prior bar from the TMA of the current bar.

Code: Select all

TMA[0] - TMA[1]
We now have a measure in pips, the change of a (average) price. Finally we need to complete our formula by dividing this by the range (ATR) of the instrument to get a reasonably comparable value. This value is what we know as the Slope (Please tell me where that name comes from).

Code: Select all

(TMA[0] - TMA[1]) / ATR
This TMA Slope is a good measure for identifying trends. (NanningBob likes to see values above 0.4 and 0.8 or below -0.4 and -0.8.) It is very good for estimating the direction of the trend.

Achilles' Heel

We suspect that something is rotten in the state of Denmark. The more current bars do not have enough future bars to calculate the TMA and Slope. We solve this by closing our eyes and simply omit any future bars that do not yet exist from any calculation.

This means that the TMA for the current bar is calculated with past bars only, like this:

Code: Select all

(21 * Close[0] + 20 * Close[1] + 19 * Close[2] + ...) / (21 + 20 + 19 + ...)
The prior bar is calculated with one future bar, the bar before that with two future bars and so on.

The TMA and Slope for the last 20 bars changes with time.

Inexperienced (for lack of another word) forex traders do not get this. They like something that is written in stone, something that they can hold onto. Values that never change, that they... (Stop me here or I'll go into Steve Hopwood Rant Mode.)

To stop this so-called repainting we have to kick TMA in the balls (and amputate one of them in the process). Because to stop the last bars from changing with time we have to stop looking at the future. This is what we do, determine 'TMA' for the current bar:

Code: Select all

(21 * Close[0] + 20 * Close[1] + 19 * Close[2] + ...) / (21 + 20 + 19 + ...)
determine 'TMA' for the prior bar:

Code: Select all

(21 * Close[1] + 20 * Close[0] + 20 * Close[2] + 19 * Close[3] + ...) / (21 + 20 + 20 + 19 + ...)
(Your sharp looks at this and sees there is only one future bar, the current one, considered here.) Now to the 'Slope':

Code: Select all

(TMA[0] - TMA[1]) / ATR
And we have the 'Slope' for the current bar. And this is how we calculate all bars, omitting the future (one side of the triangle of the TMA).

Side note: forex math geeks immediately recognize the TMA formula for the current bar as the LWMA.

Code: Select all

iMA(NULL, 0, 21, 0, MODE_LWMA, PRICE_CLOSE, 0)
And there you have it, all about TMA and Slope. (And how, we all want to be assured be the past to tell the future.)

Personal note: what has come to be known as 'TMA true' is not TMA at all, let alone 'true'. It is a LWMA with a twist but hey, a rose by any other name...

Paul
Check the MQL4 Market for my best EA's and Indicators.
dietcoke
Trader
Posts: 162
Joined: Tue Nov 15, 2011 9:59 pm

Re: Baluda Indicators

Post by dietcoke »

Baluda wrote:Gary and others,

TMA
garyfritz wrote:TMA appears to be a simple weighted average -- (21 * Close[0] + 20 * Close[1] + ...) / (21 + 20 + ...)
Not quite correct. Remember TMA is a triangluar moving average. The formula above only looks at the bars on the left (past) side of the bar we are calculating the TMA for. For a true TMA we also need to take account of the bars on the right (future) side of that bar. (Triangular, get it?) So the formula in simple form:

Code: Select all

(21 * Close[0] + 20 * Close[1] + 20 * Close[-1] + 19 * Close[2] + 19 * Close[-2] +  ...) / (21 + 20 +20 +19 +19 + ...)
This is the TMA, a double smoothed average of the closing prices of bars to the left and right.

But this value is still a price. And we can not compare prices of different instruments. The TMA of the EURUSD at some point could be something like 124.0129, the TMA for the USDJPY at the same time could be 80.32. Hardly comparable.

To compare TMA values for different instruments wo we need to get to the pips of the TMA instead of the price. One way to do this is to determine the change in the TMA by subtracting the TMA of the prior bar from the TMA of the current bar.

Code: Select all

TMA[0] - TMA[1]
We now have a measure in pips, the change of a (average) price. Finally we need to complete our formula by dividing this by the range (ATR) of the instrument to get a reasonably comparable value. This value is what we know as the Slope (Please tell me where that name comes from).

Code: Select all

(TMA[0] - TMA[1]) / ATR
This TMA Slope is a good measure for identifying trends. (NanningBob likes to see values above 0.4 and 0.8 or below -0.4 and -0.8.) It is very good for estimating the direction of the trend.

Achilles' Heel

We suspect that something is rotten in the state of Denmark. The more current bars do not have enough future bars to calculate the TMA and Slope. We solve this by closing our eyes and simply omit any future bars that do not yet exist from any calculation.

This means that the TMA for the current bar is calculated with past bars only, like this:

Code: Select all

(21 * Close[0] + 20 * Close[1] + 19 * Close[2] + ...) / (21 + 20 + 19 + ...)
The prior bar is calculated with one future bar, the bar before that with two future bars and so on.

The TMA and Slope for the last 20 bars changes with time.

Inexperienced (for lack of another word) forex traders do not get this. They like something that is written in stone, something that they can hold onto. Values that never change, that they... (Stop me here or I'll go into Steve Hopwood Rant Mode.)

To stop this so-called repainting we have to kick TMA in the balls (and amputate one of them in the process). Because to stop the last bars from changing with time we have to stop looking at the future. This is what we do, determine 'TMA' for the current bar:

Code: Select all

(21 * Close[0] + 20 * Close[1] + 19 * Close[2] + ...) / (21 + 20 + 19 + ...)
determine 'TMA' for the prior bar:

Code: Select all

(21 * Close[1] + 20 * Close[0] + 20 * Close[2] + 19 * Close[3] + ...) / (21 + 20 + 20 + 19 + ...)
(Your sharp looks at this and sees there is only one future bar, the current one, considered here.) Now to the 'Slope':

Code: Select all

(TMA[0] - TMA[1]) / ATR
And we have the 'Slope' for the current bar. And this is how we calculate all bars, omitting the future (one side of the triangle of the TMA).

Side note: forex math geeks immediately recognize the TMA formula for the current bar as the LWMA.

Code: Select all

iMA(NULL, 0, 21, 0, MODE_LWMA, PRICE_CLOSE, 0)
And there you have it, all about TMA and Slope. (And how, we all want to be assured be the past to tell the future.)

Personal note: what has come to be known as 'TMA true' is not TMA at all, let alone 'true'. It is a LWMA with a twist but hey, a rose by any other name...

Paul
Thanks for that explanation of the TMA and slope calculation. Much appreciated.

To be clear then, what you are saying is that the slope is generated from the difference between an LWMA and a partially calculated TMA??

And, the indicator we all call TMA is not really a genuine TMA because it is not calculated with all the required data??
Image
User avatar
Baluda
Trader
Posts: 330
Joined: Mon Feb 06, 2012 2:00 pm
Location: An insignificant village in the Netherlands

Re: Baluda Indicators

Post by Baluda »

dietcoke wrote:To be clear then, what you are saying is that the slope is generated from the difference between an LWMA and a partially calculated TMA??

And, the indicator we all call TMA is not really a genuine TMA because it is not calculated with all the required data??
Diet,

No, the slope as it was introduced in 10.2 (I believe it was named '10.2 TMA slope v.1.4B 4.30'.) is 'full' TMA slope. All future bars, if available, are part of the calculation.

It is only the non-repainting one that is partially castrated. This one has been been (misleadingly) named 'TMA true'. In my opinion it isn't triangular and therefore not TMA and definitely not 'TMA true'.

Just my 200 pips.

Paul
Check the MQL4 Market for my best EA's and Indicators.
dietcoke
Trader
Posts: 162
Joined: Tue Nov 15, 2011 9:59 pm

Re: Baluda Indicators

Post by dietcoke »

Baluda wrote: No, the slope as it was introduced in 10.2 (I believe it was named '10.2 TMA slope v.1.4B 4.30'.) is 'full' TMA slope. All future bars, if available, are part of the calculation.

Paul
The point i was making was that if all the required data is not available then it's only a partial TMA. Which is why the indicator repaints.

What we are doing when we look at TMA for the last 20 bars is an estimate of how the centred TMA might eventually evolve.
Image
User avatar
NeoTrader
Trader
Posts: 436
Joined: Wed Apr 04, 2012 2:52 pm
Location: small Village at Lake Chiemsee, Bavaria, Germany

Re: Baluda Indicators

Post by NeoTrader »

Hi Paul,
Baluda wrote:No, the slope as it was introduced in 10.2 (I believe it was named '10.2 TMA slope v.1.4B 4.30'.) is 'full' TMA slope. All future bars, if available, are part of the calculation.

It is only the non-repainting one that is partially castrated. This one has been been (misleadingly) named 'TMA true'. In my opinion it isn't triangular and therefore not TMA and definitely not 'TMA true'
I value your opinion and thank you also for the explanation of the TMA.

But i can not share your evaluation of the tmatrue... since the values of both tma's are the same at real time. The only difference is that the original tma repaints and smoothen the slope of the tma...for the past values...

Your claim that tma is looking in so called future Bars is not real because tma is not really seeing future bars (how could it?)... What you define as future Bars are also past Bars that are only future Bars from the point of the actual Bar that is calculated which also lies far more in the past...

In conclusion the original tma (non true) only beautifies the slope. From my perspective this is completely irrelevant since we actually rely only on the current value of the tma. And it also makes visual backtesting impossible.

The true version doesn't repaint the past bars so we have at least the possibility to do some visual backtest...and like another member in this forum told...can shatter some Illusions about this indicator.. ;)

If the calculations are triangularMA or LWMA based is really insignificant as long as the values they deliver us in real time at the end are the same...

my 2 pips..;)

happy trading,

NeoTrader

P.S.: Please feel free to correct me if i am far of with my conclusion...or otherwise..;)

-
Post Reply

Return to “Nanningbob's Holy Grail Indicator forum”