Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Point & Figure chart for Amibroker (AFL)
A great point and figure chart for Amibroker!
Author: Graham Kavanagh
Screenshots
Indicator / Formula
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | // Supersedes other P&F versions in this and yahoo files. // // P&F chart for V4.40 and above. Based on close prices. // // Problem resolved with boxes not being created at right prices due to the 9 // decimal place inaccuracies for numbers with decimals. This was causing a // problem creating the rising and falling boxes with the Ceil and Floor // functions. // // Place in indicator builder. Chart is compacted to the right end of the // chart space ending on last date bar. // // Box sizes and reverse can be changed near the beginning of the afl code // within the "Boxsize = IIF" statements. // //------------------------------------------------------------------------------ //AFL P&F Chart for Amibroker Indicator window. Based on High/low prices. //Based on code in AB help files //Reverse is 3 boxes. //Graham Kavanagh 30 Sep 2003 Version (4.40); SetBarsRequired (100000,100000); //Size for P&F boxes boxsize= IIf ( C <0.05, 0.001, IIf ( C >=0.05 AND C <0.1, 0.002, IIf ( C >=0.1 AND C <0.5, 0.005, IIf ( C >=0.5 AND C <2, 0.01, IIf ( C >=2 AND C <5, 0.02, IIf ( C >=5 AND C <10, 0.05, IIf ( C >=10 AND C <50, 0.1, IIf ( C >=50 AND C <100, 0.2, IIf ( C >=100 AND C <200, 0.5, IIf ( C >=200 AND C <500, 1, 2 )))))))))); Box = LastValue (boxsize); HX = round (( H /box)*10)/10; LX = round (( L /box)*10)/10; RH = floor (HX); FL = ceil (LX); // initialize first element j = 0; Reverse = 3; // reversal requirement PFC[j] = FL[0]; PFO[j] = PFC[j] + 1; 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++ ) { if ( FL[i] <= PFC[j]-1 && down) //continue down { PFC[j] = FL[i]; PFO[j] = PFC[j] + 1; } else { if ( RH[i] >= PFC[j] + Reverse && down) //Change direction to up { j++; swap = 1; PFC[j] = RH[i]; PFO[j] = PFC[j]-1; } } if ( RH[i] >= PFC[j] + 1 && up) //Continue up { PFC[j] = RH[i]; PFO[j] = PFC[j] - 1; } else { if ( FL[i] <= PFC[j] - Reverse && up) //Change direction to down { j++; PFC[j] = FL[i]; PFO[j] = PFC[j] + 1; 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 ); // High-Low range sets the height of the P&F bar H = IIf ( Ref (PFC,-1)> Ref (PFO,-1), Ref ( HHV (PFC,1),-1)-1, Max (PFO,PFC))*Box; L = IIf ( Ref (PFC,-1)< Ref (PFO,-1), Ref ( LLV (PFC,1),-1)+1, Min (PFO,PFC))*Box; O = IIf ( Ref (PFC,-1)> Ref (PFO,-1), Ref ( HHV (PFC,1),-1)-1, IIf ( Ref (PFC,-1)< Ref (PFO,-1), Ref ( LLV (PFC,1),-1)+1,PFO))*Box; // the difference between Open AND Close should be set to box size // the sign decides if X or O are plotted C = O + Box * IIf ( PFC > PFO, 1,-1); GraphXSpace = 2; Title = "No Jscript " + Name ()+ " PF HiLo, H: " + H + ", L: " + L + ", Box: " + box + ", Reversal: " + reverse; Plot ( C , "P&F Chart Close" , IIf ( PFC > PFO, colorBlue , colorRed ), styleCandle + styleNoLabel + stylePointAndFigure ); |
4 comments
Leave Comment
Please login here to leave a comment.
Back
too many errors (8)
Looks like keyword Reverse has been used as a variable. Replace it with Reverse_ and the P&F charts will work.
Thanks Carlin. It worked like charm
I have some problem in customize this code to 1 point reverse and get to this (missing column when price move up/move down 1 point). Can you help me to re-arrange this 1 point reverse chart? Please.

Thank you for the amazing code