Hi Tony --

This is probably not the answer to all the questions you asked, but here is
afl code to plot the pivot points for tomorrow one day ahead.

----------------------------

//    PivotPoints.afl
//
//    Traditional pivot points.
//    Thought by some to indicate levels of support
//    and resistance.
//R2 = P + (H - L) = P + (R1 - S1)
//R1 = (P x 2) - L
//P = (H + L + C) / 3
//S1 = (P x 2) - H
//S2 = P - (H - L) = P - (R1 - S1)
P = (H + L + C) / 3;
R1 = (P * 2) - L;
S1 = (P * 2) - H;
R2 = P + (R1 - S1); // P + (H - L)
S2 = P - (R1 - S1); // P - (H - L)
Plot(C,"C",colorBlack,styleCandle);
//    Displace the plot of the pivot points one bar
//    to the right.
//    Pivot points are based on the current bar,
//    but are thought to provide indication of
//    support and resistance for the next bar.
//
Displace=1;
Plot(R2,"R2",colorRed,styleLine,0,0,Displace);
Plot(R1,"R1",colorPink,styleLine,0,0,Displace);
Plot(P,"P",colorBlue,styleLine,0,0,Displace);
Plot(S1,"S1",colorPaleGreen,styleLine,0,0,Displace);
Plot(S2,"S2",colorGreen,styleLine,0,0,Displace);
//Figure 8.5 Pivot Points

------------------------------

Thanks,
Howard
www.quantitativetradingsystems.com

On Thu, Feb 21, 2008 at 3:24 PM, Tony <[EMAIL PROTECTED]> wrote:

>   Hi,
> I am hoping to have someone point me in the correct direction.
> Below is my intraday code to compute tomorrows pivot points and
> S1,S2,S3
> R1,R2,R3
> In the title line of my intraday chart is displayed daily cummulative
> quotes for close open volume etc and tomorrows pivots.
> see code below
>
> even though my price graph is in 5 minute timeframe increments i
> switch to a daily time frame to compute yesterdays close, high and
> low and am able to compute the pivots for the following day correctly.
>
> i have 2 questions which i hope someone can answer:
> 1) i need to click twice on a bar to get the values to display on
> the title for price chart (the first click shows most of the fields
> as empty values). why? may i get around this?
> 2) i tried using the plot command(see last line of code). i expected
> a single straight line plotted on my intraday chart ( a different one
> for each day). But i think i cannot plot it correctly since each of
> the arrays is in daily timeframe rather than 5 minute timeframe(which
> is the display timeframe for the chart.) would populating an array
> with the same value for all the intraday timeframe fix the problem?
> which command do i use to do this? or is there a better way
>
> Thank you in advance for your help and consideration
> Tony
>
> // compute pivot points for next day when using intraday charts
> TimeFrameSet( inDaily ); // switch to daily frame
> OpenDailyYest = Ref(Open ,-1);
> CloseDailyYest = Ref(Close,-1);
> HighDailyYest = Ref(High ,-1);
> LowDailyYest = Ref(Low ,-1);
>
> OpenDaily = Open ;
> CloseDaily = Close ;
> HighDaily = High ;
> LowDaily = Low ;
> VolumeDaily= Volume;
> TimeFrameRestore() ; // restore time frame to original
>
> PP = (HighDailyYest + LowDailyYest + CloseDailyYest) / 3;
> R1 = (2 * PP) - LowDailyYest ;
> S1 = (2 * PP) - HighDailyYest ;
> R2 = PP + (R1 - S1);
> S2 = PP - (R1 - S1);
> R3 = HighDailyYest + 2*(PP - LowDailyYest );
> S3 = LowDailyYest - 2*(HighDailyYest - PP);
>
> Title = Name() + " " + Date() + " Close="+ WriteVal
> (CloseDaily ,5.2)+ "
> Days Open = "+ WriteVal (OpenDaily ,5.2)+ "
> Days Gain/Loss= "+ WriteVal ((closeDaily-ref(closeDaily,-1)),2.3)+ "
> Days High = "+ WriteVal (HighDaily,5.2)+ "
> Days Low = "+ WriteVal (LowDaily,5.2)+ "
> Days Volume = "+ WriteVal (volumeDaily,10.0)+"
> Days Range = "+ WriteVal (highDaily-lowDaily,8.2)+"
> //DaysDelta= "+ WriteVal (close-open,8.2)+"
> TomorrowPP= "+ WriteVal (PP,8.2)+"
> TomorrowS1= "+ WriteVal (S1,8.2)+"
> TomorrowS2= "+ WriteVal (S2,8.2)+"
> TomorrowS3= "+ WriteVal (S3,8.2)+"
> TomorrowR1= "+ WriteVal (R1,8.2)+"
> TomorrowR2= "+ WriteVal (R2,8.2)+"
> TomorrowR3= "+ WriteVal (R3,8.2) ;
> Plot (PP,"PP",colorRed);
>
>  
>

Reply via email to