Pivot indicator

 

This is my Pivot indicator.

I'm sure you know very well the Pivots and its importance.

The indicator calculates the daily pivot (the yesterday pivot) and draw it with the 3 Resistances and the 3 Supports.

It use the Standard Pivot Formula:

Pivot = (yesterday_high + yesterday_low + yesterday_close)/3


xpPivot

 

Here's the new version with Alerts.

XP Pivot Alerts

I hope to hear your comments!

 
Hi.. is there a way to add to the label the price as well? I tried adding %$ but it didn't help. Please advise.
 
jb1981:
Hi.. is there a way to add to the label the price as well? I tried adding %$ but it didn't help. Please advise.

Try something like this . . .

   if(PivotLineCrossAlert && Low[0] < p && High[0] > p) 
   AlertOnce("Pivot Tocuh - Price has tocuhed the Pivot line  @ "+  DoubleToStr(p, Digits)  +" "+Symbol()+"-"+PeriodToText(),0);

   if(R1LineCrossAlert && Low[0] < r1 && High[0] > r1) 
   AlertOnce("R1 Tocuh - Price has tocuhed the R1 line  @ "+  DoubleToStr(r1, Digits)  +" "+Symbol()+"-"+PeriodToText(),1);
   
etc . . . 
 

RaptorUK.. thanks, but i'm kind of relatively new to coding MQL4. I was just reading up on ObjectSet property but it didn't help much. Also the code you posted is more of an alert. I simply want to display the price next to the label for the pivots.

Thanks.

 
jb1981:

RaptorUK.. thanks, but i'm kind of relatively new to coding MQL4. I was just reading up on ObjectSet property but it didn't help much. Also the code you posted is more of an alert. I simply want to display the price next to the label for the pivots.

Thanks.

Ah I see . . .  you asked about adding the price,  I assumed you meant to the Alert.
 

So i'm looking at this piece of line.

drawLine(s1,"S1",Maroon,0,0);
   drawLabel("S_1 -", s1,Maroon);


So the display should be S_1 - PRICE for example.

 

Try these changes . . .

   drawLine(r3,"R3", R3Color,0,R3Width);
   drawLabel("Resistance 3 - "+DoubleToStr(r3, Digits),r3,R3Color);
   drawLine(r2,"R2", R2Color,0,R2Width);
   drawLabel("Resistance 2 - "+DoubleToStr(r2, Digits),r2,R2Color);
   drawLine(r1,"R1", R1Color,0,R1Width);
   drawLabel("Resistance 1 - "+DoubleToStr(r1, Digits),r1,R1Color);

   drawLine(p,"PIVIOT",PivotColor,1,PivotWidth);
   drawLabel("Piviot level - "+DoubleToStr(p, Digits),p,PivotColor);

   drawLine(s1,"S1",S1Color,0,S1Width);
   drawLabel("Support 1 - "+DoubleToStr(s1, Digits),s1,S1Color);
   drawLine(s2,"S2",S2Color,0,S2Width);
   drawLabel("Support 2 - "+DoubleToStr(s2, Digits),s2,S2Color);
   drawLine(s3,"S3",S3Color,0,S3Width);
   drawLabel("Support 3 - "+DoubleToStr(s3, Digits),s3,S3Color);
 
jb1981:

So i'm looking at this piece of line.

drawLine(s1,"S1",Maroon,0,0);
   drawLabel("S_1 -", s1,Maroon);


So the display should be S_1 - PRICE for example.


Yep,  well done,  you were on the right track.  :-)
 
Brilliant. Was almost there. Thanks a ton for your assistance!!!
 
Raptor... sorry to bother you but one more fix. How do I push the labels so they are aligned to the right side of the chart?
Reason: