Miscellaneous
0
Views
0
Downloads
0
Favorites
ZZ_pS_v[1].0.4
//+------------------------------------------------------------------+
//| |
//| |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
#property indicator_separate_window
#property indicator_minimum -100
#property indicator_maximum 100
#property indicator_buffers 4
#property indicator_color1 LimeGreen
#property indicator_color2 OrangeRed
#property indicator_color3 LimeGreen
#property indicator_color4 OrangeRed
//---- indicator parameters
extern int ExtDepth=12;
extern int minBars = 2;
extern int nBars=300;
extern int ZZ_Method=0;
//---- indicator buffers
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double zz[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(5);
//---- drawing settings
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,119);
SetIndexBuffer(0,ExtMapBuffer3);
SetIndexEmptyValue(0,0.0);
SetIndexLabel(0,"Points_Up");
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,119);
SetIndexBuffer(1,ExtMapBuffer4);
SetIndexEmptyValue(1,0.0);
SetIndexLabel(1,"Points_Dn");
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,ExtMapBuffer5);
SetIndexEmptyValue(2,0.0);
SetIndexLabel(2,"Line_Up");
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(3,ExtMapBuffer6);
SetIndexEmptyValue(3,0.0);
SetIndexLabel(3,"Line_Dn");
//---- indicator buffers mapping
SetIndexBuffer(4,zz);
//---- indicator short name
IndicatorShortName("ZZ_pS");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int deinit()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
int shift;
bool signal;
double extzigzag;
//----
if(nBars>Bars || nBars==0) nBars=Bars;
//----
ArrayInitialize(ExtMapBuffer3,0.0);
ArrayInitialize(ExtMapBuffer4,0.0);
ArrayInitialize(ExtMapBuffer5,0.0);
ArrayInitialize(ExtMapBuffer6,0.0);
ArrayInitialize(zz,0.0);
//----
for(shift=nBars-1; shift>=0; shift--)
{
if(ZZ_Method==0) extzigzag=iCustom(NULL,0,"DT_ZZ",ExtDepth,0,shift);
else extzigzag=iCustom(NULL,0,"Swing_ZZ",minBars,0,shift);
if(extzigzag==Low[shift]) signal=true;
if(extzigzag==High[shift]) signal=false;
if (signal) zz[shift]=-1;
else zz[shift]=1;
}
//----
for(shift=nBars-3; shift>=0; shift--)
{
if (zz[shift]<0)
{
if (zz[shift+2]>0)
{
if (zz[shift+1]>0)
{
ExtMapBuffer4[shift+1]=-70;
ExtMapBuffer6[shift+1]=-70;
ExtMapBuffer3[shift+1]=0.0;
ExtMapBuffer5[shift+1]=0.0;
ExtMapBuffer4[shift]=-90;
ExtMapBuffer6[shift]=-90;
ExtMapBuffer3[shift]=-90;
ExtMapBuffer5[shift]=-90;
}
else
if (zz[shift+1]<0)
{
ExtMapBuffer3[shift]=-30;
ExtMapBuffer5[shift]=-30;
ExtMapBuffer4[shift]=0.0;
ExtMapBuffer6[shift]=0.0;
}
}
else
if (zz[shift+2]<0)
{
if (zz[shift+1]>0)
{
ExtMapBuffer3[shift]=-90;
ExtMapBuffer5[shift]=-90;
ExtMapBuffer4[shift]=-90;
ExtMapBuffer6[shift]=-90;
}
else
if (zz[shift+1]<0)
{
ExtMapBuffer3[shift]=0.001;
ExtMapBuffer5[shift]=0.001;
ExtMapBuffer4[shift]=0.0;
ExtMapBuffer6[shift]=0.0;
}
}
}
else
if (zz[shift]>0)
{
if (zz[shift+2]>0)
{
if (zz[shift+1]>0)
{
ExtMapBuffer4[shift]=0.001;
ExtMapBuffer6[shift]=0.001;
ExtMapBuffer3[shift]=0.0;
ExtMapBuffer5[shift]=0.0;
}
else
if (zz[shift+1]<0)
{
ExtMapBuffer3[shift]=90;
ExtMapBuffer5[shift]=90;
ExtMapBuffer4[shift]=90;
ExtMapBuffer6[shift]=90;
}
}
else
if (zz[shift+2]<0)
{
if (zz[shift+1]>0)
{
ExtMapBuffer4[shift]=30;
ExtMapBuffer6[shift]=30;
ExtMapBuffer3[shift]=0.0;
ExtMapBuffer5[shift]=0.0;
}
else
if (zz[shift+1]<0)
{
ExtMapBuffer3[shift+1]=70;
ExtMapBuffer5[shift+1]=70;
ExtMapBuffer4[shift+1]=0.0;
ExtMapBuffer6[shift+1]=0.0;
ExtMapBuffer3[shift]=90;
ExtMapBuffer5[shift]=90;
ExtMapBuffer4[shift]=90;
ExtMapBuffer6[shift]=90;
}
}
}
}
//----
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
---