Parabolic_ZZ_1

Author: Copyright � 2009, Vic2008
Indicators Used
Parabolic Stop and Reverse system
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
Parabolic_ZZ_1
//+------------------------------------------------------------------+
//|                                               Parabolic_ZZ.mq4   |
//|                                       Copyright © 2009, Vic2008  |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Vic2008"
#property link      ""

#include <stdlib.mqh>

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Magenta

//---- input parameters
extern double  SAR_step=0.02;     //Ïàðàìåòðû ïàðàáîëèêà.
extern double  SAR_maximum=0.2;

extern int BarsCount = 500;       //Äèñòàíöèÿ â áàðàõ äëÿ îòðèñîâêè èíäèêàòîðà.

extern bool Fibo1_off = False;    //Îòêëþ÷åíèå óðîâíåé Fibo.
extern bool Fibo2_off = False;
extern bool Fibo_Absolut_Value = False; //Âêëþ÷åíèå àáñëþòíûõ çíà÷åíèé öåíû íà Fibo óðîâíÿõ.

extern color Label_Color = Gray;
extern color Fibo_Color = Blue;

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(0,DRAW_SECTION);
   
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(1,DRAW_SECTION,0,2,Magenta);
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectsDeleteAll(0,OBJ_ARROW);
   ObjectDelete("FiboZZLast");
   ObjectDelete("FiboZZPrev");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   //int    counted_bars=IndicatorCounted();
   string txt;
   int w,PosLow,PosHigh;
   double LPic=1000000,HPic=0,price;
   datetime TimeTmp;
   
//----
   ExtMapBuffer1[0]=Close[0];
   ExtMapBuffer2[0]=EMPTY_VALUE;

 for( w=0;w<BarsCount;w++){  
 
   if( w!=0 ){ ExtMapBuffer1[w]=EMPTY_VALUE; ExtMapBuffer2[w]=EMPTY_VALUE; }
     
   if( iSAR(NULL,0,SAR_step,SAR_maximum,w) > Close[w] && LPic>=Low[w] ){ LPic=Low[w]; PosLow=w;  }
   if( iSAR(NULL,0,SAR_step,SAR_maximum,w) < Close[w] && HPic<=High[w] ){ HPic=High[w]; PosHigh=w; }
   
   // H -> L
   if( iSAR(NULL,0,SAR_step,SAR_maximum,(w+1)) > Close[w+1] && iSAR(NULL,0,SAR_step,SAR_maximum,w) < Close[w] && HPic!=0)
   {
        ExtMapBuffer1[PosHigh]=HPic;
        ExtMapBuffer2[PosHigh]=HPic;
        HPic=0; 
   }
   
   // L -> H
   if( iSAR(NULL,0,SAR_step,SAR_maximum,w) < Close[w] && iSAR(NULL,0,SAR_step,SAR_maximum,w+1) > Close[w+1] && LPic!=1000000 ) 
   {
        ExtMapBuffer1[PosLow]=LPic;
        ExtMapBuffer2[PosLow]=LPic;
        LPic=1000000;
   }
   
   
 }   

 if( Fibo1_off ) ObjectDelete("FiboZZLast");
 if( Fibo2_off ) ObjectDelete("FiboZZPrev");

 //Ðèñóåì öåíîâûå ìåòêè è óðîâíè FIBO
 int wave_cnt=0;
 for( w=0;w<BarsCount;w++){  
    if( ExtMapBuffer2[w]!=EMPTY_VALUE ){ 
        if( wave_cnt<=3 ){ 
          ObjectDelete("PZZ_"+DoubleToStr( wave_cnt, 0));
          ObjectCreate("PZZ_"+DoubleToStr( wave_cnt, 0) , OBJ_ARROW, 0, Time[w], ExtMapBuffer2[w], Time[w], 0);
          ObjectSet("PZZ_"+DoubleToStr( wave_cnt, 0), OBJPROP_ARROWCODE, SYMBOL_LEFTPRICE );
          ObjectSet("PZZ_"+DoubleToStr( wave_cnt, 0), SYMBOL_LEFTPRICE, ExtMapBuffer2[w]);
          ObjectSet("PZZ_"+DoubleToStr( wave_cnt, 0), OBJPROP_COLOR, Label_Color );
          
          
          if(wave_cnt==1 && Fibo1_off==False ){
            ObjectDelete("FiboZZLast");
            ObjectCreate("FiboZZLast", OBJ_FIBO, 0, TimeTmp, ExtMapBuffer2[w], TimeTmp, price);
            ObjectSet("FiboZZLast", OBJPROP_LEVELCOLOR, Fibo_Color);
            ObjectSet("FiboZZLast", OBJPROP_COLOR, Fibo_Color);
            
            ObjectSet("FiboZZLast", OBJPROP_RAY , False );// Äëÿ âêëþ÷åíèÿ ëó÷åé False çàìåíèòü íà True
            
               ObjectSet("FiboZZLast", OBJPROP_FIBOLEVELS, 14);               
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+0,0.236); ObjectSetFiboDescription("FiboZZLast",0,"23.6");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+1,0.382); ObjectSetFiboDescription("FiboZZLast",1,"38.2");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+2,0.50);  ObjectSetFiboDescription("FiboZZLast",2,"50.0");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+3,0.618); ObjectSetFiboDescription("FiboZZLast",3,"61.8");                              
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+4,1.0);   ObjectSetFiboDescription("FiboZZLast",4,"100.0");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+5,1.618); ObjectSetFiboDescription("FiboZZLast",5,"161.8");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+6,2.618); ObjectSetFiboDescription("FiboZZLast",6,"261.8");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+7,4.236); ObjectSetFiboDescription("FiboZZLast",7,"423.6");            
         
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+8,0.088); ObjectSetFiboDescription("FiboZZLast",8,"8.8");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+9,0.145); ObjectSetFiboDescription("FiboZZLast",9,"14.5");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+10,0.764); ObjectSetFiboDescription("FiboZZLast",10,"76.4");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+11,0.855); ObjectSetFiboDescription("FiboZZLast",11,"85.5");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+12,0.921); ObjectSetFiboDescription("FiboZZLast",12,"92.1");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+13,0.0); ObjectSetFiboDescription("FiboZZLast",13,"0.0");
            
            
            if( Fibo_Absolut_Value ){
            
               ObjectSet("FiboZZLast", OBJPROP_FIBOLEVELS, 14);               
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+0,0.236); ObjectSetFiboDescription("FiboZZLast",0,"23.6  %$");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+1,0.382); ObjectSetFiboDescription("FiboZZLast",1,"38.2  %$");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+2,0.50);  ObjectSetFiboDescription("FiboZZLast",2,"50.0  %$");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+3,0.618); ObjectSetFiboDescription("FiboZZLast",3,"61.8  %$");                              
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+4,1.0);   ObjectSetFiboDescription("FiboZZLast",4,"100.0  %$");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+5,1.618); ObjectSetFiboDescription("FiboZZLast",5,"161.8  %$");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+6,2.618); ObjectSetFiboDescription("FiboZZLast",6,"261.8  %$");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+7,4.236); ObjectSetFiboDescription("FiboZZLast",7,"423.6  %$");            
         
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+8,0.088); ObjectSetFiboDescription("FiboZZLast",8,"8.8  %$");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+9,0.145); ObjectSetFiboDescription("FiboZZLast",9,"14.5  %$");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+10,0.764); ObjectSetFiboDescription("FiboZZLast",10,"76.4  %$");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+11,0.855); ObjectSetFiboDescription("FiboZZLast",11,"85.5  %$");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+12,0.921); ObjectSetFiboDescription("FiboZZLast",12,"92.1  %$");
               ObjectSet("FiboZZLast",OBJPROP_FIRSTLEVEL+13,0.0); ObjectSetFiboDescription("FiboZZLast",13,"0.0");
                              
            }
          }
          
          
          if( wave_cnt==2 && Fibo2_off==False ){
            ObjectDelete("FiboZZPrev");
            ObjectCreate("FiboZZPrev", OBJ_FIBO, 0, TimeTmp, ExtMapBuffer2[w], TimeTmp, price);
            ObjectSet("FiboZZPrev", OBJPROP_LEVELCOLOR, Fibo_Color);
            ObjectSet("FiboZZPrev", OBJPROP_COLOR, Fibo_Color);
            
            ObjectSet("FiboZZPrev", OBJPROP_RAY , False );// Äëÿ âêëþ÷åíèÿ ëó÷åé False çàìåíèòü íà True
               ObjectSet("FiboZZPrev", OBJPROP_FIBOLEVELS, 14);
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+0,0.236); ObjectSetFiboDescription("FiboZZPrev",0,"23.6");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+1,0.382); ObjectSetFiboDescription("FiboZZPrev",1,"38.2");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+2,0.50);  ObjectSetFiboDescription("FiboZZPrev",2,"50.0");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+3,0.618); ObjectSetFiboDescription("FiboZZPrev",3,"61.8");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+4,1.0);   ObjectSetFiboDescription("FiboZZPrev",4,"100.0");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+5,1.618); ObjectSetFiboDescription("FiboZZPrev",5,"161.8");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+6,2.618); ObjectSetFiboDescription("FiboZZPrev",6,"261.8");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+7,4.236); ObjectSetFiboDescription("FiboZZPrev",7,"423.6");
                                       
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+8,0.088); ObjectSetFiboDescription("FiboZZPrev",8,"8.8");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+9,0.145); ObjectSetFiboDescription("FiboZZPrev",9,"14.5");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+10,0.764); ObjectSetFiboDescription("FiboZZPrev",10,"76.4");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+11,0.855); ObjectSetFiboDescription("FiboZZPrev",11,"85.5");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+12,0.921); ObjectSetFiboDescription("FiboZZPrev",12,"92.1");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+13,0.0); ObjectSetFiboDescription("FiboZZPrev",13,"0.0");
            
            if( Fibo_Absolut_Value ){
               ObjectSet("FiboZZPrev", OBJPROP_FIBOLEVELS, 14);
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+0,0.236); ObjectSetFiboDescription("FiboZZPrev",0,"23.6  %$");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+1,0.382); ObjectSetFiboDescription("FiboZZPrev",1,"38.2  %$");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+2,0.50);  ObjectSetFiboDescription("FiboZZPrev",2,"50.0  %$");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+3,0.618); ObjectSetFiboDescription("FiboZZPrev",3,"61.8  %$");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+4,1.0);   ObjectSetFiboDescription("FiboZZPrev",4,"100.0  %$");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+5,1.618); ObjectSetFiboDescription("FiboZZPrev",5,"161.8  %$");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+6,2.618); ObjectSetFiboDescription("FiboZZPrev",6,"261.8  %$");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+7,4.236); ObjectSetFiboDescription("FiboZZPrev",7,"423.6  %$");
                                       
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+8,0.088); ObjectSetFiboDescription("FiboZZPrev",8,"8.8  %$");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+9,0.145); ObjectSetFiboDescription("FiboZZPrev",9,"14.5  %$");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+10,0.764); ObjectSetFiboDescription("FiboZZPrev",10,"76.4  %$");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+11,0.855); ObjectSetFiboDescription("FiboZZPrev",11,"85.5  %$");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+12,0.921); ObjectSetFiboDescription("FiboZZPrev",12,"92.1  %$");
               ObjectSet("FiboZZPrev",OBJPROP_FIRSTLEVEL+13,0.0); ObjectSetFiboDescription("FiboZZPrev",13,"0.0");
               
            }   
          }
          
        }
        wave_cnt++;  
        price=ExtMapBuffer2[w];
        TimeTmp=Time[w];
    }
 }


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