Indicators Used
0
Views
0
Downloads
0
Favorites
S7
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
extern int SmoothLength = 5;
extern int StochLength = 20;
extern int StochPrice = 0;
extern double Sensitivity = 50.0;
//
//
//
//
//
double bBuffer[];
double smoothCoeffs[];
double smoothDivisor;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//
#define Pi 3.14159265358979323846264338
int init()
{
SetIndexBuffer(0, bBuffer); SetIndexDrawBegin(0, StochLength + 1);
//
//
//
//
//
ArrayResize(smoothCoeffs, SmoothLength);
smoothCoeffs[0] = 1;
smoothDivisor = 1;
for (int i = 1; i < SmoothLength; i++)
{
double temp = i << 1 / Pi;
smoothCoeffs[i] = MathSin(temp) / temp;
smoothDivisor += smoothCoeffs[i];
}
return (0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//
int start()
{
int counted_bars=IndicatorCounted();
int i,limit;
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit = Bars-counted_bars;
//
//
//
//
//
for (i=limit; i >= 0; i--)
{
double sum = 0;
for (int l = 0; l < SmoothLength; l++) sum += iStochastic(NULL,0,StochLength,1,1,MODE_SMA,StochPrice,MODE_MAIN,l+i)*smoothCoeffs[l];
//
//
//
//
//
double temp = MathMax(MathMin((sum/smoothDivisor - 50.0) / Sensitivity,0.9999),-0.9999);
bBuffer[i] = MathLog((temp+1.0)/(1.0-temp))/2.0;
}
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
---