Stochastic-X8_4

Author: Copyright � 2004, MetaQuotes Software Corp.
Indicators Used
Stochastic oscillator
0 Views
0 Downloads
0 Favorites
Stochastic-X8_4
//+------------------------------------------------------------------+
//|                                       Custom Stochastic-X8.4.mq4 |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//|     Make in Russia by lukas1 aka Victor Lukashuk / lukas1@ngs.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1  LimeGreen
#property indicator_level1  35
#property indicator_level2  15
#property indicator_level3  -15
#property indicator_level4  -35
#property indicator_maximum  50
#property indicator_minimum -50
//---- indicator parameters
extern int Stoch_D=10; //parameter of D stoch.
extern int Stoch_K=1;  //parameter of signal line.
extern int Stoch_S=5;  //parameter of S stoch.
extern double Koef=1.2;
//---- indicator buffers
double Buf7[],Buf8[];
double D10,D11,D12,D13,D14,D15,D16,D17;
double K10,K11,K12,K13,K14,K15,K16,K17;
double S10,S11,S12,S13,S14,S15,S16,S17;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name=WindowExpertName(),
          sim=StringSetChar("",0,164);
//---- indicator short name
   IndicatorShortName(StringConcatenate(short_name,sim,
      DoubleToStr(Koef,1),": (",Stoch_D,", ",Stoch_K,", ",
      Stoch_S,") ",sim ));

   D10=Stoch_D;D11=D10*Koef;D12=D11*Koef;D13=D12*Koef;
   D14=D13*Koef;D15=D14*Koef;D16=D15*Koef;D17=D16*Koef;
   K10=Stoch_K;K11=K10*Koef;K12=K11*Koef;K13=K12*Koef;
   K14=K13*Koef;K15=K14*Koef;K16=K15*Koef;K17=K16*Koef;
   S10=Stoch_S;S11=S10*Koef;S12=S11*Koef;S13=S12*Koef;
   S14=S13*Koef;S15=S14*Koef;S16=S15*Koef;S17=S16*Koef;
   
   IndicatorDigits(1);

   SetIndexBuffer(0,Buf7);
   SetIndexLabel (0,"Summa of Stochs\n");
   SetIndexStyle (0, 2, 0, 2) ;
   
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   double m1,m2,m3,m4,m5,m6,m7,m8;
     int limit;
     int counted_bars=IndicatorCounted();
  //---- last bar to be recounting ----
     if(counted_bars>0) counted_bars--;
     limit=Bars-counted_bars;
  //---- base circle ----
     for(int i=0; i<limit; i++)
      {
       m1 = NormalizeDouble(iStochastic(NULL,0,D10,K10,S10,3,1,0,i)-50,Digits+1);
       m2 = NormalizeDouble(iStochastic(NULL,0,D11,K11,S11,3,1,0,i)-50,Digits+1);
       m3 = NormalizeDouble(iStochastic(NULL,0,D12,K12,S12,3,1,0,i)-50,Digits+1);
       m4 = NormalizeDouble(iStochastic(NULL,0,D13,K13,S13,3,1,0,i)-50,Digits+1);
       m5 = NormalizeDouble(iStochastic(NULL,0,D14,K14,S14,3,1,0,i)-50,Digits+1);
       m6 = NormalizeDouble(iStochastic(NULL,0,D15,K15,S15,3,1,0,i)-50,Digits+1);
       m7 = NormalizeDouble(iStochastic(NULL,0,D16,K16,S16,3,1,0,i)-50,Digits+1);
       m8 = NormalizeDouble(iStochastic(NULL,0,D17,K17,S17,3,1,0,i)-50,Digits+1);
       Buf7[i] = (m1+m2+m3+m4+m5+m6+m7+m8)/8;
      }
   return(0);
  }
//+------------------------------------------------------------------+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---