Miscellaneous
0
Views
0
Downloads
0
Favorites
SR
//SR
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 MediumSeaGreen
#property indicator_color2 OrangeRed
//---- input parameters
extern double k_std = 1.0;
//---- buffers
double Buffer[];
double Buffer1[];
double m[10000];
double o[10000];
datetime t = 0;
int l;
//-----------------------------------
int init()
{
//---- indicators
//---- 1 additional buffer used for counting.
IndicatorBuffers( 2 );
IndicatorDigits( Digits );
//---- indicator line
SetIndexStyle( 0, DRAW_LINE );
SetIndexBuffer( 0, Buffer );
SetIndexStyle( 1, DRAW_LINE );
SetIndexBuffer( 1, Buffer1 );
string short_name = " GSV (9 / 14)";
IndicatorShortName( short_name );
SetIndexLabel( 0, short_name );
SetIndexLabel( 1, short_name );
//----
return(0);
}
//-------------------------------
int start()
{
//----
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit=Bars-counted_bars;
if(counted_bars==0) limit-=2;
if ( t != Time[0] || l == 0 )
{
t = Time[0];
l = 1;
int i, x;
double LastHigh, LastLow;
//for ( i = Bars - 1; i >= 0; i-- )
for ( i = limit; i >= 0; i-- )
{
if ( High[i+1] > LastHigh )
{
LastHigh = High[i+1];
}
//----
if ( Low[i+1] < LastLow )
{
LastLow = Low[i+1];
}
if ( TimeDay( Time[i] ) != TimeDay( Time[i+1] ) )
{
x++;
o[x] = Open[i];
m[x] = LastHigh - o[x - 1];
if ( LastHigh - o[x - 1] > o[x - 1] - LastLow )
{
m[x] = o[x - 1] - LastLow;
}
LastLow = 100000;
LastHigh = 0;
if ( x > 15 )
{
double a1 = m[x];
double a2 = m[x-1];
double a3 = m[x-2];
double a4 = m[x-3];
double a5 = m[x-4];
double a6 = m[x-5];
double a7 = m[x-6];
double a8 = m[x-7];
double a9 = m[x-8];
double a10 = m[x-9];
double a11 = m[x-10];
double a12 = m[x-11];
double a13 = m[x-12];
double a14 = m[x-13];
double ax = 0.1111111 * ( a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9 );
double ay = 0.0714285 * ( a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9 + a10 + a11 + a12 + a13 + a14 );
double stx = 0.1111111 * ( ( a1 - ax ) * ( a1 - ax ) + ( a2 - ax ) * ( a2 - ax ) + ( a3 - ax ) * ( a3 - ax ) +
( a4 - ax ) * ( a4 - ax ) + ( a5 - ax ) * ( a5 - ax ) + ( a6 - ax ) * ( a6 - ax ) + ( a7 - ax ) * ( a7 - ax )
+ ( a8 - ax ) * ( a8 - ax ) + ( a9 - ax ) * ( a9 - ax ) );
double sty = 0.0714285 * ( ( a1 - ay ) * ( a1 - ay ) + ( a2 - ay ) * ( a2 - ay ) + ( a3 - ay ) * ( a3 - ay ) +
( a4 - ay ) * ( a4 - ay ) + ( a5 - ay ) * ( a5 - ay ) + ( a6 - ay ) * ( a6 - ay ) + ( a7 - ay ) * ( a7 - ay )
+ ( a8 - ay ) * ( a8 - ay ) + ( a9 - ay ) * ( a9 - ay ) + ( a10 - ay ) * ( a10 - ay ) + ( a11 - ay ) * ( a11 - ay )
+ ( a12 - ay ) * ( a12 - ay ) + ( a13 - ay ) * ( a13 - ay ) + ( a14 - ay ) * ( a14 - ay ) );
double st1 = ax + k_std * MathPow( stx, 0.5 );
double st2 = ay + k_std * MathPow( sty, 0.5 );
double std = st2;
if ( st1 > st2 )
{
std = st1;
}
double g1 = o[x] + std;
double g2 = o[x] - std;
}
}
if ( x > 15 )
{
Buffer[i] = g1;
Buffer1[i] = g2;
}
}
}
//----
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
---