How to extract only the bottoms turnaround points extracted by the zigzag indicator?

Back to topics list  | 1 2 3 To post a new topic, please log in or register
avatar
2408
deVries 2013.10.22 10:33 #
 
jackprobe:
Thank you deVries. will try it ...


and if you put something like

this inside your code ....


avatar
335
vx0532 2013.12.04 09:26 #
 
ubzen:

Here's what i came up with. I haven't checked deVries results above [was doing this when he posted].


hello, ubzen, I just see your code as below:

I don't know what is meaning of these two lines codes: if(Bottoms[shift]>0.1) Bottoms[shift]=Bottoms[shift]; if(Toppers[shift]>0.1) Toppers[shift]=Toppers[shift];

I find that it almost change nothing when I delete these two lines' codes, so I don't know why you add this two lines.

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_width1 1
#property indicator_color2 Yellow
#property indicator_width2 1

double Bottoms[];
double Toppers[];

int init()
{

   IndicatorBuffers(2);

   SetIndexStyle(0,DRAW_SECTION);
   SetIndexBuffer(0,Bottoms);
   SetIndexEmptyValue(0,0.0);

   SetIndexStyle(1,DRAW_SECTION);
   SetIndexBuffer(1,Toppers);
   SetIndexEmptyValue(1,0.0);

  IndicatorShortName("zz show top & bottom");
  return(0);
}

int deinit()
{
  return(0);
}

int start()
{
  int counted_bars=IndicatorCounted();
  int limit=0;
  limit = Bars-counted_bars;
  
  for(int shift=limit-1;shift>=0;shift--)
  {
    int ExtDepth=12; int ExtDeviation=5; int ExtBackstep=3;
    int ZigzagBuffer=0; int HighMapBuffer=1; int LowMapBuffer=2;
    
    Bottoms[shift]=iCustom(
        Symbol(),0,"ZigZag",
        ExtDepth, ExtDeviation, ExtBackstep,
        LowMapBuffer, shift
    );
    
    Toppers[shift]=iCustom(
        Symbol(),0,"ZigZag",
        ExtDepth, ExtDeviation, ExtBackstep,
        HighMapBuffer, shift
    );
    
    if(Bottoms[shift]>0.1) Bottoms[shift]=Bottoms[shift];
    if(Toppers[shift]>0.1) Toppers[shift]=Toppers[shift];
  }
  
  return(0);
}

avatar
2408
deVries 2013.12.04 09:45 #
 
vx0532:


hello, ubzen, I just see your code as below:

I don't know what is meaning of these two lines codes: if(Bottoms[shift]>0.1) Bottoms[shift]=Bottoms[shift]; if(Toppers[shift]>0.1) Toppers[shift]=Toppers[shift];

I find that it almost change nothing when I delete these two lines' codes, so I don't know why you add this two lines.


Zigzag with line at lows and line at highs
avatar
335
vx0532 2013.12.04 09:56 #
 


I write these below codes as below in EA

but when I test it in history data, "print" shows all 0, why?

for(int shift=99;shift>=0;shift--)
  {
    int ExtDepth=12; int ExtDeviation=5; int ExtBackstep=3;
    int ZigzagBuffer=0; int HighMapBuffer=1; int LowMapBuffer=2;
    
    Bottoms[shift]=iCustom(
        Symbol(),0,"ZigZag",
        ExtDepth, ExtDeviation, ExtBackstep,
        LowMapBuffer, shift
    );
    
    Toppers[shift]=iCustom(
        Symbol(),0,"ZigZag",
        ExtDepth, ExtDeviation, ExtBackstep,
        HighMapBuffer, shift
    );
    if(Bottoms[shift]>0.1) Bottoms[shift]=Bottoms[shift];
    if(Toppers[shift]>0.1) Toppers[shift]=Toppers[shift];
 }
 
 shift=0;
 while(shift<100)
 {
 Print("Bottoms,Toppers:",Bottoms[shift]," , ",Toppers[shift]);
 shift++;
 }

avatar
2408
deVries 2013.12.04 10:10 #
 

read my posting 1 page back

deVries 2013.10.19 12:13 #

https://forum.mql4.com/54660/page2#854926


//+------------------------------------------------------------------+
//|                                              ZigZag practise.mq4 |
//|                                Copyright © 2012, Tjipke de Vries |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2012, Tjipke de Vries"
#property link      ""

//---- input parameters  ZigZag
extern int ExtDepth=12;
extern int ExtDeviation=5;
avatar
335
vx0532 2013.12.04 10:46 #
 
deVries:

thanks deVries, I have know this matter after review your post .

So I get the conclusion we can use double array and variable to receive iCustom()'s return value in Indicator's codes; but we just can use variable to receive iCustom()'s return value in EA's codes.

