how to get price value from Andrews pitchfork?

 
Could anyone help? how to get price value from Andrews pitchfork? manually or indicator drawn? objectget will not work.
 

You can get the three time/price points used to draw it. That is all.

To get values along the lines of the fork, you will have to calculate them from the original three points.

 
phy:

You can get the three time/price points used to draw it. That is all.

To get values along the lines of the fork, you will have to calculate them from the original three points.

thank you for your reply, I'm a newbie, if you could please write an sample line to show how to get value along the lines, many thanks in advance.

Actually, I don't know how it is drawn by the three time/price points, where to get the code for that?

 
MontS:

thank you for your reply, I'm a newbie, if you could please write an sample line to show how to get value along the lines, many thanks in advance.

Actually, I don't know how it is drawn by the three time/price points, where to get the code for that?

I don't know how to code but the values would have to be defined by you (there are at least two basic situations that I can think of: center point to High then upper point to next high and lower point to next low, or the inverse, with center to Low). Thereafter, the time/price values would depend on the timescale you'll be using (bar/line intersection).


Here's the exact definition found at https://forum.mql4.com/15281#101413:

The first trend line starts in a selected extreme left point (it is an important peak or trough) and is drawn exactly between two extreme right points. This line is the "handle" of pitchfork. Then, the second and the third trend line issuing from two above-mentioned extreme right points (important peak and trough) is drawn parallel to the first one. These lines are "tines" of the pitchfork.


So the three time/price points are centerpoint (the handle) at a HH or LL, then upper point at next HH and lower point at next LL (that would be the extremes).

 
Jeandl:
Could anyone help? how to get price value from Andrews pitchfork? manually or indicator drawn? objectget will not work.
#define MODE_FORK_MAIN 1
#define MODE_FORK_P2 2
#define MODE_FORK_P3 3

void Forkdraw(string name,datetime t1, double p1, datetime t2,double p2, datetime t3,double p3){
     ObjectDelete(name);
     ObjectCreate(name,OBJ_TREND,0,t1,p1,Time[(iBarShift(Symbol(),Period(),t2,false)+iBarShift(Symbol(),Period(),t3,false))/2],(p2+p3)/2);//,swings.value[0]);
     ObjectDelete(name+"P2");
     ObjectCreate(name+"P2",OBJ_TREND,0,t2,p2,Time[iBarShift(Symbol(),Period(),t2,false)-1],p2+(ObjectGetValueByShift(name,iBarShift(Symbol(),Period(),t2,false)-1)-ObjectGetValueByShift(name,iBarShift(Symbol(),Period(),t2,false))));    
     ObjectDelete(name+"P3");
     ObjectCreate(name+"P3",OBJ_TREND,0,t3,p3,Time[iBarShift(Symbol(),Period(),t3,false)-1],p3+(ObjectGetValueByShift(name,iBarShift(Symbol(),Period(),t3,false)-1)-ObjectGetValueByShift(name,iBarShift(Symbol(),Period(),t3,false))));
     
    
}
double ForkgetValueByShift(string name,int mode,int pos){
   switch(mode){
      case MODE_FORK_MAIN: return(ObjectGetValueByShift(name,pos));
      case MODE_FORK_P2  : return(ObjectGetValueByShift(name+"P2",pos));
      case MODE_FORK_P3  : return(ObjectGetValueByShift(name+"P3",pos));
   }
   return(0);
}
void Forkdelete(string name){
     ObjectDelete(name);
     ObjectDelete(name+"P2");     
     ObjectDelete(name+"P3");
}
void ForksetStyle(string name, int width=1, int style=1, color c=clrNONE){
   ObjectSet(name,OBJPROP_WIDTH,width);
   ObjectSet(name,OBJPROP_STYLE,style);
   ObjectSet(name,OBJPROP_COLOR,c);
   ObjectSet(name+"P2",OBJPROP_WIDTH,width);
   ObjectSet(name+"P2",OBJPROP_STYLE,style);
   ObjectSet(name+"P2",OBJPROP_COLOR,c);
   ObjectSet(name+"P3",OBJPROP_WIDTH,width);
   ObjectSet(name+"P3",OBJPROP_STYLE,style);
   ObjectSet(name+"P3",OBJPROP_COLOR,c);   
}

https://www.mql5.com/en/forum/132593#comment_16695633

Pitchfork and ObjectGetValueByShift
Pitchfork and ObjectGetValueByShift
  • 2011.03.24
  • www.mql5.com
Hi fellows, any way to get the values from the pitchfork or do i have to calculate the fork myself...