Indicators Used
0
Views
0
Downloads
0
Favorites
Trend strength index - Hassler
//+------------------------------------------------------------------+
//| Trend Strength Index |
//| coded by mladen |
//| |
//| The creator of of this version of Trend Strength Index }
//| is Frank Hassler in cooperation with David Varadi |
//+------------------------------------------------------------------+
#property copyright "mladen"
#property link "mladenfx@gmail.com"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 DeepSkyBlue
#property indicator_width1 2
//
//
//
//
//
extern int ShortAveragePeriod = 10;
extern int ShortAverageMethod = MODE_SMA;
extern int LongAveragePeriod = 100;
extern int LongAverageMethod = MODE_SMA;
extern int RatioPeriod = 10;
//
//
//
//
//
double tsiBuffer[];
double rawBuffer1[];
double rawBuffer2[];
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//
int init()
{
IndicatorBuffers(3);
SetIndexBuffer(0,tsiBuffer); SetIndexLabel(0,"Trend strength index");
SetIndexBuffer(1,rawBuffer1);
SetIndexBuffer(2,rawBuffer2);
IndicatorShortName("Trend strength index ("+ShortAveragePeriod+","+LongAveragePeriod+")");
return(0);
}
//
//
//
//
//
int start()
{
int counted_bars=IndicatorCounted();
int i,limit;
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit = MathMin(Bars-counted_bars,Bars-1);
//
//
//
//
//
for (i=limit; i>=0; i--)
{
double atr = iATR(NULL,0,RatioPeriod,i);
if (atr!=0)
rawBuffer1[i] = MathAbs(Close[i]-Close[i+RatioPeriod])/atr;
else rawBuffer1[i] = 0;
}
for (i=limit; i>=0; i--) rawBuffer2[i] = iMAOnArray(rawBuffer1,0,ShortAveragePeriod,0,ShortAverageMethod,i);
for (i=limit; i>=0; i--) tsiBuffer[i] = iMAOnArray(rawBuffer2,0,LongAveragePeriod,0,LongAverageMethod,i);
return(0);
}
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---