[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GT] SVN Commit r561 - trunk/GT/Docs
Author: ras
Date: 2008-03-11 07:26:06 +0100 (Tue, 11 Mar 2008)
New Revision: 561
Modified:
trunk/GT/Docs/Writing_an_Indicator_Cookbook.pdf
trunk/GT/Docs/Writing_an_Indicator_Cookbook.tex
Log:
revision submitted 10mar08
Modified: trunk/GT/Docs/Writing_an_Indicator_Cookbook.pdf
===================================================================
(Binary files differ)
Modified: trunk/GT/Docs/Writing_an_Indicator_Cookbook.tex
===================================================================
--- trunk/GT/Docs/Writing_an_Indicator_Cookbook.tex 2008-03-10 01:56:13 UTC (rev 560)
+++ trunk/GT/Docs/Writing_an_Indicator_Cookbook.tex 2008-03-11 06:26:06 UTC (rev 561)
@@ -1,5 +1,3 @@
-% This file was converted to LaTeX by Writer2LaTeX ver. 0.4
-% see http://www.hj-gym.dk/~hj/writer2latex for more info
\documentclass[11pt,twoside]{article}
\usepackage{color}
\usepackage{calc}
@@ -188,11 +186,23 @@
$self->{'sd'} = GT::Indicators::StandardDeviation->new([
$self->{'args'}->get_arg_names(1),$self->{'args'}->get_arg_names(3)]);
\end{lstlisting}
+Note that when such an intermediate series uses other series as its arguments,
+these cannot be defined by their constructor functions but must be given
+in their textual representation. For example, the following doubly smoothes
+the SMA above:
+\begin{lstlisting}[numbers=none]
+ $self->{'sma'} = GT::Indicators::SMA->new([
+ $self->{'args'}->get_arg_names(1),
+ '{I:SMA '.$self->{'args'}->get_arg_names(1).' '
+ .$self->{'args'}->get_arg_names(3).'}']);
+\end{lstlisting}
+
+
During the computation of the indicator, the intermediate series is
either computed via the dependency mechanism (see Section 4.2) or by
explicitly computing the series via:
-\begin{lstlisting}[name=example]
+\begin{lstlisting}[numbers=none]
$self->{'sma'}->calculate($calc, $i)
$self->{'sma'}->calculate_interval($calc, $i, $j)
\end{lstlisting}
@@ -200,7 +210,7 @@
\lstinline!$i! and \lstinline!$j! are time periods.
The values of these series are obtained via the standard get method,
e.g., the \textit{i}th value of the SMA is obtained via
-\begin{lstlisting}[name=example]
+\begin{lstlisting}[numbers=none]
$calc->indicators->set($self->{'sma'}->get_name, $i)
\end{lstlisting}
@@ -461,7 +471,7 @@
parameters.
For example, to define a standard moving average of the upper band of
-the Bollinger Band indicator:
+the Bollinger Band indicator (within the computation of the Bollinger Band indicator) use:
\begin{lstlisting}[numbers=none]
$self->{'upper'} = GT::Indicators::SMA->new([$self->{'args'}->get_arg_names(1),
"{I:Generic:ByName " . $self->get_name(1) . "}" ]);
@@ -472,20 +482,25 @@
of the current indicator and assigns it to an attribute of the
indicator object.
-Similarly one constructs the simple moving average of the temp indicator
-from Section 7.1 as
+Similarly one can construct a series that depends on a temporary series
+or an intermediate series. For example, the simple moving average of the
+temp indicator from Section 7.1 is defined as follows:
\begin{lstlisting}[numbers=none]
-$self->{'sma'} = GT::Indicators::SMA->new([ $self->{'args'}->get_arg_names(1),
+$self->{'sma1'} = GT::Indicators::SMA->new([ $self->{'args'}->get_arg_names(1),
"{I:Generic:ByName temp}" ]);
\end{lstlisting}
+The further smoothing of the simple moving average of the upper Bollinger
+Band (see above) can be defined by\footnote{This requires a correction
+to the I:Generic:ByName indicator available from the mailing list archives
+at http://www.geniustrader.org/lists/devel/msg02362.html.}
+\begin{lstlisting}[numbers=none]
+$self->{'sma2'} = GT::Indicators::SMA->new([ $self->{'args'}->get_arg_names(1),
+ "{I:Generic:ByName `" . $self->{'upper'}->get_name . "}" ]);
+\end{lstlisting}
+If the intermediate series has multiple outputs, the proper name must be used
+(e.g., use \lstinline!get_name($n)! to construct a series based on the
+{\em n}th output value of the intermediate series.
-It appears that it is not possible to construct a new series that based
-on an intermediate series. As a workaround, explicitly specify that
-intermediate series in the construction of the second
-series.\footnote{This will involve a duplication of the computation
-of this series. Implement a means of obtaining the value of the
-intermediate series to avoid needless duplicate computation.}
-
\subsection[Volatile dependencies]{\label{bkm:Ref192505424}Volatile
dependencies}
It is also possible for indicator dependencies to dynamically change
@@ -612,4 +627,12 @@
\section{Documentation}
Adequate documentation in pod format should be provided for each
indicator.
+
+\section{Observations and difficulties}
+The following contains a collection of observations I made in writing
+indicators and difficulties that I encountered. I do not have explanations
+for all of these, so please take them with a grain of salt.
+
+
+
\end{document}