Parabolic_cOpen_Closep

Price Data Components
Series array that contains open prices of each barSeries array that contains close prices for each bar
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
Parabolic_cOpen_Closep
//***********************************************************************//
//***********************************************************************//
//*                                          Parabolic (Open_Close).mq4 *//
//*                                         Copyright © 2009, BACKSPACE *//
//*                                           Updating from 10.02.2010  *//
//***********************************************************************//
//***********************************************************************//
//*                             Òîðãóé òðåíäû                           *//
//*                            Óìåíüøàé ïîòåðè                          *//
//*                          Äàâàé ïðèáûëè ðàñòè                        *//
//*                            Óïðàâëÿé ðèñêàìè                         *//
//***********************************************************************//
//***********************************************************************//
#property copyright "Copyright © 2009, BACKSPACE"                        //
#property link      "Updating from 10.02.2010 "                          //
//
#property indicator_chart_window                                         //
#property indicator_buffers 1                                            //
#property indicator_color1 Red                                           //
//******************// Ââîä ïàðàìåòðîâ èíäèêàòîðà
extern double Max=0.009;                                                 //   - ìàêñèìàëüíîå çíà÷åíèå Parabolic
extern double Step=0.005;                                                //   - øàã èçìåíåíèÿ Parabolic
                                                                         //******************// Ñîñòàâíûå ÷àñòè èíäèêàòîðà
double ParabolicSAR[],                                                   //   - Parabolic SAR
ParAle[],                                                         //   - Àëåðò Parabolic
HHigh,                                                            //   - ìàêñèìóì òåëà áàðà
LLow,                                                             //   - ìèíèìóì òåëà áàðà
HHighPP,                                                          //   - Previous Point HHigh
LLowPP;                                                           //   - Previous Point LLow
                                                                  //******************// Ãëîáàëüíûå ïåðåìåííûå
int    Counter;                                                          //   - ñ÷¸ò÷èê áàðîâ
double IndexHL=1,                                                        //   - èíäåêñ îäíîíàïðàâëåííîãî äâèæåíèÿ
ExtremumLong,                                                     //   - ýêñòðåìóì High
ExtremumShort;                                                    //   - ýêñòðåìóì Low
string Typ="Short";                                                      //   - òèï ñäåëêè
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
                                                                         //***********************************************************************//
//**********************-Indicator Initialization-***********************//
//***********************************************************************//
//
int init()                                                               //
  {                                                  //******************// Íàñòðîéêè ãðàôè÷åñêîãî îòîáðàæåíèÿ
   IndicatorBuffers(2);                                                  //
   SetIndexLabel(0,"ParabolicSAR");                                      //
   SetIndexStyle(0,DRAW_ARROW);                                          //
   SetIndexArrow(0,159);                                                 //
   SetIndexBuffer(0,ParabolicSAR);                                       //
   SetIndexBuffer(1,ParAle);                                             //
                                                                         //*********//
   return(0);                                                            //
  }                                                                      //
//***********************************************************************//
//*************************-Moving Rounding Off-*************************//
//***********************************************************************//
//
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;

   for(int mr=limit; mr>=1; mr--) //
     {                                                                   //
      Bars_High_Low_Init(mr);                        //******************// Èíèöèàëèçàöèÿ High/Low
      Parabolic_SAR(mr);                             //******************// Ðàñ÷¸ò Parabolic SAR
      Extremum_Long_Short(mr);                       //******************// Ýêñòðåìóìû Long/Short
     }                                                                   //
//*********//
   return(0);                                                            //
  }                                                                      //
//***********************************************************************//
//******************************-SubPogramms-****************************//
//***********************************************************************//
//
//***********************************// Èíèöèàëèçàöèÿ High/Low 
double Bars_High_Low_Init(int bhli)                                      //
  {                                                                      //
   if(iOpen(NULL,0,bhli)>iClose(NULL,0,bhli))                            //
     {                                                                   //
      HHigh =iOpen(NULL,0,bhli);                                         //
      LLow  =iClose(NULL,0,bhli);                                        //
     }                                                                   //
   else if(iOpen(NULL,0,bhli)<iClose(NULL,0,bhli))                       //
     {                                                                   //
      HHigh =iClose(NULL,0,bhli);                                        //
      LLow  =iOpen(NULL,0,bhli);                                         //
     }                                                                   //
   else                                                                  //
     {                                                                   //
      HHigh =iClose(NULL,0,bhli);                                        //
      LLow  =iOpen(NULL,0,bhli);                                         //
     }                                                                   //
//*********//
   return(0);                                                            //
  }                                                                      //
//***********************************// Ðàñ÷¸ò Parabolic SAR
double Parabolic_SAR(int ps)                                             //
  {                                                                      //
   if(Typ=="Long")                                                       //
     {                                                                   //
      if(LLow<=ParabolicSAR[ps+1]) //******************//   - óñëîâèÿ ðàçâîðîòà Short
        {                                                                //
         Typ="Short";                                                    //
         ParabolicSAR[ps]=ExtremumLong;                                  //
         ExtremumShort=LLow;                                             //
         IndexHL=1;                                                      //
         ParAle[ps]=-1;                                                  //
         return(0);                                                      //
        }                                                                //
      else                                           //******************//   - îòêðûòàÿ ïîçèöèÿ Long
        {                                                                //
         ParabolicSAR[ps]=ParabolicSAR[ps+1]+                            //
                          (Max+IndexHL*Step)*(HHighPP-ParabolicSAR[ps+1]);                 //
         if(HHigh>ExtremumLong)                                          //   - èíäåêñ îäíîíàïðàâëåííîãî äâèæåíèÿ
            IndexHL++;                                                    //
         HHighPP=HHigh;                                                  //
         ParAle[ps]=ParAle[ps+1];                                        //
         return(0);                                                      //
        }                                                                //
     }                                                                   //
   if(Typ=="Short")                                                      //
     {                                                                   //
      if(HHigh>=ParabolicSAR[ps+1]) //******************//   - óñëîâèÿ ðàçâîðîòà Long
        {                                                                //
         Typ="Long";                                                     //
         ParabolicSAR[ps]=ExtremumShort;                                 //
         ExtremumLong=HHigh;                                             //
         IndexHL=1;                                                      //
         ParAle[ps]=1;                                                   //
         return(0);                                                      //
        }                                                                   //
      else                                           //******************//   - îòêðûòàÿ ïîçèöèÿ Short
        {                                                                //
         ParabolicSAR[ps]=ParabolicSAR[ps+1]-                            //
                          (Max+IndexHL*Step)*(ParabolicSAR[ps+1]-LLowPP);                  //
         if(LLow<ExtremumShort)                                          //   - èíäåêñ îäíîíàïðàâëåííîãî äâèæåíèÿ
            IndexHL++;                                                    //
         LLowPP=LLow;                                                    //
         ParAle[ps]=ParAle[ps+1];                                        //
         return(0);                                                      //
        }                                                                //
     }                                                                   //
//*********//
   return(0);                                                            //
  }                                                                      //
//***********************************// Ýêñòðåìóìû Long/Short
double Extremum_Long_Short(int ehl)                                      //
  {                                                                      //
   if(HHigh>ExtremumLong) //******************//   - ýêñòðåìóì Long
      ExtremumLong=HHigh;                                                 //
   if(LLow<ExtremumShort) //******************//   - ýêñòðåìóì Short
      ExtremumShort=LLow;                                                 //
//*********//
   return(0);                                                            //
  }                                                                      //
//***********************************************************************//
//********************************************************************BS*//
//***********************************************************************//

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 ---