|

MASTER INDEX
SEARCH
CHARTS
MAIN TOOLBAR
SETTING PREFERENCES
TECHNICAL
INDICATORS
WHAT'S NEW
ALARMS
BACKTESTING
CONFIRMING TRADES
CUSTOM
COLUMNS
CUSTOM
INDICATORS
CUSTOM
INSTRUMENTS
CUSTOM PRICES
DATA FEEDS
DATABASE
DOWNLOADING
DATA
FEED STATUS
HEARTBEAT
HELP
MULTI-LINKING
MULTI-PERIODICITY
INSTRUMENT SETUP
NASDAQ LEVEL II
NEWS TICKER
NEWS BROWSER
OPTIMIZATION
OPTIONS
ANALYTICS
PLACING TRADES
PORTFOLIOS
PRESETS
PRINTING
QUICK
QUOTES
QUOTE PAGES
REALIZATION
RTL LANGUAGE
SCANS
SCHEDULES
SCOPE
SYSTEM STATUS
TICKER
TAPE
TIME AND SALES
TRADING NOTES
USER VARIABLES
VERTICAL SCALE
MASTER INDEX
DICTIONARY
FEEDBACK
|
Investor/RT Tour
Optimization of Trading Systems
See Also:
Trading Systems
See Also:
Trading System Deployment / Trading System Indicator
Optimization pertains to the ability to determine the
combination of trading system parameters which results in the most favorable
performance for that trading system. These optimization parameters include a
variety of technical indicator periods, periodicity, stops, targets, and
more.
The ability to use technical indicator periods (along with stops and
targets) as optimization parameters is implemented in Investor/RT through
User Variables (V# variables). The setup windows for certain technical
indicators, e.g. moving averages, now accept a V# variable in place of an
explicit number as a period. For example, the setup for a moving average can
specify that the period of the moving average be V#5. When the moving
average is evaluated as part of a trading signal, the period of the moving
average will be obtained from user variable V#5. For instance, if V#5 was
placed in the "Period" field of a Moving Average, and the value of V#5 for
the corresponding symbol was 12, then a 12 period moving average would
result. When the moving average preferences are viewed, the user will see
"V#5" in the Period field. This concept is key to understanding
optimization. By specifying certain technical indicator settings as
variables in trading signals, the optimal value of those variables can be
determined by the optimization feature.
Each optimization allows up to 8 V# variables to be used as parameters. Up
to 6 are "stepped" parameters, while 2 can have "discrete" values. A stepped
parameter has a format such as:
V#1 from 5 to 9 step 1
If this were the only parameter, the optimization would set V#1 to 5, run
the trading system and record the results, set V#1 to 6, run the system
again and record the results, and so on. The system would be run 5 times in
this example. The results would then be sorted (ranked) by a user-specified
measure and displayed.
A discrete parameter has a format such as
V#2 – 5, 8, 13, 21
If both V#1 from the previous example and V#2 were used as parameters in the
same optimization, the trading system would be executed once for every
possible combination of V#1 and V#2, which in this case would be 5 x 4 = 20
iterations.
Periodicity can also be used as an optimization parameter. Periodicity may
be expressed as either a "stepped" or "discrete" parameter. Periodicities of
"Minutes", "Seconds", or "Ticks" may be used. As an example, if we added the
periodicity as a stepped parameter with the following settings to the
optimization discussed above "Minutes from 1 to 10 step 1", the optimization
would now run 5 x 4 x 10 = 200 iterations of the trading system, and provide
the combination of V#1, V#2, and periodicity that resulted in the best
performance.
The optimization results are displayed in tabular form. One column is
displayed for each of the optimization parameters, along with columns for
each of the desired results. Options for displayed results include:
- Avg Profit/Trade
- Avg % Gain/Trade
- Avg %Gain/Bar
- Gross Profit
- Net Profit
- Avg Win/Avg Loss
- % Profitable
- # Trades
Below these options is a "Sort by" selection list
containing the same choices. The option chosen from this list will be used
when sorting the results.
As a simple example, a moving average crossover system looks to enter a long
position when a shorter term moving average crosses above a longer term
moving average, and to exit the long position when the short term average
falls below the long term average. In this trading system, there are two
candidates for optimization parameters: the short term MA period and the
long term MA period. This system will also involve a "stop", and will be
optimized across a variety of "Minute" periodicities.
First the trading system must be created. Choose File: New: Trading System
from menu bar. Give the trading system a name like "maCrossTS". The buy and
sell signals will be created using three V# variables. These will in turn be
used as optimization parameters along with periodicity. Click the "New"
button next to "Signal:". Type in the following syntax for the buy signal…
MA_ST > MA_LT AND MA_ST.1 <= MA_LT.1
MA_ST will be the short term MA, while MA_LT will be the longer term MA.
This signal detects when the shorter term MA crosses above the longer term
MA (MA_ST is above MA_LT on the current bar, but was less than or equal to
MA_LT on the previous bar). Click the "Save" button. Specify a Period of
V#1 for MA_ST, and V#2 for MA_LT. Give the signal a name like "maCrossBuy".
Add a second signal for setting (and adjusting) the trailing stop. This
signal will be used in a "no action" (NONE) rule in the trading system.
The signal has the following syntax, and should be given a name like "maCrossSetStop"...
SET(STOP, CL – V#3) STOP is a
token used to hold trailing stop values during backtesting. The signal
above will set a trailing stop at the closing price minus the value of V#3
during the execution of the system. As discussed later, V#3 will be used
as an optimization parameter, varying the trailing stop from 2 cents to 10
cents.
Now, setup the exit signal using syntax similar to the buy signal:
CL <= STOP OR (MA#1 < MA#2 AND MA#1.1 >= MA#2.1)
Save this signal with a name like "maCrossExit". The system will exit if
the stop is reached or the crossover occurs.
Now that the signals are created, return to the Trading System window.
Create the following three rules:
If maCrossBuy then BUY 1000 at Last price
If maCrossSetStop then NO ACTION
If maCrossExit then SELL 1000 at Last price
The periodicity is not really important here since the optimization will
automatically set it.
Click the "Setup Backtest" button at the bottom. In this window, specify
the symbol or quotepage that you'd like to test, along with the
backtesting period. Remember, the longer the viewing period, and the more
symbols that are tested, the longer the optimization will take to execute.
Also make sure the "Maximum position size for longs" is at least 1000
shares.
Now, click OK at the bottom of this "Backtest Setup" window, and click
"Save" in the Trading System window. This trading system should now be
ready to be optimized on V#1 (short term MA period), V#2 (long term MA
period), V#3 (stop), and periodicity.
Choose "Setup: Optimization" from the menu bar to open the Optimization
Setup window. Click on "New" and provide a name for the optimization
setup, e.g. "maCrossOpt". For the trading system, choose the "maCrossTS"
created earlier. For this example, setup the V#1 parameter (short term MA
period) from 4 to 12 step 1, the V#2 parameter (long term MA period) from
13 to 22 step 1, the V#3 parameter (trailing stop distance) from 0.02 to
0.10 step 0.01, and the periodicity from 1 minute to 10 minutes step 1
minute. Check three of the stepped user variable parameters, and the one
stepped periodicity option and fill in the proper values. On the right,
checkmark the desired results along with the measure by which the table
will be sorted. Each row of the table will represent an
iteration/execution of the trading system.
To begin the optimization, click the "Optimize" button at the lower left
corner of the window. The title bar of the optimization window provides
feedback as the optimization progresses. The title updates after each
iteration is completed and looks something like this:
(Esc key to stop) 10% (820/8200) [4,19,0.04,2] ~2:45 left [last 0.124,
avg. 0.098]
This tells the user that the optimization is 10% complete, completed 820
of the 8200 iterations, currently testing the combination of [V#1=4,
V#2=19, V#3=0.04, Periodicity = 2], there are approximately 2 minutes and
45 seconds left, the last iteration gave a result of 0.124 (based on what
is specified in "Sort by") and the average result of the completed
iterations is 0.093. The optimization can be terminated at any time by
hitting the escape (Esc) key on the keyboard. If the optimization is
interrupted, the results of the completed iterations will still be shown.
As of the Investor/RT 6.3 Beta 2, the following technical indicator periods have
been augmented to allow V# variables in period setup boxes.
-
Beta 2
-
ADX (DX Period)
-
ADX (Smoothing Period)
-
ADXR (DX Period)
-
ADXR (ADXR Period)
-
ADXR (Smoothing Period)
-
Bear Power (Moving Average Period)
-
Bull Power (Moving Average Period)
-
BOP (Smoothing Period)
-
DI+/- (DI Interval)
-
LRA (MA Period)
-
LRA (Regression Period)
-
LRS (MA Period)
-
LRS (Regression Period)
-
T3 (Period)
-
True Range (Smoothing Period)
-
True Range (Actual Range Period)
-
Volatility (Period)
-
Williams %R - WPR (Period)
-
Zig Zag (Min. Price Change %)
-
Zig Zag (Ref. Line %)
-
Zig Zag Oscillator (Min. Price Change %)
-
Zig Zag Oscillator (Ref. Line %)
-
Beta 1
-
BB (Moving Avg Period)
-
BB (Standard Deviations)
-
CCI (CCI Period)
-
CCI (Smoothing Period)
-
EMA (Period)
-
EMA (Shift Period)
-
LRF (MA Period)
-
LRF (Regression Period)
-
LRF (Forecast Period)
-
LRF (Standard Deviations)
-
MA (Period)
-
MA (Shift Period)
-
MACD (Short)
-
MACD (Long)
-
MACD (Signal)
-
PNF (Reversal Criteria)
-
PNF (Box Size)
-
RSI (RSI Period)
-
RSI (Smoothing Period)
-
RSI (Momentum Period)
-
STOCH (Raw K Period)
-
STOCH (Fast D Period)
-
STOCH (Slow D Period)
-
TLB (Reversal Criteria)
-
TLBOSC (Reversal Criteria)
-
Volume (Period)
Indicators not in the list above can, of
course, be used with trading systems, but their indicator settings will
remain constant as the trading system is optimized.
Optimizing Symbols
A checkbox has been added to the Optimization window titled "Optimize
Symbols". When checked, the symbols themselves will become optimization
parameters. This feature is applicable only when the underlying Trading
System is setup to backtest on a quotepage (as opposed to a single symbol).
Each optimization iteration will run on a single symbol instead of a
quotepage of symbols. The results will provide a column for "symbol" just as
it does for any other optimization parameter. As an example, the sorted
results may show that the combination of MSFT using V#1 of 10 and V#2 of 12
was the most favorable. In addition, the optimization will leave any
optimized V# variables for each symbol with their optimal values for that
symbol. In other words, V#1 for MSFT might be 10, while V#1 for INTC might
be 13, etc. This gives the user the ability to optimize the values on a
symbol by symbol basis, giving each symbol an independent set of optimized
V# parameters that yields the most favorable trading results for that
symbol.
|