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

Method to determine P&F box size



PureBytes Links

Trading Reference Links







I use P&F boxes in my trading system and have
always sorted them out by some rough norms. I decided to try my hand at a
calculation to size them for me to save a bit of time. It is based around the
ASX where most stocks are in the lower price brackets. I have used a 2 year
basis for the P&F charts as this gives me enough for my charting. This
calculation is based around the average close price and the mean and range of
the price over the time period.

Any comments on what I have done?

Tomasz I noticed the P&F afl in the new
amibroker, looking ok. Can it be altered to use the closing prices only. I have
not looked at it in any depth yet and realise you included it as an example
only of how to use the new chart code. 

<span lang=EN-AU
> 

Graham

 

 

<font
size=2 color=green face="Courier New">//Size for P&F boxes
based on average change of close price and the average close price, and the
range of close price over the period<font size=2 color=black
face="Courier New">

<font
size=2 color=black face="Courier New"> 

<font
size=2 color=black face="Courier New">first=<font
size=2 color=blue face="Courier New">Cum<font
size=2 color=black face="Courier New">(<font size=2
color=fuchsia face="Courier New">1<font
size=2 color=black face="Courier New">);

<font
size=2 color=black face="Courier New">period=<font
size=2 color=blue face="Courier New">Min<font
size=2 color=black face="Courier New">(<font size=2
color=fuchsia face="Courier New">520<font
size=2 color=black face="Courier New">,first);

<font
size=2 color=black face="Courier New">mean = (<font
size=2 color=blue face="Courier New">HHV<font
size=2 color=black face="Courier New">(C,period)+<font size=2 color=blue
face="Courier New">LLV<font size=2 color=black
face="Courier New">(C,period))/<font
size=2 color=fuchsia face="Courier New">2<font
size=2 color=black face="Courier New">;

<font
size=2 color=black face="Courier New">range = (<font
size=2 color=blue face="Courier New">HHV<font
size=2 color=black face="Courier New">(C,period)-<font size=2 color=blue
face="Courier New">LLV<font size=2 color=black
face="Courier New">(C,period));

<font
size=2 color=black face="Courier New">Change0 = <font
size=2 color=blue face="Courier New">MA<font size=2
color=black face="Courier New">(<font size=2 color=blue
face="Courier New">abs<font size=2 color=black
face="Courier New">(C-<font
size=2 color=blue face="Courier New">Ref<font
size=2 color=black face="Courier New">(C,-<span
>1<span
>)),period);

<font
size=2 color=black face="Courier New">Ratio = <font
size=2 color=blue face="Courier New">IIf<font
size=2 color=black face="Courier New">(range<mean, <font
size=2 color=blue face="Courier New">Max<font
size=2 color=black face="Courier New">(range/mean,<font
size=2 color=fuchsia face="Courier New">0.6<font
size=2 color=black face="Courier New">),<font
size=2 color=blue face="Courier New">IIf<font
size=2 color=black face="Courier New">(range>mean, <font
size=2 color=blue face="Courier New">Min<font
size=2 color=black face="Courier New">(range/mean,<font
size=2 color=fuchsia face="Courier New">1.1<font
size=2 color=black face="Courier New">),range/mean));

<font
size=2 color=black face="Courier New">Change=Change0*ratio;

<font
size=2 color=black face="Courier New"> 

