double value = iCustom(Symbol(), 0, "Dinapoli ZZ (ZigZag)", 300, 15, 0, i);
Where i is the shift of the bar you wish to inspect.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
can anyone tell me the icustom to read this in an ea?
//+------------------------------------------------------------------+
//| Dinapoli ZZ (ZigZag).mq4 |
//| rewritten by CrazyChart |
//| |
//+------------------------------------------------------------------+
#property copyright "rewritten by CrazyChart"
#property link ""
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Magenta
#property indicator_width1 4
//---- input parameters
extern int barn=300;
extern int Length=15;//was 6, was 30
//---- buffers
double ExtMapBuffer1[];
double prev;
double alertBar;
extern int SoundAlertMode = 1;
// extern int fibolines=1;
int LastZigZag, PreviousZigZag;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexEmptyValue(0,0.0);
//SetIndexDrawBegin(0, barn);
SetIndexStyle(0,DRAW_SECTION);
SetIndexBuffer(0,ExtMapBuffer1);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
// ObjectDelete("Fibo");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int shift,Swing,Swing_n,uzl,i,zu,zd,mv;
double LL,HH,BH,BL,NH,NL;
double Uzel[10000][3];
string text;
// loop from first bar to current bar (with shift=0)
Swing_n=0;Swing=0;uzl=0;
BH =High[barn];BL=Low[barn];zu=barn;zd=barn;
for (shift=barn;shift>=0;shift--) {
LL=10000000;HH=-100000000;
for (i=shift+Length;i>=shift+1;i--) {
if (Low< LL) {LL=Low;}
if (High>HH) {HH=High;}
}
if (Low[shift]HH){
Swing=2;
if (Swing_n==1) {zu=shift+1;}
if (Swing_n==-1) {zd=shift+1;}
} else {
if (Low[shift]<LL) {Swing=-1;}
if (High[shift]>HH) {Swing=1;}
}
if (Swing!=Swing_n && Swing_n!=0) {
if (Swing==2) {
Swing=-Swing_n;BH = High[shift];BL = Low[shift];
}
uzl=uzl+1;
if (Swing==1) {
Uzel[uzl][1]=zd;
Uzel[uzl][2]=BL;
}
if (Swing==-1) {
Uzel[uzl][1]=zu;
Uzel[uzl][2]=BH;
}
BH = High[shift];
BL = Low[shift];
}
if (Swing==1) {
if (High[shift]>=BH) {BH=High[shift];zu=shift;}}
if (Swing==-1) {
if (Low[shift]<=BL) {BL=Low[shift]; zd=shift;}}
Swing_n=Swing;
}
for (i=1;i<=uzl;i++) {
//text=DoubleToStr(Uzel[1],0);
//text=;
mv=StrToInteger(DoubleToStr(Uzel[1],0));
// if(fibolines> 0 ) {
// ObjectDelete("Fibo");
// ObjectCreate("Fibo", OBJ_FIBO, 0, Time[PreviousZigZag], ExtMapBuffer1[LastZigZag], Time[LastZigZag], ExtMapBuffer1[PreviousZigZag]);}
// ObjectCreate("Fibo", OBJ_FIBO, 0, Time[shift], ExtMapBuffer1[Swing], Time[Swing], ExtMapBuffer1[shift]);}
// ObjectCreate("Fibo", OBJ_FIBO, 0, Time[mv],prev, Time, Uzel[2]);}
if(i==13 && prev > Uzel[2] && ExtMapBuffer1[mv]!=Uzel[2] && SoundAlertMode > 0 && Bars>alertBar) {Alert("Dinap Simple ZigZag going Down on ",Symbol()," Period ",Period());alertBar = Bars;}
if(i==13 && prev < Uzel[2] && ExtMapBuffer1[mv]!=Uzel[2] && SoundAlertMode > 0 && Bars>alertBar) {Alert("Dinap Simple ZigZag going Up on ",Symbol()," Period ",Period());alertBar = Bars;}
ExtMapBuffer1[mv]=Uzel[2];
LastZigZag=Uzel[2];
prev=Uzel[2];
PreviousZigZag=prev;
}
return(0);
}
//+------------------------------------------------------------------+