icustom ZigZag - page 3

 
怎么买或卖互换
Files:
 

HI ........ Zolero


I copy your suggested code (to cod3) and try to modify it and try to store but unable to success

actually i want to store values which is shown in chart no 0,1,2,3,4..... price value and time. later i want to plot support & resistance and fibonacci, trend lines ect. using these values.

my programing skills are not high to understand codes of other any help will highly appreciated.


Thanks.

 
//                                              SupRes_New_Test.mq4 
//                                 Copyright © 2008, Arshad Qureshi 
#property copyright "Copyright © 2008, Arshad Qureshi"
#property link      "http://www.metaquotes.net"

extern int ExtDepth=12;
extern int ExtDeviation=5;
extern int ExtBackstep=3;
//--- GV
//double p1=2.0, p2, p3, p4;
//datetime t1, t2, t3, t4;
//---------------------------------------------------------------- Init and Dinit functions
int init()
   {
   return(0);
   }
int deinit()
  {
   return(0);
  }
//------------------------------------------------------------------ expert start function
int start()
   {
   int n, i;
   double p0, p1, p2;
   i=0;
      while(n<2)
      {
      if(p0>0) {p2=p1; p1=p0;}
      p0=iCustom(Symbol(),0,"zigzag",ExtDepth,ExtDeviation,ExtBackstep,0,i);
      if(p0>0) n+=1;
      i++;
      }
      
//------------------------------------------------------------------- Drawing Begin
      ObjectDelete("Res");
      ObjectCreate("Res",OBJ_HLINE,0,0,p0);
      ObjectSet("Res",OBJPROP_COLOR,Blue);
      ObjectSet("Res",OBJPROP_WIDTH,1);
      ObjectSet("Res",OBJPROP_RAY,false);
      ObjectSetText("Res","Up & Price_0 "+p0,10,"Times New Roman",Green);

      ObjectDelete("Sup");
      ObjectCreate("Sup",OBJ_HLINE,0,0,p1);
      ObjectSet("Sup",OBJPROP_COLOR,Blue);
      ObjectSet("Sup",OBJPROP_WIDTH,1);
      ObjectSet("Sup",OBJPROP_RAY,false);
      ObjectSetText("Sup","Down & Price_1 "+p1,10,"Times New Roman",Green);
     
//------------------------------------------------------------------- Drawing End
   Comment("Price 0 : ",p0,", Price 1 : ",p1," Price 2 : ",p2);

   return(0);
  }
//+-------------------------------------------------------------------- expert end function
 
This code very simple but usefully. Thank a lot.
 

hi

how can i have more than the last 2 number in zigzag?

for ex 4 or 5 number?

i really need it?

 
   int n, i, 
   double p0, p1, p2, p3, p4, p5;
   i=0;
      while(n<5)
      {
      if(p0>0) {p5=p4; p4=p3; p3=p2; p2=p1; p1=p0; }
      p0=iCustom(Symbol(),0,"zigzag",ExtDepth,ExtDeviation,ExtBackstep,0,i);
      if(p0>0) {n+=1; }
      i++;
      }
 

thanks a lot for your help

it was really useful for me

and just more question that i hope somebody answer me

how can i change external parameters in zigzag when i use iCustom() {ExtDepth,ExtDiviation,ExtBackstep}

 
iCustom(Symbol(),0,"zigzag",your parameter,your parameter,your parameter,0,i);
 
thanks
 

Hi all,

i'm working on quite the same expert advisor. All what you show is clear but what logic do you use? because my logic is not quite accurate.

if(
        p4                    <  p3                   &&
        p4                    >  p2                   &&
        p4                    >  p1                   &&
        p3                    >  p2                   &&
        p3                    >  p1                   &&
        p2                    <  p1                   &&
        BUY                   <= Max_long_Orders      &&
        p3                    != p3_trade_long        && 
        CCI                   >  100                  &&
        Ask                   >= p3                   &&
        new_trade_allowed     == true                 &&
        buy_allowed           == true                      //trend check
       )

Can someone help me with this?

Many thanks in advance!

Regards Jason

 
zolero:
I modified a little bit zigzag code to show what I mean by false signal. like they say: one picture can tell more than 1000 words....


The red line is original zigzag and it goes from bottom to top and back again in best moments... at least seems like this. But if you are coding an ea then ea get's signals which are close to yellow line. it can be even worse as I made really quick hack...
the code is redrawing up or down line until next line has been drawed and so step by step changing yellow line (deleting max and min values) until you get a red line...

coud you please share your modified code?
Reason: