Purpose of rpnf

rpnf is a collection of R functions for creating Point & Figure (P&F) charts and statistics for a given time series.

--------+---------------------------
   53.00|    X         X X              
   52.00|    XO        XOXO+            
   51.00|    XO        XOXO +           
   50.00|X+X XOX     X XOXO  +          
   49.00| OXOXOXO+   XOXO O   +         
   48.00| OXOXOXO +  XOX  O    +   X <==
   47.00| OXOXO O  + XOX  OX    +  X    
   46.00| OXO   OX  +XOX +OXO    + X    
   45.00| OX   +OXOX XO + OXO    X+X    
   44.00| OX  + OXOXOX +  O O  X XOX    
   43.00| OX +  OXOXOX+     OX XOXOX    
   42.00| OX+   O OXO       OXOXOXOX    
   41.00| O       O         OXOXO OX    
   40.00|                   OXOX  OX    
   39.00|                   OXO   O     
   38.00|                   OX          
   37.00|                   OX          
   36.00|                   OX          
   35.00|                   O           
--------+---------------------------
       Y|111111111111111111111111111
       Y|444444444555555555555555555
        |                           
       M|111111111000000000000000000
       M|000001222111133677788889999
        |                           
       D|011232001012202211212220023
       D|906316598558967947925671830

Features of rpnf

rpnf allows the creation of P&F charts and statistics with the following features

How to install rpnf

  1. We are asuming you have R installed and working. If not please consult one of well written howto’s.
  2. Go to the R console, or your favorite R-IDE (we recommend http://www.rstudio.com)
  3. Install latest stable version of rpnf with

    install.packages("rpnf")
  4. rpnf is now installed, and you can continue with the getting started section.

Getting the latest development version from Rforge

If you want to use (for a good reason) the latest development version from Rforge, then you can install it with:

install.packages("rpnf", repos="http://R-Forge.R-project.org")

How to get started with rpnf

Once rpnf is installed you can start using it by loading the library:

library(rpnf) # Load rpnf library

A typical workflow for using rpnf consists of three steps:

Getting some data

rpnf has some sample data built in:

data(DOW)   # Load some example data

You can have a look at these data with str(DOW) or DOW.

Determining the P&F statistics

To determine the P&F statistics of a time series you use:

pnfdata <- pnfprocessor(
  high=DOW$High,
  low=DOW$Low,
  date=DOW$Date,
  boxsize=1L,
  log=FALSE)

Understanding the P&F statistics

The data.frame returned by pnfprocessor(...) is full of P&F statistics on the given time series. Every row consists of one observation on the time series, whereas columns have the following meaning:

  • date : the date of the observation in the time series
  • high : the high values of the time series at observation date
  • low : the low values of the time series at observation date
  • boxnumber : boxnumber (integer) of the current chart status
  • column : current column (integer) in the P&F chart
  • status.xo : factor containing the current X or O status
  • nextX : threshold to reach in order to make an X. If latest status.xo is an O, then this is the reversal point.
  • nextO : threshold to reach in order to make an O. If latest status.xo is an X, then this is the reversal point.
  • status.bs : factor containing the current Buy/Sell status of this observation
  • lastNextX : highest value of the previous X-column. Used for Buy/Sell detection.
  • lastNextO : lowest value of the previous O-column. Used for Buy/Sell detection.
  • signal.bs : current P&F buy or sell signal, such as Double Top, etc.

This data.frame can be used either to do some statistical analysis, or it can be used to generate plots.

Generating P&F plots

Generating plots from a pnf data.frame can be achieved by:

pnfplottxt(
  data = pnfdata,
  reversal = 3,
  boxsize = 1L,
  log = F)
## --------+---------------------------
##    53.00|    X         X X              
##    52.00|    XO        XOXO+            
##    51.00|    XO        XOXO +           
##    50.00|X+X XOX     X XOXO  +          
##    49.00| OXOXOXO+   XOXO O   +         
##    48.00| OXOXOXO +  XOX  O    +   X <==
##    47.00| OXOXO O  + XOX  OX    +  X    
##    46.00| OXO   OX  +XOX +OXO    + X    
##    45.00| OX   +OXOX XO + OXO    X+X    
##    44.00| OX  + OXOXOX +  O O  X XOX    
##    43.00| OX +  OXOXOX+     OX XOXOX    
##    42.00| OX+   O OXO       OXOXOXOX    
##    41.00| O       O         OXOXO OX    
##    40.00|                   OXOX  OX    
##    39.00|                   OXO   O     
##    38.00|                   OX          
##    37.00|                   OX          
##    36.00|                   OX          
##    35.00|                   O           
## --------+---------------------------
##        Y|222222222222222222222222222
##        Y|000000000000000000000000000
##        Y|111111111111111111111111111
##        Y|444444444555555555555555555
##         |                           
##        M|111111111000000000000000000
##        M|000001222111133677788889999
##         |                           
##        D|011232001012202211212220023
##        D|906316598558967947925671830

Alternatively you can plot a graphical chart with:

pnfplot(
  data = pnfdata,
  reversal = 3,
  boxsize = 1L,
  log = F)

Support

If you need commerical support feel free to contact Sascha Herrmann sascha.herrmann.consulting@gmail.com for an offer. You can also request a new feature development there.

For non-commerical support please refer to the r-forge project page and some online communities like stackoverflow.

Development roadmap

Our current focus is to develop a set of wrappers and extensions to rpnf, so that it gets easier to exploit the full functionality of rpnf for creating Bullish Percent, Relative Strenght Charts, and others.