/*
plot tomorrows pivots on an intraday database
original code by
patrickdoherty -
modified it to suit 4 hrly tf--ford 14 jan 2014
intraday pivots
Description:
I had been struggling with the code to Plot todays pivots from yesterdays price when using an intraday database. There were none available in the Amibroker library which plotted correctly the pivots for tomorrow on a intraday database. I checked the Amibroker forum AND found the following. Thank you goes to sdebu_2k. if you wish to go to the forum search for "plotting tomorrow pivots". This routine provides todays quotes in the Title bar AND holds the todays pivots constant in the Title bar as well. The plotted pivots moves to the next Day when entering into the next Day. Absolutely brilliant! Thank you.
Formula:
*/
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g,
Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +"
{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle |
ParamStyle("Style") | GetPriceStyle() );
H1=( TimeFrameGetPrice( "H", 4*inHourly, -1 ));
L1=(TimeFrameGetPrice( "L", 4*inHourly, -1 ));
C1=(TimeFrameGetPrice( "C", 4*inHourly, -1 ));
/*PIVOT Calculation*/
p = ( H1+ L1 + C1 )/3;
s1 = (2*p)-H1;
r1 = (2*p)-L1;
s2 = p -(H1 - L1);
s3 = S1 - (H1-L1);
r2 = p +(H1 - L1);
r3 = R1 +(H1-L1);
Plot (p,"Pivot 4hrly",25,1);
Plot (r1,"R14h",12,1);
Plot (r2,"R24h",12,1);
Plot (r3,"R34h",12,1);
Plot (s1,"S14h",3,1);
Plot (s2,"S24h",3,1);
Plot (s3,"S34h",3,1);