Miscellaneous
0
Views
0
Downloads
0
Favorites
5_ZZ_Semafor
//+------------------------------------------------------------------+
//| 5_ZZ_Semafor.mq4 |
//| Copyright © 2009, Asystem2000, Serg73, TradeProgrammer |
//| http://tradeprogrammer.narod.ru/index.htm |
//| mailto:TradeProgrammer@yandex.ru |
//+------------------------------------------------------------------+
#define IND "ZZ_i"
#property copyright "Copyright © 2009, Serg73, TradeProgrammer"
#property link "www.http://tradeprogrammer.narod.ru/index.htm"
#property link "mailto:TradeProgrammer@yandex.ru"
#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 Pink
#property indicator_color2 Chocolate
#property indicator_color3 Gold
#property indicator_color4 DodgerBlue
#property indicator_color5 LimeGreen
#property indicator_width1 0
#property indicator_width2 1
#property indicator_width3 2
#property indicator_width4 3
#property indicator_width5 4
//---- input parameters
extern int DrowCount=5; // êîëè÷åñòâî îòîáðàæàåìûõ çèãçàãîâ
extern int ZZ_1_Period=7; // ïàðàìåòðû êàæäîãî çèãçàãà
extern int ZZ_1_Reverse=0;
extern int ZZ_2_Period=12;
extern int ZZ_2_Reverse=0;
extern int ZZ_3_Period=25;
extern int ZZ_3_Reverse=0;
extern int ZZ_4_Period=50;
extern int ZZ_4_Reverse=0;
extern int ZZ_5_Period=100;
extern int ZZ_5_Reverse=0;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double z;
int j,cnt;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,140);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexEmptyValue(0,0.0);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,141);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexEmptyValue(1,0.0);
SetIndexStyle(2,DRAW_ARROW);
SetIndexArrow(2,142);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexEmptyValue(2,0.0);
SetIndexStyle(3,DRAW_ARROW);
SetIndexArrow(3,143);
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexEmptyValue(3,0.0);
SetIndexStyle(4,DRAW_ARROW);
SetIndexArrow(4,144);
SetIndexBuffer(4,ExtMapBuffer5);
SetIndexEmptyValue(4,0.0);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start(){
int limit=Bars-IndicatorCounted();
for(int i=limit-1;i>=0;i--){
for(j=i,cnt=0;j<Bars && cnt<2;j++){
ExtMapBuffer1[j]=0;
z=iCustom(NULL,0,IND,ZZ_1_Period,ZZ_1_Reverse,0,j);
if(z!=0){
ExtMapBuffer1[j]=z;
cnt++;
}
}
if(DrowCount<2)continue;
for(j=i,cnt=0;j<Bars && cnt<2;j++){
ExtMapBuffer2[j]=0;
z=iCustom(NULL,0,IND,ZZ_2_Period,ZZ_2_Reverse,0,j);
if(z!=0){
ExtMapBuffer2[j]=z;
ExtMapBuffer1[j]=0;
cnt++;
}
}
if(DrowCount<3)continue;
for(j=i,cnt=0;j<Bars && cnt<2;j++){
ExtMapBuffer3[j]=0;
z=iCustom(NULL,0,IND,ZZ_3_Period,ZZ_3_Reverse,0,j);
if(z!=0){
ExtMapBuffer3[j]=z;
ExtMapBuffer2[j]=0;
ExtMapBuffer1[j]=0;
cnt++;
}
}
if(DrowCount<4)continue;
for(j=i,cnt=0;j<Bars && cnt<2;j++){
ExtMapBuffer4[j]=0;
z=iCustom(NULL,0,IND,ZZ_4_Period,ZZ_4_Reverse,0,j);
if(z!=0){
ExtMapBuffer4[j]=z;
ExtMapBuffer3[j]=0;
ExtMapBuffer2[j]=0;
ExtMapBuffer1[j]=0;
cnt++;
}
}
if(DrowCount<5)continue;
for(j=i,cnt=0;j<Bars && cnt<2;j++){
ExtMapBuffer5[j]=0;
z=iCustom(NULL,0,IND,ZZ_5_Period,ZZ_5_Reverse,0,j);
if(z!=0){
ExtMapBuffer5[j]=z;
ExtMapBuffer4[j]=0;
ExtMapBuffer3[j]=0;
ExtMapBuffer2[j]=0;
ExtMapBuffer1[j]=0;
cnt++;
}
}
}
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
---