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.
TMA True Slope
- babalu4u
- Trader
- Posts: 173
- Joined: Fri Apr 13, 2012 6:52 pm
- Location: Slovenia - EU
TMA True Slope
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.
- babalu4u
- Trader
- Posts: 173
- Joined: Fri Apr 13, 2012 6:52 pm
- Location: Slovenia - EU
Re: TMA Slope
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
What does TMA mean bro? Trying to understand this but can not find a reference to it's meaning. Is this what Nanningbob uses?
- milanese
- TechAdmin
- Posts: 3293
- Joined: Wed Jan 09, 2013 9:02 am
- Location: btr rdx, r8 +
TMA True Slope
TMA=Triangular moving averageexcalibre30 » 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?
Cheers
Tommaso
Global Prime is the official SHF broker 
Searching for Servers and Workstations with individual configuration?
Just PM
Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
Searching for Servers and Workstations with individual configuration?
Just PM
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
Thanks Tommaso.milanese wrote:TMA=Triangular moving averageexcalibre30 » 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?
Cheers
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.
- milanese
- TechAdmin
- Posts: 3293
- Joined: Wed Jan 09, 2013 9:02 am
- Location: btr rdx, r8 +
TMA True Slope
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..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.
Cheers
Tommaso
Global Prime is the official SHF broker 
Searching for Servers and Workstations with individual configuration?
Just PM
Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
Searching for Servers and Workstations with individual configuration?
Just PM
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
- SpiderX
- Trader
- Posts: 554
- Joined: Thu Aug 22, 2013 4:50 pm
TMA True Slope
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
-Corinthians 13:4-8
- milanese
- TechAdmin
- Posts: 3293
- Joined: Wed Jan 09, 2013 9:02 am
- Location: btr rdx, r8 +
TMA True Slope
I will take a look if I find some time ..SpiderX » Wed May 21, 2014 12:24 am wrote: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
Cheers
Tommaso
Global Prime is the official SHF broker 
Searching for Servers and Workstations with individual configuration?
Just PM
Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
Searching for Servers and Workstations with individual configuration?
Just PM
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
- milanese
- TechAdmin
- Posts: 3293
- Joined: Wed Jan 09, 2013 9:02 am
- Location: btr rdx, r8 +
TMA True Slope
I added some information about the TMA to the KnowLedge base http://www.stevehopwoodforex.com/phpBB3/kb.php?a=16milanese » Wed May 21, 2014 8:44 am wrote:I will take a look if I find some time ..SpiderX » Wed May 21, 2014 12:24 am wrote: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
Cheers
Tommaso
Cheers
Tommaso
Global Prime is the official SHF broker 
Searching for Servers and Workstations with individual configuration?
Just PM
Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
Searching for Servers and Workstations with individual configuration?
Just PM
NOTE: Cookies and JavaScript are required for the using the board, with full functionality