<font
size=2 color=black face="Courier New">box = <font
size=2 color=blue face="Courier New">IIf<font
size=2 color=black face="Courier New">(mean<=<font
size=2 color=fuchsia face="Courier New">10<font
size=2 color=black face="Courier New">,<font size=2
color=blue face="Courier New">Max<font size=2 color=black
face="Courier New">(<font size=2 color=blue
face="Courier New">int<font size=2 color=black
face="Courier New">(change)+<font size=2
color=blue face="Courier New">round<font size=2
color=black face="Courier New">(<font size=2 color=blue
face="Courier New">frac<font size=2 color=black
face="Courier New">(Change)*<font size=2
color=fuchsia face="Courier New">10<font
size=2 color=black face="Courier New">)/<font
size=2 color=fuchsia face="Courier New">10<font
size=2 color=black face="Courier New">,<font size=2
color=fuchsia face="Courier New">0.1<font
size=2 color=black face="Courier New">),

<font
size=2 color=blue face="Courier New">IIf<font
size=2 color=black face="Courier New">(mean><font
size=2 color=fuchsia face="Courier New">10<font
size=2 color=black face="Courier New"> AND mean<=<font size=2 color=fuchsia
face="Courier New">20<font size=2
color=black face="Courier New">,<font size=2 color=blue
face="Courier New">Max<font size=2 color=black
face="Courier New">(<font size=2 color=blue
face="Courier New">int<font size=2 color=black
face="Courier New">(Change)+<font size=2
color=blue face="Courier New">round<font size=2
color=black face="Courier New">(<font size=2 color=blue
face="Courier New">frac<font size=2 color=black
face="Courier New">(Change)*<font size=2
color=fuchsia face="Courier New">10<font
size=2 color=black face="Courier New">)/<font
size=2 color=fuchsia face="Courier New">10<font
size=2 color=black face="Courier New">,<font size=2
color=fuchsia face="Courier New">0.1<font
size=2 color=black face="Courier New">), 

<font
size=2 color=blue face="Courier New">IIf<font
size=2 color=black face="Courier New">(mean><font
size=2 color=fuchsia face="Courier New">20<font
size=2 color=black face="Courier New"> AND mean<=<font size=2 color=fuchsia
face="Courier New">30<font size=2
color=black face="Courier New">,<font size=2 color=blue
face="Courier New">Max<font size=2 color=black
face="Courier New">(<font size=2 color=blue
face="Courier New">int<font size=2 color=black
face="Courier New">(Change)+<font size=2
color=blue face="Courier New">round<font size=2
color=black face="Courier New">(<font size=2 color=blue
face="Courier New">frac<font size=2 color=black
face="Courier New">(Change)/<font size=2
color=fuchsia face="Courier New">5<font
size=2 color=black face="Courier New">*<font size=2
color=fuchsia face="Courier New">10<font
size=2 color=black face="Courier New">)*<font
size=2 color=fuchsia face="Courier New">5<font
size=2 color=black face="Courier New">/<font size=2
color=fuchsia face="Courier New">10<font
size=2 color=black face="Courier New">,<font size=2
color=fuchsia face="Courier New">0.1<font
size=2 color=black face="Courier New">), 

<font
size=2 color=blue face="Courier New">IIf<font
size=2 color=black face="Courier New">(mean><font
size=2 color=fuchsia face="Courier New">30<font
size=2 color=black face="Courier New"> AND mean<=<font size=2 color=fuchsia
face="Courier New">50<font size=2
color=black face="Courier New">,<font size=2 color=blue
face="Courier New">Max<font size=2 color=black
face="Courier New">(<font size=2 color=blue
face="Courier New">int<font size=2 color=black
face="Courier New">(Change)+<font size=2
color=blue face="Courier New">round<font size=2
color=black face="Courier New">(<font size=2 color=blue
face="Courier New">frac<font size=2 color=black
face="Courier New">(Change)/<font size=2
color=fuchsia face="Courier New">5<font
size=2 color=black face="Courier New">*<font size=2
color=fuchsia face="Courier New">10<font
size=2 color=black face="Courier New">)*<font
size=2 color=fuchsia face="Courier New">5<font
size=2 color=black face="Courier New">/<font size=2
color=fuchsia face="Courier New">10<font
size=2 color=black face="Courier New">,<font size=2
color=fuchsia face="Courier New">0.2<font
size=2 color=black face="Courier New">), 

<font
size=2 color=blue face="Courier New">IIf<font
size=2 color=black face="Courier New">(mean><font
size=2 color=fuchsia face="Courier New">50<font
size=2 color=black face="Courier New"> AND mean<=<font size=2 color=fuchsia
face="Courier New">200<font size=2
color=black face="Courier New">,<font size=2 color=blue
face="Courier New">Max<font size=2 color=black
face="Courier New">(<font size=2 color=blue
face="Courier New">round<font size=2
color=black face="Courier New">(Change),<font size=2
color=fuchsia face="Courier New">0.5<font
size=2 color=black face="Courier New">),

<font
size=2 color=blue face="Courier New">IIf<font
size=2 color=black face="Courier New">(mean><font
size=2 color=fuchsia face="Courier New">200<font
size=2 color=black face="Courier New"> AND mean<=<font size=2 color=fuchsia
face="Courier New">500<font size=2
color=black face="Courier New">,<font size=2 color=blue
face="Courier New">Max<font size=2 color=black
face="Courier New">(<font size=2 color=blue
face="Courier New">round<font size=2
color=black face="Courier New">(Change),<font size=2
color=fuchsia face="Courier New">1<font
size=2 color=black face="Courier New">),

<font
size=2 color=blue face="Courier New">IIf<font
size=2 color=black face="Courier New">(mean><font
size=2 color=fuchsia face="Courier New">500<font
size=2 color=black face="Courier New"> AND mean<=<font size=2 color=fuchsia
face="Courier New">1000<font size=2
color=black face="Courier New">,<font size=2 color=blue
face="Courier New">Max<font size=2 color=black
face="Courier New">(<font size=2 color=blue
face="Courier New">round<font size=2
color=black face="Courier New">(Change),<font size=2
color=fuchsia face="Courier New">1<font
size=2 color=black face="Courier New">),

<font
size=2 color=blue face="Courier New">IIf<font
size=2 color=black face="Courier New">(mean><font
size=2 color=fuchsia face="Courier New">1000<font
size=2 color=black face="Courier New"> AND mean<=<font size=2 color=fuchsia
face="Courier New">2000<font size=2
color=black face="Courier New">,<font size=2 color=blue
face="Courier New">Max<font size=2 color=black
face="Courier New">(<font size=2 color=blue
face="Courier New">round<font size=2
color=black face="Courier New">(Change),<font size=2
color=fuchsia face="Courier New">2<font
size=2 color=black face="Courier New">),

<font
size=2 color=blue face="Courier New">Max<font
size=2 color=black face="Courier New">(<font size=2
color=blue face="Courier New">round<font size=2
color=black face="Courier New">(Change/<font size=2
color=fuchsia face="Courier New">5<font
size=2 color=black face="Courier New">)*<font
size=2 color=fuchsia face="Courier New">5<font
size=2 color=black face="Courier New">,<font size=2
color=fuchsia face="Courier New">5<font
size=2 color=black face="Courier New">)))))))));

<font
size=2 color=black face="Courier New"> 

<font
size=2 color=black face="Courier New">box = <font
size=2 color=blue face="Courier New">IIf<font
size=2 color=black face="Courier New">(box<<font
size=2 color=fuchsia face="Courier New">0.1<font
size=2 color=black face="Courier New">,<font size=2
color=fuchsia face="Courier New">0.1<font
size=2 color=black face="Courier New">,box);

<font
size=2 color=black face="Courier New"> 

<font
size=2 color=black face="Courier New">Filter<font
size=2 color=black face="Courier New"> = Change><font
size=2 color=fuchsia face="Courier New">0<font
size=2 color=black face="Courier New">;

<font
size=2 color=blue face="Courier New">AddColumn<font
size=2 color=black face="Courier New">(Box,<font
size=2 color=fuchsia face="Courier New">"Box
Size"<span
>,<span
>1.1<span
>);

<font
size=2 color=black face="Courier New"> 

 





<font size=2
face="Courier New">To
unsubscribe from this group, send an email to:<font size=2
face="Courier New">
amibroker-afl-unsubscribe@xxxxxxxxxxxxxxx



Your use of Yahoo! Groups is subject to the <a
href="">Yahoo! Terms of Service.<span
>