[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] Simplified, modified P&F chart



PureBytes Links

Trading Reference Links

LOL
If you can use that, good for you



Cheers,
Graham
http://groups.msn.com/ASXShareTrading
http://groups.msn.com/FMSAustralia
-----Original Message-----
From: Michael.S.G. [mailto:OzFalcon@xxxxxxxx] 
Sent: Wednesday, 6 August 2003 7:22 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Simplified, modified P&F chart


Simple  P&F chart.  

Color = IIf(O > C, colorRed, colorBlue );
Plot(C,"P&F",color, stylePointAndFigure);

<MSG>


At 04:50 PM 6/08/2003 +0800, you wrote:

Good to see you getting the P&F to suit your needs
Always thought I was more neanderthal than cromagnum though

Cheers,
Graham (aka Kaveman)
http://groups.msn.com/ASXShareTrading
http://groups.msn.com/FMSAustralia


-----Original Message-----
From: aequalsz [mailto:aequalsz@xxxxxxxxx] 
Sent: Wednesday, 6 August 2003 7:16 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Simplified, modified P&F chart


Here's my simplified version of P&F chart.  Original was by that Cro-Magnon
or Neandertal guy - can't remember his name. :-)
 
Cheers,

a  




{
Box = IIf(C>5000.0,100.0,
                      IIf(C<=2500.0 AND C>1000.0,50.0,
                      IIf(C<=1000.0 AND C>500.0,20.0,
                      IIf(C<=1000.0 AND C>500.0,5.0,
                      IIf(C<=500.0 AND C>100.0,2.0,
                      IIf(C<=100.0 AND C>20.0,1.0,
                      IIf(C<=20.0  AND C>10.0,0.50,
                      IIf(C<=10.0  AND C>5.0 ,0.50,
                      IIf(C<=5.0   AND C>0.0 ,0.25,2.0))))))))); 
Box=LastValue(box);
}
BoxInput = Param("Box Size",0.0,0.0,2.0,0.05);
Box = IIf(BoxInput != 0.0,BoxInput,Box);

eps = 0.0001;

// initialize first element
j = 0;

PFC[j] = Box*ceil(Low[0]/Box);
PFO[j] = PFC[j] + Box;
down = 1;                  // By default the first bar is a down bar.
up = 0;
swap = 0;

// perform the loop that produces PF Chart
for( i = 1; i < BarCount; i++ )
{

Reverse = Box * 3;                      // reversal requirement

 if( (Low[i]-eps) <= PFC[j]-Box && down)         //continue down
 {
  //PFC[j] = Box*floor(Low[i]/Box);
  PFC[j] = Box*ceil((Low[i]-eps)/Box);
  PFO[j] = PFC[j] + Box;
 }
 else
 {
  if( (High[i]+eps) >= PFC[j] + Reverse && down)  //Change direction to up
//? PFO ??????
  {
   j++;
   swap = 1;
   //PFC[j] = Box*ceil(High[i]/Box);
   PFC[j] = Box*floor((High[i]+eps)/Box);
   PFO[j] = PFC[j]-Box;
  }
 }
 if( (High[i]+eps) >= PFC[j] + Box && up)         //Continue up
 { 
  //PFC[j] = Box*ceil(High[i]/Box);
  PFC[j] = Box*floor((High[i]+eps)/Box);
  PFO[j] = PFC[j] - Box;
 }
 else
 {
  if( (Low[i]-eps) <= PFC[j] - Reverse && up)   //Change direction to
down
  {
   j++;
   //PFC[j] = Box*floor(Low[i]/Box);
   PFC[j] = Box*ceil((Low[i]-eps)/Box);
   PFO[j] = PFC[j] + Box;
   swap = 1;
  }
 }
 if( swap )
 {
  swap = 0;
  if( up )
  {
   up = 0;
   down = 1;
  }
  else
  {
   up = 1;
   down = 0;
  }
 }
}
delta = BarCount - j-1;

PFO = Ref( PFO, -delta );
PFC = Ref( PFC, -delta );
 
H = IIf(Ref(PFC,-1)>Ref(PFO,-1),Ref(HHV(PFC,1),-1)-Box,Max(PFO,PFC));
L = IIf(Ref(PFC,-1)<Ref(PFO,-1),Ref(LLV(PFC,1),-1)+Box,Min(PFO,PFC));
O =
IIf(Ref(PFC,-1)>Ref(PFO,-1),Ref(HHV(PFC,1),-1)-Box
,IIf(Ref(PFC,-1)<Ref(PFO,-1),Ref(LLV(PFC,1),-1)+Box,PFO));

C = O + Box * IIf( PFC > PFO, 1,-1);

H = H + Box/2.0;
L = L - Box/2.0;

GraphXSpace = 1;
Hdec = IIf(H<0.5,1.3,1.2); Ldec = IIf(L<0.5,1.3,1.2); Bdec =
IIf(Box<0.01,1.3,1.2);
  
Title = Name() + " " + Date() + "  PF Hi-Low, H: $" +
WriteVal(H,LastValue(Hdec))+ ", L: $" + WriteVal(L,LastValue(Ldec)) + ",
Box: $" + WriteVal(box,LastValue(Bdec)) + " Reversal: " +
WriteVal(Reverse/box,1);

Plot(C, "P&F Chart Close", IIf( PFC > PFO, colorBlue, colorRed ),
styleCandle + styleNoLabel + stylePointAndFigure);


Yahoo! Groups Sponsor
ADVERTISEMENT




Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/