PureBytes Links
Trading Reference Links
|
Bill,
Change the boxsize in AB to 10 to see if that makes a difference. Most PnF charting apps have boxsize modified automatically. You will have to manually change it here.
Regards, Peter
On 4/23/07, wavemechanic <fimdot@xxxxxxxxx> wrote:
apfxtrader:
I checked your code against StockCharts chart (
http://stockcharts.com/def/servlet/SC.pnf?chart=$NDX,PLTADANRBO[PA][D][F1!3!!!2!20]&pref=G)
for ^NDX. Screen shots of both are attached. As you can see, the
number of columns (and reversal levels) is different. For example, looking
at the more recent columns (from the last major drop), StockCharts has 8 columns
and your code produces 16. Might there be a factor of two difference
somewhere? I played around with the four "/ 2" in the code but that did
not seem to have any effect. Any idea what is going
on?
Bill
----- Original Message -----
Sent: Monday, April 23, 2007 12:46
PM
Subject: [amibroker] Re: Identifying Pnf
Patterns
SUNW P&F Chart
(Box=1, Reverse = 3)
Below is the code to chart only
Stocks. You can control the right margin space for PF Chart,
Last value close, Horizontal Grid, and Price Axis through
variables:
shiftChart =0; shiftLastClose
=1; shiftGrid =7; shiftPriceAxis =
2;
//-----------COPY
HERE-------------------------------------------
GraphXSpace =
5;
SetChartBkColor(ParamColor("BackGroundColor",
colorBlack)); GraphColor =
ParamColor("GarphColor",colorLightGrey); GridColor =
ParamColor("GridColor", ColorRGB(39,49, 67) );
Box =Param("Box", 1,
0.2, 5, 0.2);
shiftChart =0; shiftLastClose =1; shiftGrid
=7; shiftPriceAxis = 2;
Reverse = Param("Reverse", 3, 1,
5); j = 0; PFL[0] = Box * ceil(Low[0]/Box) + Box; PFH[0] = Box *
floor(High[0]/Box); direction = 0;
for( i = 1; i < BarCount;
i++ ) { if(direction[j] == 0) { if(Low[i] <= PFL[j] -
Box) { PFL[j] = Box * ceil(Low[i]/Box); } else { if(High[i]
>= PFL[j] + Reverse*Box) { j++; direction[j] = 1; PFH[j] = Box
* floor(High[i]/Box); PFL[j] = PFL[j - 1] +
Box;
} } } else { if(High[i] >= PFH[j] +
Box) {
PFH[j] = Box * floor(High[i]/Bx); } else { if( Low[i]
<= PFH[j] - Reverse * Box ) { j++; direction[j] = 0; PFH[j] =
PFH[j - 1] - Box; PFL[j] = Box *
ceil(Low[i]/Box);
} } } } delta = BarCount - j
-1; direction = Ref(direction, - delta); Hi = Ref(PFH, -delta) +
Box/2; Lo = Ref(PFL, -delta)- Box/2; Cl = IIf(direction == 1, Hi,
Lo); Op = IIf(direction == 1, Cl - Box, Cl +
Box);
PlotOHLC(Op, Hi, Lo, Cl,"", GraphColor ,
stylePointAndFigure|styleNoLabel, 0, 0 ,shiftChart);
Last =
Ref( LastValue(C), -(BarCount-1)); Plot( Last,"",
colorRed,styleNoLine|styleDots, 0 , 0, shiftLastClose);
// selected
value Value= IIf(direction>0, SelectedValue(Hi)-box/2,
SelectedValue(Lo)+box/2);
//----------------------------------------------------------------------- //
GRID
CONSTRUCTION //----------------------------------------------------------------------
PlotGridLines
= ParamToggle("PlotdGid", "Yes|No", 0);
if
(PlotGridLines) { begin = SelectedValue(BarIndex()); end =
LastValue(BarIndex()); period = end-begin +1;
if(
begin<end) {
ScreenHigh =LastValue( HHV(cl, period )) +
box; ScreenLow =LastValue( LLV( Cl, period) )-box;
top=
LineArray( begin-shiftGrid, screenHigh, end, screenhigh, 0 , 1); Bot=
LineArray( begin-shiftGrid, screenlow, end, screenLow, 0, 1);
Plot(
top, "", gridColor,styleLine|styleNoLabel , 0, 0,shiftGrid); Plot( bot, "",
gridColor,styleLine|styleNoLabel, 0 , 0 ,
shiftGrid);
VerticalGrid = IIf ( BarIndex() >= begin,
IIf(direction==1, screenHigh, screenLow), Null);
Plot (VerticalGrid,
"", gridColor, styleStaircase|styleNoLabel, 0,0,
1);
format = 8.2;
//while ( LastValue(bot)< LastValue(top)-0.5*box)
for ( n=LastValue(bot); n< LastValue(top); n =
n+box) { &nbp;
Plot( bot , "", gridColor,
styleLine|styleNoLabel, 0, 0 ,shiftGrid);
text = NumToStr(LastValue(bot) +
0.5*box, format); xposition =
BarCount+shiftPriceaxis; yPosition =
LastValue(bot)+0.27*box;
PlotText(text, xPosition , yPosition,
colorWhite);
bot = bot + box;
}
}
}
//--------------------------------------------------------------------- //
TITLE
//----------------------------------------------------------------------
Title
= "\n" + " Instrument : " + Name() + FullName()+"\n " + "Formula
: " + " Point & Figure (High/Low Range)" + "\n " + "Box : "
+ NumToStr(Box, 4.4) + " " + "Reverse :
" + NumToStrReverse, 2.0) + "\n " + "ATR : " +
WriteVal(LastValue(ATR(100)), format = 4.4);
No virus found in this incoming message. Checked by AVG Free
Edition. Version: 7.5.446 / Virus Database: 269.5.1/765 - Release Date:
4/17/2007 5:20 PM
__._,_.___
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
SPONSORED LINKS
__,_._,___
|