your explain is that:"that are the wrong buffers and you have to find value of i at what bar the top or bottom will be"

my understanding is that in EA, when we use array x[i] to receive iCustom(), assignment is ok, but the bar of the assignment is uncertain.

so iCustom() not only return a value simply but other things, yes?

but I still don't understand the significance of the code: " if(Bottoms[shift]>0.1) Bottoms[shift]=Bottoms[shift]; if(Toppers[shift]>0.1) Toppers[shift]=Toppers[shift];"

avatar
2408
deVries 2013.12.05 15:41 #
 
vx0532:

thanks deVries, I have know this matter after review your post .

So I get the conclusion we can use double array and variable to receive iCustom()'s return value in Indicator's codes; but we just can use variable to receive iCustom()'s return value in EA's codes.

your explain is that:"that are the wrong buffers and you have to find value of i at what bar the top or bottom will be"

my understanding is that in EA, when we use array x[i] to receive iCustom(), assignment is ok, but the bar of the assignment is uncertain.

so iCustom() not only return a value simply but other things, yes?

but I still don't understand the significance of the code: " if(Bottoms[shift]>0.1) Bottoms[shift]=Bottoms[shift]; if(Toppers[shift]>0.1) Toppers[shift]=Toppers[shift];"


you're still strugling to get data from ZigZag indicator

why do you want me to explain what is not inside my code ??

why don't you research the code of

//+------------------------------------------------------------------+
//|                                              ZigZag practise.mq4 |
//|                                Copyright © 2012, Tjipke de Vries |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2012, Tjipke de Vries"
#property link      ""

//---- input parameters  ZigZag
extern int ExtDepth=12;
extern int ExtDeviation=5;

the whole code you can find one page back.... https://forum.mql4.com/54660/page2#854926

if you understand working of that code then it is simply using same method in EA's

 
avatar
12995
WHRoeder 2013.12.05 17:41 #
 
  1. deVries: the whole code you can find one page back....
    Don't say one page back, post the link to the exact post. It's the # sign right of your name (right click, copy link) one page back
  2. vx0532: but I still don't understand the significance of the code: " if(Bottoms[shift]>0.1) Bottoms[shift]=Bottoms[shift]; if(Toppers[shift]>0.1) Toppers[shift]=Toppers[shift];"
    What do you think the significance of "if(x>0.1) x=x;" means? Nothing! The corrected code later says:
        if(ZigZag[shift]>0.1 && Low[shift]==ZigZag[shift]) Bottoms[shift]=ZigZag[shift];
        if(ZigZag[shift]>0.1 && High[shift]==ZigZag[shift]) Toppers[shift]=ZigZag[shift];
    
avatar
2408
deVries 2013.12.05 19:48 #
 
WHRoeder:
  1. deVries: the whole code you can find one page back....
    Don't say one page back, post the link to the exact post. It's the # sign right of your name (right click, copy link) one page back
  2. vx0532: but I still don't understand the significance of the code: " if(Bottoms[shift]>0.1) Bottoms[shift]=Bottoms[shift]; if(Toppers[shift]>0.1) Toppers[shift]=Toppers[shift];"
    What do you think the significance of "if(x>0.1) x=x;" means? Nothing! The corrected code later says:

done https://forum.mql4.com/54660/page2#854926
avatar
1
spjuliman 2015.03.05 14:17 #
 

Dear All,

thanks for this wonderful discussion on the ZigZag and the codes. I would add a new spin to the discussion
For me it would be of great value if I could extract the high/low values calculated by the ZigZag
indicator (with a given, specific set of parameters) together with their times of occurrence to a text or csv file,
something like this: 

- Day, Time, High-Value, High(Boolean)
- Day, Time, Low-Value, Low(Boolean)

I would like to extract these values for further analysis in MS Excel in order to identify probabilities of
occurrence of time-periods and amplitudes in a chart. In the end, histograms will be created from
this data, indicating the "signature" of the value in the chart by identifying intrinsic time periods and
and intrinsic swing amplitudes.  

Maybe I am trying to reinvent the wheel here and there is code out there that does want I want to
do. If not, it would be worthwhile to develop such code. I am doing this type of analysis manually
with tons of charts every day, and I can clearly state that knowing the intrinsic signature of a value
vastly improves the chance to predict a change of direction. In my opinion, this process could be
easily automatized ... but I would need some help from people with programming experience. The
result would either be a handy-dandy indicator, or even an automatic MT4 EA (Expert Adviser)  
that trades at significant turning points.  

Would be nice to find someone here who is interested in a collaborative effort. But a few hints
on how to extract the data from the ZigZag indicator would also help. Many thanks! 

- spjuliman  

 

 

Back to topics list   | 1 2 3  

To add comments, please log in or register