TMA True Slope

Post your indicators here
Post Reply
User avatar
babalu4u
Trader
Posts: 173
Joined: Fri Apr 13, 2012 6:52 pm
Location: Slovenia - EU

TMA True Slope

Post by babalu4u »

Hi,

The indicator calculate TMA True Slope and SMA of TMA. You must have also Average True Range indicator instaled!
This was my first experience with C# and cAlgo and I must say that is izzy to migrate.
You do not have the required permissions to view the files attached to this post.
Last edited by babalu4u on Thu Jun 06, 2013 8:15 pm, edited 2 times in total.
User avatar
babalu4u
Trader
Posts: 173
Joined: Fri Apr 13, 2012 6:52 pm
Location: Slovenia - EU

Re: TMA Slope

Post by babalu4u »

And here is the code:

Code: Select all

 //#reference: AverageTrueRange.algo

    using System;
    using cAlgo.API;
    using cAlgo.API.Indicators;

    namespace cAlgo.Indicators
    {
        [Indicator(IsOverlay = false)]
        public class TMASlope_01 : Indicator
        {
          private AverageTrueRange _averageTrueRange;
          private WeightedMovingAverage _weightedMovingAverage;
          private SimpleMovingAverage _simpleMovingAverage;
          
            [Parameter(DefaultValue = 14)]
        	public int smaPeriod { get; set; }
        	
            [Output("TMA", Color = Colors.Gray, PlotType = PlotType.Histogram)]
            public IndicatorDataSeries TMA { get; set; }

            [Output("Positive TMA", Color = Colors.Green, PlotType = PlotType.Histogram)]
            public IndicatorDataSeries TMA_Up { get; set; }
            
            [Output("Negative TMA", Color = Colors.Red, PlotType = PlotType.Histogram)]
            public IndicatorDataSeries TMA_Down { get; set; }

			[Output("Sma", Color = Colors.Red)]
        	public IndicatorDataSeries Sma { get; set; }
        	
            protected override void Initialize()
            {
                _weightedMovingAverage = Indicators.WeightedMovingAverage(MarketSeries.Close, 21);
                _averageTrueRange = Indicators.GetIndicator<AverageTrueRange>(100);
                _simpleMovingAverage = Indicators.SimpleMovingAverage(TMA, smaPeriod );
            }
           
          double calcPrevTrue( int index )
          {
             double dblSum  = MarketSeries.Close[ index - 1] * 21;
                double dblSumw = 21;
                int jnx, knx;
       
                dblSum  += MarketSeries.Close[ index ] * 20;
                dblSumw += 20;

                for ( jnx = 1, knx = 20; jnx <= 20; jnx++, knx-- )
                {
                   dblSum  += MarketSeries.Close[index - 1 - jnx ] * knx;
                   dblSumw += knx;
                }
             return ( dblSum / dblSumw );
          }


            public override void Calculate(int index)
            {
                double dblTma, dblPrev;
                double atr =_averageTrueRange.Result[index - 10] / 10;
                double gadblSlope = 0.0;

                if ( atr != 0 )
                {
                   dblTma =_weightedMovingAverage.Result[index];
                   dblPrev = calcPrevTrue( index );
                   gadblSlope = ( dblTma-dblPrev ) / atr;
                }
                
                TMA[index] = gadblSlope ;

                if( TMA[index]>0)
                {
                TMA_Up[index] = TMA[index] ;
                TMA_Down[index] = 0 ;
                }
                if(TMA[index]<0)
                {
                TMA_Down[index] = TMA[index] ;
                TMA_Up[index] = 0 ;
                }
                Sma[index] = _simpleMovingAverage.Result[ index ] ;
            }
        }
    }
excalibre30
Trader
Posts: 68
Joined: Sat Mar 08, 2014 7:45 am

TMA True Slope

Post by excalibre30 »

What does TMA mean bro? Trying to understand this but can not find a reference to it's meaning. Is this what Nanningbob uses?
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

TMA True Slope

Post by milanese »

excalibre30 » Wed Apr 30, 2014 2:56 pm wrote:What does TMA mean bro? Trying to understand this but can not find a reference to it's meaning. Is this what Nanningbob uses?
TMA=Triangular moving average

Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
excalibre30
Trader
Posts: 68
Joined: Sat Mar 08, 2014 7:45 am

TMA True Slope

Post by excalibre30 »

milanese wrote:
excalibre30 » Wed Apr 30, 2014 2:56 pm wrote:What does TMA mean bro? Trying to understand this but can not find a reference to it's meaning. Is this what Nanningbob uses?
TMA=Triangular moving average

Cheers :)

Tommaso
Thanks Tommaso.

I read that it is the origin of CSS but I also read that TMA has to be used in conjuction with css. I'm confused. :(
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

TMA True Slope

Post by milanese »

excalibre30 » Wed Apr 30, 2014 3:20 pm wrote:
Thanks Tommaso.

I read that it is the origin of CSS but I also read that TMA has to be used in conjuction with css. I'm confused. :(
yes this is right the TMA-Slope is base for the CSS, CSS is the TMA slope calculation using all selected pairs for the calculation, too you can look at the TMA bands, if you read the 10.7 thread http://www.stevehopwoodforex.com/phpBB3 ... =38&t=3549 and the CSS thread http://www.stevehopwoodforex.com/phpBB3 ... =38&t=3556 you will understand it better..

Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
User avatar
SpiderX
Trader
Posts: 554
Joined: Thu Aug 22, 2013 4:50 pm

TMA True Slope

Post by SpiderX »

milanese » Wed Apr 30, 2014 11:02 pm wrote: TMA=Triangular moving average

Cheers :)

Tommaso
Hi Tommaso

Can you point to a discussion specifically on this or maybe write an article on this ?
The forum seems to assume everyone knows about this.

Cheers
"Love is patient, love is kind. It does not envy, it does not boast, it is not proud. It does not dishonor others, it is not self-seeking, it is not easily angered, it keeps no record of wrongs.Love does not delight in evil but rejoices with the truth. It always protects, always trusts, always hopes, always perseveres."
-Corinthians 13:4-8
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

TMA True Slope

Post by milanese »

SpiderX » Wed May 21, 2014 12:24 am wrote:
milanese » Wed Apr 30, 2014 11:02 pm wrote: TMA=Triangular moving average

Cheers :)

Tommaso
Hi Tommaso

Can you point to a discussion specifically on this or maybe write an article on this ?
The forum seems to assume everyone knows about this.

Cheers
I will take a look if I find some time ..

Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

TMA True Slope

Post by milanese »

milanese » Wed May 21, 2014 8:44 am wrote:
SpiderX » Wed May 21, 2014 12:24 am wrote:
milanese » Wed Apr 30, 2014 11:02 pm wrote: TMA=Triangular moving average

Cheers :)

Tommaso
Hi Tommaso

Can you point to a discussion specifically on this or maybe write an article on this ?
The forum seems to assume everyone knows about this.

Cheers
I will take a look if I find some time ..

Cheers :)

Tommaso
I added some information about the TMA to the KnowLedge base http://www.stevehopwoodforex.com/phpBB3/kb.php?a=16

Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
Post Reply

Return to “Indicators”