Click HERE to see
list of Our Other Products and/or
to Place an Order for such
products.
Cycle
Simple Trading Model License
$250.00 usd
Cycle
Simple-3©
Trading Model
Indicator/Signal
Versions for: TS2000i®TS
Pro®/TS6®-TS8®
ALL PRODUCTS OFFERED BY SYTECH ARE OPEN SOURCE
{+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + }
Model: Cycle_Simple-3
(It ain't simple at all ! ! ! ! !)
This code is an attempt to model the behavior of a type of
market trading that might take place IF one were to elect to
use "triangular" or "cosine" waves to establish potential entry
and exit points and/or to control the direction of entry.
Parameters are:
Period and Shift/Alignment for primary period.
Period and Shift/Alignment for secondary period--if the use of
a secondary period is desired.
As an aid to determining the period of the primary and/or the
secondary wave period, the FOURLINE indicator (which
computes a Fourier Line Spectra of the data) may be used to
obtain the most likely periods to use. Typically this analysis
should use in the order of 400+/- bars and should present results
for up to 211 period cycles.
Specification as to whether a triangle wave or a cosine wave
is to be used.
If a Secondary wave is specified then the user may
select for
the application to combine the two waves into a single waveform
or to use the secondary wave as a "direction indicator" for
trades.
The first
part of this presentation covers DAILY data and
does an extensive review of basic operation of the model.
A later section will give great detail about the use of the
model on 30 minute intraday data.
The following picture, created by the application,
illustrates
most of these above indicated facilities. The picture shows the
results of the FOURLINE_CALD indicator (Fourier Line
Spectra using the calendar day equivalent of the cycle periods).
Within the
data area is a listing of all significant peaks found
in the FOURLINE_CALD plot.
Also within the data area is the type of display that can be
created showing the waves currently in use in the trading
mode. The user has control of color, line size, and style.
The four
indicators show the triangle and cosine waves that
can be created in either the separate or summed mode.
OVERVIEW OF CYCLE_SIMPLE-3 GRAPHICS

Any use of
this model requires that a period and shift must be
determined for at least the primary wave and after looking at a
number of results it would appear that a period and shift should
be selected for a secondary wave -- regardless of whether we are
to use a TRIANGLE or COSINE wave.
There are
two approaches to this selection:
1. Use the periods indicated and optimize the shift.
2. Use optimization to determine both period and shift.
The
following picture shows an example of the use of the #2
method indicated above. To see the actual results of the
optimization run you will have to use your browser shift bar to
view the far right side of the chart.
In that
evaluation we found that a period of 15, 70, and 90
appeared to offer the maximum profit. Note that these periods
were determined using increments of 5 bars in the optimization.
Therefore, using the periods indicated by FOURLINE of 13,
66, and 87 as a comparison is probably a valid assumption.

An
optimization run was performed individually on the periods
indicated in the FOURLINE study. The following list of periods
and delays is what was found.
13/7 66/23 87/41 and the
raw optimization 15/0 70/35 90/50
These
values are used in both the single wave and the two wave
studies shown below. There is an indicator on each chart that is
labeled SharpeMeasureBeta9 (thanks to Bob Fulks) which, just to
the right of the label are two values. The first is the NET PROFIT
for that study and the following is the maximum drawdown.
All of the following studies use TRIANGLE waves.
Two Waves (66/87) Summed and Traded as One:

Two Waves (66/87) Second is Direction Indicator:

Two Waves (13/87) Summed and Traded as One:

Two Waves (13/87) Second is Direction Indicator:

Two Waves (13/66) Summed and Traded as One:

Two Waves (13/66) Second is Direction Indicator:

Two Waves (70/90) Summed and Traded as One:

Two Waves (70/90) Second is Direction Indicator:

Two Waves (15/90) Summed and Traded as One:

Two Waves (15/90) Second is Direction Indicator:

Waves (15/70) Summed and Traded as One:

Two Waves (15/70) Second is Direction Indicator:

The
following are pictures created by the application and used
to illustrate the different types and combinations of waveforms
that are available by use of this application.
We will show the following:
1. A
study of a single triangle wave optimized by period and
delay.
2. A
study of a single cosine wave optimized by period and
delay.
3. A
study of two triangle waves summed and traded as a single
wave. These wave periods were selected from a Fourier Line
Spectra plot using the FOURLINE routine. Optimization
was
only performed on the delay of each wave.
4. A
study of two COSINE waves executed as in 3 above.
5. A study of two
triangle waves in which the primary wave is
the "trigger" for a trade when a top or bottom of the wave
is
reached and the secondary wave controls whether a trade
is
taken or not depending on the direction of secondary
wave.
6. A
study of two COSINE waves executed as in 5 above.
These pictures were made using Tradestation 8 with the TS data.
First date
loaded was 2/20/2004 and strategy used a "maximum
number of bars strategy will use" (MaxBarsBack) of 210.
1. SINGLE TRIANGLE WAVE -Optimized P/D

2. SINGLE COSINE WAVE-Optimized P/D

3. TWO TRIANGLE WAVES
SUMMED
Note the periods were selected from FOURLINE

4. TWO COSINE WAVES
SUMMED
Note the periods were selected from FOURLINE

5. TWO TRIANGLE WAVES -Optimized
Note the periods and shift were optimized

6. TWO COSINE WAVES -Optimized
Note the periods and shift were optimized

The
following are pictures created by the application are used
to illustrate the different types and combinations of waveforms
that are available by use of this application.
We will show the following:
1. A
study of a multiple triangle waves optimized by period and delay
-- no length for secondary specified so only primary
used .
Momentum length specified so momentum is screening
tool.
2. A
study of a multiple triangle waves optimized by period and delay
-- length for secondary IS specified so we see summed
waves .
Momentum length specified so momentum is screening
tool.
3. A
study of a multiple cosine waves optimized by period and delay
-- length for secondary IS specified so we see summed
waves .
Momentum length specified so momentum is screening
tool.
These pictures were made using Tradestation 8 with the TS data.
First date
loaded was 2/20/2004 and strategy used a "maximum
number of bars strategy will use" (MaxBarsBack) of 210.
1. MULTIPLE TRIANGLE WAVES
plus:
Momentum as Trade Direction
Indicator (blue)
Note: Although this is set to
sum 2 waves, since no length is
specified for
second wave we only get the primary wave.

2. MULTIPLE TRIANGLE WAVES
plus:
Momentum as Trade Direction Indicator
(blue)
Note: Now a secondary length is
specified so 2 waves used

3.
MULTIPLE COSINE WAVES plus:
Momentum as Trade Direction Indicator
(blue)
Note: Now a secondary length is
specified so 2 waves used

You will
note a considerable difference in the characteristics of the
secondary wave for the triangle and the cosine case.
The
following is the frontend documentation for the FOURLINE and the
FOURLINE_CALD indicators. The _CALD version simply translates
bars (on which the analysis is done) to equivalent calendar days if the
model is being run with calendar days.
{ Indicator: FOURLINE-CALD
Purpose: Plot a "line spectra" of the selected data
up to end of data or ending date if selected.
Analysis is done by use of the Fourier line
spectra method of cyclic determination.
Also plots a ramp indicating the frequency of
each line.
By activating the DataWindow and setting it
to display one line of data (put at top of chart)
then by clicking on a line showing a peak you
can read the peak amplitude (*scaler) and the period
of that peak. The period values are also displayed on
the chart where peaks in the spectrum occur.
Author: Clyde Lee, SYTECH/Futuresmagic.
Copyright: Clyde Lee, 1998-2002.
}
Input: FreqAvg(1), {Average the frequency data for the }
{specified number of lines to reduce }
{the horizontal extent of the plot }
{A negative value indicates the number}
{of blank bars to insert between lines}
Scaler(1000), {Strictly for display purposes since }
{indicator plots the ramp representing}
{frequency then it may be necessary to}
{multiply amplitude values to keep }
{in a range that can be observed. }
MinPlot(44), {Minimum number of bars to allow in }
{display of analysis and sets point at}
{which plot will end. }
MaxPlot(240), {Maximum number of bars to allow in }
{display of analysis and sets point at}
{which plot will begin. }
NData(1241); {Number of bars of data to use in the }
{MEM coefficient computation. }
{for analysis. }
Input: PrntPric(0); {Close at which to print the picked }
{peaks--0 = lowest low for MaxPlot }
{length. }
The
following picture shows both the Calendar days version and
the bars version on a synthetic waveform superimposed on a set
of "trend" type values. This had to be done in TS2000i since we
still cannot read these types of files in TS8.
The code
(which is open source) also contains (commented out)
the code that is necessary to create a Maximum Entropy indicator.

The
following is the frontend documentation for the Cycle Simple
(Triangle and
Cosine Wave) Trading Model .
The purpose of this model is to show
how a simple triangular or
cosine wave may have application in the
timing of trades in many
(if not all) markets.
{+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +}
{
Model: Cycle_Simple-3
This code is an attempt to model the behavior of a type of
market trading that might take place IF one were to elect to
use "triangular" or "cosine" waves to establish potential entry
and exit points and to control the direction of entry. Although
this application (when used with Tradestation) will generate info
that appears as market orders, it is not the intention of the
author for this to be used as a strategy but simply as an
indicator of what this type of model of the market might do.
Author: Clyde Lee, Copyright 2004, SYTECH Corporation
This model code may not be reproduced under any condition.
Any modification of this product will be reported (using the
source code) to SYTECH Corporation at clydelee@clydelee.com.
This is a licensed product and can only be used by persons/firms
that have paid a proper fee to SYTECH Corporation or has been
provided this application upon request to Clyde Lee/SYTECH.
Purpose: Make simple Model to check potential Cycle trading.
Parameters are:
Period and Shift/Alignment for primary period.
Period and shift for secondary period--if one is desired.
Specification as to whether a triangle wave or a cosine wave
is to be used and whether the primary and secondary wave (if
used) are to be combined into a single waveform.
Period and Smoothing length for a Direction Indicator (other than
a cycle wave) setup by computation of momentum or a "simple"
stochastic.
Amount for a "money market disaster" type stop in dollars or in
a multiple of Average True Range.
Amount for a Pullback from maximum profit (i.e. trailing) stop set
in either dollars or a multiple of Average True Range.
Other parameters exist to aid in testing and display of cycle data.
Model allows user to specify the number of CALENDAR days or the
number of bars in the cycle to be studied. The cycle used in
this application is a triangle like linear cycle or may be a
conventional cosine wave cycle.
If number of days is specified as zero then this Model runs on
the basis of the MOON cycle.
The alignment of any cycle with the data can be controlled by
use of the "DaysShift1 and DayShift2" parameters which can be any
value from minus the cycle length to plus the cycle length.
If the model is run in the ONE Wave mode (either by specification
of only primary wave parameters or by specification of the
summation of the primary and secondary) then buys will be executed
as soon as the bottom of the primary or summed cycle is detected and
sells will be executed as soon as the top of the primary cycle is
detected.
If the model is run in the TWO Wave mode -- no summation -- then
the buys and sells are executed ast noted above EXCEPT the direction
of movement of the secondary wave must be the same as the direction
of the signalled trade.
In the momentum mode, a trade will occur at any point in which
the sign of the momemtum is in the same direction at a detected top
or bottom of the primary wave.
In the Stochastic mode, a buy will occur at any point in which
the Stoch value is > 50 and a top or bottom is achieved.
A "disaster" type stoploss can be specified by use of the
"MaxxLoss" parameter. If this value is negative then the
stoploss is set at an amount equal to the absolute value of
the parameter times the 14 day average true range. If the
parameter is positive then the stoploss is defined in dollar
terms. In both cases the stop point is measured from the
entry price
A trailing pullback from max profit stop can be specified by use
of the "MaxxPullB" parameter. If this value is negative then the
stop is set at an amount equal to the absolute value of the
parameter times the 14 day average true range. If the parameter
is positive then the stop is defined in dollar terms. The stop
amount is set from the highest low on long trades and lowest
high on short trades.
In order to visualize the cycle being evaluated, if desired,
a plot (using trendlines) can be made. The location of the plot
can be around some specified price value or automatically around
the average of a 100 day highest high/lowest low. OR, the plot
can be inhibited. The amplitude of the plotted wave can be
controlled with an "AmplMult" value which is applied as a
multiplier to the cycle values. Maximum amplitude (before use
of this parameter) is 1/2 the cycle length. The color and size
of the line can be specified. If size is specified as zero then
a dotted line is drawn. A facility exists to auto-scale this
by making this parameter a negative value. A value of -1 will cause
the swings to be auto-scaled and plotted at the determined scaling.
A value of -0.5 will rescale the auto-scaled value to 1/2 what is
determined, etc.
The plot made using calendar days will have a small wavy look
in that the cycle is based on calendar days and plotting is done
on market days so values for weekends and holidays are missing
from the chart.
NOTE: IF RUNNING AUTO SET OF PLOT PRICE THEN MAXBARSBACK MUST BE
SET TO 201 OR GREATER. IF NOT AUTO THEN 15 WILL WORK.
IF RUNNING THE ASSOCIATED INDICATOR IT IS IMPERATIVE THAT
THE INDICATOR MAXBARSBACK BE SAME AS THE MODEL.
}
{+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + }
Input:
Period1 (80), {Number of Days to use for normal Cycle period.}
{If set to zero this will become a MOON Model. }
{If set negative then cycles are computed on the}
{basis of number of bars -- not calendar Days. }
{If the absolute value of ModeC2 is less than 10}
{then the waveform is triangular. If the ModeC2}
{absolute value is >= 10 then the waveform is a }
{Cosine waveform. }
ShiftDays1(55), {Number of Days to shift the cycle for match. }
Period2(170), {Number of Days to use for 2nd Cycle period.}
{If set negative then cycles are computed on the}
{basis of number of bars -- not calendar Days . }
ShiftDays2(95), {Number of Days to shift the cycle for match. }
ModeC2(-1), {This parameter controls whether the model is a }
{model based on only Period1 and (if selected) }
{Period2 cycles. The parameter may consist of }
{two digits (e.g. 11, 10, 12, 13). The high }
{order digit determines whether the final waves }
{will be triangles -- values 0, 1, 2, 3 -- or }
{whether final waves will be cosine waves if the}
{value is 10, 11, 12, or 13. }
{If set to one (1/11) model will be a 2 cycle }
{model if a Period2 is defined or will be a one }
{cycle model if Period2 is set to zero. }
{If negative, sum wave 1 and wave 2 and do not }
{use wave2 as a direction indicator. }
{If set to zero (0/10) only period 1 is used. }
{Values >=10 will cause cosine waveforms. }
{If set to two (2/12) calculate the MomStoLeng }
{momentum of the close and smooth w/ XAverage of}
{length=SmooLeng. }
{If negative, sum wave 1 and wave 2 and do not }
{use wave2 as a direction indicator. }
{Values >=10 will cause cosine waveforms. }
{If set to three (3/13) calculate a "simple" }
{stochastic function using MomStoLeng and }
{SmooLeng for smoothing. }
{If negative, sum wave 1 and wave 2 and do not }
{use wave2 as a direction indicator. }
{Values >=10 will cause cosine waveforms. }
MomStoLeng(18), {If Modec2>1 then this is length for the momen- }
{tum or simple stochastic for direction. }
SmooLeng(3), {Smoothing length for momentum or stochastic if }
{such trade direction is selected by ModeC2 }
MaxxPullB(0), {Max offset for trailing type take profit/stop }
{loss $ (if positive) or % ATR14 if negative }
{Relative to the maximum profit that is reached }
{in any trade. }
MaxxLoss(0), {Max loss $ (if positive) or % ATR14 if negative}
{Relative to entry price of a trade. }
PlotPrice(-5), {Price around which to plot the cycles. A zero }
{value results in no plot -- be sure to set this}
{to ZERO when OPTIMIZING TS2k. A negative value}
{causes auto determination from HH/LL of number }
{of bars equal to absolute value of this value }
PlotScale1(-1), {Multiplier to bring plotted values into range }
{of price of symbol being evaluated for Plot1. }
{set to < zero for auto detection of multiplier }
{Value given is multiplier of auto scale. }
PlotScale2(-1), {Multiplier to bring plotted values into range }
{of price of symbol being evaluated for Plot2. }
{set to < zero for auto detection of multiplier }
{Value given is multiplier of auto scale. }
PlotCWS(2.13), {Color, Width (size), and style of line in plots}
{Format: C.WS C=Color, W=Width/Size, S=Style. }
ExitOnLast(False), {Set true for testing purposes to insure that a }
{trade is closed out on last bar of chart. }
FileName(""); {File ID to save parameters and results }
Cycle
Simple Trading Model License
$250.00 usd
.

Disclaimer: Neither TradeStation Technologies nor any of its affiliates has reviewed, certified, endorsed, approved, disapproved or recommended, and neither does or will review, certify, endorse, approve, disapprove or recommend, any product or service that offers training, education or consulting regarding the use of EasyLanguage.