//+------------------------------------------------------------------+
//| i-MaZZSig-T01.mq4 |
//| 25.07.2006 Tranlated on MT4 by Êèì Èãîðü Â. aka KimIV |
//| http://www.kimiv.ru |
//+------------------------------------------------------------------+
/*[[
Name := Urovny
Author := HomeSoft Corp.
Link := spiky@transkeino.ru
Separate Window := No
First Color := Gold
First Draw Type := Symbol
First Symbol := 241
Use Second Data := Yes
Second Color := Lime
Second Draw Type := Symbol
Second Symbol := 242
]]*/
#property copyright "HomeSoft Corp."
#property link "spiky@transkeino.ru"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LightBlue
#property indicator_width1 1
#property indicator_color2 Salmon
#property indicator_width2 1
//------- Âíåøíèå ïàðàìåòðû èíäèêòîðà --------------------------------
extern int depth = 20;
extern int deviation = 5;
extern int backstep = 3;
extern int per = 55;
extern int nBars = 1000;
//------- Ãëîáàëüíûå ïåðåìåííûå èíäèêòîðà ----------------------------
double dBuf0[], dBuf1[];
//+------------------------------------------------------------------+
//| Indicator initialization function |
//+------------------------------------------------------------------+
void init() {
SetIndexArrow (0, 241);
SetIndexBuffer (0, dBuf0);
SetIndexEmptyValue(0, EMPTY_VALUE);
SetIndexStyle (0, DRAW_ARROW);
SetIndexArrow (1, 242);
SetIndexBuffer (1, dBuf1);
SetIndexEmptyValue(1, EMPTY_VALUE);
SetIndexStyle (1, DRAW_ARROW);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void start() {
double zz=0, zzold, S2Ma, S0Ma;
int LoopBegin, shift;
if (nBars==0) LoopBegin=Bars-500;
else LoopBegin=nBars;
LoopBegin=MathMin(Bars-500, LoopBegin);
for (shift=LoopBegin; shift>=0; shift--) {
if (zz!=0 && zz!=zzold) zzold=zz;
zz=iCustom(NULL, 0, "ZigZag", depth, deviation, backstep, 0, shift);
S2Ma=iMA(NULL, 0, per, 0, MODE_EMA, PRICE_CLOSE, shift+4);
S0Ma=iMA(NULL, 0, per, 0, MODE_EMA, PRICE_CLOSE, shift);
if (zz!=0 && zzold<zz && zz>S0Ma && zz>S2Ma && S2Ma>S0Ma) {
dBuf1[shift]=zz+5*Point;
}
if (zz!=0 && zzold>zz && zz<S0Ma && zz<S2Ma && S2Ma<S0Ma) {
dBuf0[shift]=zz-5*Point;
}
}
}
//+------------------------------------------------------------------+
Comments