User Functions

Most uers will never need to write a user function, so you can just skip this section if you want to.
The purpose of user written functions is to allow the extension of a program beyond what the original author supplied.
Your extension may be something from a magazine or an entirely new idea of your own.
Don't be afraid to experiment - you can't hurt anything!
Don't let the idea of a programming language scare you.
SpiffyCharts User Functions are written in a rather simple language that is very similar to many others that you may see in magazines such as Stocks & Commodities. Our manual gives a detailed explanation and a number of examples.

There are a number of user functions supplied with SpiffyCharts. You can copy one and edit it to see what happens.

Simple Example
; The following is an "advanced" User Function. A Simple User Function can be Really simple!
; Anything after a semicolon in a user function is a comment.
; The first few lines of a user function are usually an explanation of the function.
; The Kalman function, originally for missle tracking.
; Some smoothing, very little lag, but results can be wild.
; adapted from Stocks & Commodites, page 163, October 1985
; Xm of magazine is input, Price1
; Kone of article is Data1
; NB smoothing factor must be less than one
; Newcol = Kalman(oldCol, 0.04) is an example of worksheet input.

Require 1 columns, 1 numbers; The first real line of the function - allows us to check for proper input.
Columns; You must have a "Columns"definition line, even if empty. The Output column is always defined by default
Variables Ktwo Xp Xdel dX Xs; Variables and columns are initially zero

Ktwo= sqrt(Data1*2.0); The first three lines set variables.
Xp = Price1; XP is the predicted price.
Xdel = 0;

Procedure; This word Tells SpiffyCharts to loop through your data and do what follows on each day.
Xdel = (Price1 - Xp); Xdel is diff from actual price to predicted price.
Dx=DX + Xdel*Data1;
Xs = Xp + Xdel*Ktwo;
Xp = Xs + 9*DX;
Output = Xp; Output is the value predicted for today
RunProcedure;

Here's an example of a chart using the Kalman filter.


And Remember: SpiffyCharts is free software for Commodity Traders.
SpiffyCharts is free stock charting software.
and SpiffyCharts is free technical analysis software.

Sorry, this is repetitious but when folks search for exact pharses - you need to have the exact phrase even if it's only slightly different.

Home