WLP User Guide PDF
WLP User Guide PDF
eReview #442760
Wealth-Lab Pro User Guide
Any screenshots, charts or company trading symbols mentioned, are provided for illustrative purposes only and
should not be used or construed as an offer to sell, a solicitation of an offer to buy, or a recommendation for the
security.
Third party trademarks and service marks are the property of their respective owners.
While every precaution has been taken in the preparation of this document, the publisher and the author assume no
responsibility for errors or omissions, or for damages resulting from the use or misuse of information contained in
this document or from the use or misuse of programs and source code that may accompany it. In no event shall the
publisher and the author be liable for any loss of profit or any other commercial damage caused or alleged to have
been caused directly or indirectly by this document.
Table of Contents
Foreword 0
Part V Data 34
1 Data Manager
................................................................................................................................... 37
Create New DataSet
.......................................................................................................................................................... 38
Data Providers
......................................................................................................................................................... 39
Fidelity ......................................................................................................................................... 39
ASCII ......................................................................................................................................... 41
MetaStock ......................................................................................................................................... 44
WL4 Files ......................................................................................................................................... 44
Yahoo! ......................................................................................................................................... 45
Update Data .......................................................................................................................................................... 49
Data Update .........................................................................................................................................................
Log 50
Sym bol Managem ..........................................................................................................................................................
ent 50
Watchlist Export
.......................................................................................................................................................... 52
2 Streaming
...................................................................................................................................
Data 54
Part VI Charting 55
1 Chart Window
................................................................................................................................... 57
2 Chart Context
...................................................................................................................................
Menu 60
Right Click Trading
.......................................................................................................................................................... 61
3 Chart Control
................................................................................................................................... 63
4 Drawing
...................................................................................................................................
Toolbar 66
Notes and Im ages
.......................................................................................................................................................... 68
Shapes .......................................................................................................................................................... 68
Lines and Trendlines
.......................................................................................................................................................... 69
Fibonacci .......................................................................................................................................................... 72
Gann Fan .......................................................................................................................................................... 73
Regression Channel
.......................................................................................................................................................... 75
Speed Resistance
..........................................................................................................................................................
Lines 76
5 Chart Styles
................................................................................................................................... 79
Line .......................................................................................................................................................... 79
OHLC .......................................................................................................................................................... 80
Candlestick .......................................................................................................................................................... 80
EquiCandle .......................................................................................................................................................... 80
EquiVolum e .......................................................................................................................................................... 81
Trending Chart ..........................................................................................................................................................
Styles 81
Kagi ......................................................................................................................................................... 82
Line Break ......................................................................................................................................................... 82
Renko ......................................................................................................................................................... 83
Point and Figure
......................................................................................................................................................... 84
6 Plotting
...................................................................................................................................
Indicators 86
Plotting w ith Drag
..........................................................................................................................................................
and Drop 87
Pushing Dropped..........................................................................................................................................................
Indicators 89
Plotting from ..........................................................................................................................................................
Code 91
Show /Hide Panes
.......................................................................................................................................................... 91
7 Fundamental
...................................................................................................................................
Data 92
8 Streaming
...................................................................................................................................
Charts 93
II
III User Guide, Wealth-Lab Pro
6 Backtesting
...................................................................................................................................
Strategies 116
Sym bol Mode ..........................................................................................................................................................
Backtest 117
Multi-Sym bol..........................................................................................................................................................
Backtest 119
Pairs and Rotation
..........................................................................................................................................................
Strategies 120
Inside a Portfolio
..........................................................................................................................................................
Sim ulation 120
Note on Lead
.........................................................................................................................................................
Bars 122
A Lead Bar.........................................................................................................................................................
Solution 123
How Trades ..........................................................................................................................................................
Are Chosen 125
100% of Equity..........................................................................................................................................................
Sizing 127
Stream ing Strategies
.......................................................................................................................................................... 128
Troubleshooting
..........................................................................................................................................................
the Unexpected 128
7 Optimization
................................................................................................................................... 130
Full Optim ization
.......................................................................................................................................................... 130
Optimization
.........................................................................................................................................................
Control 131
Optimizing Rule-based .........................................................................................................................................
Strategies 134
Results ......................................................................................................................................................... 135
Preferred Values ......................................................................................................................................... 136
Graphs ......................................................................................................................................................... 138
Walk-Forw ard ..........................................................................................................................................................
Optim ization 139
WFO Control
......................................................................................................................................................... 140
Results ......................................................................................................................................................... 143
Parameter.........................................................................................................................................................
Graph 145
WFO FAQs ......................................................................................................................................................... 146
IV
V User Guide, Wealth-Lab Pro
10 Trading
................................................................................................................................... 240
11 Email...................................................................................................................................
Settings 243
2 Navigation
...................................................................................................................................
Bar 289
3 Function
...................................................................................................................................
Toolbar 290
4 Drawing
...................................................................................................................................
Toolbar 291
5 Data ...................................................................................................................................
Panel 292
Scale Control.......................................................................................................................................................... 292
Data Range Control
.......................................................................................................................................................... 295
Position Size..........................................................................................................................................................
Control 296
Raw Profit.........................................................................................................................................................
Mode 297
Portfolio Simulation
.........................................................................................................................................................
Mode 299
Sym bol (Go) .......................................................................................................................................................... 301
DataSet Tree.......................................................................................................................................................... 302
Strategy Param ..........................................................................................................................................................
eters 303
6 Dialogs
................................................................................................................................... 305
Strategy Explorer
.......................................................................................................................................................... 305
Technical Indicators
.......................................................................................................................................................... 308
Fundam ental..........................................................................................................................................................
Data Item s 308
QuickRef .......................................................................................................................................................... 309
Debug and Error
..........................................................................................................................................................
Messages Window 309
7 Symbol
...................................................................................................................................
Info Manager 310
8 Futures
...................................................................................................................................
Mode Characteristics 314
9 Keyboard
................................................................................................................................... 315
Shortcuts .......................................................................................................................................................... 315
Shortcuts by..........................................................................................................................................................
Category 317
Editor Shortcuts
.......................................................................................................................................................... 319
10 Glossary
................................................................................................................................... 321
11 Acronyms
................................................................................................................................... 332
Index 333
VI
1 User Guide, Wealth-Lab Pro
1 Trial Mode
Trial mode refers to the 30-day period in which is not required to log in to use Wealth-Lab
Pro. After the first log in, during or after the 30-day trial period, Wealth-Lab Pro becomes
a "full" version.
During the "trial" period, only features related to logging in that are disabled. Specifically:
No streaming charts. Static intraday charts can be updated with approximately 20
minutes delay, and daily data updates only for the previous complete session.
No quotes in Quotes tool (requires streaming)
No real-time quotes in trade ticket
No Trading in live accounts
No Accounts and Balances for live accounts
Strategy monitor is available in the trial version for daily strategies associated with
Paper account. The full version with login is required to run strategies in intraday
scales.
Fundamental data updates are not available
No ability to update the GICS database
Accounts Tool
Closed accounts were erroneously appearing in the account list.
Certain types of alternate brokerage accounts (BrokerageFlex, etc.) were not
showing up in the account list.
Miscellaneous
Various login instability issues.
Improved application security.
3 Introduction
What is Wealth-Lab Pro?
Wealth-Lab Pro is a complete platform for developing and back-testing stock and futures
trading strategies based on technical analysis and where applicable, fundamental analysis.
Proven trading strategies can be applied to trading end-of-day as well as real-time data
using Wealth-Lab's automated trading features.
A trading strategy (or trading system) is a set of explicit rules that tell you when to buy,
sell, sell short, and cover. Trading strategies are meant to exploit opportunities to profit
in the markets. Wealth-Lab Pro lets you develop and validate trading strategies, and can
help you implement them in real-world trading.
Quick Start
Quick Start is an abridged version of the detailed information found in the rest of the User
Guide.
1. Data
After a few notes and tips on getting started, we go straight into the all-important topic
of Data. You cannot even view a chart without data, so it's a good place to start.
2. Charting
With the data that you've collected for your DataSets, you'll want to get right to
charting. Wealth-Lab charts are some of the finest, and eventually you may discover that
you can do some strategy building and testing with them that isn't offered in any other
charting or backtesting software.
3. Strategy Window
Developing, testing, and trading strategies is at the heart of what Wealth-Lab is all
about. In this chapter you'll learn how to run strategy simulations against individual
instruments as well as for complete DataSets. In addition, you can use the Optimizer to
find ranges of strategy parameters that are more likely to work best.
While the ability to program is a big plus for developing practically any
trading strategy that you can think of, non-programmers can use Wealth-
Lab's Strategy Builder to express trading ideas using a convenient drag-
and-drop interface.
4. Strategy Monitor
Version 6's all-new Strategy Monitor 147 executes all of your strategies in a single window
so that you can scan for signals at the end of each day or using up-to-the-minute data
to get trading alerts in real-time.
5. Quotes
You can use Quotes windows to simply monitor streaming quotes for selected symbols, but
the real power is to use it as an automation tool to trigger stop and limit orders entered
from trading strategies so that they can be staged in the Orders window at the most
opportune moment.
6. Orders
The Orders tool is the bridge for trading automation between Wealth-Lab Pro and the
Fidelity brokerage back end. You can Stage orders from the various Alert-generating tools
to later manually or automatically place them in the market.
8. Preferences
User defaults for Chart appearance, backtesting, sounds, etc. are configured through the
Preferences dialog, just an F12 keystroke away.
9. Extension Manager
Add features to Wealth-Lab by installing them using the Extension Manager.
11. Reference
The Reference has important information and guidance for menus, toolbars, and other
dialogs that are used by the primary tools in Wealth-Lab Pro. You can also find a list of
Keyboard shortcuts and a useful glossary.
Partial: To focus on the essence of the example, most often only the Execute()
method is given. In this case, completely replace the Execute() method, which is
highlighted in the image below.
4. Pay attention to green comment lines in the sample code, which may include special
initialization or setup instructions.
5. Click Compile in the Editor's toolbar and ensure "Strategy compiled successfully!" in
the lower message frame.
6. Click F5 on the keyboard, or click a symbol of your choice in the Data Panel 292 to
execute the example.
4 Quick Start
About Quick Start
The goal of Quick Start is to provide additional material that will help customers quickly
get started using Wealth-Lab Pro. For more in depth detail on any of the topics covered
refer to the specific topics in the Wealth-Lab User Guide, WealthScript Programming Guide,
or QuickRef (F11), all located within the Help menu of Wealth-Lab Pro, or on Fidelity.com’s
Active Trader download section.
Important Note: Examples of specific securities or concepts depicted in the in this Wealth-
Lab Pro Quick Start and User Guides are given for illustrative purposes only and should not
be used or construed as a recommendation or offer for any specific security.
Fidelity’s Wealth-Lab Pro is available to those investors in households that place 120 or more stock, bond, or
options trades in a rolling twelve-month period, plus $25,000 in assets across their eligible Fidelity brokerage
accounts are eligible for Wealth-Lab Pro. Combined household trading activity is calculated each business day.
Customers who do not maintain the required trading activity in their combined household accounts will become
ineligible for Active Trader Pro and Wealth-Lab Pro entitlements without notice. See the Household Relationship
Form for details on how to authorize Fidelity to consolidate accounts held by you, or your immediate family
members who reside with you, into an aggregated relationship household.
The 30 day Trial version does not require an entitlement and can be used with
limited functionality for 30 days.
- Or -
Step 6: If you are eligible for Wealth-Lab Pro and have already been granted
access, you may now begin to use the full version of the application. You
are no longer required to obtain an entitlement key from Fidelity.
Key Sections
1) View Charts View historical or real-time charts for your favorite stock. Enhance
your analysis with drag & drop technical indicators and fundamental
data or use the drawing tools to create support and resistance
channels, tradable trendlines or chart annotations.
2) Explore and Explore pre-built trading strategies for ideas, or customize them to
Backtest validate your own trading ideas by backtesting the idea and analyzing
the hypothetical results.
3) Build and Build your own trading strategy easily with drag & drop functionality, or
Backtest program your own strategy. By backtesting your trading strategy
using historical data you can see the hypothetical performance of
your strategy and understand how your strategy could behave in the
future.
4) Activate Now that you've built a strategy, add that strategy to the Strategy
Strategies Monitor. Monitor your trading strategies for trade alerts in one
location. Customize each strategy to your trading preferences with
backtesting parameters like scale, trade size or portfolio management
settings, data range, and symbols. Activate each strategy to
automatically check for data updates and new trade alerts, and then
manage those alerts from the same window.
5) Manage With the Orders tool get the latest status on active, canceled and
Orders executed orders thru Wealth-Lab Pro.
6) What’s New This section will update dynamically to display links to Help, information
Figure 3.0 Launch the Data Manager from the Navigation toolbar.
Data Manager
Once in the Data Manager you have two main actions:
1. Create a new DataSet.
2. Modify or update an existing DataSet like the Dow 30.
See the User Guide's Data Manager 37 topic for more details and other data maintenance
options.
Figure 3.1 Data Manager showing Symbol Details for the selected
DataSet (Dow 30) and right-click DataSet actions menu.
Another way to keep your data current is to enable Automated Data Updates (Fig. 3.4).
It is highly recommended that you keep your market data as up to date as possible by
running daily manual or scheduled data updates to maximize your experience with Wealth-
Lab Pro.
Your PC must be on and Wealth-Lab running during the hour that you've
scheduled automated data updates.
Chart Layout
Use the Chart and Scale toolbars to control the appearance of the Chart View. Configure
the default settings for Chart Color, Fonts, and Grid Lines using the Colors/Style view of
the Preferences tool. For example, use the Chart Drawing Toolbar (far right) to apply
Fibonacci Lines or a Regression Channel (Fig. 4.1).
Chart Toolbar
Use the Chart toolbar to customize the appearance of your charts by increasing or
decreasing bar spacing, or change the chart style to Kagi or Renko among the many other
options offered (Fig. 4.1).
A DataSet represents a link to a source of static historical market data. DataSets appear
in a tree view along the left side of the application in the Data Panel, which can be viewed
or hidden from the View menu or using the Ctrl+D shortcut. Contained in each branch of
the tree are the symbols that make up the DataSet.
Included Strategies
Wealth-Lab Pro Version 6 comes with more than 25 pre-built strategies, a list of standard
technical indicators, and a list of fundamental data items that you can leverage to help
create your own trading systems. Additional pre-built strategies may be downloaded from
Wealth-Lab.com using the Strategy Explorer's Download feature.
The Strategy Builder utilizes a database of Entries, Exits, and Conditions, which are
collectively referred to as Rules. The Wealth-Lab Pro installation comes with a full set of
Rules (Fig. 6.0).
Step 3. Form your basic strategy by selecting Entry and Exit types.
Drag and drop an Entry or Exit type to the window on the right. You can also double click
an Entry or Exit to select it, which is then added to the bottom of the list. An Exit is
paired with the Entry directly above it. The Wizard accomplishes this by assigning a
unique Position Signal Name to each Entry selected, as you can later verify in Strategies
with multiple Entry and Exit strategies. Placing an Exit at the top of the list (above any
Entries) applies it to all Entries of the same type in the strategy. For example, you may
wish to place a Trailing Stop at the top of a list so that it will be used against all Long
A Rules tab instead of an Editor tab in the Strategy window indicates that the Wizard has
complete control of the Strategy code. If you select Convert to Code-based Strategy
you can no longer use the Strategy Builder to modify the Strategy.
Template Code
A "New Strategy from Code" window always initializes the Editor view with a
"skeleton" (template) to start working from. If you frequently use the same library
references and/or variables in Strategies, you can save yourself time by editing the
Template and then selecting Edit > Set as Default Template Code.
Editor Options
Set your preferences for how the editor displays text, fonts, functions and other items
from the Editor's Options dialog, selected right from the Editor's toolbar.
Multi-Symbol Backtesting
You develop and backtest trading systems on individual securities in the Strategy Window.
You can now easily test a system’s performance on a list of stocks or DataSet without
going to a new tool with Multi-Symbol or Portfolio backtesting.
single collection. It then aligns the trades by date and time, applies position sizing rules,
and finally reports on the overall system results, which includes a portfolio equity curve
based on the starting equity that you specify before running the backtest.
Choosing "All Data" in the Data Range setting for intraday Strategies will result
in reduced performance due to the large amount of data being processed.
Since you are looking for Trade Alerts based on the most recent price action
we recommend choosing a smaller amount of data for this setting.
Changing Settings
To change your settings, highlight a Strategy and select the Change Settings button.
Alternatively you can double click the Strategy. Either action launches the Strategy
Activation Settings page for a new settings configuration. If you save new settings by
clicking OK, the Strategy must be reactivated.
If you have Strategies that are run on a periodic basis you can still add them to the
Strategy Monitor for quick access when you want to use them. To run the Strategy,
simply Activate the Strategy or select Run this Strategy now item in the right click menu.
When an Alert is received for a strategy, the Alert can be sent to the Quotes tool for
further monitoring or to the Orders tool for trading. You can configure Strategies to
automatically send the Trade Alerts to the Orders tool by enabling Auto-Stage button.
Live trading is not enabled in the current Wealth-Lab Pro 5.0 release.
If you do not want the Orders tool to open each time an Alert is sent you may
turn off this feature in Preferences (F12) > Advanced Options.
Strategy Monitor
With the Strategy Monitor, there's no need to open and run multiple strategies that you
want to trade. Add and activate multiple Strategies in the Strategy Monitor and you are
ready to begin. Whether you are using a daily or intraday interval, each strategy will be
evaluated for new trading opportunities as the data is updated. As with other tools
having alert-generating capability, you can route orders directly to the Orders tool for
automated order entry via the Auto Place function. You may also Stage Orders for later
submission, Place Orders for immediate submission, or send the alerts to be monitored in
the Quotes tool.
Strategies are executed only when a new complete bar interval is received.
Alerts and indicator calculations are based on the last complete bar interval
only.
Prior to Auto-Trading with a live account, investigate the Paper Trading option
to familiarize yourself with the aspects of automated trading. In the User
Guide, see: Orders > Paper Trading.
Important! When the Auto Trading is enabled, it is enabled for all Fidelity accounts in a
given household.
In general, the Orders tool ensures a consistent order flow from trading strategies such
that each trade remains open or canceled based on the trading strategy's logic and that
no order is duplicated.
Orders that are already staged will not be submitted upon selecting Auto
Trading Mode. Also, orders entered manually and put in the queue by clicking
the Stage Order button will not be placed automatically even if Auto Trading is
enabled.
Auto Trading will be turned off by any of the following actions:
Clicking the Enable Auto Trading button after it has been selected
Clicking the Cancel All Orders button
Closing the Order Manager
To learn more or get started using Auto Trading, please call our Active
Trader Service team at 1-800-TRADER1.
Automated trading poses significant additional risks. Use of Wealth-Lab Pro’s automated
trading feature is subject to additional terms, conditions, and eligibility requirements.
5 Data
Wealth-Lab Pro isn't useful for backtesting without a good set of historical market data to
use as the basis for strategy development. You have many data options, but it's
important to understand that all data are not created equally! In this chapter, we'll learn
primarily how the Data Manager tool can collect and update price and fundamental data,
and we'll describe some of the details of the static data providers that come packaged
with the Wealth-Lab installation.
With Wealth-Lab Pro Version 6, it's never necessary to run Active Trader Pro to
access data.
Data Specification
For OHLC/V data, two requirements exist:
1. The data must include a Closing price series and a corresponding series of Dates. High,
Low, Open, and Volume series are recommended if available, but are not absolutely
required.
2. For the proper display of Performance data following a backtest, none of the OHLC/V
series can contain negative values. Generally this isn't a problem for stock data, but
some futures continuous contract data can contain negative values. In this case, we
recommend adding a constant value to the OHLC series such that all data are non-
negative (example).
Data Precision
Wealth-Lab Pro Version 6 accesses and stores price and volume data with double-
precision. This means that price data and calculations based on it are accurate to at
least 15 digits of precision.
In backtests, Wealth-Lab creates trades at the full precision of the data for AtMarket and
AtClose orders. For example, a stock that splits 3:1 and traded pre-split at 35.21, will
trade post-split at a double-precision value of 11.7366666666667. Note that this value
Testing Equality
Finally, it's important to understand that even at double-precision, most floating point
numbers cannot be represented precisely in a computer. Avoid testing exact equality of
floating point numbers. If necessary, one technique is to define an acceptably small value
that you can use to compare to the absolute value of the difference between two floating
point values (example).
Example (How to run Example code? 8 )
C#
// Buy and hold a stock that closes at 40.43
protected override void Execute()
{
const double Epsilon = 0.0005d;
for(int bar = 1; bar < Bars.Count; bar++)
{
if (Math.Abs(Close[bar] - 40.43) < Epsilon)
BuyAtMarket(bar + 1);
}
}
Data Corrections
The Fidelity static provider applies data corrections during all Data Manager updates as
well as on-demand requests.
Exception: Strategy Monitor updates for 10-minute intervals and lower do not
include corrections. Before starting the Strategy Monitor, we recommend using
the Data Manager to update DataSets used.
Data Editing
If supported by the static Provider, editing, adding, or removing bar data (or manually
applying a split) is possible from the chart interface. See Edit Bar Data 61 in Charting >
Chart Context Menu.
custom user settings, configurations, Strategies, static data, and more are found at the
following path and its subfolders, named appropriately for the data they contain. To see
these data it may be required to configure Windows Explorer's Tools > Folder Options >
View dialog to Show hidden files/folders.
Windows XP, Windows Server 2003:
C:\Documents and Settings\Windows User Name\Application Data\Fidelity Investments
\WealthLabPro\1.0.0.0\Data\
Windows Vista, Windows 7, Windows Server 2008
C:\Users\Windows User Name\AppData\Roaming\Fidelity Investments\WealthLabPro
\1.0.0.0\Data
Right-click the DataSet and select Rename or Delete from the pop-up menu.
Data Manager showing Symbol Details for the selected DataSet (Dow 30)
and right-click DataSet actions menu.
Update DataSet
Updates pricing (OHLC/V) of the selected DataSet as well as data from the Fundamental
Data Providers selected in the Update Data view for the symbols in the selected DataSet.
Symbol Details
Displays the Symbol, Security name, number of bars, and the date last updated for each
symbol in the DataSet. If the DataSet has many symbols, this operation could take
several minutes.
Naming DataSets
You can use letters, numbers, and special characters in DataSet names, and, you can
rename a DataSet at any time.
Tip:
While a DataSet's Scale is obvious in the Data Manager, the Scale may not
be obvious when searching through many DataSets in the Data Tree. You
can avoid confusion by consistently naming Intraday DataSets with a suffix
containing the intraday interval. For example Dow 30_5 or Dow 30(5) would
indicate that the DataSet is composed of 5-minute data.
Advanced: Names of DataSets are only important when Strategy code needs to
access a symbol in a DataSet that is not currently under test. In this
case, Wealth-Lab searches through DataSets in alphabetical order to
find secondary-symbol data.
It's worth noting that static and streaming providers work together to provide chart
backfill and streaming data for charts. Generally speaking, in Wealth-Lab Pro Version 6,
once you've requested historical data for a particular scale, it never needs to be
requested again since it will be stored locally by the static provider.
5.1.1.1.1 Fidelity
The Fidelity Static Data Provider comes with an accompanying Streaming and Fundamental
Data Providers. Fidelity data are split-adjusted, but are not adjusted for dividends and
other cash-distributions. You can, however, "collect" dividends (or pay if short a stock)
during backtests by enabling "Apply dividends" in the Backtest Settings 230 .
Step 2a. Enter the Symbols manually or paste them from the Clipboard
Entering symbols is final step for this choice before naming the DataSet.
Symbols should be separated by spaces, commas, or new lines.
Step 2b. Select the Symbols from predefined Industry Classification groups
Click the Update Industry Data button to retrieve or update the GICS
data, which is stored locally. Once the Industry Data is available,
navigate to the SubIndustries and double-click or use the arrow buttons.
You can select more than one SubIndustry
5.1.1.1.2 ASCII
ASCII is a universal text document format, and many data vendors use ASCII format to
store their data. ASCII data can come in a wide variety of formats, and Wealth-Lab Pro is
very flexible in its ASCII support.
The name of the file (excluding the extension) is used as the symbol.
Each record in the file represents one bar (or tick).
At a minimum, a record must contain a Date field and one numeric field (Close).
Excluding fields that are specified as Date, Time, or Security Name, all other fields
must be numeric. If your data files contain other fields that non-numeric, these fields
should be specified as "Filler" when creating the ASCII DataSet in Wealth-Lab.
The format of each record (decimal character, field delimiter, etc.) is variable, but you
must specify these properties when creating the ASCII DataSet in Wealth-Lab. See
Format Options below.
Data can be in chronological or reverse-chronological order.
How it works
When an ASCII file is accessed for the first time, a binary file is created that comprises its
Bars object and any custom Data Series that it contains. Subsequent backtests benefit
from reading the data from binary cache. The provider compares the time of last
modification of actual ASCII file with its cached version. If it hasn't been modified, data is
read from cache, otherwise the cache is cleared and re-created. To easily tell that you're
working with cached data, the chart will display an extra string "#Cache#" attached by
the provider to the Bars.SecurityName property.
Background
Because ASCII files contain text strings, they have to be parsed and converted to
numbers. Binary files, like WL native format, MetaStock and others don't require parsing,
so working with them is faster. From the technical standpoint, there are arguments as to
how implement caching: file-based cache vs. RAM-based. Although caching in RAM could
be slightly faster, it increases memory consumption and such cache must be recreated in
every Wealth-Lab session - so the file-based scheme wins!
Benefits of caching ASCII data is noticeable on large data histories. On a final note, it
effectively deprecates the workarounds like DataToWL or utility scripts that serialize data
to binary formats, leveling out the speed difference between ASCII and binary data files."
Add Field...
Time
If the data file contains a separate field for time, add Time to the field list
and move it to the appropriate position. It's common for a single white
space to appear between Date and Time. In this case, don't add a
separate Time field unless the Field Separator is actually a "Space".
Open Interest
Add the Open Interest field for futures data containing Open Interest. Use
the FindNamedSeries method of the Bars object to access the Open
Interest DataSeries.
Filler Items
For non-numeric items, or other fields that should not be read, add "Filler"
items to act as place holders. Filler fields are simply skipped so that the
rest of file can be properly parsed.
Custom Field
Custom Fields contain any other numerical data like indicators or
fundamentals. You must provide a unique name for each custom field that
you enter. Use the FindNamedSeries method of the Bars object to
Format Options
Common Formats...
If applicable to your ASCII DataSet, select a common format to quickly
arrange the ASCII Format settings, or, apply the format of an existing
ASCII DataSet to the one that you're creating via Copy format from a
DataSet. Add your own frequently-used ASCII Formats to the list by
selecting Save these Settings as a Common Format.
Date Format
Specifies the description of how dates are formatted in the file. For a
specification of the Date and Time Format specifiers, see http://
msdn2.microsoft.com/en-us/library/8kb3ddd4(VS.71).aspx
Time Format
Specifies the description of how time values (if present) are formatted in
the file.
Field Separator
Specifies the character that separates the fields in a single row of data.
If your ASCII data uses a field separator that doesn't appear in
the list, just type it in.
Decimal Separator
Specifies which character is used as the decimal separator for price fields
- either Period (.) or Comma (,).
Thousands Separator
If it exists, the Thousands Separator must be different than the Decimal
Separator.
Ignore First/Last Lines in File
If your data file contains one or more header/trailer lines, specify this
value in the Ignore First Lines in File entry field. These lines are ignored
when the file data is imported.
Volume Multiple
Some files store volume data that must be multiplied by 10, 100, or
another multiplier.
Implied Decimals
Decimal numbers that do not actually use a decimal separator require an
implied decimal specification. For example, the number 12340 with 2
implied decimals would be imported as 123.40.
It's rare to find data that uses implied decimals. Specify 0 if
you're unsure.
5.1.1.1.3 MetaStock
The MetaStock format is a common data format for historical financial data. It is the
format used by the Reuter's DataLink data subscription service.
The WL4 Files (Wealth-Lab Version 3/4) Format Provider lets you connect to Wealth-Lab
Pro or Developer DataSources that you created with Version 4 or prior. We've created
the WL4 adapter for WL5 as a matter of convenience for backtesting with existing data.
You cannot create or update Version 4 data using this adapter.
Wealth-Lab Version 6 Streaming data providers use local history from a
corresponding Static provider for backfill. If you want to use a year of 5-minute
data in a streaming chart - no problem! For trading and streaming charts, it's to
your advantage to build up and use Version 6 DataSets.
For Version 4 installations on the same machine, choose the first option to
connect to an existing WatchList.
For Wealth-Lab Pro 4, choose the first option only for Fidelity
DataSources. For all others, such as Yahoo!, Intraday
Historical, etc., use the second option.
5.1.1.1.5 Yahoo!
Wealth-Lab Pro's Yahoo! Provider could very well be the best Yahoo! downloader available
for static Daily data. Its features include:
Local storage of split and dividend history, which can be optionally applied to price data.
This means that DataSet refreshes are never required in order to apply the most-
recent split and dividend data.
Chart Annotations 209 : "Split (Yahoo! Finance)" and "Dividend (Yahoo! Finance)".
Automatic data corrections for data changed on the Yahoo! server (usually affects
volume).
On-demand data requests supported.
Tip:
To increase history depth at a later time, simply delete the
DataSet and recreate it using an older starting date. The
Yahoo! Provider will automatically refresh symbols with the
oldest starting date requested from any DataSet.
Provider Settings
The Yahoo! Provider Settings are
found in a dedicated tab in the
Data Manager (see image)
Perform Dividend/Split
Adjustment
Data are adjusted at the moment
they're passed to Wealth-Lab by
the Y! Provider so that the newest
dividends are applied automatically
to the price data. Note that split
and dividend adjustments affect
both price and volume. The
dividend adjustment factor
equation is 1 - dividend/close .
Prices (pre-ex-date) are multiplied
by the adjustment factor(s),
whereas the factor becomes the
divisor for volume.
Adjustment mode when Data Range Applies to: Perform Dividend and Split
specified Adjustment
Choose "Keep" so that price and volume data are always the same, historically, even when
specifying a past data range. "Ignore" is an advanced option for testing with past
adjusted data without the influence of future splits or dividends that are excluded from
the chart's Date Range.
To use the bar data editor for anything besides deleting a bar in a Y! chart, you
must apply the "Keep" option during the edit. See Data Editing below.
Data Editing
To edit bar data, open a chart and either: a) double-click the bar to edit, or, b) right-click
the bar and select Edit Bar Data. When editing Y! data, be aware of the Perform
Dividend Adjustment selection since the chart values will reflect this adjustment. Deselect
this option and refresh the chart to edit raw price and volume.
With the "Ignore splits and dividends which fall out of the range" option
selected (disabled by default), only deleting bars is possible.
Also Update Symbols that you accessed, but are not contained in DataSets
When you delete DataSet from a Wealth-Lab-integrated Provider, only the list of symbols
is deleted, but the price data is not. Enabling this option will continue to maintain all
symbols' price data when you perform an "Update all" even if the symbols no longer exist in
any DataSet.
Automatically update data for symbols on-demand when they are charted or
accessed.
This is the same option as File > Update Data on Demand. While this option is useful during
the trading day to access ad-hoc static charts, Multi-Symbol Backtests will run faster
with "on demand" disabled. Use the Data Manager for the best update performance.
Streaming charts ignore the "on demand" selection, and, in some cases will
cause static data to be updated with the historically-requested bars.
LastUpdateLog.txt
For performance reasons, Wealth-Lab clears the update log automatically when
approximately 50kB of text is displayed. Nonetheless, you can obtain the complete log of
the most-recent update by inspecting the LastUpdateLog.txt file located your Wealth-Lab
Data directory 35 .
Symbol Quarantine
Quarantined symbols do not participate in Fidelity Data Updates. When Wealth-Lab Pro
detects a specified number of [Symbol Not Found] errors during data updates, those
symbols are placed in the quarantine list. See Error(s) Before Quarantine 52 .
Actions
Delete Symbol(s)
This action physically deletes the data for the selected symbol(s) in the quarantine list
and removes them from all Fidelity DataSets. Prior to deleting a symbol and its data:
1. check to see if the symbol has changed. If it has, perform the Change Symbol
action instead to preserve the local data history.
2. determine if you want to maintain data from delinquent companies for testing. If
so, do not delete symbols from the quarantine!
Restore Symbol(s)
The restore action removes selected symbol(s) from quarantine so that they will
participate in Fidelity Data Updates. Restored symbols are simply removed from the list
and can re-enter the quarantine after failing updates again.
Change Symbol
Symbols change more frequently than you may imagine. (In 2006 alone, nearly 800
companies traded on U.S. exchanges permanently changed their symbols.) Using the
Change Symbol action, you can update all Fidelity DataSets and data files for a change in
symbol. This action can take several seconds the first time it's used in a Wealth-Lab
session, but thereafter the operation is much quicker.
Relocate Data
Specifies the location of Fidelity price and fundamental data. You can, for example,
update and store all of your Fidelity static data on a shared network folder and access it
from any computer on the LAN with Wealth-Lab Pro. If you physically move existing data
from the default location 35 to a new folder, arrange it such that the top-level folder that
you specify for the Relocate Data path contains the folders FidelityStaticProvider and the
fundamental data folders, FidelityFMDFundamentalProvider and FidelityWSOD*.
2. Launch the Data Manager (Ctrl+M) and select the Fidelity Export tab
3. Check one or more of your Fidelity DataSets containing the symbols that you want to
export.
4. Select symbols individually or click the Select/Deselect All Symbols buttons. You
cannot export more than 50 symbols per Watchlist.
5. Name your Watchlist. You cannot use the name of an existing Fidelity.com Watchlist.
6. Click Export
The Export button is enabled if, a) you're logged in to Fidelity, b) the number of
symbols selected is 1 to 50, and, c) 15 or fewer Watchlist exist at Fidelity.com.
6 Charting
Charts are the primary tool of a technical analyst to visualize trading opportunities as well
as to verify that a programmed strategy is functioning per specification. This chapter is
dedicated to describing the types of charts that are available as well as the most basic
operations you'll need to get going with Wealth-Lab charts. As you become more familiar
with Wealth-Lab, you'll find that additional methods are often available to perform the
same action.
To perform this operation, it is necessary that the chart's status bar is in view.
If it is not, select the Show Status Bars on Chart button in the Function
"Show" toolbar.
See also: Strategy Window 95
1: Price Pane
The main OHLC/V Data Series (1a) are automatically plotted in the Price Pane according to
the selected Chart Style 79 . Up/Down coloring of the bars are controlled in the Chart
Colors 206 Preferences. Prices Tooltips 207 (1b) are displayed, when enabled, upon hovering
the mouse pointer over a specific bar. Horizontal and vertical gridlines (1c) as well as
Pane separators can be optionally displayed based on their individual selections in the
Chart Colors and Styles 206 Preferences, whose chart shortcut is (Ctrl+F12).
2: Volume Pane
Volume data are automatically displayed in the Volume Pane as a histogram (2a), whose
Up/Down coloring defaults are controlled by the Chart Colors 206 Preferences.
Chart Status Bars are displayed only if Show Status Bars on Chart is
selected in the Function toolbar.
7: Y-axis
Each pane has its own y-axis that is auto-scaling for data currently displayed. By default,
y-axes are scaled linearly, but can be made logarithmic programmatically by the
SetLogScale() method.
Wealth-Lab does not provide a special method to display more than one y-axis
scale in the same pane, though a motivated programmer could certainly
accomplish this.
8: Chart Scaling
Hovering the mouse over the cue will display a basic scaling menu
from which you can use one click to change the chart
scale to Daily, Weekly, Monthly, or any of the n-Minute scales shown. Using this method
to change a chart scale is convenient especially when the Data Panel is hidden.
Print
Prints the chart image. See Print Preferences 238 in the Advanced Options.
Immediately send a market order to Buy, Sell, Short, or Cover the underlying ticker to the
Orders tool.
Remarks
Right-click trading is disabled for Portfolio Simulation mode Max Percent Risk sizing.
Trades are destined to the default trading account 240 unless the underlying Strategy
has an alternate account association. You can associate Strategies with specific
accounts with the Strategy Explorer 305 via the Set Account account.
All trades are market orders, however, you can edit the trade once in the Order
Manager's queue if Auto-Trading is disabled. If the Auto-Trading is enabled, trades
are immediately placed at market without the ability to edit the order.
Equity is based on the equity curve value at the last bar after
running the ChartScript.
* mrb = most-recent bar
Data Panel
Use the Data Panel to control chart Scale, Data Range, and Symbol. Position Size isn't a
chart control setting per se, and like the Strategy Parameters frame, it applies only to
Strategy Windows 95 and Alert sizing for Tradable Trendlines 71 .
See the Data Panel 292 topic in the Reference chapter for a more complete treatment of
this very important set of controls.
When a Chart or Strategy window is in focus 325 , the Function Toolbar provides several
charting control options for that window. Different chart windows have their own set of
options, which are recalled each time focus returns to the window.
New
Selections identical to File | New in the main menu for creating a new DataSet and
launching fresh Chart/Strategy, Workspace, and Quotes windows.
Open Strategy
Launches the Strategy Explorer to open a strategy in a new Strategy window.
Save / Save As
Saves Dragged & dropped indicators, Strategy code, and/or Wizard-based Strategy Rules.
Log in to Fidelity
Logs in to Fidelity servers, which is required for streaming charts, Strategy Monitor, GICS
updates, account views and trading.
Spacing:
To adjust the spacing of the bars on your chart, use the Increase, Decrease, and Restore
bar spacing buttons. You can also control the bar spacing by scrolling the mouse wheel
Increase
Increases the width of bars so that fewer are displayed in the chart area. Use this in
combination with the horizontal scroll bar to see more detail in a specific area.
Restore
Restores bar width to Wealth-Lab's default setting.
Decrease
Decreases the width of bars so that more are displayed in the chart area.
Chart Styles:
Chart Styles are graphical representations of an instrument's OHLC/V data.
Linear Scale
Semi-Log Scale
Switch between linear and semi-logarithmic scales by selecting the appropriate button.
The semi-log scale option scales the Y axis of the chart by percentage change in price,
rather than absolute price value. With log scaling, the distance between 10 and 100 on
the Y axis would be the same as the distance between 100 and 1000. It's called "semi-
log" because the X axis (time) is linear, not logarithmic.
Tip:
To control a chart pane's y-axis scaling from your Strategy code, use the
SetLogScale method.
Show:
Preferences.
Tip:
To toggle "Show" selections to all charts at once, press and hold the Alt key
when clicking on of the Show buttons above.
Data Window
The Data Window displays digital information for all plotted prices and indicators for the
bar at the mouse pointer's position. The decimal display for prices and indicators is
The Drawing toolbar is located along the right border of the application.
As with DataSets, the subfolders are organized by scale and symbol, and, the drawing
object (.DRW) files are binary-formatted. Generally, the raw data from these files are not
useful to you. However, it may be useful to know that you can delete the DrawingObjects
and/or scale folders to clear all drawing objects for all symbols in a single operation.
Before deleting Wealth-Lab data, close all Workspaces first.
Drawing objects are saved for Symbol/Scale upon closing a Chart or Strategy
Window.
Click and drag an object by its red handle, but use the grey handles for resizing.
Drawing objects remain contained in the pane (Price or Volume Panes only) in which they
are drawn. However, by using a movement handle on an edge opposite of the direction in
which you want to drag, it's possible to extend objects partially outside the top, bottom,
or left portion of the pane while preserving the object's original shape. However, a
drawing object cannot extend past the right edge of a chart. In this case, object's will
distort (become smaller) in the horizontal dimension.
Crosshair Tool
Use the crosshair to visually align vertical and horizontal components of a chart. Select
the crosshair, click, hold, drag and release at the desired location. The price and date are
shown at the left and upper extremes of the crosshair.
When hovering the cursor over the balloon, two handles will appear. The red, upper-left-
most handle allows you to reposition the balloon. To move the pointer to a different
location, drag and drop the grey handle at the tip of the pointer.
Image Tool
Quickly add your company's logo or other image to a chart via the Image Tool. You use
image files of type *.BMP, *.JPG, *.JPEG, *.GIF, *.PNG, or *.TIF.
Select this tool and then click on an area in the chart where you want the upper-left
corner of the image to appear. After identifying this area, select the image file from the
dialog box that appears and click Open. The image can be repositioned using its selection
handle.
6.4.2 Shapes
Tip:
You can set a Fill Transparency value from 0 (opaque) to 100
(transparent) for each shape's Properties. A value between 75 and 90
provides a very pleasing effect on a chart.
Rectangle Tool
Ellipse Tool
Rectangles and ellipses are drawn in a similar fashion by defining two-opposing corners of
the shape. In the case of the ellipse, the "corners" are the intersecting (and invisible)
horizontal and vertical tangent lines. Select the shape desired, click on the first point on
the chart, and while holding the mouse button drag until reaching the second point.
Resizing these objects are done in the standard manner using the grey resizing handles.
Triangle Tool
Diamond Tool
The triangle and diamond-shape tools actually create 3 and 4-sided polygons,
respectively. Choose the tool by clicking on it once, and then create a vertex by left-
clicking a point on the chart. While maintaining the button depressed, drag the cursor to
another point for a second vertex.
Trendline Tool
Tip:
For a horizontal trendline, select the
Trendline tool and simply click once on
the chart and release. Drag the line with
the red handle to precisely the price level
desired by monitoring the Trendline value
displayed.
Name of Line
A useful Strategy feature is the ability to provide a
name for your manually-drawn trendlines in the
Trendline Properties dialog. You can then access the
Trendline Properties
trendline's value at any specific bar in your Strategy
code, using the TrendLineValue function.
Drawing Style, Options
You can set the color, thickness, and line style of the trendline, as well as control
whether the ends "snap" to the nearest price (open, high, low or close). With the snap
feature, you may need re-drag the end points after initially drawing the trendline.
Trendlines may be extended right and/or left. When extended, the "drag handles" are
positioned at the trendline endpoint(s) when hovering the cursor. Finally, you can display
the percentage change between the closing prices that correspond to the trendline
endpoints.
namespace WealthLab.Strategies
{
public class MyStrategy : WealthScript
{
protected override void Execute()
{
const string trendlineName = "Resistance";
double res;
for(int bar = 1; bar < Bars.Count; bar++)
{
if ( Close[bar-1] < TrendlineValue( bar-1, trendlineName ) )
{
res = TrendlineValue( bar, trendlineName );
if ( Close[bar] >= res )
{
SetBarColor( bar, Color.Green );
DrawCircle( PricePane, 10, bar, res, Color.Red, Color.Yellow, WealthLab.Li
}
}
}
}
}
}
We recommend always leaving "Extend Line Right" checked for Tradable Trendlines.
Trade Alerts
The share (or contract) size for TT Alerts is based on the Position Size setting and the
closing price of the Alert bar. For example, $5,000 fixed sizing for a stock that closes at
$25.00 will cause the Alert sizing to be 200 shares. The trendline name will appear in the
Signal Name 328 of the Alert, i.e., Tradable Trendline( Trendline_name ).
Because TT Alerts are market orders, they will out-prioritize Stop and Limit
Alerts from an underlying Strategy while using the Auto-Trading. Since
Tradable Trendlines signals are discretionary in nature, we do not recommend
mixing TT Alerts with automated system trading.
TT Alerts are directed to the Default Account 240 . To direct the order to a
different account, right click to edit the alert or order.
The same TT will continue to generate Alerts 321 as bars are added to the chart
as often as the crossing condition occurs.
Scale matters: TTs trigger Alerts only for the symbol and scale for which they
were drawn.
6.4.4 Fibonacci
Fibonacci Retracement
Fibonacci Fan
Fibonacci Arcs
Fibonacci Retracement, Fan, and Arcs tools project support and resistance areas into the
future that are characterized by Fibonacci and/or user-defined ratios. After defining a
major peak and trough, these zones are represented in the various manners by dividing
the difference between the peak and trough into the ratios configured in the Fibonacci
Retracement Properties dialog.
Although the principal Fibonacci ratios are 38.2, 50.0, and 61.8%, Wealth-Lab allows you
to enter your own ratios, which may be any positive number expressed as a percentage.
The manner in which each Fibonacci Retracement tool is drawn is exactly the same.
Select the desired tool, and draw a line from a swing high to a swing low, or from a low to
a high. The Fan and horizontal retracement levels are extended to the chart edge. You
can modify the levels by editing the Fibonacci control line.
Tip:
Generally Fibonacci tools are drawn between well-defined peaks and
troughs. However, when drawn to the end of the chart before a peak/
trough develops, the retracement values will be "off the chart". To see the
retracement levels add the statement PadBars(15); to the Execute()
method in a Strategy window.
Consequently, the Time Zone tool draws vertical lines at Fibonacci number distances,
where each zone line is relative to the previous.
To draw the time zones, simply click the tool and then click the bar on which to begin the
Fibonacci Time Zones. The [first] line drawn at the start bar is the control line used to
select, edit and move the object. A number corresponding to the Fibonacci distance is
displayed for each time-zone line. The illustration below indicates where lines will be
drawn if the start bar were Bar Number 0 (the first bar in the chart).
Tip:
If using more than one Time Zone tool in the same chart, you can
distinguish them by changing the color and/or line style in the object's
property settings. Double-click (or right click) the initial line to Change
Drawing Object Properties.
Tip:
Change the Line Width to 2 or more to
clearly identify the 1x1 (45º) line. Gann Fan Properties dialog
To edit the properties, launch the Gann Fan Properties dialog by double clicking the origin,
or by selecting Change Drawing Object Properties from the chart's right-click menu.
Tip:
Adjust the Time Unit setting to a number such that the 1x1 line appears at
a 45º angle on the chart. For higher-priced instruments like indices, a
number greater than 10 is required, whereas a number 0.5 or less is suitable
for most stocks. As a general rule, raise (lower) the number if the 45º line is
too flat (steep).
namespace WealthLab.Strategies
{
public class GannFan : WealthScript
{
/* Draw a Gann Line and return its value on the last bar of the chart */
public double DrawGannLine( int bar, double price, int timeUnits, int priceUnits,
double priceUnitsPerBar, Color color, LineStyle style, bool drawU
{
//int b2 = bar + (int)Math.Round(timeUnits/priceUnitsPerBar);
int b2 = bar + timeUnits;
int bcm1 = Bars.Count - 1;
double delta = priceUnits * priceUnitsPerBar;
double y = price + delta;
if( !drawUp ) y = price - delta;
if( b2 > bcm1 )
{
DrawLabel(PricePane, "Sorry, cannot draw this line", Color.Red);
return -1d;
}
else
{
DrawLine(PricePane, bar, price, b2, y, color, style, 1);
double res = LineExtendY(bar, price, b2, y, bcm1);
DrawLine(PricePane, b2, y, bcm1, res, color, style, 1);
return res;
}
}
/* Adjust the priceToTimeRatio so that the black 45 deg line (1:1) appears to be 45 de
* If the line is pointing upward too steeply, then raise the value (and vice-versa).
*/
double priceToTimeRatio = 0.25;
if( tb > 0 )
{
DrawGannLine( tb, Low[tb], 1, 1, priceToTimeRatio, Color.Black, LineStyle.Solid, tr
int n = 2;
do
{
DrawGannLine( tb, Low[tb], 1, n, priceToTimeRatio, Color.Blue, LineStyle.Solid,
DrawGannLine( tb, Low[tb], n, 1, priceToTimeRatio, Color.Red, LineStyle.Solid, t
n += 2;
} while (n < 8);
}
}
}
}
The distance of the channels are based on the highest distance of a single point above or
below the regression line. To edit or delete a Regression Channel, follow the same
procedure as described for trendlines.
Exercise in Linear Regression
1. Drag and drop a LinearReg indicator with a Period of 50 into a chart (Plotting
Indicators 86 ).
2. Select the Regression Channel Tool.
3. Click on the last bar of the chart, hold, and drag backwards 50 bars and release.
For assistance in determining the precise number of bars, watch the bar number in
the Price Data Status Bar 58 .
4. Move the regression channel back and forth by grabbing its red handle along the
middle regression line. You should see that the regression channel always ends
precisely at the same value as the LinearReg indicator.
The n-Period linear regression line always ends at the value of the n-Period LinearReg
indicator.
Only the defining trendline is used for editing and movement of the S-R object. The two
resistance lines are formed automatically by drawing lines from the origin that intersect
values at the final bar that are 1/3 and 2/3 the distance between the prices identified by
the control trendline. The intersection points, illustrated by the grid crossings at points A
and B, are located at the same bar as the end point of the control trendline. Since the
trendline is drawn from 94.0 to approximately 106.0, the 1/3 divisions are 4.0 points apart.
Notice how the resistance lines cross the endpoint bar at 102.0 (A) and 98.0 (B).
To edit the properties, launch the S-R Properties dialog by double clicking a selection
point, or by choosing Change Drawing Object Properties from the chart's right-click
menu.
It's easy to duplicate S-R lines and other objects in a script as the next example
demonstrates.
namespace WealthLab.Strategies
{
public class SpeedResistanceDemo : WealthScript
{
public void SpeedResistance(int bar1, double price1, int bar2, double price2 )
{
// You can extend the lines drawn with this procedure using LineExtendY or LineExtendY
double delta = price1 - price2;
DrawLine(PricePane, bar1, price1, bar2, price2, Color.Red, LineStyle.Solid, 2);
DrawLine(PricePane, bar1, price1, bar2, price2 + delta / 3, Color.Blue, LineStyle.Dots
DrawLine(PricePane, bar1, price1, bar2, price2 + delta * 2 / 3, Color.Blue, LineStyle.
}
protected override void Execute()
{
// Find the latest 8% peak and trough and draw the S-R lines between them
int bar = Bars.Count - 1;
int b1 = (int)PeakBar.Value(bar, Close, 8.0, PeakTroughMode.Percent);
int b2 = (int)TroughBar.Value(bar, Close, 8.0, PeakTroughMode.Percent);
if (b2 > b1)
SpeedResistance( b1, Close[b1], b2, Close[b2] );
else
SpeedResistance( b2, Close[b2], b1, Close[b1] );
}
}
}
Software developers can create their own Chart Style Adapters for Wealth-Lab Pro. See
the WealthScript Programming Guide chapter "APIs".
6.5.1 Line
Line
The Line style is the most simple of all chart styles. It is formed by connecting the closing
prices of contiguous bars with a line segment whose color is based on the Up/Down Bar
Color specified in the Chart Colors and Style Preferences (F12).
Since Wealth-Lab's Up/Down Bar Color is with respect to the open and close of
the current bar, it's possible for a descending line segment to be drawn with
the "up" color and vice versa due to gap openings 321 .
Chart Style Settings...
Line Width Specifies line thickness in pixels.
6.5.2 OHLC
OHLC
The Open-High-Low-Close representation is one of the most popular chart styles since it
conveys all of a bar's information in a concise format. Referring to the OHLC icon selected
above (top left), the open and closing prices of the bar are represented by the horizontal
ticks to the left and right of the vertical line, respectively, while the high and low of the
bar are given by the extremes of the vertical line, which in turn represents the bar's
trading range. If the right tick (close) is higher than the left tick (open), then the bar is
drawn with the Up Bar Color selected in the Chart Colors and Style Preferences (F12).
6.5.3 Candlestick
Candlestick
Candlesticks contain the same Open-High-Low-Close information as OHLC bars, but
accentuate the difference (if any) between the open and closing prices. The rectangular
area of a Candlestick bar is called the "body". The lines above and below the body are the
"shadows". The relationships between the bodies, shadows, and their relative sequence
give rise to a whole new class of technical analysis first made popular to U.S. traders in
the early 1990's in Steve Nison's books "Japanese Candlestick Charting Techniques" and
"Beyond Candlesticks".
6.5.4 EquiCandle
EquiCandle
EquiCandle simply combines the techniques of both Candlestick and EquiVolume chart
styles. Opening and closing price information is preserved in this "EquiVolume"
representation.
6.5.5 EquiVolume
EquiVolume
EquiVolume charts combine price movement and volume into a single representation. Bars
are composed of only the highest and lowest price for the interval, which are designated
by the top and bottom, respectively. Bar width is determined by volume and consequently
is relative to other bars in the chart. For example, you would expect the width of a bar
on a day that traded 100,000 shares to be twice as wide as a bar on a day whose volume
was only 50,000 shares.
Thin bars having large price variation can be interpreted to be "easy movement", whereas
small bars having a squarish shape indicate lack of commitment from both bulls and bears.
On the other hand, strong commitment from these camps are detected on bars with large
volume, observed by thick bars. Large price movement on these days indicate a push
from one side, whereas a short and wide bar signifies a battle between both sides.
Special note for executing scripts that use Chart Style public methods
Wealth-Lab does not execute a Strategy automatically following a change
to a Chart Style's settings. This is of no consequence unless your script
uses data from a Chart Style adapter's public methods. In this case, you
must manually execute the script after a settings change for trades to
reflect the new settings.
6.5.6.1 Kagi
Kagi
Steve Nison tells us in Beyond Candlesticks that "Kagi" comes from the Japanese word for
key and that the lines drawn by this style resemble an old-fashioned key with an L-shaped
head.
Wealth-Lab's Kagi charts are based on closing prices only. After choosing the Kagi Chart
Style, configure the Kagi Reversal Amount in the Chart Style Settings. You can choose
between percentage or point reversals. If you don't think you're seeing a sufficient
amount of Kagi lines, try reducing the reversal amount.
Tip:
When using Kagi percentage reversal, switch to the semi-log Chart Scale
setting so that all same-percentage moves are viewed as equal vertical
displacements. Likewise, use a linear Chart Scale for Kagi point reversals.
Kagi lines are constructed by drawing a continuing vertical line in the direction of gradually
increasing price until a reversal occurs (on a closing basis) that meets or exceeds the Kagi
Reversal Amount. When a reversal occurs, a short horizontal line, called the inflection
line, is drawn. A vertical line is then drawn in the reverse direction by the full value of the
reversal and continues with decreasing price until another reversal of the specified
magnitude occurs, and so on.
Due to the manner in which Kagi charts are drawn, the time axis is irregular.
Dates and price data are displayed only for the bar of the highest or lowest
point before the next reversal.
Line Break
Wealth-Lab offers a representation of the most popular Three-Line Break chart, also
referred to as "Three-Price", "Three-Step, and "Three-Link" Break. The Line Break style
uses closing prices only and allows you to visualize trends and trend reversals in any time
frame. Although three (3) break prices is most often used, you can select any number of
In a bull market, white (up) lines are drawn for each new higher closing price. After three
white lines are drawn, the reversal or "break" price becomes the third previous higher
close. Acting like a stop, the break price trails as new higher closes occur. When the
break price is penetrated on a closing basis, a reversal (dark) line is drawn. At this point,
a new [bear] trend can develop downward, or, the previous trend can resume if a new
higher close occurs. When three dark lines are drawn, the bear trend has been
established and the process is same. Trend-less markets are observed by alternating
reversal lines, white and dark.
Since lines are drawn only for new price highs and lows, the time axis for Line
Break charts is distorted and uneven. During periods of large price movement,
more bars will be shown than in a similar less volatile period.
6.5.6.3 Renko
Renko
As with Line Break, Renko charts use only closing prices. However, the Renko chart style
draws bars, or bricks, of the fixed amount that you specify in the Chart Style Settings as
Renko Price Units (RPU). Price must move greater than this fixed amount for a new brick
to be drawn, and, no matter how large the price movement, bricks are always drawn
equally-sized. For example, a 10-point move in a 2-RPU chart would result in five
consecutive 2-point bricks.
The Renko basis price, or starting price is quite arbitrary and is based on your Data
Loading configuration. Consequently, Wealth-Lab uses cardinal boundaries when
determining to draw a new bar. For example, if you set an RPU of 1.0, bricks will be drawn
for 1-point price changes relative to integer price levels, e.g. 10, 11, 12, etc. Because
Renko bricks are all the same size, price changes in excess of an integer multiple of the
RPU are discarded. Continuing the previous example, if our Closing Price Series were ...,
9.0, 9.1, 10.8, ..., only a single brick would be drawn from 9 to 10.
Finally, for a brick to be drawn in the reverse direction, price must exceed the base price
of the previous brick by the RPU. Expanding our example series ..., 9.0, 9.1, 10.8, 10.1,
9.2, 8.7, 7.3, ...., a reversal brick would be drawn from 9 to 8 upon the 7.3 close.
Remarks
1. Since "bricks" are drawn only when price exceeds the RPU, the time axis for Renko
charts is distorted and uneven. During periods of large price movement, more bricks
will be shown than in a similar less volatile period.
2. Price movement that does not result in the drawing of a brick is unimportant for Renko
charts, therefore, the Data Window displays only the OHLC/V data for the underlying
bar of data from which a brick is formed.
The basic PnF charting method divides the price axis into a user-specified box size. If the
box-size is 1 point, a mark ('X' or 'O') is placed in the box into which the price falls. For
example, if the control price were 18.65, a mark is placed in the 1-point box marked 18.
Price fluctuations between 18.00 (inclusive) and 19.0 are completely ignored until another
price prints outside that range. When prices are advancing, we use X's for the marks,
such that if the next price were 19.00, 19.02, etc. we would place another X in the same
column above the previous X between in the box marked 19, and so on as prices continue
to rise into new box levels. In the event of gapping prices, all boxes are filled between
the prior box and the box containing the price, such that no empty boxes are visible
between marks in the same column.
The Reversal Boxes setting determines when to start a new PnF column of marks in the
opposite direction. In our example, if 3 reversal boxes were specified, once a mark had
been placed in the 20 box we would ignore all pullbacks until price dropped to or
below17.0, i.e., into the box representing prices between 16.0 - 17.0. When this occurs,
a new column to the right is immediately formed with a corresponding number of O's,
starting with the box below the most-recent X, i.e., the boxes for 19, 18, and 17 would be
filled.
Due to the Point and Figure convention, when prices are falling the "O" mark
appears in the box above the one reached by falling prices, whereas "X" marks
correspond precisely to the box attained by the control price.
While true Point and Figure charting uses tick data, the Price Field (or Control Price) allows
us to use either the Close or High/Low prices from OHLC data. The closing price is
essentially treated the same as tick data, although an identical chart will not be formed
since the bar's high and low prices are ignored. The problem is partially remediated by
using the high and low values of bar data, though this method also has limitations. In the
high/low method, when prices are advancing, the high is tested to determine if another X
can be drawn. If the high does not create a new box, only then is the low value checked;
vice-versa for declining prices.
The Log method is similar to the Point method, but mathematically more intensive since
the log value of price is calculated and the box size is based on percentage movement.
Finally, 1-box reversal charts have their own characteristics, the most notable of which is
that an X can be drawn in the same column as an O, which is known as a "one-step back"
reversal.
Tip:
Save plotted indicators as a "Strategy" so that you can recall it or even
open it with a Workspace 331 . You can continue to modify an indicator's
properties using the point-and-click interface as long as you don't convert
it to code.
Example
To smooth an RSI with a simple moving average (SMA), first plot the RSI, and then
drag a SMA directly on top of the RSI's plotted line as if to select it, as shown in the
image below. When the SMA Properties dialog appears, you'll notice that the "Source"
Data Series contains a description of the targeted indicator.
A RSI is smoothed by a SMA indicator by dropping the SMA directly on the plot of an RSI.
To plot a technical indicator, simply drag an indicator from the Technical Indicators
dialog and drop it into a chart. Once dropped, the Indicator's custom Properties dialog is
immediately displayed to allow customization of the indicator. (For step-by-steps: How
to Plot Indicators 86 .)
Dropped indicators are for viewing only and never affect the results of an
actual Trading Strategy 329 . Dropped indicator parameters are never available
for modification from the Strategy Parameters 328 frame.
You can always continue to interact with dropped indicators, and, you can save your work
to resume graphical interaction with the indicators in future sessions.
Use the Technical Indicators dialog for drag and drop plotting,
or just to peruse the indicators for ideas.
Typical indicator
A typical indicator is one that
is not characterized by special
properties of those described
below. The EMA indicator is
one such example. You can
alter the Drawing Style and
Parameter values for these
and all indicators.
Oscillator
Oscillators let you optionally
define overbought and
oversold regions that can be
filled with color.
Transparency is a percentage
from 0 (opaque) to 100
(invisible).
Partner Bands
Indicators that are normally
plotted in pairs, such as Upper
and Lower Bollinger Bands, fall
into the Partner Bands group.
In this case you can plot the
pair simultaneously and assign
a fill color to the area
between the bands.
Example
Assume that you want to develop a strategy that uses a SMA and RSI indicators. You
could use the Strategy Builder for this, but you want to do it manually this time.
the statements and variables required for their sliders, if applicable. Depending on your
Editor's template, the resulting code appears below:
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
namespace WealthLab.Strategies
{
public class MyStrategy : WealthScript
{
//Pushed indicator StrategyParameter statements
private StrategyParameter slider1;
private StrategyParameter slider2;
public MyStrategy()
{
//Pushed indicator CreateParameter statements
slider1 = CreateParameter("SMA_Period_1",50,2,200,20);
slider2 = CreateParameter("RSI_Period_2",14,2,200,20);
}
protected override void Execute()
{
for(int bar = 20; bar < Bars.Count; bar++)
{
if (IsLastPositionActive)
{
//code your exit rules here
}
else
{
//code your entry rules here
}
}
//Pushed indicator ChartPane statements
ChartPane paneRSI1 = CreatePane(40,true,true);
5. You'll find two PlotSeries* statements near the bottom. Within those statements, copy
SMA.Series and RSI.Series and their parameter list to create easy references to
DataSeries to be used in your Strategy. The complete statements would be as follows
and be placed just before the for loop.
As you can see, all of this code can be generated in just seconds!
As shown in the image, when multiple indicators are collapsed in the same pane, an ellipsis
"..." is displayed to the right of the top indicator's label.
You can also configure Chart Annotation Preferences 209 to enable display of Fundamental
icons in the Price Pane. For the annotation method, however, it's required to "mouse
over" the icon to view the data values.
More:
1) Use the Strategy Builder to plot and include Fundamental Data and Ratios
in Strategy-based Rules.
2) "Working with Fundamental Data" in the WealthScript Language Guide has
more details about plotting and manipulating fundamental data.
Tip:
To enable or disable "streaming" for all charts simultaneously, press and hold
the Alt key when clicking the Stream button on any chart.
Warning!
Before requesting symbols for streaming, it is highly recommended to create
intraday DataSets that contain the symbols with the desired interval or
subinterval. Otherwise, the first request for data could result in a lengthy
delay while retrieving backfill.
After adding backfill bars to the chart, new bars are built by the Fidelity Streaming
Provider from the streaming ticks. For a symbol that’s actively traded, you'll immediately
notice a tick or bar forming on the far right side of the chart as in the image above. This
is called the ghost bar 325 or partial bar.
Finally, at the end of each interval, the Streaming Provider adds the final OHLC/V values
of this ghost bar to the chart and immediately starts forming a new ghost bar with the
next tick. Most importantly, the addition of this bar to the chart generates an interrupt to
execute a Strategy window's 95 Strategy.
In order to reduce the effect of bad prints in Streaming Charts and Strategy Windows,
consider using the Bad Tick Filter 210 .
Streaming Disconnected
Should the Streaming Provider report that it has disconnected, (Disconnected) is displayed
in the main Status Bar. The Fidelity Streaming Provider will continually attempt to
reconnect provided that the internet connection is functioning. To attempt to restart
streaming manually, click the (Disconnected) link. Upon reconnecting, be patient as the
charts are automatically refreshed.
7 Strategy Window
What is a Trading Strategy?
Simply put, a trading strategy, or Strategy, is composed of a set of conditions that when
"true" trigger trading actions (buy, sell, short, or cover). Conditions and their
combinations can be based on literally anything that you can express in a computer
program (even moon phases), but most often they involve analysis related to price action,
technical indicators, and fundamental data.
Strategies are created by launching a New Strategy from Rules (Ctrl+Shift+R) or a New Strategy
from Code (Ctrl+Shift+S). However, when you save a plain Chart window 55 , with or without
dropped indicators, it automatically becomes a Strategy window by virtue of the addition
of an Editor view that contains template code 329 for a Strategy.
Chart Window with dropped SMA indicator. Chart window (left image) becomes Strategy
window after save.
Technical Indicators and Fundamental Items that are dragged and dropped
never contribute to a trading Strategy. Their useful only to you; perhaps as a
visual confirmation of trading signals.
The Strategy Builder utilizes a pre-defined set of Entries, Exits, and Conditions, which are
collectively referred to as Rules. In most cases you can customize selected Rules as
explained below.
Main menu: File > New > New Strategy from Rules
Navigation bar: Charts & Strategies > New Strategy from Rules
Function toolbar: New > New Strategy from Rules
From the Conditions tab assign conditional Rules to your selected Entries and Exits.
Qualify Conditions by dropping them on top of an Entry or Exit. Multiple Conditions added
to the same Entry or Exit are logically AND-ed together. To logically OR Conditions,
separate them with the OR Divider (found at the top of the Conditions list) by dropping it
on top of the second (lower) Condition in an OR-ed pair. Also, see how to group multiple
conditions 101 using the Multi-Condition Group qualifier.
5. Run the Strategy or choose another option in the Strategy window toolbar
You may go back and forth, altering Conditions and refining parameters. Notice that the
Wizard automatically plots any indicator that you have selected for trading conditions in
the Strategy.
Remarks
During or after Rules selection, you can re-arrange their order in the "Selected" window
using drag and drop. To place Rule1 above Rule2, drop Rule1 on top of Rule2. To place
a Rule at the very bottom of the Selected Rule's list, drop it in the blank area below the
list.
To delete a rule, use the Delete key, or drag and drop it back in the selection window at
the left.
Many Wizard Rules contain variable parameters. After selecting a Rule, you can
configure them in the Edit Parameters frame.
Limits do not exist for the number of times the same Rule can be used. Each Rule may
be paired and configured independently as you please, so it's up to you to do it in an
intelligent manner.
Renaming Parameters
Slider parameters are often generically named, especially in the General Indicator Rules 100 .
If more than one indicator has a Period parameter, for example, it can be difficult to tell
which rule's Period is the one being adjusted. By clicking the blue parameter link, you can
specify your own unique name for each parameter so that you can easily distinguish them
when using the sliders.
Slider Notes
Sliders have pre-defined default values to which they are initialized when created.
Slider increments are calculated based on a predefined min/max range expected for a
particular indicator. For example, Period sliders will generally increment in units of 10
since a large range of periods can be defined. For fine tuning, turn off the slider and
enter a precise value in the Rules view.
Limitations
Possibilities are literally endless when programming in WealthScript, but the Strategy
Builder is limited to the Rule entries available in a database. The Strategy Builder helps
you build simple strategies visually, but it doesn't cover the full range of possibilities of
coding a script manually.
1. From a "General" category, drag the desired general condition to the entry or exit signal.
2. Where prompted, click to select an indicator (or fundamental item).
3. C hoose the indicator from the list, and then,
4. select its parameter values.
5. Set up any remaining parameters required for the condition.
All indicators are not appropriate for every condition. In the example above,
the condition "Indicator crosses above a Value", makes sense for an oscillator
bound to a specific range (like RSI), but not for a moving average of a stock's
price, which is not range-bound.
MC Group Parameters:
Sliders are created for the number of Required Conditions and Lookback Period. To
expose sliders at the bottom of the Data Tree, see Parameter Sliders for Strategy
Builder 99 .
Required Conditions defaults to 1 (the minimum). You should set Required Conditions
from 1 up to the total number of conditions in the group.
Lookback Period is the "window" during which the conditions can add to the count
of Required Conditions.
From the current bar and looking back Lookback Period bars, if a condition is
true during at least one of those bars, it adds 1 to the group tally for the
current bar. If the tally adds up to the specified number of Required Conditions
then the collective MC Group is logically true for the current bar.
Example
Consider the following image. The MC Group is AND'd with "Moving Average is trending
up" but OR'd with "Bullish Hammer" below. Within the MC Group of conditions, all 3
are Required Conditions to have occurred at least once during the specified 4-bar
Lookback Period. Consequently, the BuyAtMarket condition will trigger if ("Moving
Average is trending up" AND "MC Group") OR "Bullish Hammer".
Main menu: File > New > New Strategy from Code
Navigation bar: Charts & Strategies > New Strategy from Code
Function toolbar: New > New Strategy from Code
You can edit the template code and save it by clicking Edit > Set as Default Template Code.
Tip: If you always wish to see blank space to the right of the bars in a
Strategy window, insert
PadBars( 10 );
where 10 is the number of bars to "pad", immediately after Execute()
method in the Strategy window's Editor. Then from the main menu, click
Edit > Set as Default Template Code.
The sum of all child strategy allocations can be more (or less) than the overall Starting
Equity. Giving over-sized allocations to one or more of the child strategies can help to
increase exposure. If an equity constraint arises in the backtest, Wealth-Lab gives
higher priority to Positions created by strategies with a lower value for Strategy
Priority, i.e., a child strategy with priority 1 has the highest priority.
Settings
Account Alerts for the child strategy are assigned to the Account specified.
This value overrides the default account and the account assigned
to a Strategy in the Strategy Explorer.
Scale The data scale used for the child strategy
Position Size Portfolio Simulation sizing for the child strategy. The Starting Equity
displayed is a function of the overall Starting Equity and the amount
allocated.
Use Preferred Self-explanatory. See Preferred Values 136 .
Values
Parameters
The parameters associated with the child strategy may be modified using the slider(s)
provided that Use Preferred Strategy Parameter Values is not selected in the Settings
box.
DataSet
Use default DataSet is automatically checked when adding a new child strategy. The
"default DataSet" is the DataSet or symbol selected in Wealth-Lab's main Data Panel
(Ctrl+D). To assign the Strategy to a DataSet other than the default (and recalling
that you specify Scale in the Settings box), uncheck the default DataSet option and
click on the DataSet or symbol.
5. Data Range
Assign the test period using the main Data Range control atop Wealth-Lab's main Data
Panel (Ctrl+D) for Combination Strategies. Only one test period is used for the overall
Combination Strategy. Note that the Data Panel's Scale and Position Sizing controls do not
apply to Combination Strategies.
Avoid using All Data or the Fixed Number of Bars option for Combination
Strategies, especially when combining child strategies that use different
scales.
1. Child strategies are each configured with their individual Starting Capital allocation.
2. Separate Portfolio Simulation backtests are run on each of the child strategies. Each
strategy item develops its own equity and cash curves. Position sizing is based on the
child strategy's equity and cash levels.
3. At the child level backtests, rejected signals are evidence of achieving maximum
allocation. Rejected trades are not candidates for the overall Combination Strategy
backtest.
4. Finally, the overall Combination Strategy backtest's equity curve is built on a bar-by-bar
basis using trade candidates (already-sized Positions) provided from each of the child
strategies. Positions are selected from higher-priority strategies first, starting with the
highest-priority Position in each one. This process implies that trade candidates that
were sized and accepted in the child strategy simulation may be rejected in the overall
Combination Strategy backtest.
The number of trades not included in the Combination Strategy backtest is the
sum of the trades rejected at the child and combination backtest levels.
Margin Effect
Increasing Margin to a level greater than 1:1 increases the ability of the overall
Combination Strategy to accept more trades from the contributing child strategies on bars
with limited cash. For example, if a Combination Strategy simulation rejects a trade from a
strategy with lower priority due to insufficient capital, increasing margin could allow this
trade to be taken. Margin loan interest specified in Preferences > Backtest Settings 230
applies.
Combination Strategy margin affects allocation. For example, with 2:1 margin
you can allocate up to 200% of Starting Capital to a child strategy. Assuming
$100,000 Starting Capital with 200% allocation, it follows that 100% of equity
sizing will size a $200,000 position.
Viewing Results
Performance Visualizers that apply to Portfolio Simulations also apply to Combination
Strategies. An exception is Analysis Series 225 , and although Monte Carlo-Lab 225 can be
applied, it has limited utility Combination Strategy mode due to its inability to work at the
Look for the Strategy Selector atop the Performance, Equity Curve, and Drawdown
visualizers, where you can see results from the aggregate Combination Strategy as well as
the backtest results for each of the child strategies separately.
Trades
Double-clicking a trade in a Combination Strategy window launches a Strategy Window
associated with the trade. If the child strategy ran a Multi-Symbol Backtest, then the
window is displayed in MSB mode 119 . It's important to note that the trades shown in the
new window are from the child-level Portfolio Simulation, which may include trades that
were rejected in the aggregate backtest.
The Combination Strategy Window can be used effectively for end-of-day (EOD) trading
without the need to break out the child strategies in the Strategy Monitor. As with any
backtest, however, all Alerts are displayed, so even in this case allocations must be
controlled manually or by using different accounts.
These actions launch the Strategy Explorer from which you can select an existing strategy
to open in a Strategy window. See Backtesting Strategies 116 .
Strategies are executed using the Scale, Data Range, and Position Size settings that you
select at the top of the Data Panel 292 .
Important Disclaimer: Pre-built Strategies are strictly for informational purposes and are not to be construed
as advice or solicitation to buy or sell any security or instrument.
For a complete discussion of each of the Performance Visualizers see their topics in the
Preferences 205 chapter.
Trade Circles
Wealth-Lab draws blue circles centered on trades' entry prices. Likewise, red circles are
centered on trades' exit prices. Since circles are drawn inside a bar's range, it's possible
for the bar coloring to be occlude them. Try switching to the OHLC Chart Style 80 if you
have trouble locating trade circles.
Trade Triangles
Triangle icons mark entries and exits. An inverted triangles ( ) above a bar denotes sale,
whereas a right-side-up triangle ( ) below a bar represents a purchase. Refer to the
legend below:
Long entry
Long Position sold for a profit
Long Position sold for a loss
Short entry
Short Position covered for a loss
Short Position covered for a profit
Hover the mouse over a triangle for trade entry and exit tooltip information. Wealth-Lab
automatically draws a line to connect a trade's entry circle to its associated exit circle (if
applicable).
DataSet View
When you click on a DataSet name in the DataSet Tree, the DataSet view replaces the
Chart to prepare for a backtest on all symbols contained in the DataSet. The interface
contains only one button to initiate a Multi-Symbol Backtest 119 .
Parameters
A comma-delimited list of the currently-selected Strategy Parameter 303 values (if any).
Strategy Activation
If the Chart data is streaming, then the Strategy is "Active", meaning that you can elect
to Auto-Stage 321 trading Alerts that the Strategy generates. See the Alerts View 113 for
details. Otherwise, the Strategy is not Active as shown in the image.
7.5.4 Editor
The Editor view is where you compose and enter WealthScript Strategy code for code-
based Strategies. When you open a New Strategy from Code, the Editor initializes with
some template code that you can use as a basis to form a new strategy. You can edit
and save your own template code for future sessions by clicking Edit > Set as Default
Template Code.
Compile
Compiles the Strategy only. It's a good idea to stay on top of syntax errors by
occasionally clicking the Compile button while coding. Once the code has been compiled,
you can execute it (How to Run a Strategy 108 ).
Tip:
Clicking on a syntax error in the lower message frame will automatically
place the cursor at the point where the error was detected. Often, but not
necessarily, this is the precise location of the error.
References...
Power users can select references to external .NET assemblies for use in strategy code.
The Reference's dialog provides a static list of .NET Framework assemblies. For
assemblies not in the list, use the "Other Assemblies to Reference" method. Selected
references are saved with each script.
If you use the same References often, open a new Strategy Window (Ctrl+Shift
+S), select your reference(s), and choose Edit > Set as Default Template code.
Print
Provides preview and printing options for Strategy code.
Options...
The Editor is feature-rich. Explore the options to customize the Editor's environment and
to find dozens of keyboard shortcuts 319 .
QuickRef (F11)
Convenient launch points for Debug window and QuickRef dialog.
Tip:
Place the cursor on a WealthScript object or method name and strike the F1
key to launch the QuickRef to precisely the right place.
Select All
Highlights all Alerts for another action.
Place Orders
Immediately places the order with Fidelity. You must be logged in to activate this action.
Stage Orders
Transfers the selected order(s) to the Orders tool, where additional action may be
required to Place the trade.
Trade Type (Cash / Margin) Applies to: Live (not Paper) Trading
Trade Type defaults to Margin for margin accounts and applies to long trades/positions
only. If required, choose Cash to buy or sell a cash Position in your margin account. Note
that in this case the Alert's Trade Type remains Margin, but it changed to Cash when the
order is Staged/Placed.See also: Trade Type 194 .
Field Descriptions
Self-explanatory: Symbol, Account, Qty, Order Type, and Scale
Alert Time
The date and time of the last bar that triggered the Alert.
Price
The Stop or Limit price of the Alert. This field will be blank for AtMarket and AtClose order
types.
Signal Name
The string name assigned (if any) to the trading signal in the Strategy code.
Position Sizing
At first glance, the results above don't look very promising. The Buy & Hold strategy
resulted in the most net profit. So why use a trading system at all? Note that the
Oscillator and BBand Break systems both had a Profit per Bar substantially higher than that
of Buy & Hold. This indicates that the systems were more efficient at extracting money
from the market.
You can translate this efficiency into profit by applying Position-sizing rules to the system.
The idea is to maximize the exposure 324 of the system without taking on too much risk.
By increasing the Position size, you can realize more profit. In the example above, we can
take the BBand Break strategy and apply Position sizing of 25% of capital per Position.
The results would be amazing.
When evaluating the results of a system, we look at total net profit, but also Exposure,
Max Drawdown and other metrics. Our own statistic, Wealth-Lab Score 215 , combines
profit, exposure and drawdown into a single figure.
We can now re-run the BBand Break strategy, but increase the Position-sizing to 25% of
capital per Position:
Net profit increased (beating Buy & Hold). Note that Wealth-Lab Score changed only
slightly, illustrating that this metric isn't as influenced by Position-sizing as net profit is.
This action loads the data, executes the backtest, and causes results to be
displayed.
Re-running a Strategy
By changing the scale, Strategy Parameter(s) 303 , or any other setting in the Data Panel,
Wealth-Lab automatically re-runs the Strategy. An exception is Wealth-Lab applies
Position Size modifications without the need to execute the Strategy code/rules. To re-
run a Strategy after changing Preferences 205 , click or use the F5 shortcut.
If you make changes to a code-based Strategy, you must compile the Strategy
first before using any of the methods above for the changes to be recognized.
Backtest Results
When a Strategy script completes, Wealth-Lab's post-processing tasks begin. Wealth-Lab
immediately renders all plots of indicators, chart annotations 209 , drawing by cosmetic
chart methods, and plots the trades 109 for the primary chart symbol. In addition, if the
Chart Status bar is displayed, you'll see a Net Profit summary of the Strategy as well as
one for Buy & Hold. Besides the Chart view, a variety of detailed metrics and
visualizations of backtest results appear in Performance Visualizers 211 that you've selected
for displayed in Preferences.
The Status Bar shows a Net Profit summary for the Strategy under test and the Buy & Hold
Strategy.
data for the next symbol entered in the Data Panel from any
chart window. Each chart window continues to use its
previously-established Scale, Data Range, and Position Size
settings.
Stream Enables streaming for the Streaming Data Provider 210 selected in
Preferences. More: Streaming Charts 93 , Streaming Strategies 128
Warning!
"All Data" is not recommended for multi-symbol testing for intervals less
than 5-Minutes.
Re-running a Strategy
Same as Re-running a Strategy 118 in Symbol Mode, with the exception that the Strategy
is not automatically executed again upon changing Strategy Parameters.
Backtest Results
See Symbol Mode Backtest Results 118 .
To reset the "locked-in results", select or type a symbol and click , or, click a symbol
from another DataSet. Either action forces Wealth-Lab to return to execute the Strategy
in Symbol Mode Backtest 117 mode.
Collecting Data...
This process can take a significant amount of time to update and load data into
memory, especially for DataSets with many symbols. For the best backtest
performance, use the Data Manager to update data required for the backtest and
consider disabling File > Update Data On Demand.
Executing System...
With the test data loaded in memory Wealth-Lab executes the Strategy on each
symbol individually in serial fashion and in a Raw Profit mode. Trades generated by the
Strategy are stored in a list with an initial size of 1 share. Since Wealth-Lab is
Position-based the size of a Position is unimportant during the Strategy's execution as
Position Sizing is applied later using real-world rules. Armed with a list of trades,
Wealth-Lab sizes each Position and synchronizes the trades bar-by-bar as the
combined equity curve is calculated in a chronological fashion.
It is important to know that it's not possible to determine within a Strategy
(script) the actual/eventual size of Positions or to create trading rules that are
based on a Portfolio's Equity, Cash, or Drawdown.
Since Wealth-Lab always executes a Strategy's trades in Raw Profit mode, the first trade
in a series of entry triggers will always result in creating a Position. If that Position is later
rejected due to sizing rules or insufficient cash, when using single-Position logic it's not
possible for any of the other potential trade triggers to have occurred until the
programmed exit of the first trade because the entry logic would not be executed until
that time.
As a generic example, imagine a strategy whose single-Position entry logic buys a Position
on any Tuesday or Wednesday and whose exit logic sells on Friday. Raw profit processing
will always result in picking up the Position on Tuesday, which causes only the exit logic to
be processed until the Position is sold on Friday. The test to enter a Position on
Wednesday will never be executed - even if the simulated Position from Tuesday is
rejected.
We've alluded to the fact that Positions can be rejected in a Portfolio Simulation Mode
backtest. In the next topic we explore how Wealth-Lab chooses trades...
In an attempt to nullify the effect of the seed data period, legacy versions of Wealth-Lab
introduced an optional feature for backtests called Lead Bars. An analyst specified the
number of lead bars required so that additional bars were front-loaded to be used as the
seed data for the strategy. However, Wealth-Lab ignored those extra bars (and any
trades that may have occurred on them) when computing the performance metrics,
resulting in a measured system performance for the entire test and trading period.
On the other hand, cumulative metrics like Net Profit, Net Profit %, and Gross Profit/Loss,
as well as measures that encompass the performance of the entire test period like
Annualized Gain %, Exposure, Recovery Factor, Sharpe Ratio, etc., are impacted by Lead
Bars. Due to the compounding effect of equity, the amount of influence has a non-linear
relationship with the number of seed bars divided by the total number of bars in the test
period. (Look up the formula for CAGR 332 to get an idea how additional bars of trading can
affect a smoothed rate of return.)
For example, assume that you backtest an EOD strategy over the past 2 years (about 500
bars) using a 100-bar SMA, and thus a 100-bar seed period. If Profit per Bar were 10.0
without the use of Lead Bars, you're likely to find that Profit per Bar varies minimally from
10.0 when using Lead Bars, assuming that no trading outliers existed during the first 100
bars. However, without Lead Bars there is no way for the strategy to contribute to profit
during those 100 bars, and that effectively reduces Profit, Gain, and Sharpe Ratio for a
profitable strategy.
It's not possible to identify a single formula that accounts for the effect of
Lead Bars for all performance measures. It depends on the particular metric's
calculation as well as the sizing strategy in use.
Lab code base that ultimately resulted in bugs that made the feature difficult to maintain
and often unreliable. In addition, a large percentage of users were confused by Lead Bars
and how to use them - no doubt largely due to the former. For these and other reasons,
the Lead Bars feature was retired with the Version 4 code line.
Summary
The Lead Bars feature will not be available in Version 6 primarily to simplify backtesting
and the code base that supports it, which we believe will lead to greater reliability. The
result of the inability to apply Lead Bars for positive return-producing strategies is that full
test period metrics will tend to be more pessimistic than in reality. The amount of
pessimism is non-linearly related to the proportion of seed data to the backtesting data
range. If this ratio is large (above 5 to 10%), then pessimism can be larger, and you may
consider applying corrections, such as a smoothed rate-of-return for APR. Nonetheless,
you will agree that it's better to get a pessimistic backtesting result and later be
pleasantly surprised by better-than-expected trading performance than the other way
around.
Finally, we recommend using a Monte Carlo simulation tool to gain better insight into the
trading dynamics associated with strategy backtests. A backtest is just one possibility
that is unlikely to ever repeat; in other words, do not put too much faith in the results of
a single backtest. In a matter of seconds, Monte Carlo simulations can randomize and
scramble a backtest's trades and/or returns thousands of times to provide the most
pessimistic, median, and optimistic results one could have expected for actually having
traded a strategy.
Run the script on a recent data range (like 1/1/2012 to present) and scroll to the start of
the chart. Notice that the SMA is plotted with the correct value on the very first bar of
the chart. (You can verify it by extending the start date back in time by another year
and again checking the SMA value on the first trading day of 2012.)
namespace WealthLab.Strategies
{
public class NoLeadBarsRequiredExample : WealthScript
{
protected override void Execute()
{
/* 2. Copy and paste this line; bars will have the out-of-synch Bars object with al
Bars b = Bars.Symbol.GetAllDataForSymbol( this.GetDataSetName(), Bars.Scale, Bars.B
/* 3. Create out-of-synch indicator(s) with bars. Note! bars.Close (not just Close
DataSeries sma200 = SMA.Series(b.Close, 200);
if (IsLastPositionActive)
{
if (CrossUnder(bar, Close, sma200))
SellAtMarket(bar + 1, LastPosition);
}
else
{
if (CrossOver(bar, Close, sma200))
BuyAtMarket(bar + 1);
}
}
}
}
}
In Portfolio Simulation Mode, trades can be rejected due to insufficient buying power.
Simulation". This method produces worst-case simulations by default for all strategies.
Method 2
By adding the last 2 lines in the Example to your Strategy code, you can generate worst-
case simulations for selected strategies. Just as Method 1 does automatically, the code
forces Wealth-Lab to choose the Positions with the least NetProfitPercent in a cash-
limited situation. Generally, this results in a worst-case simulated scenario.
Example (How to run Example code? 8 )
C#
protected override void Execute()
{
for(int bar = 20; bar < Bars.Count; bar++)
{
if (IsLastPositionActive) {
//code your exit rules here
}
else {
//code your entry rules here
}
}
/* Give the largest losers the highest priority for backtests in Portfolio Simulation Mode *
foreach (Position Pos in Positions)
Pos.Priority = -Pos.NetProfitPercent;
}
Basis Price
Whenever your script generates a buy or short signal, Wealth-Lab must determine the
number of shares for the order. Imagine that you use a Fixed Position Size for each order,
such as $5,000, so that each trade contains the number of shares that will come as close
to $5,000 as possible. You might think that the best way to accomplish this is to simply
take the Entry Price and divide this into the fixed dollar size. For example, if the entry
price of the trade is $25, then the Position Size should be 200 shares. However, we don't
know the actual entry price of the trade until after the fact.
For market orders, the entry price is the market open price, not considering slippage. One
way to determine the Position Size would be to observe the market open price and then
quickly calculate the number of shares and submit the order. If you're dealing with more
than a handful of orders, this is clearly unfeasible and would result in order-placement
delay.
Wealth-Lab uses the Basis Price to determine the number of shares to buy or short. The
Basis Price is dependent on the order type. In the table below, Signal Bar refers to the bar
on which the order was signaled, and Entry Bar is the bar following the Signal Bar.
Consider this case. The Basis Price of a market order is $25 and the backtest currently
has $100,000 of capital to invest. The number of shares to purchase at 100% of Equity is
4,000. Imagine there is a price gap between the closing (Basis) price, and the next bar's
open (Entry) price. Say prices open at $26, a $1 difference. The total size of the resulting
position would be $104,000. The simulation does not have enough money to take this
trade, so it is dropped.
Pairs and other intraday Strategies involving external symbols may be required
to execute from the Strategy Monitor to properly synchronize the secondary
data with the primary symbol.
Trading Alerts
Streaming or static, trading alerts generated in Strategy windows appear in the Alerts
view 113 . The only difference is that you can enable the Auto-Stage 321 option for
Streaming Strategy windows so that orders are immediately routed to the Orders 179 tool.
For more Streaming details and tips, see the Streaming Charts 93 topic in the Charting
chapter.
No Trades
1. See 100% of Equity Sizing 127 if applicable.
2. Ensure that Position Size 296 is set adequately large enough to purchase at least 1
share.
3. Turn off Round Lots 234
4. Check (or disable) Slippage 234
5. Check that you're loading a sufficient amount of data for the strategy to operate on.
For example, if your strategy uses a 200-period moving average, then you'll need more
than 200 bars for trading to occur. Determine the number of bars loading in a chart by
moving the mouse pointer near the last bar of the chart and check the chart's price
data status bar 58 .
7.7 Optimization
What is Optimization?
The process of optimizing a trading strategy involves executing it repeatedly over a range
of different parameter values and collecting the results from each run. For example, if you
have a strategy that enters and exits based on price closing above or below a moving
average, you could optimize it to discover which moving average period produced the
most profitable results, i.e., the "optimal" return.
You can optimize a strategy using any number of parameters (within practical limits of
time and computer memory) on a single instrument or on a DataSet for a Multi-Symbol
Backtest. Wealth-Lab is installed with two different optimization methods, Exhaustive and
Monte Carlo, described later in this chapter, but additional methods may be added later by
third-party programmers. For example, a Genetic Optimizer by MS123, Inc. is available as
a free extension from Wealth-Lab.com.
In Wealth-Lab Version 6 optimization comes in two flavors: Full Optimization (FO) and
Walk-Forward Optimization (WFO).
If your strategy does not yet use Straps, follow the instructions for Add New Parameter in
the Optimization Control 131 topic.
Strategy Parameters
Strategies that incorporate Strategy Parameters (Straps) are ready to optimize "out of
the box". The parameter list reflects the properties for the Straps that are defined and
compiled in the script.
Parameter editing options are not available for Rule-based Strategies or pre-
compiled Strategies, like the ActiveTrader Strategy Pack, which is available at
www.wealth-lab.com > Extensions.
Edit Selected Parameter
To edit a parameter's properties, select it in the list on the left and modify the values
for Name, Default, Start, Stop, and/or Step. Note that the Name property is used for
slider label, not the parameter variable name in the code.
Rollback Changes
Restores the parameter changes in the O.C. to their state in the previously-saved
script.
After adding a Strap and applying it to the code, you need to modify the line above
with the Strap variable, parameterN, where N is the parameter number in the list.
If you wish to completely remove a parameter that is actually used in the Strategy,
Apply Changes to Code and then manually edit your code to remove any instance of
the parameter variable.
Parameter Checkboxes
Uncheck a parameter to exclude it from full optimization processes such as Exhaustive
or Monte Carlo optimizations. When a parameter is not checked, optimizations will
apply the parameter's default value shown in the Optimization Control. Other add-in
optimizers may require modification for this feature to work.
Modify a parameter's default value using the sliders and clicking "Save
Parameters". The Optimizer will recognize the new default value after closing/
re-opening the Strategy and selecting the Optimize link in the status bar.
Optimization Method
Two optimization methods are installed with Wealth-Lab Pro; others may be added by
extension.
Optimization methods are extendible by third-party programming. API
documentation will be made available on the WL5 Wiki.
Exhaustive
An exhaustive optimization is a brute-force approach that executes the Strategy once
for every possible combination of parameters. Carefully choose the number of
parameters and their ranges or you could soon enter the range of optimizations that
would take weeks or months to complete. Runs Required indicates the number of
individual Strategy runs on a per symbol basis.
Monte Carlo
A Monte Carlo optimization attempts to zero in on a range of parameter values that
maximize the selected Optimization Metric (see below) by trying different random
combinations. Because of its random nature, a Monte Carlo optimizer will not always
discover the values that truly optimize the selected metric, but it can find optimal
ranges much more quickly than an Exhaustive search for a large number of parameter
combinations.
Metric to Optimize
To choose the MC Optimization metric, 1) select the desired Position Sizing 296
method and click to run the script. This action initializes the metric sets,
which are slightly different between Raw Profit and Portfolio Simulation sizing
methods, and, 2) choose a Scorecard on the Results 135 tab from the drop down
control above the results grid. At this point, the choices for the Metric to Optimize
are correctly set up.
Highest/Lowest Value
Instructs the Monte Carlo process whether it should zero in on the highest or
lowest value for the selected metric.
Runs Controls the number of times that the MC optimizer shrinks the
parameter windows to re-center them around the resultant closest-
to-optimal value.
Test per Controls the number of random tests within each Pass without
Run shrinking or moving the windows.
Assume that you have chosen "Profit" to be maximized. At the start of each pass,
the range of random values is decreased and centered on the most profitable value
determined in the previous pass. The Monte Carlo Optimizer keeps shrinking the
parameter windows as it proceeds, until it winds up centered on a set of values
that maximize the targeted metric.
The Monte Carlo process chooses random combinations of values that fall
between the Start and Stop values defined for the parameters; the Step
value is meaningless.
Genetic Optimizer
A Genetic Optimizer is usually able to find an optimal solution in a fraction of the time
required by an exhaustive search, and one is available as a free extension from
Wealth-Lab.com.
Optimize
Select a Scorecard
The Scorecard contains a set of selected metrics available to the selected
Optimization Method, and these metrics are usually (but are not required to be)
displayed in the optimization Results 135 .
Estimate
Click the Estimate button to get an idea of how long the optimization procedure will
take based on the current settings. This action executes the Strategy on the
selected symbol or DataSet. If the number of calculate runs exceeds 100,000, the
Estimate will be "Too many runs". You can continue the optimization anyway know
that time and memory use could be excessive.
Begin Optimization
Starts optimization processing. Prior to starting an optimization, it's important to set
up the optimization target in the Data Panel 292 . You can optimize on a single symbol
or an entire DataSet. Next, set up the Scale, Data Range and Position Sizing method
296 to use for the optimization. Raw Profit sizing yields symbol-by-symbol
optimizations, whereas Portfolio Simulation mode results in true portfolio simulations for
the DataSet as a whole. In this case, the (DataSet Name) will be indicated as the
symbol in the Results tabulations view.
Portfolio Simulation sizing yields a true portfolio simulation, including dropped
trades due to insufficient capital. To achieve repeatable optimization results,
assign Position.Priority in your script, or enable "Use Worst Trades in
Portfolio Simulation" in Preferences (F12) > Backtest Settings 230 .
Cancel Optimization
Interrupts an Optimization in progress. Incomplete results up to the point at which the
operation was canceled will be shown in the Results 135 view.
To optimize Rule-based Strategies, expose the sliders for the parameters that you wish to
optimize. See Parameter Sliders for the Strategy Builder 99 . A Step value is calculated
automatically to provide a reasonable of variations between the Start and Stop values for
each indicator.
7.7.1.2 Results
The optimization process automatically executes a Strategy over and over using a
different combination of variables each time. The Results view displays the outcome of
each Strategy run in a tabulation view, which can be sorted by any metric.
Scorecard
ScoreCards are used in both Strategy Ranking 157 and Optimization tools. Choose either
the Basic or Extended Scorecard. Scorecard metrics (appear when optimization
completes) depend on the selection of Raw Profit or Portfolio Simulation sizing modes.
Grouping of results from an optimization on a DataSet also depends on the Position Sizing
method. In Raw Profit mode, each symbol's run is shown separately, but an <Average>
result for all symbols can be selected (see View the Average Result for all Symbols 135 ).
However, for Portfolio Simulation sizing creates true portfolio simulation optimizations
Portfolio Simulation sizing yields a true portfolio simulation, including dropped
trades due to insufficient capital. To achieve repeatable optimization results,
assign Position.Priority in your script.
View the Average Result for all Symbols Applies to: Raw Profit Optimizations
This option, which appears after completing an optimization on a DataSet that uses Raw
Profit sizing, calculates the arithmetic mean of each Scorecard metric for each parameter
set. The result is an <Average> row.
Copy to Clipboard
Copies the Results table to the
Windows clipboard for pasting
into another application.
When loaded from a file, optimization results must match the parameter
signature from the script that created them. Wealth-Lab can't load the results
if you change the number or type of parameters in the script or if you optimized
after removing a parameter but didn't apply the change to the code.
If a symbol (or DataSet) doesn't have Preferred Values assigned for a particular
script, then its PVs are the Parameter's default value(s).
Assign Preferred Values based on the highest (lowest) metric value per symbol
Applies to: Optimizations using Raw Profit or Portfolio Simulation mode
The metric whose highest (or lowest) value determines the set of parameters assigned
is selected in the dropdown control above the table on the right. Note that multiple
rows may contain the same highest or lowest metric value (especially for integer
metrics or infinite results), and in this case you should specify PVs by using one of the
row selection options.
Assign Preferred Values based on the highest (lowest) average value per
symbol
Applies to: Optimizations using Raw Profit mode
Same as the previous action, but the metric is averaged among all contributing
symbols before finding the highest (or lowest) value. To see <Average> metric
calculations, select the View the Average Result for all Symbols 135 option.
Important! After assigning Preferred Values, save the Strategy Window, Ctrl+S.
PVs are stored in the Strategy code's xml file.
7.7.1.3 Graphs
Exhaustive optimizations generate 2 and 3-dimensional graphs to visualize relationships
between Parameter values and performance metrics.
Graphs are not available for Monte Carlo optimizations.
1-Parameter Graph
The 1-Parameter Graph displays a graph of a single Parameter. Select the symbol,
Strategy Parameter (x-axis), and Scorecard metric (y-axis) that you want to graph from
the drop down lists.
2-Parameter Graph
The two Parameter Graph lets you visualize the results of two Parameters simultaneously
and their interrelationships. Select the symbol and metric (y-axis) as before. Then,
select two different Parameters to be plotted on the x and z axes. The result is a three-
dimensional surface showing the results of the first Parameter mapped to the second
Parameter. You can rotate this 3D view by clicking and dragging with the mouse. The
graph can help you visualize profitable ranges in your Parameters.
When optimizing with more than two parameters, use the sliders to configure all
other parameters to see their effect on the 2-parameter optimization space.
When selecting parameters based on the graphs, you should focus on areas that are
stable, not on sharp peaks. It's desirable to see curves like the one on the left below,
which shows stable and profitable areas for multiple adjacent parameter values. On the
other hand, it's difficult to see a stable area in the jagged curve on the right, whose
Strategy is likely to produce much more volatile and inconsistent trading results.
Focus on smooth areas of the curve without Selecting parameters based on sharp peaks
sharp peaks or drop-offs. is an
example of over-optimization, which is
undesirable.
If your optimization consisted of more than 2 variables you can check the values of the
additional parameters by using the controls as described previously.
A Strategy that already uses Strategy Select WFO from the Status bar of static
Parameters is ready for optimizing "out of the (not Streaming) Strategy Windows.
box". If a Strategy that you'd like to
optimize does not use Straps, see
Programming Trading Strategies > Strategy
Parameters in the WealthScript Programming
Guide.
Walk-Forward Settings
Out-of-sample Data %
The percentage of data in each interval that is reserved for the Out-of-sample
backtest using the optimized parameters that were found in the same interval's In-
sample optimization. For practical reasons, the value is constrained to be between 10
and 50%. In an expanding window (see Window Type below), the percentage
corresponds to the amount of OOS data for the first interval only.
Optimization Method
The Optimization method is employed for each In-sample interval. For details, see
Optimization Methods 133 in the Full Optimization documentation.
Optimize
Estimate
Click the Estimate button to get an idea of how long the optimization procedure will
take based on the current settings.
Begin Optimization
Starts optimization processing. Prior to starting an optimization, it's important to set
up the optimization target in the Data Panel 292 . You can optimize on a single symbol
or an entire DataSet. Next, set up the Scale, Data Range and Position Sizing method
296 to use for the optimization. Raw Profit sizing yields symbol-by-symbol
optimizations, whereas Portfolio Simulation mode results in true portfolio simulations for
the DataSet as a whole. In this case, the (DataSet Name) will be indicated as the
symbol in the Results tabulations view.
Portfolio Simulation sizing yields a true portfolio simulation, including dropped
trades due to insufficient capital. To achieve repeatable optimization results,
assign Position.Priority in your script, or enable "Use Worst Trades in
Portfolio Simulation" in Preferences (F12) > Backtest Settings 230 .
Cancel Optimization
Interrupts an Optimization in progress. Incomplete results up to the point at which the
operation was canceled will be shown in the Results 135 view.
7.7.2.2 Results
The WFO In-sample Results view provides the Strategy Parameter combination and
Scorecard metrics for the optimum backtest (based on the selected metric) for each In-
sample (IS) interval as well as for the current IS range. As if it were a regular backtest,
Out-of-sample (OOS) results and trades for the Walk-Forward Optimization are given in
the other Performance Visualizers you have selected.
Although the Out-of-sample date ranges for each interval is provided for
reference, performance shown on the Results page refer to In-sample
outcomes only. Out-of-sample results for the walk-forward backtest are
shown in the regular Performance Visualizers 211 like any other backtest.
Instead of using annualized profit as the normalized metric in calculating WFE, Wealth-Lab
divides net profit by the total number of bars in each of the IS and OOS tests,
respectively. Because profit per bar (PPB) is valid for both Portfolio Simulation and Raw
Profit backtesting modes, it allows the same relationship to be reflected when calculating
WFE. Consequently, WFE is calculated by dividing the profit per bar of the Out-of-sample
run by that of optimized run, i.e., PPBoos / PPBopt.
In the case that In-sample net profit is negative, Wealth-Lab calculates WFE
as (PPBoos - PPBopt) / Abs(PPBopt).
The Overall Walk-Forward Efficiency displayed above the table is the mean of the WFE
values for all walk-forward intervals. Be mindful that it is desirable that a high percentage
of intervals produce favorable efficiencies.
Important!
In-sample and Out-of-sample metrics used to calculate WFO Efficiency are taken from
backtests executed over their respecitve date ranges. Strategies that require a long
seed period before indicators are valid may need to make adjustments so that a
representative sample of trading can be produced. This can be done by:
a. reducing the number walk-forward intervals, and/or,
b. increasing the OOS %, or,
c. using the Lead Bar Solution 123 . Although simple to implement, this advanced
programming technique provides the greatest ability for almost any indicator-
based Strategy to create a valid trade even from the first bar of the date
range.
Scorecard Metrics
The Results view provides the parameters and the corresponding metrics for each
interval's optimal In-sample run, which is based on the selected Metric to Optimize.
To inspect a particular In-sample run more closely, double-click a row to open
the Strategy for a Standard Full Optimization in a new window using the In-
sample Date Range.
As always, metrics that are available for a particular Scorecard are a function of the
Position Sizing mode, i.e., Portfolio Simulation vs. Raw Profit modes. When performing a
WFO on a DataSet in Raw Profit mode, metrics return the average values for the group,
i.e., all symbols under test.
Current Interval
Wealth-Lab Walk-Forward Optimizations include a Current interval optimization. To trade
a Strategy per the WFO methodology, one would assign the optimized parameter value(s)
from the Current run for use as the Strategy's default or Preferred Values for live (or
paper) trading.
Assigning Parameters
By right-clicking on a specific row, you can: a) set the row's parameter values as the
Strategy's default values, and/or, b) assign them as the Strategy's Preferred values for
the entire DataSet used for the WFO or the selected symbol. Generally, if you decide to
begin trading the walk-forward method, you would choose to assign the optimum
parameters from the Current optimization row. Save the Strategy to persist the change.
Some trades in my Out-of-sample backtest have exit dates that are different from
non-WFO backtest?
A trade is opened using the best parameter(s) determined for a walk-forward interval.
Assuming the trade doesn’t close in the same interval, exit criteria for the trade will
be based on the best parameters in a subsequent interval. In other words, in the
walk-forward OOS backtest it's possible (and probable) for some trades to be opened
using one set of parameters and closed using a different set.
Why do I get different results each time I run the same WFO in Portfolio Simulation
mode?
Position Priority. See How Trades are Chosen 125 . Consider using the "Worst Trades in
Portfolio Simulation" option in Preferences > Backtest Settings 230 for WFO testing.
8 Strategy Monitor
The Strategy Monitor allows you to store one or more Strategies and set up each one
with custom Strategy Parameters, data, scale, and sizing so that you can manage all
Trading Alerts from one location. In short, the Strategy Monitor alerts with the current
trading signals for each activated Strategy.
Launch the Strategy Monitor from the Tools menu, Navigation bar, or by striking the F3
shortcut.
Min/Max selectable scales are 1 Minute/1 Year. See Scale control 292 .
Active Strategies update data automatically, execute the Strategy, and display the
current Trade Alerts, which can be Placed or Staged as orders in the Orders tool.
The Strategy Monitor accesses historical bar data from Fidelity's data servers, not
streaming data.
It's possible for the Strategy Monitor to produce different results than a
Streaming Strategy window since the data may not be precisely identical.
The Strategy Monitor obtains its copy of the compiled strategy when it is opened. Edits
in a Strategy Window do not affect strategies until the Strategy Monitor is closed and
re-opened.
The lower Alerts pane displays the most-recent trading alerts, if any, for the selected
strategy in the upper pane. The Alert pane is refreshed with each new interval. You
can't clear a Strategy's Alerts, nor is there a need to do so. (It's also possible to show
the Alerts for all Strategies by enabling that option in the Alerts pane toolbar.)
For example, a PosSizer 300 that sizes based on "percent winners" would
base the number of winners on all symbols in the DataSet in a Multi-Symbol
Backtest, whereas in the Strategy Monitor the winners would come only
from the symbol currently executing.
Set the Data Range to load only the data that you need. "All Data" is not recommende
intraday data that contain tens of thousands of bars since it requires a large amount of
processing that will result in lagging performance.
When opened, the Strategy Monitor recalls the last configuration. Therefore, for future
Wealth-Lab sessions, it's only required to manage the current Alerts generated by your
Strategies.
Add Strategy
This action launches the Strategy Explorer to select an existing Strategy. Once selected,
edit the Strategy Activations Settings in a dialog (below) that mimics each of the Data
Panel's controls - Date Range, Position Size, Scale, Trade Type 194 , DataSet or symbol,
and Strategy Parameters (see Employment Notes) 155 . Options exist to use Preferred
Values 136 , Auto-Stage/Place orders, and Email trading Alerts, the latter two of which can
also be configured from the main Strategy Pane. When the setup is complete, the
Strategy is added as inactive (see Activate below).
Tip: You can add a pre-configured Strategy directly from the Add to
Strategy Monitor 118 link in the Strategy Window's lower Status Bar.
Account Association
For customer with multiple
accounts you can specify the
account (or paper account) to
associate for Strategy Monitor
alerts. If not specified, the
default account specified in the
Trading Preferences is used.
Remove Strategy
Removes the selected Strategy from the Strategy Monitor.
Change Settings
Double-click a Strategy or use this action to edit the Strategy Activation Settings.
Making changes to the settings of an Active Strategy will automatically De-
activate it.
Run Dailies
Executes all daily and higher time frame strategies immediately, on demand.
Auto-Stage / Auto-Place
When Auto-Stage is enabled, new Alerts for the selected active Strategy are immediately
Staged 328 . When Auto-Trading is enabled in the Orders tool 179 , this button changes to
Auto-Place to indicate that new Alerts (orders) are immediately placed with Fidelity.
Wealth-Lab retains and restores the configuration of each Strategy in the
Strategy Monitor - including Active and Auto-Stage settings.
Auto-Email
Auto-Email sends Strategy Alerts to the Email account(s) that you set up in Preferences >
Email Settings 243 . This option is enabled only after Email Settings 243 have been
configured in Preferences.
Enable/Disable/View Logging
A convenient way to create and view logs of Strategy
Monitor processes is provided for purpose of
troubleshooting, if required.
Similar to the Strategy Window 95 , Alerts are automatically refreshed each time
the Strategy is executed. The current set of Alerts for any particular Strategy
is always shown.
Important!
Alerts are never suppressed by logic in PosSizers 300 . If, for example, you
use the Max Entries per Day PosSizer with 3 set as the maximum number of
entries, it's possible to have many more than 3 Alerts simultaneously
generated. In this case, you must choose which of the Alerts are ultimately
placed as orders.
Tip:
To help select the Alerts from a single Strategy, click "Strategy" in the
column header to sort Alerts.
Edit Alert...
Keep in mind that if the Auto-Stage option is enabled for
a Strategy's Alerts, the Staged order should be managed
in the Orders tool.
Update Method 1 (Used by Fidelity for Daily scales and higher only)
When a Strategy requires an update for the most-recent bar, Wealth-Lab initiates the
request via the Static Data Provider associated with the symbol or DataSet. This method
is always using for Daily scales and higher, but also for intraday scales unless the provider
implements the alternate method.
Update Method 2
Data providers may implement intraday updates with a streaming solution. In this case
polling for data updates is not required, minimizing update delay at the expense of
additional processing overhead (building bars from ticks). Fidelity implements a client/
server integrated solution such that data interval conflation occurs at the server, freeing
client processors of that task. Complete bars are fed to the Strategy Monitor after the
end of interval at which time Wealth-Lab client can apply their full cpu load on processing
strategies.
Be sure to set the Data Range to load only the amount of data that you
need. "All Data" is not recommended for symbols that contain tens of
thousands of bars since it requires a large amount of processing that could
result in lagging performance
End-of-day Strategies
By default Wealth-Lab schedules the run time for Strategies using Daily and greater scales
one half hour after the market close. You can change the scheduled run time for EOD
Strategies in the Strategy's Activation Settings. See Daily Strategy Scheduling 151 .
Additionally, you can refresh the Alerts manually at any time using the Run this
Strategy now action from the Strategy frame's right-click menu 152 .
9 Strategy Rankings
The Strategy Rankings tool provides the ability to backtest a selected group of strategies
on one symbol or a complete DataSet as a batch process. By sorting the tabular results
by clicking on the column headers, you can find the strategies with the best performance
for a specified set of test conditions (Scale, Data, Data Range, Sizing, etc.).
Strategy Rankings: By adding a Strategy more than once, you can rank it using
different Parameters by adjusting the sliders for each instance.
Tip: To retain all settings and strategies for future rankings, save the
Workspace after configuring Strategy Rankings.
9.1 Setup
Scorecard
Choose either the Basic or Extended Scorecard. As with the Performance Report 212 ,
Scorecard metrics depend on the selection of Raw Profit or Portfolio Simulation sizing
modes.
Add Strategies
To add strategies, select one or more Strategies from the Strategy Explorer. Hold the
Shift or Ctrl keys to select multiple Strategies. Repeat the "Add" procedure as often as
required to select Strategies from different folders.
You can add the same Strategy more than once to test and compare various
configurations of Strategy Parameters for the same Strategy. Once added, select each
Strategy one by one to modify its parameters (if any) using the sliders at the bottom of
the Data Tree.
Strategies are compiled when loaded into the Rankings tool (and upon
modification of a Strategy Parameter). Changes to code in a Strategy Window
won't take effect in Rankings until a) removing and re-adding the Strategy in
Rankings, or, b) closing and reopening Rankings.
Remove Strategies
Hold the Shift or Ctrl keys to select multiple Strategies and click this button to remove
them from the Rankings list.
Begin
Before initiating the Rankings process configure the Data Tree for Scale, Date Range,
Sizing, and symbol or DataSet. Click Begin or to start.
Errors
Referring to the next image, strategy syntax or execution errors are denoted by the
icon. Check the Errors view for more information. Double click or right click to open the
strategy in a Strategy Window to troubleshoot the code. After correcting the error, save
the Rankings Workspace and then re-open it to re-compiled all Strategies in Rankings.
10 Quotes
The Quotes tool monitors streaming quotations for ad-hoc symbols and creates visual and/
or audio alerts when prices reach target levels for limit and stop orders, i.e., Price
Triggers 326 . You can add Price Triggers manually one-by-one in a Quotes window, but
normally you'll populate Quotes from the Strategy Monitor's Alerts, Strategy Window's
Alerts, or WealthSignals Trader by highlighting one or more Alerts and then clicking the
Monitor in Quotes Window button (as shown).
What is Triggering?
Example: Assume Symbol ABC trades at 20.01 and that your Strategy has determined that
you should enter a BuyAtLimit order for 200 shares at 17.99. It's uncommon for most
stocks to move the 10% required for this limit order to be filled, and, ABC could very well
trade higher. Consequently, placing the order can tie up buying power that could be used
for other trades.
Price Triggers give you a automated way to place stop and limit orders at the moment
they are marketable. By monitoring real-time quotes, Wealth-Lab can automatically
trigger the order when ABC is trading at or near the target price. Once triggered, you can
manually Stage/Place the order in the Orders tool or set up Quotes to do it automatically
(Auto-Stage/Place).
Market orders are always immediately triggered from Quotes since by definition
a market order should be placed at the beginning of the session (or just
before).
Consequently, triggering is a way to place stop and limit orders in the market at (or near)
the moment that they're likely to execute.
Quotes Providers
Quotes is a streaming tool that is fed by the Streaming Provider selected in Preferences 205
. Note that it's a good idea to enable the Bad Tick Filter 210 to reduce chances of
premature triggering due to a single data spike.
By design, Quotes is "always on" when the tool is opened.
Quotes in Workspaces
As with all tools, Quotes windows are saved with Workspaces. Lists of symbols that are
added for basic quotes will be saved with the Quotes window, however Price Triggers (and
Alerts) are not saved with Workspaces.
Add Quotes
To monitor quotations for any general purpose, click Add Quote(s). Enter one or more
symbols separated by spaces or commas. Symbols added as "quotes" are not Price
Triggers and don't have buy/sell arrows.
Tip:
Add one symbol or an entire DataSet of symbols by dragging and dropping
their respective icons into the Quotes Pane from the Data Panel.
Clear All
Immediately clears the Quotes Pane of all Price Triggers and quotations.
Trigger Threshold %
Threshold % is a measure of the proximity of the current price to the target stop or limit
price with respect to a reference price, where 100% means that price has attained the
target. Set the threshold in percent at which you want Alerts to be triggered. When the
Threshold value matches or exceeds the Trigger Threshold %, the Alert is triggered. The
default setting is 100%, but positive values above 0 and up to 100 can be used. A
setting slightly below 100%, say 95%, will trigger stop and limit orders just before the
market actually reaches the alert price, which can help place an order in time to catch a
fast-moving market or to place a short limit order early while a stock is still in an up tick.
For rising targets (e.g., SellAtLimit, BuyAtStop, etc.) threshold is calculated as follows.
Negate the equation for descending targets (e.g., SellAtStop, BuyAtLimit, etc.).
Last Ref
Threshold % 100
Abs Target Ref
where,
Last is the most-recent quote, Ref is a reference price, and Target is the stop or limit
price.
By default, Price Triggers use the previous day's close as the reference price. However, if
a rising (descending) target price is entered below (above) yesterday's close, the value of
the first incoming tick is used as the reference. This is required to prevent premature or
unexpected triggering, especially for Price Triggers added during market hours.
Gap Filter
The gap filter is a EOD Quotes tool feature that prevents an entry limit order from
triggering if the opening price of the market session "gaps" too close to (or beyond) the
limit trigger price. Just as you can program a filter using the opening price for
backtesting, this allows you perform the same operation in real time trading.
The gap filter affects only BuyAtLimit and ShortAtLimit order types.
Activation
The Gap Filter is disabled by specifying 0% (default). To enable it, enter any positive
number (2 decimals max); generally a number on the order of 2 to 5%. The value specified
represents a percentage of the limit price. The last-entered value is the default for new
Quotes windows, however each Quote window is independent and changes to the filter
value are applied when quotes update. To avoid triggering Alerts for gaps at or beyond
the limit price itself, enter a small value, like 0.01. If the session's Opening price falls
within that percentage, Alert triggering is blocked.
For example, assume a BuyAtLimit price of 50 and the gap filter set to 5%. If the open
of the day were equal to or below 52.50, the gap filter would prevent the limit order from
triggering even if price eventually fell to 50 or lower. Conversely, for a ShortAtLimit
price of 50 and a 5% gap filter, if the open were equal to or above 47.50, the gap filter
would prevent the short order from triggering even if price eventually rose to 50 or higher.
Operation
When the gap filter has blocked an Alert trigger from triggering, the icon is displayed
(see images above) next to the last quote time. While the icon is showing the Alert will
not automatically transition to the triggered Alerts pane, but you can right click and
manually trigger the Alert at any time.
Sample Usage:
Assume you backtest a Dip Buyer Strategy with an entry rule like this one that rejects
(filters) trades if the opening price is within 5% of the limit order price:
// open of the trade day must be greater than 5% above the limit price
if (Open[bar+1] > limitPrice * 1.05)
BuyAtLimit(bar + 1, limitPrice);
Since you can't get the Open price for tomorrow (bar + 1) you must code the rule as
follows in order not to generate an error when processing the last bar of the chart:
// the open of the trade day must be greater than 5% above the limit price
if (bar < Bars.Count - 1 && Open[bar+1] > limitPrice * 1.05)
// this signal is for backtest;
BuyAtLimit(bar + 1, limitPrice);
else
// always Alert for real trading for the last bar
BuyAtLimit(bar + 1, limitPrice);
Note that the Strategy must generate all Alerts because it's not possible to know the
Opening price until the market opens, and that's where the gap filter comes in. It does
the job of checking if (Open[bar+1] > limitPrice * 1.05) for live trading. In other
words, if this condition returns false, the limit order is prevented from triggering. For
ShortAtLimit orders, a 5% setting would be equivalent to if (Open[bar+1] <
limitPrice * 0.95).
Auto-Sort
Automatically sorts the Quotes list by Threshold value. Price Triggers with the greatest
values rise to the top of the list.
Auto-Remove
When enabled, this option removes Price Triggers from the Quotes Pane when they
trigger.
Select All
By "selecting all", you can apply the Place, Stage, or Remove actions to all triggered Alerts
simultaneously.
Remove
Wealth-Lab does not automatically remove Triggered Alerts from the Alerts Pane. To
remove all Alerts simultaneously, right-click and select Clear all Alerts.
Auto-Stage/Place
With Auto-Stage enabled, triggered Alerts are immediately Staged in the Orders tool
without any manual intervention required. When Auto-Trading is enabled in the Orders
tool 179 , this button changes to Auto-Place to indicate that new Alerts (orders) are
immediately placed with Fidelity.
Auto-Email
Auto-Email sends Strategy Alerts to the Email account(s) that you set up in Preferences >
Email Settings 243 . This option is enabled if Email Settings 243 have been configured in
Preferences.
Convert to Market
While "Convert" is enabled, Wealth-Lab converts stop or limit orders to market orders upon
triggering. Since it's possible for an instrument to quickly move away from a target price,
you can be certain to execute the trade if you place the order "at market" instead of
using a stop or limit order. Data latency or order-entry and transmission delays can also
influence if a stop or limit order is marketable when it is placed. Related: Trigger
Threshold 162 .
When using this option, it's recommended to employ the Bad Tick Filter 210 with
a tight percentage (less than 1%) to reduce chances of premature triggering
due to a single data spike.
The act of enabling or disabling this option does not have an affect on existing
triggered Alerts.
Edit Alert...
If not using the Auto-Stage option, it's possible to change
an Alert's order properties before staging or placing it.
However, the Quotes tool is practically a requirement for "band trading" or "dip-buyer"
Strategies that generate a large number of Price Triggers (at least one for each symbol in
the DataSet) but in reality only have the opportunity to enter a few trades per day. For
example, assume that you're sizing positions with 10% of equity. Imagine attempting to
enter 100 or more limit orders with a broker while trading a dip-buyer Strategy. It's likely
that your broker will reject orders after having exceeded your buying power. Instead,
you'll use Quotes to monitor a list of Alerts, and, when a security approaches its
corresponding Alert price, Quotes will notify you that the time is opportune to place the
stop or limit order. In other words, Alerts that are not marketable are never placed in the
market, so they do not consume your buying power.
Still, it's possible that your system needs a "human element" to reject specific trades
following news events, or, you may simply not want to show your order for all the world to
see until the market comes to your price. The Quotes and Orders tools make a potent
combination to post your order at nearly the precise moment in which a trade is
marketable.
11 WealthSignals Trader
The first topic in this chapter describes the web-based end-of-day trading signals service
developed by Wealth-Lab.com called WealthSignals™. You can participate in
WealthSignals™ as a subscriber to and/or an author of WealthSignals™ Trading Systems.
The next topic introduces the WealthSignals Trader Tool, which subscribers can use to
download signals from WealthSignals trading systems directly to their Wealth-Lab Pro
desktop application for further trade processing.
A Wealth-Lab.com login is required to participate in WealthSignals as an author
or subscriber.
11.1 WealthSignals
own forum.
4. If you determine that a particular trading system interests you, Subscribe to (or
Watch) the trading system. Nearly all systems will include a free, no-obligation trial
subscription period in which you can receive signals.
5. Monitor and navigate to all your subscriptions and watches from a single view using
My Dashboard at Wealth-Lab.com.
6. To retrieve signals directly in Wealth-Lab Pro, launch the WealthSignals Trader from
the Tools menu and enter your Wealth-Lab.com credentials. See Accessing Signals 175
in the WealthSignals Trader Tool topic.
One-time Setup
1. Install the WealthSignals
Publisher extension and put a
check mark next to it in
Preferences (F12) >
Performance Visualizers >
WealthSignals.
The WealthSignals
Publisher is a type of
"Alerts Visualizer" that
allows you to upload
backtest results and
trading signals (alerts)
to Wealth-Lab.com. Get
it from the Extensions
section at Wealth-
Lab.com.
Staging Signals
Two methods exist to Stage signals for publishing.
Important!
It is not possible to modify signals after they have been published following the grace
period or immediately after 9:00 AM ET.
Abort Publishing
During the 15-minute grace period, you can abort publishing signals by ether method by
clicking the Abort Publishing Signals button on the system's Wealth-Lab.com Details page.
Signals that were entered remain queued after aborting and may be deleted or modified
on the Details page.
Following an abort, be careful not to duplicate signals that are already queued
when re-staging with the WealthSignals Publisher (Method 1 above).
11.2.1 Actions
Log in to WealthSignals
Use your Wealth-Lab.com credentials to Log in to WealthSignals. To log out from
WealthSignals, close the WealthSignals Trader window.
Download Signals
Shortly after login to WealthSignals, signals to systems to which you are subscribed are
downloaded automatically. After 12:00 AM ET and prior to 9:00 AM ET the WealthSignals
Trader "Auto-updates" these signals every 15 minutes. After 9:00 AM ET, automatic
refreshes occur every 5 minutes until approximately 9:25 AM. At any time, if you wish to
download signals manually, just click the Download Signals button. To disable Auto-
updates, close the WealthSignals Trader.
Set Account...
Just as with Wealth-Lab Strategies, you can assign WealthSignals Systems to a specified
live or paper account. Just highlight a WealthSignals system (or one of its signals), click
Set Account, and select one of the accounts from the list. Assigning an account is
required just once per WealthSignals System.
Select All
This action selects all signals for all WealthSignals systems for the Place, Stage or Monitor
actions.
Select all orders for a single system by clicking on its name. Individual or
multiple signals may be selected using the standard windows methods (left click
plus Shift or Ctrl).
[Trade Type]
Choose Margin or Cash trading if required for live accounts.
Accessing Signals
To download signals to the WealthSignals Trader, log in to WealthSignals using your
Wealth-Lab.com credentials. The WealthSignals Trader will automatically poll for signals
for systems to which you are subscribed. After 12:00 AM ET and prior to 9:00 AM ET the
WealthSignals Trader "Auto-updates" these signals every 15 minutes in order to retrieve
new signal publication from all your subscribed systems. After 9:00 AM ET, automatic
refreshes occur every 5 minutes until approximately 9:25 AM. At any time, if you wish to
download signals manually, just click the Download Signals button. To disable Auto-
updates, close the WealthSignals Trader.
A system's signals will not change once they have been published/downloaded.
Signal Fields
Signals are grouped by Strategy.
Action Awaiting System author has not yet staged signals for the
Publication session
Buy Short Trading signal type
Sell Cover
No Signals System author published a "NST" notification
Today
Under Review Author failed to stage signals (or NST) for two
consecutive market sessions. Current subscribers
can still receive signals, but the system cannot
accept new subscribers for 30 days.
Symbol (Self-explanatory)
Qty The number of shares based on your personalized account factor.
Order Type Market, Stop, or Limit. Market at Close orders are not supported.
Order Price Stop/Limit trigger price. Blank for Market orders.
Account Account to which the WealthSignals system is assigned; or default
account in Preferences (F12) > Trading
Date/time (Self-explanatory)
Downloaded
Case 2: Stopped in
If the system uses stop orders to enter a position (long or short), you could end up
owning a position that is not supported by the WealthSignals system. This is an
"orphaned position" that the account owner must manage.
Perform daily a cross check for synchronization of positions between your Wealth-Lab
back test and the WealthSignals model account's Open Positions view. (We recommend
using the Trades+ Open Trades view of the Performance Visualizers library extension by
MS123, available at Wealth-Lab.com.)
Be wary of trade synchronization around dividend ex-dates when using dividend back-
adjusted data. The back adjustment can cause hypothetical trades resulting in current
positions to be "missed"; likewise new trades may appear to be active that were not
previously.
When exiting a full position, ensure that the exit signal position size matches the
WealthSignals's Position and adjust if required. WealthSignals will automatically adjust
"too many" shares to match the current Position, but no action is taken if the shares
are fewer since a partial position exit may be intended.
Limit order slippage should be disabled for the WealthSignals forward test trading in
Preferences (F12) > Slippage and Round Lots.
High-exposure stop or limit order systems should employ a time-of-day Position priority
logic such that trades that occur earlier in the day have the highest priority. Contact
Support at Wealth-Lab.com if you need assistance with this.
If you feel that WealthSignals should have (or did not) execute a trade due to bad data
or otherwise, create a support ticket at Wealth-Lab.com as soon as possible.
12 Orders
Warning!
Do not use the same Windows User login to trade accounts for more than
one Social Security Number (SSN). If necessary, create a separate
Windows login for each SSN, and run Wealth-Lab Pro in a separate Windows
session for each user.
The Orders tool dynamically handles orders from all Wealth-Lab alert-generating tools and
the manual Trade Ticket 195 , and integrates user options to customize order placement
decisions. Orders are integrated with both Live and Paper accounts. To familiarize
yourself with the automated trading environment, we encourage you to try Wealth-Lab's
Paper Trading 180 first.
Once you are familiar with the manner in which the Orders tool functions and have made
the necessary preparations, the Orders tool can significantly reduce your trading activity
workload while providing you with the latest trading and Fidelity account statuses. Trades
that are placed and executed through the Orders tool will be reflected in the Default
Account 240 or in the Fidelity account associated with the Strategy that generated the
Alert (automated entry).
See the Advanced Options 238 that control the behavior of the Order Manager when a
trading is Staged or Placed.
Although you can open many main Workspaces, only a single Orders window
can be active. Attempting to launch a second Orders window will automatically
shift focus to the first active Orders tool in another Workspace.
Margin accounts cannot trade cash positions with Wealth-Lab Pro.
Real and paper trades can be staged or placed through strategy-generated trades/alerts
using Chart or Strategy Windows, Strategy Monitor, price trigger trades/alerts in the
Quotes tool, as well as through the Manual Trade Ticket 195 . Log in to Fidelity is not
required to place trades with Paper Accounts via the Trade Ticket or from a static (EOD)
chart. However, to trade an automated intraday strategy using a Quotes tool, a
Streaming Strategy Window, or the Strategy Monitor, login is required to access data.
In dynamic markets the Paper broker may not execute stop/limit orders when
expected. A strategy will always theoretically fill a stop/limit order whose
activation price is met or exceeded, assuming zero slippage 234 . However, if the
market moves back within the activation price at the time the snapshot is
taken, the Paper broker won't fill the order, which will cause an out-of-synch
condition between the Strategy and Paper account.
Automated cancels
Wealth-Lab Pro cancels Active orders if an Alert does not exist for the same order(s)
on the next bar.
Wealth-Lab Pro cancels Active stop and limit orders only if 1) price changes, or if 2)
the Alert(s) are not submitted again on the subsequent bar. When the limit or stop
activation price changes, the order is canceled and replaced with the new price.
It should not be necessary to change your strategy code for this interaction to
occur. It occurs naturally as a fallout of the way strategies are programmed.
Additionally, only one stop and/or limit order is possible (one of each type) for exit
orders on a single position. For example, 2 stop loss orders with different prices for the
same position is not valid, and only the stop order closest to the current price will be
accepted.
Limitations
It's not possible to place cash trades for margin accounts in Wealth-Lab Pro.
Warning!
Do not use the same Windows User login to trade accounts for more than
one Social Security Number (SSN). If necessary, create a separate
Windows login for each SSN, and run Wealth-Lab Pro in a separate Windows
session for each user.
AtClose Orders
AtClose Orders are not supported by the Orders tool. See How to: Alert for AtClose
Signals in the WealthScript Programming Guide.
AtStop/AtLimit Orders
Placing AtStop/AtLimit orders such that they would immediately execute "at market" is
not accepted by Fidelity backend subsystems and will result in an order entry error
accompanied by a message to the effect, "please review your order". Generally, this
situation may occur when placing a Strategy's stop/limit orders into a price gap for an
end-of-day Strategy. Intraday Strategies can conditionally place market orders upon
detecting that a stop/limit trigger price would trigger at market with respect to the
current closing price.
Please be informed that Fidelity has informed us that it is not possible to
change the behavior of backend subsystems to accommodate stop/limit orders
that would execute at market when placed.
Portfolio Synchronization
Portfolio Synch is greatly simplified in Wealth-Lab Pro Version 6, which no longer requires
additional code to function. Strategies always execute in a theoretical backtest mode
while synchronization occurs only in the context of exit Alerts. The main limitation is the
inability of a Strategy to directly access a real Position's actual entry price, which may
or may not apply to your Strategy. See Portfolio Synchronization 186 for more details.
Account Feedback
It is not possible to ascertain the status of live Positions (or their exits) from within a
Strategy. While this isn't a problem for Market or Stop order strategies, it's quite
possible that a Limit-order strategy fills an order theoretically while the live order
remains open, which can happen when the market trades precisely to the Limit price and
then reverses. Monitor Limit-order strategies closely.
Warning!
Do not use the same Windows User login to trade accounts for more than
one Social Security Number (SSN). If necessary, create a separate
Windows login for each SSN, and run Wealth-Lab Pro in a separate Windows
session for each user.
Stage Sends an Alert, which may have been manually modified, to the Orders
tool, where the Order can be edited (if required) and placed. Staging
an order is manual action that will never place an order, even if Auto-
Trading is enabled.
Place Places the selected order(s) with Fidelity. The order status can be
monitored in the Orders tool.
Auto-Stage Stages Alerts in the Orders list without manual intervention.
Auto-Trading
The Orders tool is responsible for placing orders with Fidelity and managing their status
thereafter. When the Orders tool receives an order, two things can happen:
1. the order is staged (queued) and must be placed manually, or,
2. the order is placed immediately, i.e., Auto-Trading
Off All Alerts that are Staged or Auto-Staged to the Orders tool must be placed
manually.
Paper Enables Auto-Trading for Alerts destined to Paper Accounts (only). Wealth-
Accounts Lab tools with Strategies that have been assigned to a Paper Account for
trading will have an Auto-Place button, whereas those for Paper Accounts
will have an Auto-Stage button.
Live Enables Auto-Trading for Alerts destined to Live Accounts (only). Wealth-
Accounts Lab tools with Strategies that have been assigned to a Live Account for
trading will have an Auto-Place button, whereas those for Paper Accounts
will have an Auto-Stage button.
Clicking Stage to stage an order will never result in placing an order even
when Auto-Trading is enabled.
Order-Entry Summary
Anywhere an Alert can be triggered in Wealth-Lab Pro, the order can be passed directly to
the Orders tool. The following table lists the options available:
By default, Wealth-Lab Pro synchronizes automated trading with your account's positions
in two ways:
Alerts and Trade Ticket orders to exit positions with more shares than you own are
automatically reduced in size to match your account shares, and,
Alerts to exit positions that are not owned in your account are not automatically
transmitted to the Orders tool when Auto-Stage or Auto-Place is enabled. These
Alerts will still be visible in the Alerts views, however.
To disable Portfolio Synchronization, refer to the Trading Options group in
Trading Preferences 240 .
In addition, you can choose to make exit Alerts always match the total number of shares
held in your account by selecting the "Exit Orders" option in the Trading Preferences 240 .
It is not possible for a Strategy to directly access a live Position's true entry
price or number of shares.
In the following examples assume that you've enabled Auto-Stage so that Alerts are
automatically staged in the Orders tool.
Example 1
Your account (or Paper account) holds 300 shares of XYZ. Position sizing is set up such
that a strategy generates an Alert to sell 500 XYZ. Portfolio Synch will automatically
reduce the Alert shares to match those in the associated account and stage the order to
sell 300 XYZ in the Orders tool.
Example 2
Your account (or Paper account) holds 500 shares of XYZ. Position sizing is set up such
that a strategy generates an Alert to sell 200 XYZ. There are two possibilities depending
on the selection of the "Exit Orders" preference.
1. If the preference is enabled, an Alert to sell 500 XYZ (all shares in the account) is
staged in the Orders tool.
2. If the preference is disabled, an Alert to sell 200 XYZ is staged.
Example 3
Your account (or Paper account) holds 0 shares of XYZ, and, a strategy generates an
Alert to sell 300 XYZ. Since the account associated with the strategy does not hold a
Position that matches the Alert, Wealth-Lab will not stage the order in the Orders tool.
settings) 233 and can therefore become out-of-synch with your Live account. Generally,
this isn't a problem for strategies that use market orders, but can be a factor when stop/
limit orders are used.
AtStop Orders
Fidelity uses the bid/ask to trigger stop orders on the back end subsystem while Wealth-
Lab requires a trade at the stop price for theoretical trade to take place. Therefore if an
actual trade does not occur at the bid (sell/short stop orders) or ask (buy/cover stop
orders) that falls on a stop price, an out-of-synch condition will occur since the backend
will execute the stop order, but Wealth-Lab will not recognize that the stop order
triggered. This is a rare condition for a highly-liquid markets, but can occur more
frequently when using stop orders in lightly-traded markets.
AtLimit Entries
For example, assume slippage is deactivated, the market is trading at 25.50, and you
place an order to buy 100 shares at 25.32 limit. If the market trades down to precisely
25.32 and then rises again, Wealth-Lab will theoretically fill the order and as a
consequence the strategy will begin processing exit logic for this Position. However, in
real life, it's quite possible that your order, one of many at 25.32, not be filled. While
you're still looking to enter the market in real life, your Strategy will be processing exit
logic, which could result in a missed opportunity to enter the market later.
With an end-of-day strategy employing the Quotes tool, consider using the "Convert to
Market Order" option to prevent an out-of-synch situation from occurring. Currently no
viable solution exists to resolve this for intraday strategies. While you my be tempted to
activate limit-order slippage 233 such that the theoretical fill does not occur until a tick
occurs at even a lower price, the precise opposite synch problem could occur in which
your Live account fills but the strategy does not. In this case, the strategy will continue
processing entry logic, which may result in additional (unwanted) positions.
Disable limit-order slippage for live trading of strategies that use limit orders to
enter positions.
AtLimit Exits
Conversely, for strategies that use market orders to enter a trade but limit orders to exit,
it may make sense to apply limit-order slippage. In this way, you're almost guaranteed
that the strategy will continue processing exit logic until an actual fill occurs. It's "almost"
because there's always a possibility of a trade occurring beyond your limit (e.g., a data
spike, or a trade hitting an order on a different ECN), which again may fill the strategy's
theoretical condition but not your actual trade.
Risk exists that your strategy become out-of-synch with your Live account.
Monitor for this condition and compensate for it manually, if required. In
real-time you can adjust a limit order price, create an offsetting order with
the trade ticket, or manage the out-of-synch position at your discretion.
Log in to Fidelity
In order to place a trade for Live accounts it's required to manually complete the login
action. You can log in to Fidelity in two ways:
1. Click on the Log in to Fidelity button in the Function toolbar as shown below, or
2. Click on the Log in to Fidelity button in the manual trade ticket.
Depressing the Log in to Fidelity icon will launch a dialog box to allow the user to connect
to Fidelity. Upon successful login, appears in Wealth-Lab's Function
toolbar.
Account
The Order tool can show a composite list of Wealth-Lab orders for all your Fidelity
accounts by selecting "All Accounts". Choose a specific account to filter Orders
information for an individual account.
"All Accounts" represent all Live accounts; Paper accounts are not included.
Cancel All
Clicking the Cancel All button 1) cancels all Live and Paper account orders having an
Active or Partial status, and, 2) disables Auto-Trading. You must acknowledge a Cancel All
action by clicking the Yes/No dialog.
Warning!
The Cancel All button cannot cancel Live orders if a stable internet connection does
not exist between Wealth-Lab Pro and Fidelity. For emergencies, keep your broker's
trading desk phone number handy.
Important!
When the Auto-Trading is enabled:
1. it is enabled for all Live Accounts or Paper Accounts, as specified by your selection.
2. Auto-Stage buttons becomes Auto-Place for the Strategies associated with
the account type enabled for Auto-Trading. See Stage, Place, Auto 184 .
The Orders tool ensures a consistent order flow from trading strategies such that each
trade is active or canceled based on the trading system's logic and that no order is
duplicated. For example, if your trading system uses bracket exit orders (simultaneous
stop and limit orders for the same symbol), the Auto-Trading feature will automatically
enter the order pair as a bracketed (OCO) order. When one of the orders is filled, the
Order Manager automatically cancels the opposing order.
Orders that are already staged are not placed upon selecting Auto-Trading
Mode. Also, orders manually put in the order list by clicking the Stage button
from any tool will not be placed automatically even if Auto-Trading is enabled.
Auto-Trading is turned off by any of the following actions:
selecting Auto-Trading: Off, or,
clicking the Cancel All button, or,
closing the Orders tool, or,
logging out of Fidelity
Update
Wealth-Lab Pro communicates with Fidelity to display the latest status of all orders.
However, in the case that Wealth-Lab Pro does not receive a timely message from the
back-end, you can click the Update button to request order statuses for all Accounts for
orders in any of the following states: Active, CancelPending, or Unknown. Wealth-Lab Pro
must Logged in to Fidelity to activate the button.
"Guaranteed Alerts" are part of Fidelity's backend subsystem to provide
updated order status to Wealth-Lab Pro. In the event that Guaranteed Alerts
fails, Wealth-Lab polls for order updates approximately once every 30 seconds.
Use the Update button to request order status updates immediately. To
reconnect to Guaranteed Alerts after a failure, restart Wealth-Lab Pro.
Selecting Orders
For the actions that can be applied to multiple orders, you can select multiple items using
the Shift or Ctrl keys in combination with the left mouse button in the standard Explorer
manner. Alternatively, make multiple selections by holding the Shift key while tapping the
up/down arrow keys or by left-clicking and dragging over an area. The DEL key will remove
selected orders that are not Active from the list.
Options for Cancel and Place are enabled only when a connection exists with Fidelity.
Note that you cannot Delete or resubmit (Place) orders having a Submitted or Active
status; the Orders tool will ignore such requests.
Edit Selected
This action provides the ability to change a staged
order's details - see dialog to the right.
If the Route selection is not displayed, then
your account is not entitled for directed
trading and Auto is used as the default
route.
Place Selected
Places all highlighted (selected) queued order(s) to
Fidelity for execution.
Cancel Selected
Requests that Fidelity cancel all highlighted (selected)
Active, including partially-filled orders.
For Live accounts, Cancel and Place are enabled only when a connection
exists with Fidelity. You cannot Remove or Place orders that have a
Submitted or Active status; the Orders tool ignores such requests
Remove Selected
Removes orders using the same criteria as Remove
Completed (below), but only for the orders selected
in the list.
Remove Completed
Removes all completed Live and Paper orders from the
list. Completed orders are those that have a status
of Filled, Overfilled, Canceled, Error, or Unknown.
This action will not clear Partial, Staged, Submitted,
or Active orders.
Auto Remove
Automatically removes stop/limit orders that are canceled and replaced by trading
automation. For example, if you Strategy uses a trailing stop, the order is likely to be
canceled and replaced several times as the Position becomes more profitable. Auto
Remove keeps the Order list tidy by removing canceled orders and showing only the
most-recent trailing stop and limit orders.
Date/Time
Date and time of the order. For automated trades (alerts generated by the Strategy
Window or Strategy Monitor, the date is the time stamp of the signal bar, which due to
order-entry and execution delays, will always be prior to the time of the actual trade
execution. The Orders tool discards duplicate orders, consequently the date/time will
reflect that of the order which was initially Staged or Placed. An order is a duplicate if all
the following components are the same: Strategy, Scale, Symbol, Order Action and Type,
Quantity (shares), and Price.
Status
Submitted Order submitted to Fidelity, but not yet confirmed active.
Active Order accepted and confirmed active by Fidelity. Active orders
must be first canceled if you wish to clear them from the list.
PartialFilled Order partially filled and will remain active unless canceled.
Filled Order completely filled. Note that this information is passed to
the Accounts tool.
CancelPending A request to cancel the Order has been submitted to Fidelity.
Canceled Order confirmed canceled by Fidelity. See Order Messages for
more information.
Error An error occurred during Order processing. See the Message
field for more information.
Overfilled On a very rare occasion your order may be Overfilled. In this
case you'll see the order's status change from Filled to
Overfilled. Immediately contact Fidelity to remove the overfilled
portion of the order.
Unknown The order status cannot be verified through Fidelity. This will
occur, for example, if you shut down Wealth-Lab Pro with
active orders. If you then launch the Orders tool without
having connected to Fidelity, the status of previous live orders
cannot be verified.
Bracket Exit OCO (one cancels other) bracket order placed. A bracketed
exit simultaneously places profit target limit order with a stop
loss order.
Order Price
The Stop/Limit order price. For the Market Order Type, this field will be blank.
Filled (Shares)
The number of shares that were secured or sold for the order. A cumulative number of
partially-filled shares will appear in this field and be dynamically updated as additional
shares are secured. This data is received from the <%FIDO% back-end.
Fill Price
The average price at which the order was executed.
Route
Wealth-Lab Pro-selected order route.
Message
This field contains detailed information for orders with an Error or Canceled status. Error
messages are received from Fidelity and may occur for any number of reasons. By clicking
on the error in the Order messages window, additional message details may be displayed in
the Message Full Text frame. If the message text is cut off in the Order Messages
window, highlighting it will show the complete message in the message full text box.
Wealth-Lab can also prevent an order reaching Fidelity by canceling it due to
one of the following conditions which are controlled in the Trading Preferences
240 :
TIF
Day, DayPlus, or GTC. See Time in Force 196 .
Trade Type
Trade Type is identified by Cash, Margin, or Short for live accounts, but is blank (not
used) for Paper Accounts.
While cash accounts are confined to cash-only long trades, you can specify Cash or
Margin when entering or exiting long positions (Buy or Sell) in a margin account. Short
trades (Short or Cover) are identified automatically with a Short Trade Type for margin
accounts. Specifying Trade Type primarily allows customers with margin accounts to
trade cash positions.
You can pre-configure and/or edit Trade Type in the Strategy Monitor
Activation Settings 150 Dialog, Strategy Window Alerts view, and Quotes tools.
While Wealth-Lab Pro automates your scripted trading activities, don't miss those other
opportunities that arise in the markets by quickly entering a trade manually. The Manual
Trade Ticket may be displayed at the top or bottom of a Workspace, allowing you to
easily place a manual trade regardless of other tasks you may be performing.
With the exception of the ability to use AtClose orders, which are not compatible with
the Orders tool, the Manual Trade Ticket interface gives you the same order-entry options
available to you in Wealth-Lab Pro Strategies. The trade ticket is largely self-explanatory
and is independent of the Orders tool. In the image below, for example, an order has been
configured to Buy 100 Shares of AA at a Limit price of $8.50.
If you are not actively entering orders, you can hide the trade ticket by clicking
the Hide Trade Ticket button located in the Function Toolbar 290 or by
striking Ctrl+T to toggle the view on and off.
Account
Choose the Fidelity (or Paper) account to which manually-entered orders will be directed.
Initially, the Default Account 240 is selected.
Order Type
Account Order Types
Live Market, Limit, Stop, Trailing Stop $ and %. Trailing Stops are based
on the last trade when the Place or Stage button is clicked and are
valid for both entry and exit orders.
Paper Market, Limit, Stop. (Trailing Stops not supported)
Amount
The price for Limit or Stop Order Types or the point/percentage Trailing Stop amount. This
field is disabled for when Order Type is Market.
Example: For a Sell stop to trail the last price by 2%, select Trailing Stop % and enter 2
for the Amount.
Only whole numbers can be entered for the Trailing Stop % Amount. e.g., 1,
2, 3 (%), etc.
Route
Currently, Auto is the only available order-routing option for Live accounts.
Account TIF
Live Auto-routed Stop and Limit Day and GTC ('Good Til Canceled')
orders
Paper All order types: Day (only)
Summary of order routing and TIF combinations in Wealth-Lab Pro for Live accounts.
Trade Type
The selection generally defaults to the appropriate type based on the Account and Order
types, providing the ability to identify your trades as Cash, Margin, or Short. Trade Type
does not apply to Paper Accounts.
Place
Enabled when a connection exists with Fidelity. When clicked, the specified order is
immediately submitted to Fidelity. Manual orders are never checked against Account
positions, therefore Wealth-Lab Pro will never inhibit submitting a manual order. In all
cases, however, Fidelity's back-end prevents invalid orders (like selling a Position that you
don't have) and the corresponding error code/message will be displayed in the Order List.
Stage
Enabled when a connection exists with Fidelity. This action places the order in the Orders
tool queue for submission at a later time.
Staged orders from the Manual Trade Ticket are never automatically placed
even if Auto-Trading is enabled.
You can highlight and place any staged order at the same time that you place
bracket orders. OCO orders are identified by placing a stop and limit order
simultaneously for the same symbol. The OCO behavior is automatic and not
optional.
Partial Fills
Applies to: Non-GTC Automated Orders
These few examples highlight that software is only one of the essential
components for trading. Everyone has their own worst-case scenario;
please plan carefully for yours.
Changes in a stop or limit price will also cause the previous stop or limit order to be
canceled before the new order is placed. In the case of live trading, Wealth-Lab Pro
employs the Cancel and Replace method, which is handled by Fidelity's backend trading
subsystem.
Designed to keep detailed trade histories of multiple portfolios, Wealth-Lab Pro's Account
Balances and Positions tool, or simply Accounts, automatically tracks trades placed
through the Orders tool 179 . Accounts and Orders work together to keep your account's
equity holdings synchronized with those in your Fidelity account.
How to: Open the Account Balances & Positions tool (Ctrl+Alt+T)
1. Log in to Fidelity
2. From the main menu select Tools > Accounts (Ctrl+Alt+T), or, click Accounts in the
Navigation toolbar 289 .
Although you can open many main Workspaces, only a single Accounts window
can be active. Attempting to launch a second Accounts window will
automatically shift focus to the first active Accounts tool in another
Workspace.
It is not possible to place cash trades with a margin account using Wealth-Lab
Pro. Cash positions that exist in a margin account (traded via Active Trader
Pro® or fidelity.com) will not appear in Wealth-Lab's Accounts tool.
Streaming Updates
When the Streaming Updates button is selected during market hours, the Positions Value
and Positions Profit/Loss fields are updated in real-time.
Update
Provides snapshot updates of Account Balances.
Configure Accounts
Add, delete, and otherwise configure Paper accounts. Log in to Fidelity is required to
configure accounts.
As with other lists in Wealth-Lab, click on the column headings to sort the list. For
Fidelity accounts, the fields for Market Value, Profit, etc. are updated automatically when
connected to Fidelity. Listed items will have a green or red Profit and % Profit field, based
on being "in the black" or "in the red", respectively.
Position
Long or Short for securities.
Account
The Fidelity account in which the Position is held.
Symbol
The security's (or FCASH) symbol.
Quantity
The number of shares, or that have been secured for the Position.
Cost Basis
Cost basis of the Position, calculated from the trade entry or wash sale-adjusted price
plus commissions.
Last Price
When not connected, Wealth-Lab Pro will update the Last Close automatically during a
manual or scheduled update.
Market Value
The dollar value of the Position based on the last price.
Trade Type
Identifies the Position as Cash, Margin, or Short in a live account. Trade Type is always
"blank" for Paper Accounts.
Profit
The absolute dollar profit/loss for the Position. The list item's Market Value is green for
winning Positions and red for losing Positions.
% Profit
The percentage profit with respect to the entry price.
Dollar and % Profit may not be available on the day of the trade entry (N/A).
Action
Buy, Sell, Short, or Cover for securities.
Account
The account in which the transaction occurred.
Date/Time
The local date and time at which the order was filled and entered into the Trade History.
Quantity
The number of shares, or contracts in case of a futures symbol, that were secured or sold
for the Position.
Symbol
The security's symbol.
Price
Trade execution price.
Trade Type
Identifies the Position's Trade Type as Cash, Margin, or Short. Trade Type is always
"blank" for Paper Accounts.
Trade Type will be empty for Positions entered into in the Local Trade History
prior to use of Version 6.0.
Strategy
The name of the Strategy from which the signal was generated
Scale
The selected Scale (timeframe) from which the signal was generated. Intraday scales can
be any number of minutes.
14 Preferences
The Preferences Dialog allows you to control and personalize default settings in Wealth-
Lab Pro. Open the Options Dialog by pressing the F12 function key, by selecting
Preferences from the Tools menu, or by clicking the Preferences button on the far right
side of the Navigation toolbar. The Preferences dialog is divided into a number of
functional tabs.
Chart Colors
Background
The color of the chart background.
Up Bars
The default color for price bars whose Close is greater than the Open.
Down Bars
The default color for price bars whose Close is less than or equal to the Open.
Tip: You can override the Up/Down color defaults using SetBarColor() or
SetBarColors() in your script.
Gridlines
The color of x- and y-axis gridlines on the chart.
Tip: Volume and the Volume Pane can be removed from the chart with the
HideVolume() method in your script.
Pane Separator
The color of the line that separates the Price, Volume, and/or custom chart panes.
Chart Options
Horizontal and vertical grid line spacing is controlled automatically. Horizontal lines are
drawn at the major grid points along the Y-axis, and vertical lines are generally drawn
every 5 to 20 bars depending on the time frame and bar spacing selected.
Horizontal Gridlines
Enables horizontal grid lines for display.
Vertical Gridlines
Enables vertical grid lines for display. For intraday charting, a double-thick vertical grid
line is drawn on the first bar of the day.
Enables vertical grid lines for display. For intraday charting, a double-thick vertical grid
line is drawn on the first bar of the day.
ToolTips
Prices
Enables the pop-up display of the OHLC/V and change-from-previous-bar summary box
when hovering the mouse pointer over the bars for the primary chart symbol in the price
pane.
Indicators
Enables the pop-up display of the indicator's description and value when hovering the
mouse pointer over an indicator (including fundamental data items) plotted in any pane.
For histograms, point to the extremes of the bars for the tooltip.
Indicator Tooltips are required in order to interact with drag and drop
indicators.
Fundamental Items
Enables the pop-up display of 1) fundamental information when hovering the mouse
pointer over fundamental data icons, including split and dividend icons, and, 2) trade
rollover data.
Chart Fonts
To obtain the underlying information, hover the mouse pointer over an annotation.
Your installation includes the following Chart annotations, but more may be added
depending upon installed static and fundamental data provider(s):
Fidelity Static and Fundamental Providers
Split
Dividend
Fundamental data
Economic data
Earnings per share
Earnings estimate
Equity Summary Score and Category
Insider Buy, Sell, Net Transactions
Short Interest
Yahoo! Provider
Split
Dividend
Streaming tickers are displayed when streaming is activated for a Chart window
or if a Quotes tool is receiving quotes.
Enables real-time filtering of "bad ticks" from the Fidelity Wealth-Lab Pro streaming feed.
A tick that varies more than the Bad Tick Threshold percentage from the previously-
received tick will be ignored and not incorporated into the Streaming chart data.
This option works in real time only and does not apply to the historic back-fill
portion of a real-time chart.
Visualizer Name
A unique, descriptive name for each visualizer.
Applies to
Whether or not a selected visualizer is displayed may depend on the strategy testing
mode as follows:
Portfolio Simulation
These Visualizer are available only when running a simulation in Portfolio Simulation mode
326 , and consequently is not displayed for Raw Profit mode 327 simulations.
Multi Symbol
These Visualizers are displayed for Multi-Symbol Backtests or for strategies that
explicitly execute trades on other than the "clicked symbol" following a call to
SetContext.
Combination Strategies
Applies (currently) only to the By Strategy 217 Visualizer.
All Backtests
These Visualizers are displayed in the Strategy window for all backtests in any mode.
For Performance Visualizers, the Apply button simply stores new settings
without closing the Preferences dialog. Any changes are applied only to newly-
opened Strategy windows.
14.4.1 Performance
The Performance Visualizer provides a detailed report of the trading system's performance
statistics that describe the results of the Strategy. A list of performance metrics is
presented in the first column on the left. Each metric is reported for All Trades (Long and
Short), Long Only, Short Only, as well as for the Buy & Hold strategy.
Performance Metrics
The set of metrics presented depend on the mode selected for backtest: Portfolio
Simulation Mode or Raw Profit Mode. Unless otherwise specified, performance measures
apply to both modes.
The amount of capital including the closing value of open Positions at the end of the
backtest.
Net Profit
The total dollar profit generated. This is the sum of the net profits, reduced by
commissions 228 and slippage 233 , for each trade generated by the system. Note that in
Raw Profit mode, by using a fixed position size for each trade you can more fairly compare
the strategy's performance with that of Buy & Hold.
Even though a system doesn't beat Buy & Hold in terms of net profit, if it has a higher
Profit per Bar we can say that it's more efficient than Buy & Hold. We can exploit this
efficiency by applying more aggressive Position sizing techniques in Portfolio Simulation
Mode to increase actual profit.
where n is the number of annual periods, and, FV and PV represent the future and present
values of an investment, respectively.
The total dollar amount of commissions paid for simulated trade executions.
The total amount of interest earned on free cash during the backtest period. See:
Backtest Settings Preferences 230
Number of Trades
The total number of round-trip trades plus open positions. For Buy & Hold, this will equal
the number of symbols in the DataSet that was selected for the backtest.
Results in this section include interest on unused cash.
Max Consecutive
The maximum number of consecutive winners and losers generated.
Max Drawdown
Max Drawdown is the largest peak to valley dollar decline in the system's Equity Curve.
Wealth-Lab reports Drawdown on a closing price basis.
In Wealth-Lab Pro, the Wealth-Lab Score is calculated by first finding the Annualized Risk
Adjusted Return, which is simply the Annual Percentage Return, or APR, divided by percent
Exposure. For profitable systems, the RAR is adjusted by multiplying the sum of 1 plus the
Max Drawdown Percent (a negative number). Consequently, profitable but risky systems,
which typically have periods with large drawdowns, will have a lower score than an equally
profitable system that assumes less risk. In summary, the formula for Wealth-Lab Score
is:
APR
xRAR
Exposure
where xRAR is the annualized RAR. If xRAR is greater than 0 (profitable) then
For example, with an APR of 8.0, an Exposure of 25%, and a Max Drawdown of -15.0%,
the Wealth-Lab Score is:
( 8.0 / 0.25 ) * ( 1 - 0.15 ) = 32 * 0.85 = 27.20
Taking the same example with an APR of -8.0, we obtain a Wealth-Lab Score as follows:
( -8.0 / 0.25 ) * ( 1 + 0.15 ) = -32 * 1.15 = -36.80
Profit Factor
Profit Factor is the system's Gross Profit divided by Gross Loss. Look for systems that
have a Profit Factor of 2 or higher.
If your strategy has only winning trades and no losing trades, then Profit Factor
is Infinity.
Recovery Factor
Recovery Factor is equal to the absolute value of Net Profit divided by Max Drawdown.
Recovery Factor should typically be larger than 1. A healthy Recovery Factor, especially
one that is greater than that of Buy & Hold, indicates a strategy's ability to overcome a
drawdown.
Payoff Ratio
Payoff Ratio is the system's average percentage profit per trade divided by the average
percentage loss per trade. Unless the system has a particularly high Win/Loss ratio, we
look for high Payoff Ratios.
Buy & Hold See also: Benchmark Buy & Hold 232
14.4.2 By Strategy
The By Strategy Visualizer provides a quick overview of key metrics for each of the child
strategies in a Combination Strategy. The subset of metrics includes:
Strategy Name
Profit
Buy & Hold
Profit Per Bar
Buy & Hold Profit Per Bar
Trades
% Winners
Avg Bars Held
14.4.3 By Symbol
The By Symbol visualizer breaks down a subset of performance statistics for each Symbol
traded during the backtest with side-to-side profit comparisons to the Buy and Hold
strategy. The visualizer is displayed only for Multi-Symbol Backtests or for strategies that
explicitly trade multiple symbols following the use of SetContext.
The following metrics are available and are described in the Performance 212 topic.
Profit 213
Buy & Hold Profit
Profit per Bar 213
B&H per Bar
Trades 214
Pct Winners 214
Avg Bars Held 214
For scaled and compressed DataSeries values to appear, you must manually
add a reference to a synchronized version of their DataSeries to the primary
Bars cache as the following snippet demonstrates.
SetScaleCompressed(30);
DataSeries rsi = RSI.Series(Close, 14);
RestoreScale();
rsi = Synchronize(rsi);
Bars.Cache.Add(rsi.Description, rsi); // extra step
14.4.4 Trades
The Trades View displays a list of all of the trades (Positions) generated by the Strategy
and a set of details and performance metrics for each trade.
Tip:
Sort the list by clicking on a column heading, or double click to zero in on a
particular trade on the chart.
Double-click action
Double click a trade to show it in the Chart view. You can use this action to review
trades in the chart after performing a Multi-Symbol Backtest (MSB) without re-executing
the Strategy on the selected symbol. In this way, trades for the selected symbol are in
the context of the MSB, which may have rejected some trades due to money management
rules in Portfolio Simulation mode. See Multi-Symbol Backtest 119 .
The following metrics are described in the Performance 212 topic and are shown for both
Raw Profit and Portfolio Simulation modes.
Position
Long or Short. The Position column is also flagged with the same Position icons in the
Chart view. The symbols for closed Positions are filled in, while the symbols for open
Positions are hollow.
Symbol
Contains the symbol that the Position was taken in.
Qty
The number of shares or contracts in the Position.
Entry/Exit Date
The dates that the Position was opened and closed. A time will also be displayed for
backtests on DataSets that contain intraday data.
Entry/Exit Price
The price at which the Position was opened and closed.
Profit %
The percentage profit of the trade, less commissions 228 and slippage 233 .
Profit $
The total net profit generated by the trade, less commissions 228 and slippage 233 .
Bars Held
The number of bars that the trade was held.
Both the entry and exit bars count in "Bars Held". For example, a Position
that's exited on the next bar after entry is considered to have been held for 2
bars - instead of 1, like in Wealth-Lab Version 4. The new method gives the
performance report the most pessimistic "profit per bar" rating possible.
MAE %
The Maximum Adverse Excursion percentage of the trade. MAE is the largest intraday
loss that the trade has suffered during its lifetime.
MFE %
The Maximum Favorable Excursion percentage of the trade. MFE measures the highest
Equity curve showing a backtest with $100,000 Starting Capital. The light green area
indicates
the Equity value of Positions and therefore shows the exposure on a historical basis.
Account Equity
Account Equity is portrayed as the solid green area of the graph. Equity changes over
time as trading-system Positions gain or lose value. The Account Equity area itself is
divided into a Cash Position (dark green) and a Market Position (light green). Dividing the
Equity into Cash and Market levels lets you see at a glance the history of your strategy's
market exposure.
Buy & Hold Equity See also: Benchmark Buy & Hold 232
The Buy & Hold Equity is represented as a blue line. The line is calculated by taking equal
dollar-sized Positions in each symbol of the DataSet at the beginning of the simulation
period and holding them until the end of the backtest period. The Strategy Window uses
real-world rules for the Buy & Hold Positions by basing their size on the closing value of
the first bar of data (bar #0) and activating the Position at the opening price of the next
bar. For futures the n Because of this you'll notice that Buy & Hold Exposure is usually
never exactly 100%, but is typically within 1% of 100%, assuming 1:1 margin.
For more information, see Performance > Buy & Hold 216 .
Net profits of the trades are divided into a number of evenly-distributed bins. Each bar on
the graph contains a number of trades whose profit falls within the upper bounds of the
bin. For example, imagine that the bins are spaced apart by 5% each. The bin labeled
10% contains 20 trades. This means that 20 trades had a net profit between 5 and 10%.
Use the right click menu to toggle between Dollar and Percent views.
14.4.7 Drawdown
The Drawdown visualizer presents two different ways of analyzing equity Drawdown.
The depth of the current Drawdown is displayed on a bar by bar basis, covering the
complete period of the historical simulation. You can quickly identify the periods of
deepest and longest Drawdown.
For backtest periods involving a large number of bars, it may not be possible to
display the exact drawdown for each bar due to screen rendering errors. For
exact value of Max Drawdown, refer to the tabular data in the Performance 212
report.
MAE Graph
The MAE graph displays a breakdown for all trades, and another for winning trades only.
Use this in combination with the Profit Distribution 221 to help set appropriate stop loss
levels. The Profit graph will show you the potential losses that could be capped by
setting a stop loss, and the MAE graph will show you how many potential winning trades
would be converted to losers if the stop loss was placed.
MFE Graph
The MFE graph displays two breakdowns also. It shows MFE for all trades, and also for
losing trades only. Use this in combination with the Profit Distribution 221 graph to help
determine effective profit target levels. The Profit graph will tell you how much profit
you're likely to lose by capping it with a profit target. The MFE graph can show you how
many losing trades could have been converted to winners by establishing a profit target at
a certain level.
14.4.9 By Period
The By Period visualizer allows you to see the strategy performance broken down by day,
week, month, quarter, or year. By Period returns are simply the account's equity value on
the last day of the period minus the value on the last day of the previous period.
Consequently, the return value is calculated by the change in the equity curve, not
by the sum of exits in the specified period. As in the Profit Distribution view 221 , you have
the choice of displaying your data in percentage (default) or dollar representations using
the right click menu.
After selecting a period, it could take several seconds for Wealth-Lab to
compile and display By Period returns. For large simulations, be patient.
By Period returns are not available after running a backtest in Raw Profit Mode.
Average Return
The average percentage return for the specified period. For example, if you select
Monthly, the percentage return by month is calculated and its average value is reported
here.
Sharpe Ratio
Sharpe Ratio measures how much of an investment's gains can be attributed to the
trading system and how much to chance. A value above 1 is considered good, and a
value above 2 is typically considered outstanding. Please refer to its description in the
Performance 216 topic.
Best/Worst Return
These values indicate the best and worst returns recorded during the simulation period on
a by-period basis.
Total Periods
The total number of periods (months, years, etc.) used in the analysis.
Profitable Periods
The total number of profitable periods, and the percentage of periods that were profitable,
are reported here.
Max Consecutive
The maximum number of consecutive profitable and unprofitable periods are reported here.
Raw Returns
This graph displays the individual percentage returns on a by-period basis.
Distribution of Returns
This graph displays a distribution of percentage returns on a by-period basis.
Colors
The Heat Map color codes Average Profit % (by symbol in a MSB) or Profit % (by trade for
a single symbol). You can change the Profit and Loss colors by clicking the color picker.
The Color Key is variable and dependent on the range of Profit and Loss values in the
backtest.
Change View
While the color always represents Profit/Loss, the size of the polygon is determined by the
view and type of backtest. The table below indicates what the size of a polygon is
proportional to.
Search Symbol
To find the polygon for a specific symbol in a Multi-Symbol Backtest, enter the symbol and
click Search. Hover the mouse over a polygon for a tooltip popup with the textual
information represented by the size and color.
Use the Analysis Series Visualizer to experiment with indicator filters to find how they
would have affected the performance of your trading strategy. Analysis Series compares
the indicator or series that you select with the net profit of the trades generated by your
strategy. For example, you could see if applying a filter based on RSI or CMO would have
improved the average profit per trade.
You can analyze most all indicator series in a single strategy. It will work in Raw Profit
and Portfolio Simulation mode alike. Analysis Series takes all data series created by your
strategy from the special Bars.Cache property (see note below). This allows you to use
Analysis Series on-the-fly, even with Rule-based strategies.
Analysis Series is not available for (or applicable to) Combination Strategies.
The second graph depicts the average percent profit of the trading system if different
levels of filtering were applied. For example, you might expect that if the system was
filtered by increasingly lower values of RSI then you would see a steady increase in
average profit per trade. Mouse over the histogram bin to see the net profit % value and
the bin threshold. The histogram bin color varies depending on profitability: blue for a
profitable histogram bin value and red for a loss.
Analysis Series
This drop down list contains all of the indicators or custom series created by your
Strategy. Just select one of the items to regenerate the graphs. There will be one
entry for each data series present in Bars.Cache.
Because DataSeries can be generated in runtime, the DataSeries dropdown list
is cleared after re-running the backtest.
rsi = Synchronize(rsi);
Bars.Cache.Add(rsi.Description, rsi); // extra step
Analysis Bar
This specifies at which bar the analysis will take place. You can specify the bar before
entry and the bar of entry. The most useful Analysis Bar is the bar before entry,
because this is typically the bar in which the entry signal was generated. The only
time the actual entry bar might be useful is when your system enters on "AtClose", and
thus has a more or less complete picture of the bar's composition when making the
entry decision.
Filter Type
The Filter Type control determines the type of filter applied in the lower graph. You
can select a greater than or a less than filter. Unless you select some Analysis Bar
and/or Filter Type, the visualizer defaults to "EntryBar-1" and "Greater Than".
The lower graph shows profit on the y-axis, and the x-axis is contains the Analysis
DataSeries values divided into bins. Greater than averages the Profit from trades
whose DataSeries value on the Analysis Bar was greater than the bin value.
Consequently, greater than's leftmost bin contains the average profit from [virtually]
all trade samples, whereas the rightmost bin's average value will contain only a few (or
fewer) samples. Conversely, Less than averages the Profit from trades whose
DataSeries value on the Analysis Bar are less than the bin value, and in this case the
rightmost bin's average is derived from all trade samples.
Percentage/dollar
Ability to toggle to dollar amounts from percentages is helpful when backtesting
futures instruments, where the percentage changes are not as useful as the dollar
changes, especially if the prices go negative. This option can help evaluating results of
a futures system. Because of the different leverage, a 1% move in Sugar can be quite
different from a 1% move in Crude Oil in dollar terms.
14.5 Commissions
Commission preferences allow you to choose and test commission structures that can be
applied to simulated trades.
Wealth-Lab applies commissions to trades after script execution. Trading
commissions are accessible during Performance Visualizer post-processing via
the EntryCommission and ExitCommission properties of the Position object.
Commission Settings
Commission Structures that use custom user-defined settings will display a Commission
Settings hyperlink (image), as for the "Per Share Commission" structure.
Commission Description
Provides a general description of the commission structure.
Test Commission
Commission structures can be based only on the type of trade, number Shares (or
contracts), order type, and the trade's execution price. Calculate a typical commission
by configuring the controls and clicking the Calculate button.
Apply interest rates below when running a backtest using Portfolio Simulation
mode
Enables Portfolio Simulation mode backtests to earn interest on uninvested cash and to
pay interest on margin loans. Enable margin from the Position Size control.
To collect a dividend during a Portfolio Simulation mode backtest, the strategy must own
shares at the close of the day prior to the dividend ex-date 324 . Likewise, if your
simulation is short a stock that pays a dividend, then you pay the dividend, i.e., the
simulated account's cash reserve is reduced by the dividend amount per share.
Dividends are not reflected in the Trades View. In other words, although
dividend payments have an effect on the overall portfolio, they are not
captured on a per-trade basis.
Dividend payments are applied to Buy & Hold results when this option is
selected.
Important!
When using dividend-adjusted data, do not apply dividends using this preference as
the result would overstate the effect of dividends. For example, if the the Yahoo!
Provider's "Perform Dividend Adjustment" option is selected, the effect of dividends is
already accounted for in the data.
Background: When more trade entry signals than cash are available for a particular bar,
Wealth-Lab chooses the Positions with the highest priority for backtests.
Position.Priority is a random number unless you set the priority in the script.
The "worst case" option overrides all Position priorities such that Positions that will have
resulted in the least percentage gain are assigned the highest priorities. The result is
often the most-pessimistic (conservative) Portfolio Simulation possible for the current
backtest settings.
The worst-case option functions on Profit %. A worst-case backtest will result
on a cash Profit basis when using equal dollar sizing for each Position entered
on the same bar.
Benchmark Symbol
As an alternative to the standard Buy & Hold methodology 216 , you can specify a single
benchmark symbol, typically an index or mutual fund, for Buy & Hold comparison. Check
the box to enable the benchmark method and specify the symbol, which may exist in any
DataSet.
Turn off limit/stop order rounding Applies to: Portfolio Simulation mode
entirely
By default, Wealth-Lab adjusts stop and limit trigger prices to a "tick" value not only for
futures, but for stocks too. In some cases, the adjustment will cause a theoretical
(backtest) order to fail that would otherwise have executed at full precision. This option
stops Wealth-Lab from adjusting stop and limit prices to an instrument's tick value, and
therefore will execute the orders at full decimal precision.
Turning off stop/limit order rounding is not recommending for live trading. Order
prices may not conform to order-precision requirements and may result in
rejected orders.
See also: Advanced Options > Decimals 239
Activate Slippage...
Check this box to include the effects of slippage in your system performance results.
Slippage adversely adjusts entry and exit prices for Market, Stop, and AtClose orders by
the slippage amount based on the Percentage Slippage.
Warning! Disable limit-order slippage for Live trading of strategies that use limit
orders to enter positions.
By activating limit order slippage, slippage will be applied to Limit orders as well. In these
cases, slippage doesn't adjust the entry or exit price of the orders (see Exception), but it
does add the additional condition that price must have traded at least to the slippage-
adjusted price. If prices fail to trade to the adjusted price, the Limit order is not
executed. This option makes the probability of limit order execution in backtesting more
realistic because many competing limit orders in actual trading may prevent yours from
being filled. Consequently, you can be more certain that your order would have been filled
if price actually exceeded your limit price.
Exception If the limit price is exceeded on an opening gap, slippage will be applied to
the opening price to obtain a new execution price to the extent allowed by
the bar's range.
Exception Example
Imagine that you're using 0.1% of slippage with a long position, and the market closes
at 24.05. If you enter a limit order to lock in profits 24.50 and the market gaps open
to 25.00, the trade will be executed at the greater of 24.75 (25.00 - (25.00 * 10 *
0.1%)) or the low of the bar.
Usage Notes
Limit Order Slippage is not compatible with zero-range bars, i.e., time-of-sales,
or tick data. Since trade executions are enabled only for bars that achieve the
slippage-adjusted price, and, execution price cannot be outside the bar's
range, aberrations in execution price will result. When backtesting, the
slippage-adjusted price will effectively serve as the limit order price.
For Equities
This specifies how much Slippage to apply to the entry and the exit prices of Equities in
percent terms.
For Futures
For futures, slippage is represented by the tick value of the corresponding contract,
specified in the Symbol Info Manager 310 .
Example
The following example clarifies how Slippage settings modify entry and exit prices with
respect to a long trade.
Round Lots
Round Lot options automatically adjust the sizes of stock Positions created by trading
strategies and alerts to the nearest 100 shares. For example, if a Position were sized as
250 shares, rounding lots would automatically adjust the share size up to 300. Likewise, a
Position sized as 249 shares would be set to 200 shares.
Tip:
The Round Lots options also affect Positions sized by a PosSizer. For the
greatest control over position sizing with PosSizers, disable the Round Lots
option and perform all sizing and rounding in your PosSizer.
14.8 Sounds
Sound preferences control when to play sounds and what sounds are played.
window.
Tip:
When trading a stop or limit-order intraday strategy, you may want to hear
an audible alert, but not for each new bar. For total control over producing
sounds from the Strategy window, use the SoundPlayer in the
System.Media namespace.
namespace WealthLab.Strategies
{
public class MyStrategy : WealthScript
{
protected override void Execute()
{
SMA sma20 = SMA.Series( Close, 20 );
PlotSeries(PricePane, sma20, Color.Blue, WealthLab.LineStyle.Solid, 2 );
PlotStops();
for(int bar = 20; bar < Bars.Count; bar++)
{
if (IsLastPositionActive)
{
Position p = LastPosition;
double ep = p.EntryPrice;
if (!SellAtStop(bar + 1, p, ep * 0.95, "5% StopLoss"))
Other Sounds
Strategy-Dependent Preferences
When saving a strategy, the current configuration of the items listed below are saved in
the strategy's xml file. Items that you check below are recalled and initialized upon
opening the strategy.
DataSet/Symbol
Data Scale
Data Range
Position Size
Parameter Slider Values
These preferences apply to all strategies when selected.
These settings are overridden when opening Strategy Windows a Workspace or launching
a Strategy window from tools such as the Strategy Monitor or Rankings.
Orders-Related
Also, switch to view the Orders window for that Trade's Account
The Orders tool provides a selector for which you can view trades for "All Accounts" or
by a specified account. This option will automatically choose to display trades only for
the account having the most-recent Place or Staged trade.
Printing
final output. If you always print using the default printer's settings, it may be convenient
for you to check this option.
Decimal Places
Configure the number of default decimals places desired for viewing price and indicator
digital information throughout Wealth-Lab. The number of decimals for symbols specified
in the Symbol Info Manager 310 will override the Pricing Decimal default shown here when
Futures Mode is enabled.
For backtesting, Wealth-Lab adjusts prices to a "tick value". For U.S. stock markets, the
tick value is generally thought to be 0.01 (2 decimal places) even though live trades may
be executed at higher precision. To provide more precision for testing stocks that trade
on various world exchanges, Wealth-Lab will use the number of decimal places specified
here for the stock tick value.
Advanced Options > Decimals Places do not apply to symbols that match
expressions in the Symbol Info Manager (SIM), even when Futures Mode is
disabled. In this case Wealth-Lab respects the SIM's Tick and Decimal
settings.
Example 1
An Alert has a BuyAtStop price of 17.0612307245525 at full precision, but when
adjusted to the standard 2-decimal tick value, the order price becomes 17.07. It is
adjusted higher (to ceiling) because BuyAtStop orders should trigger at or above the
trigger price. If the same Alert were adjusted to a 3-decimal tick value, the order
price becomes 17.062.
Example 2
An Alert has a ShortAtStop price of 15.1587692754475 at full precision, and the price
becomes 15.15 at two decimals. It is adjusted lower (to floor) because ShortAtStop
orders should trigger at or below the trigger price. If the same Alert were adjusted to
a 3-decimal tick value, the order price becomes 15.158.
See also: Advanced Options > Price Rounding for Orders 232
14.10 Trading
Trading Preferences determine trade routing and other automated trading behavior for
your Fidelity account.
Important!
Trading Alerts by Strategies using weekly, monthly, or larger scales are placed
as Good Til Canceled (GTC).
Default Account
The Default Account determines the account to which trades are directed by default.
You can specify any one of your Live or Paper accounts as the default account. Log in
to Fidelity to update the list.
Direct Alerts to a predetermined account by associating Strategies to a specific
brokerage or paper accounts. See the Set Account 305 function of the Strategy
Explorer.
Warning!
Do not use the same Windows User login to trade accounts from more than
one Social Security Number (SSN). If necessary, create a separate
Windows login for each SSN, and run Wealth-Lab Pro in a separate Windows
session for each user.
Trading Options
Disable Portfolio Synch
This preference removes the Portfolio Synchronization 186 logic for live and paper trading,
and therefore has the following effects:
Exit alerts will be Auto-Staged/Placed even if a security is not owned in the account.
Size for exit alerts that are Staged/Placed (auto or manual) will not be reduced
automatically when the share quantity is greater than the number of shares owned in
the account.
Likewise, the "Exit Orders" preference (below) will be disabled and will not function.
Fidelity's backend trading subsystem will respond with appropriate errors when exit orders
and/or their size don't match Positions in your account.
It might be advantageous to disable Portfolio Synch if, a) you're experiencing
trouble with Auto-Staging/Placing Alerts, or, b) same-bar exit orders error out.
Exit Orders (Sell and Cover) should always exit the full Position currently held on
a per Trade Type basis
This option overrides the Position size from Strategy exit alerts in favor of the number of
shares actually held by the account. This option will cause Alerts that exit positions to be
sized up to the number of shares of the symbol held in the account associated with the
Strategy in use. If an account association does not exist, then the exit Alert is sized by
number of shares of the symbol in your default account.
Notes:
1. This option does not apply to trades entered by the manual Trade Ticket.
2. If you hold both cash and margin Positions for the same stock, Position shares are
chosen by the exit order's Trade Type, Cash or Margin.
3. As part of the Portfolio Synch 186 functionality, orders are automatically sized down
to the number of shares owned in the account, e.g., if your account owns 50
shares of ABC, any order to exit ABC with more than 50 shares will be sized down
without regard to this option.
Checklist for enabling stop and limit exits on the entry bar:
1. Strategy code requirements:
For a stop loss on the entry bar assign a non-zero value to RiskStopLevel
before generating the BuyAt or ShortAt signal.
For a profit target on the entry bar, assign a non-zero value to AutoProfitLevel
before generating the BuyAt or ShortAt signal.
3. Enable Auto-Trading mode for the Orders tool. If you don't have Auto-Trading
entitlements, you must click "Place" to submit all orders from the Orders queue,
including the same-bar exit orders.
Trading Thresholds
Check one or both options as required to inhibit automated orders from being placed if
your real-time cash or buying power has depleted below levels that you specify. This
option applies to manual and automated orders submitted through the Orders 179 tool.
individually.
Email Properties
Provide the SMTP Host and Port (25 is standard) properties for the SMTP server to use.
Enter one or more Email addresses to receive Alert notifications. Multiple addresses must
be separated by a semicolon (;) or a carriage return (new line).
Authentication Details
Enter your Email account name and password if required for authentication. Check SSL to
use the Secure Socket Layer protocol.
Test Mail
Send Test Mail to ensure that you've configured the settings correctly. If the test
message does not arrive:
Double check the Email Properties and Authentication Details.
Check your Email client's Junk Mail folder and Anti-Spam settings.
Your SMTP server and/or anti-spam filters may filter some messages when
sending dozens (or hundreds) of Email Alerts in a short period of time. If you
plan to use Auto-Email in this manner, please configure accordingly.
15 Extension Manager
Extensions are plug-ins that that extend Wealth-Lab's features and capabilities. Examples
of components that can be added as extensions include price and fundamental data
providers, chart styles, performance visualizers, and strategy and indicator libraries. In
conjunction with Wealth-Lab.com, Wealth-Lab Pro Version 6.9 makes it easy to find,
install, and update extensions. There's no need to visit different sites and keep track of
new releases. If you're searching for a data provider or a new application revision, you'll
be able to install it with just a few clicks. Likewise, you can uninstall extensions that you
don't find useful.
For more details about the Extension Manager and available Extensions,
please visit Extensions at Wealth-Lab.com.
Wealth-Lab Pro's built-in Extension Manager (EM) allows you to install, uninstall, update
and get more information on installed extensions. To access the EM, click Tools > Extension
Manager.
"Fidelity Supported" refers to extensions that, generally, are installed with Wealth-Lab Pro
and can be supported by Fidelity phone support. When showing Fidelity Supported
Extensions third-party extensions are not displayed.
Installs
The Installs category groups Fidelity Supported extensions that are available for
installation. Generally speaking, since Fidelity extensions are installed by default, this
category will contain an item only on rare occasions.
Updates
Reviews all updates currently available for installed extensions.
(Restart Wealth-Lab)
After installing or updating an extension, you must restart Wealth-Lab for the installation
to complete. You can restart using any method, but this handy restart button will close
and re-launch Wealth-Lab in one click. After restarting, be ready to acknowledge a
dialog describing the success of installing or uninstalling extension(s).
(Options)
By enabling Check for Updates on Program Start, the Extension Manager will automatically
determine if updates exist for the extensions that you have installed when you launch
Wealth-Lab (internet connection required).
3. Launch the EM and either: a) use the "Open Extension's *.wle file" link, b) drag and drop
the .wle file on the EM, or c) double click the .wle file. Any method will cause the EM to
download the associated files.
4. Restart Wealth-Lab to complete the installation.
16 Index-Lab®
What is Index-Lab®?
With Index-Lab® you can use to easily create and update your own unique Market Indices
and Aggregate Indicators. Here are some examples of what you can do with Index-
Lab®:
Create a Market Index that tracks the average gain/loss of any group of symbols
that you select.
Create custom Advance/Decline Lines to measure broad market performance, and
create other Market Breadth indicators.
Create Aggregate Indicators, such as the average RSI for all symbols in the Index.
Take action when the Aggregate Indicator reaches oversold or overbought levels.
Capture the breadth of the market with Aggregate Indicators like Tsokakis MACDBull
and Tsokakis MACDBear.
The terms Index-Lab® and Index-Lab® may be used interchangeably in this
guide, although Index-Lab® always refers to the Index-Lab® tool window.
How Does Index-Lab® Work?
Index-Lab® uses Index Definitions which define how to create the Index or Aggregate
Indicator. Index Definitions are compiled components that Wealth-Lab detects at startup.
For more information on how to develop your own library of Index Definitions, see Wealth-
Lab Pro Under the Hood at fidelity.com.
Once your Index Definitions are created, you can assign them to one or more DataSets
using Index-Lab®'s Index Builder view. The assignment determines which Index Definition
is applied to which DataSet. The calculation process begins automatically the first time
that you reference an index or in the Data Manager during a price-only or Custom Index
Provider update.
Index symbols appear in the Data Tree under Index-Lab DataSets, but they
cannot be traded or streamed.
Custom Indexes
This view simply contains a complete list of all indices created along with the Index
Definition used, DataSet, and applicable parameters, if any.
To delete an index, right-click it in the Data Tree and select the Delete option.
Alternatively, you can edit the Data Set in the Data Manager to effectively
delete index(es).
Index Builder
Use the Builder view to begin creating one or more indices by assigning an Index Definition
to DataSet(s). A new index symbol is created for each DataSet that you select.
The Builder view shown above is the first in a series of wizard pages. Simply follow the
Index Definition cues to choose methods, indicators, and/or parameter to customize your
indices. For example, when creating an Aggregate Indicator, you select the indicator and
adjust its parameters on second Builder page.
The final wizard page gives you a chance to choose a name for each custom index.
The final result is added to the index's Bars Custom Indexes Provider Update
object, which therefore contains Open, High,
Low, Close, and Volume series. For most
index definitions derived from indicators,
these DataSeries will be identical. For
others, like the Basic Index, these series will
differ, resembling a synthetic symbol.
Warning!
Index Definitions that operate directly on price, like the Basic Index or
Moving Averages, inherently peek if the constituent symbols have split. A
split is a "future action" that influences prices and volume in the past.
Therefore the historic prices that make up then index today would not be
the same as when traded prior to split actions.
Synchronization
When creating or updating an index, contributions from each of the DataSet symbols are
collected on a bar-by-bar basis and averaged by the number of symbols contributing to a
particular bar. Generally this method will provide a good average measure of the
aggregate, but spikes or irregularities may be observed when a DataSet has only a few
symbols (with widely-varying prices) or perhaps as symbols are introduced to the index
series due to different start (and end) dates.
For best results prior to creating an index, update the target DataSet and run
the "Bad History Data Check" script (or equivalent). Identify and correct/
refresh symbols who have missing or out-of-sequence bars.
Index Updates
In general, Index-Lab® applies updates to indices by checking an index's last date and
then adding bars as required based on updates to its DataSet symbols. Once calculated,
an index's bar value will not change unless the index is refreshed; by a Reload Chart Data
action, for example. Index-Lab® also respects the Data on Demand setting, for example:
If an index is charted and Data on Demand is enabled, then the DataSet symbols are
updated prior to updating and charting the index.
Likewise, referencing an index as a secondary symbol with Data on Demand enabled
can cause the DataSet symbols to be updated before the index.
When Data on Demand is disabled, indices are generally not updated.
Refreshing an Index
To refresh an index's calculation for any reason, open it in a Chart Window and use the
right-click Reload Chart History option. This action has the following effect for index
symbols:
1. deletes the data file for the custom index
2. temporarily turns on on-demand update
3. updates the DataSet on which the custom index depends if required, and,
4. regenerates the Bars for the custom index
C#
protected override void Execute()
{
// Access a custom index
DataSeries index = GetExternalSeries("%EMAPCT_DOW_30", Close);
// smooth it
index = Kalman.Series(index);
// plots
ChartPane iPane = CreatePane(40, true, true);
PlotSeries(iPane, index, Color.Blue, LineStyle.Solid, 2);
PlotSeries(iPane, signal, Color.Red, LineStyle.Solid, 2);
17 Monte Carlo-Lab
What does the Monte Carlo Visualizer do?
Monte Carlo Visualizer (MCV) performs Monte Carlo Analyses on Wealth-Lab historical
simulations. This analyses consist of computing a large number of randomized Runs based
on the original simulation results, providing insight into the trading system's potential in
the future by giving you an idea of the probability of achieving various profit objectives.
What is the largest loss I can expect from the system within a 1 year period?
What is the expected average monthly profit and drawdown of the system?
What is the chance that the system will generate a loss over a specific time frame?
What is my chance of realizing a 20% profit using a 5% of equity position size as
opposed to a fixed $5,000 per trade position size?
access to child strategy allocations. Therefore its use is limited and not
recommended for analyzing Combination Strategies.
Stock/Futures Mode
The Symbol Info Manager 310 preference for Enabling/Disabling Futures Mode is honored for
simulations generated by the Monte Carlo process.
Slippage
Slippage is a function of the baseline Portfolio Simulation, which alters the entry and exit
prices of the trades. The resulting, always more-conservative effect is carried forward to
Monte Carlo runs, which which uses the raw trades from the baseline simulation.
Dividends
Dividends are not applied for MC simulations.
Worst-Case Trades
Since the Worst-Case Trades result in less-than-random outcomes, MCV ignores this user
preference and always execute simulations with Worst-Case Trades set to false.
17.3 Settings
The Monte Carlo Settings (upper left toolbar) control the technique that the MCV uses to
randomize the raw trade data and generate new, simulated historical results. There are
two basic modes of randomization that are available: Equity Curve Scramble and Trade
Randomization.
The Equity Curve scramble works by populating a new equity curve one bar at a time. For
each bar, a random bar of the baseline equity curve is selected, and the bar to bar
percentage return is applied to the randomized equity curve. Equity Curve Scramble
allows returns from the initial equity curve to be re-sampled. If re-sampling were not
allowed all resulting equity curves would have the same Net Profit.
This method effectively captures the dynamics of the historical testing period, including
price shock events, because the effects of multiple positions reacting to events is
captured in the baseline equity curve and translated to the randomized Monte Carlo equity
curves.
The Trade Synthesize > Maintain Date Clustering option is similar to the same
date scramble (see below), but since it mixes trades from different dates the
distribution of those trade returns tend to be more smooth/positive than reality.
Trade Scramble
The first method of Trade Randomization is Trade Scramble. The starting dates of all
of the raw trades are randomized, and a simulation is performed based on the
randomized start dates.
Trade Synthesize
Same as Trade Scramble, above, but the bar by bar returns of each raw trade are
synthesized. Each bar by bar return is synthesized by selecting a random bar by bar
return from the complete list of bar by bar returns for all raw trades.
Allow Trade Return Recycling Applies to: All TR Methods except Trade
Scramble
If enabled, it allows the raw trade's bar by bar returns to be re-sampled during the
process of randomizing the trade's bar by bar returns. This results in an additional
level of randomization.
AutoStop Settings
See Simulation Control 259
Baseline Run
The Baseline Run is the initial non-randomized simulation whose results are given in all
other Visualizer views like Performance, Equity Curve, Drawdown, etc. Since MCV uses all
of the raw trades, not just the ones accepted by the Baseline Run, it's possible to see a
diversity of outcomes not previously captured.
Another reason why the Baseline Run might can have wildly different Net Profit than the
other runs is caused by price shock events. During price shocks, all positions typically
suffer large losses at exactly the same time. These events can be captured more
effectively in MCV by maintaining Date Clustering and Win/Loss Sequence in the Monte
Carlo Settings 257 .
If you have a set of trades that cannot be modeled accurately in MCV using Trade
Randomization mode, switch to Equity Scramble mode. This mode should result in random
runs that contain the same effects of extreme events such as price shocks. On the other
hand, if you want to minimize the influence of extreme effects in your randomized runs you
can use Trade Randomization to effectively accomplish this goal.
Equity Curve
Click on any of the Runs in the list to view its equity curve in the graph below. For Equity
Scramble mode, only the equity level is available, you will not be able to see a cash level.
In Trade Randomization mode you will be able to see both the equity and cash levels,
giving you an idea of the strategy's exposure, just like in the Equity Curve Visualizer.
Below the graph is a small report that displays the average value, median value, and 5%
and 1% extremes. These extremes are the robust measures of the trading system that
you can consider when comparing one system with another.
Drawdown
Toggle the View to show the drawdown analysis graph, which is a distribution of maximum
drawdown % from all of the Monte Carlo simulations runs. Maximum drawdown % is the
largest peak to trough decline in the equity curve of a historical simulation. The
distribution is compiled over the specified Time Span 263 . The distribution displays the
number of runs that have a maximum drawdown % within a specified range.
Below the graph is a small report that displays the average value, median value, and 5%
and 1% extremes, exactly like the corresponding Net Profit Analysis report.
The graph lets you quickly visualize the overall probability dynamic of the system that was
exposed by the Monte Carlo simulation. For example, select a profit target value along
the X-Axis and follow it up to where the curve intersects to Y-Axis to determine the
probability of achieving the profit level. The "break-even" level displayed in the sub-title is
the intersection of the zero profit level and the probability curve. It represents the
chance that the trading system will at least produce a break-even result within the
selected time span.
You can select Weekly, Monthly, Quarterly, or Yearly time frames, or reset the analysis to
use the complete time span of the original historical simulation. Changing time span
causes the analysis views to take multiple samples within the resulting equity curves. For
example, if you run an original 5 year simulation and then select to view Yearly results, the
equity curve of each generated Monte Carlo run will be sampled 5 times to report on profit
and drawdown.
18 Neuro-Lab®
What is Neuro-Lab®?
Neuro-Lab® is a Wealth-Lab Pro Extension for creating and training your own artificial
neural networks (ANN or simply NN) that form the basis of custom indicators. You can add
the NN Indicator to Wealth-Lab Strategies for testing and trading. Use neural networks
alone or in conjunction with traditional indicators and chart patterns to develop powerful
trading systems.
The NN Indicator
Upon installing Neuro-Lab®, a new Neuro-Lab® Indicator folder containing a single
NNIndicator will appear in list of Technical Indicators. The NNIndicator takes two
parameters - a Bars object and the string name of a neural network. For this to be useful,
you must first train one of the sample networks installed with Neuro-Lab® or create and
train a network of your own design. See the Sample Networks 281 topic for typical use of
the NNIndicator in a trading Strategy.
Overtraining
It is very important to avoid overtraining a neural network. Overtraining can occur if the
neural network contains too many hidden layers and neurons compared to the amount of
training data. The neural network can memorize the relationships between input and
output data, instead of generalizing the relationships. In this case, the neural network will
predict the output of the training data flawlessly, but will fail when used on out-of-sample
data.
We've only plotted the indicator for a quick demonstration, but it too can be used like any
other indicator in a Strategy. See Sample Networks 281 .
Does the input data have to be price data, or can it be another type of data like
price-to-earnings ratio, day of week, weather forecast, etc.?
You can use any numerical input data that you like or that you can generate in a script.
In the end, the data are simply a series of floating point numbers that is passed to the
NL.NeuroLab.Input function.
How can I use neural networks created and trained on computer A on computer B?
In the ..\Data\NeuroLab folder, locate the files (.xml and .ann) bearing the network's name
and copy them to the new destination.
Settings
The settings interface lets you define the network's Momentum, Training Rate, and
Jitter.
Momentum controls how much of the previous weight adjustment is applied to the
current weight adjustment during training. It can help the network overcome obstacles
and can improve the smoothness of the learning process. You can modify these rates
during network training.
Training Rate (also known as Learning Rate) should typically be left in the low range -
at least 0.1 but usually not more than 0.3. The value is the multiplier for the current
change in the synapse weight demanded by the training algorithm. For example, if the
current weight is 0.2 (a product of all the training to that point) and training suddenly
demands it to be 0.7, only a portion of the 0.5 delta would be added to 0.2.
Too low a Training Rate will make the network learn very slowly. Too high a
Training Rate will lead to wild fluctuations in the network's weights, and no
learning at all.
Topology
The Topology interface displays the number of Input and Output neurons, which are
defined in the Input and Output Scripts. Here you also control how many hidden layers are
in the network, and how many neurons are in each hidden layer.
The number of input neurons will update automatically when the training set is
applied and the scripts are evaluated.
At least one hidden layer is required for non-linear classification, and since multiple hidden
layers tend to optimize on the in-sample data (overtrain effect), a single hidden layer is
often the best choice for most applications.
As a starting point one NN expert suggests to start with 1 hidden layer and use the
square root of the number of neurons in the input layer (rounding up) for the number of
neurons in the hidden layer. So, if you had 10 inputs, you would start with 4 neurons in 1
hidden layer and experiment from there.
Example
public NL.NeuroLab neuroLab = new NL.NeuroLab();
neuroLab.Input(RSI.Series(Close, 14));
neuroLab.Input(ROC.Series(Close, 21));
}
It is not necessary to scale your input data for the network; Neuro-Lab® does
this automatically.
When the Input Script is ready, click the Check for Errors button to ensure that you
have made no syntax errors or another mistake that would result in an error during
runtime. If the Input Script executes without error, Neuro-Lab® will update the Network
Topology's input layer with the correct number of neurons.
Note that the function of the Input Script is to generate the DataSeries that will be
utilized to train the network and later feed the input. Remember, each series passed as a
parameter to NL.NeuroLab.Input() corresponds to a single neuron (node) on the input
layer of the network. See the Train Network 275 topic for a description and illustration of
how the DataSeries values are fed to the network in random order during network training.
Valid Functions
In general, you should limit Input/Output Script code to use only those functions that are
required to generate data for the indicator and/or network output (see next topic). Other
WealthScript functions that deal with Cosmetic Chart, Position Management, Trading, etc.
are of no use in creating the NN Indicator, and when encountering one of these functions
the I/O Script Editor will highlight them with italics and underline. Example: CreatePane
The example below populates the network training output with the future profit after 5
days. Notice that the Output Script purposely "peeks" into the future to access future
data. Consequently, the loop must end on BarCount - 1 minus the number of bars in the
prediction, otherwise an error will result. When the Output Script is complete, click the
Check for Errors button to ensure that you have made no syntax errors or another mistake
that would result in an error during runtime.
Example
/* This generic Output Script can be use to predict the gain after 5-bars */
using System;
using System.Collections.Generic;
using System.Text;
using WealthLab;
using NL;
namespace WealthLab.Strategies
{
public class MyStrategy : WealthScript
{
public NeuroLab neuroLab = new NeuroLab();
The Output Script is used only to train the network. It provides the truth data with which
the estimates that are created by the final output of the network are compared. The
training process uses the difference between the Output Series and the network
prediction as a basis to adjust the weights of the neural synapses (the lines connecting
the neurons). See the Train Network 275 topic for a description and illustration.
Valid Functions
See Valid functions 269 in the Input Script topic.
Training Period
The Training Period controls allow you to specify the first or the last portion of the data to
use for training, as well as the amount of data. This will allow you to train the network on
one portion of the data, and later evaluate the performance on the out-of-sample data.
You can, for example, train the network with the first 50% of the data, and then evaluate
the performance later on the second half. The valid range is between 1% and 99%,
inclusive.
Important!
The Training Period is [currently] bar-based, not date-based. This is an important
distinction if you select a DataSet that contains symbols with varying date ranges. For
simplicity, assume that your DataSet has two symbols, YHOO and IBM. Selecting 50%
of data for training means that you are selecting 50% of the available data in both
sets. Depending on the data provider, YHOO data could start in 1996, but in 1962 (or
earlier) for IBM. Assuming the year is 2010, the in-sample data for IBM would include
data from 1962 to 1986, but from 1996 to 2003 for YHOO. In other words, you would
be "accidentally" training the network with out-of-sample data with respect to IBM.
What does this mean exactly? When the Training Set is applied every DataSeries from the
Input and Output Scripts are calculated so that a matched set of training data is available
at both the input and output layers of the network. As we'll learn later, these data are
actually applied to the network in a random fashion for each epoch of training.
Consequently, it makes no difference to the network that the data are sequential or
chronological; rather what's important is to condition the network with known inputs and
their corresponding truth data, which are compared to the network's output. Load every N
Bars, then, simply reduces the number of random training patterns that are selected from
the Training Data Set.
Lead Bars
The Lead Bars control should be set to a value based on the indicators or back data used
in the Input or Output Scripts. For example, if you use 5, 10, and 15-period RSIs in your
script, you should set Lead Bars to 45 since it takes an RSI indicator about 3 times its
period to stabilize. Consequently, the first 45 bars of the data set will not be used for
training.
End Bars
End Bars determines how many bars to ignore at the end of the data series for training
purposes. If your network will be trained using data at the end of the data series, End
Bars can be set to the number of bars used in the Output Script prediction so that zero-
value estimates are not fed back into the network during training. For the purpose of the
illustration below, we omitted 2 bars at the end of the training sample, implying that the
output script will predict 2 bars into the future.
Statistics
The statistics view displays statistics on your input data and training output data:
minimum and maximum values, mean and standard deviation.
Training Set
The Training Set table shows the raw training data for both the input and output series.
To filter training data, create a new DataSeries and assign a value of 1 for each bar that
you want to allow training data. Pass the result to the NL.NeuroLab.Filter() method.
This operation must be accomplished in both the Input and Output scripts.
Be sure that your Input Script and Output Script contain the same code that
assigns values to the DataSeries filter. Otherwise Neuro-Lab® cannot properly
align the input and output data.
Example
The example below modifies a Neural Network to illustrate how filtering works. The
filter simply allows only bars that fall on either Thursday or Friday to be included for
training. Notice that the filtering code is identical in both scripts.
Input Script
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using NL;
namespace WealthLab.Strategies
{
public class RFFilterIn : WealthScript
{
public NeuroLab neuroLab = new NeuroLab();
int i = 5;
while (i <= 25)
{
neuroLab.Input( RSI.Series(Close, i) );
neuroLab.Input( CMO.Series(Close, i) );
neuroLab.Input( RSI.Series(dji, i) );
neuroLab.Input( CMO.Series(dji, i) );
i += 5;
}
filter[bar] = 1;
}
neuroLab.Filter(filter);
}
}
}
Output Script
using System;
using System.Collections.Generic;
using WealthLab;
using NL;
namespace WealthLab.Strategies
{
public class RFFilterOut : WealthScript
{
public NeuroLab neuroLab = new NeuroLab();
The error term represents the sum of one half of the square of the difference between the
network's output and the target output for all training patterns on each epoch and then
multiplied by 1000. Since the network links are initialized with a set of random weights, the
error rate will decrease rapidly at first and then more slowly as the network continues to
learn.
Stop Training
Click the Stop Training button to end the training. As soon as you click Stop Training, the
neural network weights are saved and the network is locked. You can resume the training
by clicking the Resume Training button. After you switch
networks, or close and restart Neuro-Lab®, you will lose the opportunity to resume
training. Be sure that you're satisfied with the network training results before switching
networks or exiting Neuro-Lab®.
excessive noise masking your signal (the signal is what you are trying to find, it is
causal).
Unlocking a Network
If you do want to modify any network settings, or make changes to its scripts, you have
to explicitly unlock the network. Click the Unlock Network toolbar button, or select
Unlock Network from the Network menu to unlock the network. If you save changes to a
network after unlocking it, the weighting information from the network training will be lost,
and the network will be saved in an "untrained" state.
In the Evaluate Performance tab, click on a DataSet or a symbol in the tree to select the
data to use to evaluate the network performance. You can select the same data that you
used to train the network, or a different data set. You can also choose to evaluate the
in-sample data, the out-of-sample data, or all data. The in-sample period is the period
that was selected in the Training Data interface. It's always useful to see how well the
network performs on the in-sample period of the same training DataSet, and then see how
it performs on the out-of-sample period of the same data. You want to look for networks
that perform reasonably well on out-of-sample data while considering that results on out-
of-sample data will almost never be as good as the results for the training data.
Performance Results
The performance results table compiles the NN outputs for each bar of the symbols in the
selected data set. The following columns are displayed in the performance results:
NN Indicator
This column contains the values that the neural network produced. The range of
values corresponds with the observations in the same row. Neuro-Lab® indicators
always produce output in the range of 0 to 100. When a network outputs a low value
it is predicting that the output will be close to low end of the output range. Likewise,
when the network outputs a high value, it is predicting that (based on the given
inputs) the output will be in the high end of the range. For example, if the Output
Script is set to predict the net return after 5 days, then the NN Indicator value will be
higher when the NN thinks that there will be a higher profit after 5 days.
Predicted Output
This column contains the predicted Output Value in this indicator range. Compare this
value to the Actual Output to see how well the Network is able to predict the Output.
Observations
This column displays the number of individual observations (bars) of data that were
contained in the NN Indicator range. When interpreting the performance results, make
sure that there are a healthy number of observations in a data row before giving it a
high importance.
Actual Output
This column contains the average actual output of the observations that composed
this range of NN Outputs. When evaluating the network's performance you want to see
a correlation between the higher NN Output Ranges, and higher actual output values.
% of Average
This column displays how much higher or lower the average output of this row is
compared to the Average Output of all Observations, displayed above the grid. A
color-coded bar is displayed next to this column, which provides a visual
representation of how the average output of the row compares to the overall average
output.
As shown here, you want to see red bars at the top and green bars at the bottom,
meaning that the actual NN output is higher than the average output when the NN
predicted output is also higher.
Input Script
The network's Input Script creates RSI indicators of various periods, and calls the
NL.NeuroLab.Input() method for each one. Each call to NL.NeuroLab.Input() creates
a new neuron in the network's input layer.
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using NL;
namespace WealthLab.Strategies
{
public class MyStrategy : WealthScript
{
public NeuroLab neuroLab = new NeuroLab();
Output Script
The Output Script populates a custom DataSeries with the percentage profit 5 bars
ahead. Predicting a future profit should be a very common thing in Neuro-Lab®, and new
networks automatically are preloaded with a version of this Output Script so you can use
this Output Script, perhaps modifying the number of bars that it looks ahead.
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using NL;
namespace WealthLab.Strategies
{
public class BroadMarketOut : WealthScript
{
public NeuroLab neuroLab = new NeuroLab();
18.10.2 Patterns
Basis of this Network
The Patterns neural network is meant as an experiment to see if there is any predictive
power in the pattern of successive open and closed candlesticks in the chart (an open
candle occurs when prices close above their open price, and a closed candle when prices
close below their open price). The network examines the most recent string of candles
and uses the pattern to try to predict whether the following candle will be open or closed.
We will train the network on the first half of data for a single stock (MSFT) and write a
trading system to trade the network signals on the out-of-sample data.
Input Script
The network has 13 inputs, that correspond to the 13 most recent candles. Open candles
are represented as ones, while closed candles as zeroes. So, each training data set will
contain a pattern of 13 zeroes and ones.
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using NL;
namespace WealthLab.Strategies
{
public class PatternsIn : WealthScript
{
public NeuroLab neuroLab = new NeuroLab();
{
// initialize an array of DataSeries
const int hist = 13;
DataSeries[] arPatterns = new DataSeries[hist];
for(int n = 0; n < hist; n++)
{
DataSeries ds = new DataSeries(Bars, n.ToString());
arPatterns[n] = ds;
}
Output Script
The network is trying to predict whether the following candle will be a open or closed. The
training output data assigns a one if the following candle is open, otherwise the default
value of zero remains in the custom Price Series that we create.
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using NL;
namespace WealthLab.Strategies
{
public class PatternsOut : WealthScript
{
public NeuroLab neuroLab = new NeuroLab();
neuroLab.Output(ds);
}
}
}
data series. This example uses the Dow Jones Industrial Average (.DJI) and Nasdaq (.IXIC)
broad index symbols to train the network, as well as the underlying symbol.
Input Script
The Input Script feeds the network the 20 and 40 period RSI (Relative Strength Index)
and ROC (Rate of Change) indicators, as well as the 20 and 40 bar RSI and ROC of the
Dow 30 and Nasdaq indices.
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using System.Windows.Forms;
using NL;
namespace WealthLab.Strategies
{
public class BroadMarketIn : WealthScript
{
public NeuroLab neuroLab = new NeuroLab();
Output Script
The network's Output Script contains the percentage profit after 10 bars.
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using NL;
namespace WealthLab.Strategies
{
public class BroadMarketOut : WealthScript
{
public NeuroLab neuroLab = new NeuroLab();
19 Reference
The image of the Wealth-Lab Workspace in the Orientation topic identifies the main,
commonly-used components of the application, each of which is described in detail in the
following topics.
File Menu
Update Data on Demand
When this option is selected, Wealth-Lab automatically attempts to update price and
volume data as symbols are charted or accessed. This option can also be configured in
the Data Manager's Update Data view. On-Demand Updates never collect or request
fundamental data.
Streaming chart requests ignore the Update Data on Demand selection in
order to automatically update a symbol's static data, the source of a chart's
backfill.
Edit Menu
Set as Default Template Code
Saves the code currently existing in the Editor as a template for "New Strategy from
Code" windows.
The Edit menu is active only when a Strategy Editor is selected and in focus.
View Menu
Hides or Shows the specified dialogs and toolbars.
Tools Menu
With the exception of Orders, each tool in this list can be activated once in every main
Workspace. Most items can be launched from the Navigation bar as well.
Although you can open many main Workspaces, only a single Orders window
can be active. Attempting to launch a second Orders window will automatically
shift focus to the first active Orders tool in an alternate Workspace.
Charts & Strategy and Quotes windows do not exist in the Tools menu by design since
these have special menu controls in the Navigation bar for multiple windows.
Workspaces Menu
Window Menu
This is the Windows-standard menu for applications with a multiple document interface
(MDI).
Tip:
It's easiest to locate a specific Chart or Quotes window among many using
the Navigation bar's 289 Charts & Strategies and Quotes drop down menus.
Help Menu
About Wealth-Lab Pro
Use this selection if you're required to check the software version of Wealth-Lab.
Software Upgrade
Periodically check for upgrades to the main Wealth-Lab application. (Login to Fidelity is
required.). Upgrades and installations for other components, such as data adapters, may
be available separately from Wealth-Lab.com.
Charting mode
With a Chart or Strategy window in focus 325 , the Function Toolbar provides several
charting control options for that window. Different windows have their own set of toolbar
(and Data Panel) options that are recalled for the selected window.
See: Charting > Chart Control > Function Toolbar (Chart Mode) 63
Non-charting mode
When any other window besides a Chart or Strategy window is in focus, only a small
subset of the buttons shown in the previous image is available. This is due to the fact
that most non-charting tools such as Quotes 160 , Orders 179 , and Data Manager 37 contain
integrated toolbars.
New
Selections identical to File | New in the main menu for creating a new DataSet and
launching fresh Chart/Strategy, Workspace, and Quotes windows.
Open Strategy
Launches the Strategy Explorer to open a strategy in a new Strategy window.
Preferences
Launches the Preferences dialog (keyboard shortcut F12).
Tip:
Use Advanced Options in Preferences (F12) to automatically configure the
Data Panel to the settings last-specified when a Strategy is opened.
configuration of the window in focus. Typically, when opening a new Chart window, the
Scale is initialized to the most recent selection (exception: Preferences > Advanced
Options 238 ), which you can change without affecting the other windows.
Method 1
1. As shown in the image above, click the drop down button to the right of the Scale
selection.
2. Choose one of the standard scales or a Custom Intraday Scale at the bottom.
It's not necessary to click "OK" unless you are selecting a Custom Intraday
Scale.
3. Scale selections are "sticky". Once you've changed the scale, clicking other symbols in
the same DataSet will be charted using the last-selected scale.
Method 2
Hover the mouse over the cue in the lower-left corner of the Price Pane to display a
basic scaling menu from which you can use one click
to change the chart scale to Daily, Weekly, Monthly, or any of the n-Minute scales
shown.
Non-Intraday Scales
Tip:
Create Daily DataSets for use with all non-Intraday scales (Weekly,
Monthly, etc.). When a higher time frame (scale) is selected, Wealth-Lab
will quickly scale Daily data appropriately.
Daily
Daily bars consists of all price action on the same date from 12:00:00 AM to 11:59:59
PM.
Weekly
Compresses Daily (preferred) or Intraday price action from Sunday through Saturday,
inclusive, into a single Weekly bar. Weekly bars are date-stamped with the last day
available for the weekly period; normally Friday for U.S. stocks.
Monthly
Same as Weekly, but summarizes all price action for a calendar month in a single bar.
Quarterly
Same as Weekly, but summarizes all price action for a 3-month quarter in a single bar.
Quarters are date-stamped with the date of the last trading day in March (3), June
(6), September (9), and December (12).
Yearly
Same as Weekly, but summarizes all price action for a calendar year in a single bar.
Intraday Scales
Common Intervals
The most common intraday interval selections (1, 5, 10, 15, 30, and 60 minute) are
immediately selected from the control using a single click.
In Wealth-Lab Pro, 60-minute intervals are always compressed from lower time
frames. If you test/trade on an hourly basis, create 30-minute DataSets to
optimize the compression.
It's certainly possible to have a DataSet whose native interval is not a "standard". In this
case, simply selecting the DataSet or a symbol in the Data Tree will cause the backtest's/
chart's scale to use the native scale of the DataSet. However, most custom scales are
derived from compressing data from existing DataSets. For example, selecting a 7-minute
scale would involve the compression of 1-minute bars, whereas a 20-minute scale could
be derived from 10-, 5-, or 1-minute DataSets.
Data scaled from lower to higher intervals (e.g., 1-min to 7-min) is always
relative to the market opening time. For the U.S. stock market, the first 7-
minute bar, for example, will use 1-minute interval data from 09:30 to 09:37,
the next bar from 09:37 to 9:44, and so on.
Multiple Scales
Wealth-Lab Pro allows you to create Strategies that use data from multiple time frames.
It's important to know that "Scale" controls the base scale of the chart, and
consequently, backtests. If a Strategy changes the scale (SetScaleCompressed,
SetScaleDaily, etc.) to create indicators in another time frame, it must return to the
base scale by calling RestoreContext before executing any trading signals. The
aforementioned WealthScript Time Frame functions allow you only to generate indicators
and other Price Series in a more compressed time frame that you must referenced in the
base time frame to accomplish trading.
The Data Range control always displays the current state of the selected option(s) so
that you won't be in doubt of the range of data selected or in use. In the image below,
the Data Range configuration will cause the most-recent five years of data to be loaded
for the selected symbol, or for each symbol in a Multi-Symbol Backtest 326 .
All Data
All data available is loaded. No filtering whatsoever is applied.
Most Recent
This option loads data for the most-recent calendar period selected - years, months,
weeks, or days. Consequently, if 2 years are selected and the system date is 11 June
2008, then all data from 12 June 2006 to 11 June 2008, inclusive, is loaded. If the
symbol does not contain data after 11 June 2006, then no data would be loaded.
Date Range
Choose the Date Range radio button to filter a DataSet by a specific date range. Any
data existing between and including the dates are loaded.
Tip:
When selecting the date using the drop-down feature, quickly choose a
month and year by clicking them at the top of the calendar. Dates are
displayed according to your computer's short date format.
No Data Available
If the selected range of data does not exist in your DataSet, the message "No Data
Available" appears in place of a chart. To correct the condition, carefully check the Data
Range that you specified and/or update the DataSet.
look at your Portfolio equity at the beginning of the day. If this is $98,700, then
simply select and set Raw Profit Fixed Dollar sizing to $9,870. It should be clear that
by repeating this simple task on a daily basis, your live trading results should closely
follow simulated results.
For example, a PosSizer 300 that sizes based on "percent winners" would base the number
of winners on all symbols in the DataSet in a Multi-Symbol Backtest, whereas in the
Strategy Monitor the winners would come only from the symbol currently executing.
In RP mode, the concept of "Starting Capital" does not exist, consequently all trades that
are signaled by the strategy will appear in the results provided that at least 1 share (or
contract) can be purchased using the selected sizing. For example, if you backtest in RP
mode with $5,000 fixed sizing, it would not be possible to purchase even 1 share of a
stock (or index) trading above $5,000 per share.
Fixed Dollar
This option gives each position an equal dollar size. The number of shares is determined
by dividing the position's basis price 322 into the selected amount. We recommend using
this option when testing (or trading) stocks to avoid distorted results that might occur
when using fixed share position sizes.
With Fixed Dollar sizing, you must specify a dollar value that would result in the
purchase of at least 1 share (contract) otherwise the trade will not execute.
For example, if an stock is trading for $625/share, then you must specify a
minimum value of 625 to purchase at least 1 share.
Basis price 322 may be calculated at a higher precision than the price displayed
in an Alert, for example. The higher precision can result in a share size that is
slightly higher or lower than you expect - especially for "penny stocks".
Fixed Share
Each position is assigned the number of shares specified.
For a symbol to use Futures Position Sizing, you must add an entry for it in the Symbol
Info Manager 310 (SIM). If the symbol does not have an entry in the SIM (or if Futures
Mode is disabled) then its size is based on the Stocks Position Size configuration
described above.
Fixed Contract
Analogous to Fixed Share for stocks, each position is assigned the number of contracts
specified.
Starting Capital
The amount of starting capital to use for
the Portfolio Simulation.
Fixed Dollar/Margin
Gives each position an equal dollar
(stocks) or margin (futures) size. This is
the same setting as the one described
above for Raw Profit Only, with the only
difference of being used in a true
simulation environment with starting
capital. This implies that if the simulated
portfolio runs out of cash or equity, the
backtest cannot enter new trades/
positions.
Shares/Contracts
Assigns a specified number of shares
(stocks) or contracts (futures) to a
position. This is the same setting as the When a Portfolio Simulation Mode option is
one described above for Raw Profit Only, selected, the background is green.
with the only difference of being placed
in a portfolio simulation environment with
starting capital. This implies that if the
simulated portfolio runs out of cash or
equity, the simulation will not enter new
trades/positions.
Percent of Equity
Lets you scale position sizes based on changes to the overall portfolio equity level.
Specify the percentage of the total account equity that each position should take.
Account equity is based on cash available plus the value of open positions on the Alert
bar - the bar prior to the trade. Once this value is determined, position sizing proceeds
along the same lines as the Fixed Dollar/Margin options above.
For example, suppose you want each new position to be worth 10% of your account's
equity. If the account equity were $50,000 at the time your script generated an entry
signal, the position size would be $5,000. For a stock trading at $20 per share, this
would translate into 250 shares.
The maximum selectable Percent of Equity is 100% x Margin Factor.
At a position size of $30,000, if our trade stops out at the $72 level, we lose 3%
($3,000) of our total account equity. Note that the trade itself is a 10% loser, ($80 -
$72) / $80 = 10%.
PosSizer FAQs
Q: What can a PosSizer do?
A: PosSizers size Positions - only! Since PosSizers can also size a trade to zero size,
they can in effect reject trades as well.
Q: With multiple trades per bar, in what order does a PosSizer "see" the Positions
that need to be sized?
A: Wealth-Lab always sizes Positions in order of priority, which is random if your
script does not assign Position.Priority.
Margin Factor
Set Margin Factor to a ratio greater than 1:1 to allow a backtest to borrow cash for
new purchases when required. This type of margin does not apply to futures and you
should set it back to 1:1 when simulating futures trading. Contract margin for futures is
set in the Symbol Info Manager.
Wealth-Lab uses a simplified, but reasonable margin model that differs somewhat in
comparison to the Regulation T (Reg. T) rules used by U.S. brokers. It works as follows.
Assume MF represents the Margin Factor. When enabled, the amount of buying power
for new purchases is calculated as follows:
BuyingPower = ( ( MF - 1 ) * Equity ) + Cash,
where Equity is the total Portfolio Equity and Cash is the amount of free cash available
for purchases.
Buy & Hold assumes the risk of full margin and pays the margin loan rate of
interest 230 .
Save Parameters
Saves the current parameter values as the
default setting for the script.
Re-run Backtest
This action replaces Save Parameters if you adjust slider values following a Multi-Symbol
Backtest. In this case, the backtest is not automatic re-run and you must click this
action link or "Go"
Reset
Resets the parameter value(s) to the default setting, which may have been altered by
Save Parameters, and immediately re-executes the backtest.
19.6 Dialogs
19.6.1 Strategy Explorer
(Create/Delete
Folders)
You can reorganize your
Strategies by creating new
or deleting existing ones.
Drag and drop one or more
strategies to move them into
Associate an account to one or more Strategies. new folders. See also:
Map Network Path
You can also use Windows Explorer to add or delete folders and Strategies,
which can be found in the local Data folder. Close Wealth-Lab Pro prior to such
operation with third-party tools.
Import...
Imports Strategies (XML-based only) from another location into the currently-selected
folder.
Download...
Download Strategies from Wealth-Lab.com for a source of new ideas. Strategies are
categorized to keep them organized in the installation folders, although it's possible for
downloads to create new Strategy folders. Downloaded Strategies are displayed using
blue text, and, to quickly identify all downloaded items click Show Downloaded
Strategies in the Search view.
Public Strategies
Check this option to download Strategies from
the public domain, offered freely by the
Wealth-Lab community.
Strategies are validated as "safe"
by Wealth-Lab technicians before
being approved for download.
Private Strategies
Strategies that you upload to Wealth-Lab.com
are marked private by default. Downloading
private strategies requires that you supply
your website credentials.
Delete
Deletes one or more selected Strategies.
Set Account...
If you trade with more than one brokerage or paper account, use this action to associate
one or more selected Strategies with a specific account. An associated account is the
destination for trading signals (Alerts) from the specified Strategy. If a Strategy is not
associated with an account, then the Default Account 240 is used.
Example
The image below demonstrates mapping to a network path P:\Strategies that has two
subfolders Shared and Utilities, each of which contains Strategies for personal use or
collaboration, if shared.
Warning!
Strategies on shared network paths are shared without source control. The version of
the strategy on the network will reflect the last change to a Strategy saved by any
user.
You can readily access the Technical Indicators dialog at any time by
clicking the Indicators button in the Navigation or Function toolbars,
from the Tools menu, a chart's right-click menu, or simply using the
Ctrl+F11 shortcut.
All indicators found in the dialog are available for use in the Strategy
Builder 97 as well as in WealthScript code, which explored in depth in
the WealthScript Language Guide.
To access Technical Indicators in Strategy code, you must
reference the WealthLab.Indicators namespace.
Short descriptions are provided for each indicator, or follow the More
Info... link at the bottom of the dialog for more details.
You can readily access the Fundamental Data dialog at any time by
clicking the Indicators button in the Navigation or Function toolbars,
from the Tools menu, a chart's right-click menu, or simply using the
Ctrl+U shortcut.
All fundamental data items shown in the dialog are available for use in
the Strategy Builder 97 and in WealthScript code, which explored in
more depth in the WealthScript Language Guide.
Short descriptions are provided for each item, or follow the More
Info... link at the bottom to launch the Fundamental Data Guide.
19.6.4 QuickRef
The WealthScript QuickRef (Quick Reference) is a concise guide to the
WealthScript class methods that you use in Strategy code. Each
method shows the proper syntax and a description for its use. Most
entries also contain an example (How to run Example Code 8 ).
The QuickRef is intentionally a partial guide to WealthScript
for use in programming Strategies. Methods that are not
covered by the QuickRef are not supported, and their use
may produce unexpected results.
Tip:
To quickly open the QuickRef to a specific WealthScript object, function,
etc., position the cursor on the word in the Strategy Editor and strike the
F1 key.
Clear
Messages accumulate in the Debug window until you clear them by clicking Clear. It
can be convenient to automatically refresh the Debug window by including a call to
ClearDebug() at the beginning of a script.
Topmost
Keeps this window on top of all other applications in MS Window's "Z-order" so that it is
always in view.
SIM data are stored in the SymbolInfo.xml file located in the main data folder 35 .
Futures Mode
Futures Mode must be enabled to properly work with futures data.
Enabled
Wealth-Lab uses the Point Value, Margin, and Tick values established for each symbol
whose Type is 'Future' for backtesting and trading.
Futures Mode applies only to symbols that are specified to be Type 'Future' in
the SIM. It is recommended to always leave Futures Mode enabled.
Disabled
Symbols whose Type is 'Future' are treated as stocks (equities).
Important!
You can leave Futures Mode enabled always, even when working with
stocks. Futures Mode simply instructs Wealth-Lab to treat all symbols
whose Type is 'Future' as futures symbols. All other symbols are treated as
Stocks except as specified in the SIM.
Disabling the special processing of futures symbols may be necessary only in rare cases
in which a stock symbol matches a futures symbol, or for some other investigative
purpose.
Fields / Properties
Symbol
The Symbol field is entered using RegEx. Don't worry if you're not familiar with RegEx,
you only need to know a few rules in order to create a single symbol expression that
will match all contracts for a futures instrument. The guide and examples below are
sufficient to cover most cases, however RegEx is a large topic; if required use web
resources for more information.
Example
Assume you testing the S&P 500 E-mini contracts. If you didn't use RegEx for the
symbols, you'd need 16 records/symbols for 4 years of contracts, all with the same
specifications. With RegEx, you'll only need 1 record with the following Symbol
expression:
ES[HMUZ]\d
Let's break down this expression:
1. The root of the contract is ES. Since these two letters are required to be
matched, you specify them just as they are.
2. The choices for the third character, the month code, are grouped in brackets. It
means that the character in the third position must match H or M or U or Z.
3. Finally, \d means "digit". It will match any digit character, 0 to 9, which will
correspond to the contract's year.
Therefore, ES[HMUZ]\d matches any of these symbols: ESM1, ESZ0, ESH8, etc. If
your E-mini symbol has a space between the root and the month, then the
expression would change to ES\s[HMUZ]\d, where \s matches a white space.
Special Characters
Legacy users who already have populated their symbols don't necessarily need to
change anything for RegEx compatibility. However, if a symbol contains any of the
following special characters, then it needs to be preceded by the Escape character, \:
\ ^ * . [ ] { } <>| ? +
Escape Character \
The first of the special characters, \, is the "escape character". Its combination with a
letter that follows it has special meaning as a RegEx, just as we saw above with \d
and \s. However, if your futures symbol actually uses a special character, you can
escape it so that it is matched as a literal character. For example, if your data
provider has an e-mini symbol like ES+M1, then the expression for those contracts
would become:
ES\+[HMUZ]\d
Type
Specify Equity, Future, or Mutual Fund.
By default, all symbols are treated as stocks, consequently it is not necessary
to specify equities in the SIM.
Margin
The Margin value determines the amount of cash in dollars required in a trading account to
establish a single contract Futures position. In Portfolio Simulation Mode, Wealth-Lab
uses the margin value to ensure that you don't overextend and take on more Positions
than your current equity level can support.
For example, assume cotton (CT) uses a margin setting of $8,000. If you run a backtest
with Starting Capital = $100,000 and Position Size = 20% of Equity, your first Position in
CT would be for (100,000 * 20%) / 8,000 = 2 contracts. This results in $8,000 * 2 =
$16,000 of capital used for the Position in CT, leaving $84,000 available for additional
Positions.
Point Value
In Wealth-Lab, the Point Value is amount of profit/loss generated by one contract for a
one dollar change in price. For example, assume that you have a long Position in cotton
for 1 contract. Since the Point Value of cotton is $50,000, your Position will gain $50,000
profit for every one dollar increase in the price of cotton. Since cotton currently trades in
the $1 to $2, every 0.01 change in a bushel of cotton is worth $500.
Tick
Sets the tick value, or the minimum price movement of the futures symbol. For example,
at the Tick Value of cotton (0.0001), each tick is worth $5.
Tip:
In Strategy code, use the Bars object's .Margin, .PointValue, and .Tick
properties to access a their corresponding values for a symbol.
Decimals
Sets the number of digits after the decimal when displaying prices for the instrument.
19.9 Keyboard
19.9.1 Shortcuts
In addition to the shortcuts below, you can activate/deactivate the main menu from the
keyboard by striking (then releasing) the Alt key. When activated, the menu items will
contain an underlined letter that you can select on the keyboard to expand the menu.
You can then select the desired function in the menu drop-down list in a similar manner or
by clicking the item with the mouse. Alternatively, after activating the menu with the Alt
key, you can navigate with the arrow keys and press the Enter key to launch the
highlighted item.
To use the keyboard shortcuts, press and hold the Ctrl, Alt, and/or Shift key(s) as
applicable and then strike the desired letter or F-key.
Additional Strategy Editor shortcuts are available. See Editor Shortcuts 319 .
Notice that Ctrl + Shift + Letter items are selections from the File | New menu.
File Menu
Edit Menu
Ctrl + Z Undo
Ctrl + X Cut
Ctrl + C Copy
Ctrl + V Paste
Del Delete
Ctrl + A Select All
Ctrl + F Find
Ctrl + H Find Replace
(none) Set as Default Template Code
View Menu
Tools Menu
Workspaces Menu
Window Menu
(none)
Help Menu
Code snippets
Code snippets allow insertion of frequently-used fragments of code into the editor by
executing code snippet popup window with Ctrl + K, X key sequence (default keyboard
assignment). Code snippets permit you to quickly enter one of the predefined pieces of
text. If some fields are declared in the code snippets, editor allows modifying their values
causing updating field value inside whole snippet. Since snippets are predefined, it's not
currently possible to make additions.
19.10 Glossary
A 321 | B 322 | C 322 | D 323 | E 324 | F 324 | G 325 | H 325 | I 325 | J 325 | K 325 | L 325 | M 326 | N
326 | O 326 | P 326 | Q 327 | R 327 | S 328 | T 329 | U 330 | V 330 | W 331 | X 331 | Y 331 | Z 331
A
Activate Strategy
Activate a Strategy in the Strategy Monitor for Wealth-Lab to automatically execute
a Strategy at the end of the specified interval/scale. While the Strategy Monitor is
open, it automatically runs all Active Strategies to generate trading Alerts.
To activate a Strategy select it and then click the Activate Strategy button. The
icon appears next to the Strategy's name to indicate that it is activated to generate
Alerts as shown in the image.
Example
On 5-minute interval chart's last bar, whose time stamp is 14:05, a Strategy
generates an Alert to Buy 200 shares of INTC at Market. If trading this Strategy, you
should immediately place this order to be executed at the start of the next bar,
whose time stamp will be 14:10 when its interval completes.
Alerts do not refer to any historical or past theoretical trades created by a
Strategy.
Auto-Place
Auto-Place automatically places Alerts as orders with Fidelity. The order's status can
be monitored in the Orders 179 window. The Auto-Stage actions in the Strategy
Monitor, Strategy Window, and Quotes tool become Auto-Place when Auto-Trading is
enabled.
Auto-Trading
When enabled in the Orders 179 window, Auto-Trading automatically places orders with
Fidelity that enter the Orders queue. Enable Auto-Trading will not place orders with a
"Staged" status that already exist in the Orders window.
Special account entitlements are required to enable Auto-Trading. Call
Fidelity Active Trader Support for the latest information.
B Top 321
Backtest
A Backtest uses actual historical data to determine what would have occurred,
theoretically, had you traded a Strategy during a specified test period. In this guide,
backtest and simulation are used interchangeably.
See also: Raw Profit Mode, Portfolio Simulation Mode
Basis Price
Whenever your Strategy generates a buy or short signal, Wealth-Lab must determine
the number of shares for the order. Wealth-Lab uses a Basis Price to determine the
number of shares to buy or short. Basis Price is dependent on the order type as
shown in the table below, where "Signal Bar" refers to the bar on which the order was
signaled, and "Entry Bar" is Signal Bar + 1.
C Top 321
Chart Style
A Chart Style is a visual representation of a symbol's OHLC/V data. Examples: Line
chart, Candlestick chart, Renko chart, etc.
D Top 321
Data Manager
The Data Manager is used to create, update, delete, and otherwise manage price and
fundamental data for static DataSets.
Data Panel
The Data Panel
is the center of
data control for
all Charts and
Strategy
windows. It's
configuration
can be
customized for
each window,
and is recalled
when focus
returns to the
associated
window.
E Top 321
F Top 321
Full Optimization
In a Full Optimization, the entire data range is used to discover the optimum Strategy
parameter(s) based on a selected metric, such as highest Net Profit or lowest
Drawdown, for example
G Top 321
Gap Open
Generally referring to daily data, price is said to "gap open" when the day's opening
price is different (often differing greatly) than the previous day's closing price.
Ghost bar
In a streaming chart, the ghost bar refers to the right-most bar that contains partial
(incomplete) interval data. Since scripts are executed using data from complete bars,
the data in the ghost bar is generally not available for Strategy processing.
Exception: See GetSessionOpen() in the QuickRef (F11).
H Top 321
I Top 321
Indicators (Technical)
Technical indicators are indicators based on price and/or volume data that attempt to
identify repetitive patterns or trends in market data. Generally, technical traders
combine conditions stemming from multiple indicators (perhaps using different time
frames) for trade setups and triggers.
In focus
The window that is currently selected in a Workspace window is said to be "in focus".
Generally, you put the focus on a window by clicking it or by striking Ctrl+Tab to
switch the current window.
J Top 321
K Top 321
L Top 321
Level I
Level I (pronounced "level one") is the last price and current "inside" or "best" quote
for an instrument, i.e., the highest bid and the lowest offer. Wealth-Lab displays
Level I information in the Quotes 160 tool in the form of last price and change from the
previous day's close.
Level II
Level II (pronounced "level two") is a real-time quotes screen that shows bid and ask
depth pricing by Exchange/ECN. Generally, Level II is used by point-and-click traders
for order routing. Wealth-Lab does not use and does not have access to Level II
information.
M Top 321
Multi-Symbol Backtest
Same as backtest, but by selecting the DataSet in the Data Panel, you can run a
"collective" backtest for each symbol. In Portfolio Simulation Mode, the results are
combined to create a real-world Portfolio Simulation with money-management rules.
MAE, MAE%
Maximum Adverse Excursion represents the largest intraday loss that a trade suffered
within its lifetime and can be represented in both dollars and percentage terms. To
see MAE% of trades following a backtest, use Wealth-Lab's MAE/MFE Performance
Visualizer 222 . In WealthScript code, use the MAE and MAEPercent properties of the
Position object to access a closed Position's MAE and MAE%.
MFE, MFE %
Maximum Favorable Excursion represents the largest intraday gain/profit that a trade
achieved within its lifetime and can be represented in both dollars and percentage
terms. To see MFE% of trades following a backtest, use Wealth-Lab's MAE/MFE
Performance Visualizer 222 . In WealthScript code, use the MFE and MFEPercent
properties of the Position object to access a closed Position's MFE and MFE%.
N Top 321
No Data Available
When a symbol or DataSet does not contain any data in the range specified by the
Data Range control in the Data Panel, the message No Data Available is displayed. If
this message is unexpected:
1. Ensure that the Data Range control is configured properly.
2. Update the symbol "on Demand" (if applicable to the data provider), or,
3. Update the symbol's DataSet using the Data Manager.
O Top 321
On-Demand (Update)
You can configure Wealth-Lab to update a symbol's static price data when required,
or "on demand", which is especially useful for viewing charts of ad-hoc symbols. The
advantage is that you don't spend time and resources unnecessarily accessing data
that you do not use. However, strategies that require many DataSet symbols can
probably be updated more efficiently all at once using the Data Manager.
Optimization
See Full Optimization.
P Top 321
Paper Trading
Paper Trading allows you to use most of the same functionality that you use in
Wealth-Lab Pro for real/live trading except that orders are filled in a simulated
environment. Configure Paper accounts in the Accounts tool and use them in the
same was as you would a real trading account. See Orders > Paper Trading 180
Parameters see: Strategy Parameters
Park (Alerts/Orders) see: Stage
Portfolio Simulation Mode
Portfolio Simulation mode enables
a true trading simulation with
money management rules. In
Portfolio Simulation mode, you
define the amount of starting
equity and the position sizing
rules to be used for a backtest.
If several trading signals occur
on the same day (bar) and your
portfolio does not have enough
free cash to enter and or all of
the new trades, then these
trades are rejected.
Position Size
The size of a Position is the quantity of shares or contracts traded. Note that
Wealth-Lab is Position-based. Strategy code creates and operates on Position
[objects], while those Positions are actually sized by the Position Size control 296 .
Price Trigger
Price triggers are stop or limit order prices used to trigger a trade Alert in the Quotes
tool. You can manually add price triggers to a Quotes window.
Q Top 321
R Top 321
S Top 321
Scale
Scale is the measure of time used to summarize the trading activity of a single OHLC
bar of data. Consequently, if each bar in a chart represents the trading activity for
one day, the chart is said to be a "Daily [Scale] chart".
Setup(s)
A setup is an enabling condition for a trade action and are usually expressed as
"greater than/less than" conditions. Setups generally remain in a "true" state for
multiple bars awaiting a triggering condition that actually initiates, or triggers, the
trade action.
When you create and update DataSets, you're creating and updating static data. It's
"static" because it's stored locally on your computer's hard drive for fast access.
Static data are used for backtests as well as for backfill (history) in streaming charts.
Strategy
See: Trading Strategy
Strategy Explorer
The Strategy Explorer is a Windows
Explorer-like interface from which you
can search and select existing
Strategies for charting and/or testing.
Strike the Ctrl+O shortcut to launch
the Strategy Explorer in order to Open
a Chart window that contains an
existing Strategy.
Strategy Monitor
The Strategy Monitor allows you to store one or more Strategies and set up each one
with custom Strategy Parameters, data, scale, and sizing so that you can manage all
Trading Alerts from one location.
Strategy Parameters
Strategy Parameters are values that an author of a scripted Strategy makes available
to be modified by slider controls in the Strategy Parameters frame located at the
bottom of the Data Panel 292 or in the Strategy Activation Settings dialog for the
Strategy Monitor. Upon altering parameter values in a Strategy window, the script is
immediately recalculated so that you can see how the change affects the Strategy
performance results. Note that Strategy Parameters are never applicable to
indicators that have been dragged and dropped.
Strategy Window
A Strategy window is a Chart window that is loaded with a code-based Strategy
(Editor tab) or rules-based Strategy (Rules tab). Strategies can be as simple as a
single-plotted indicator.
Streaming (data)
Streaming involves the process of maintaining a subscription for one or more symbols
with a provider that furnishes data in real-time on a tick-by-tick basis. The ticks are
used by Charting 55 to build bars in real time, or by the Quotes 160 tool to monitor the
last trade price, which is used to trigger trade Alerts.
T Top 321
Template Code
The code template is script that is loaded in the Editor view of a New Strategy
Window. You can think of it as a document template for a memo, for example. You
can change the template by modifying it and selecting Edit > Set as Default Template
Code.
TestAccount
TestAccounts are local accounts to be used for Paper trading. You can add, delete,
and configure PaperAccounts using the Account Balances and Positions tool (Ctrl+Alt
+T).
Tradable Trendline
Tradable Trendlines 71 are manual drawing objects 66 that can generate trading
Alerts.
Trade Ticket
The Trade Ticket (Ctrl+T) allows you to place discretionary trades to the live or paper
account specified in the Account selector.
Trading Strategy
A Trading Strategy is a set of well-defined rules, expressed in the WealthScript
Language code, that determine when to enter and exit trading Positions - generally
based on technical and/or fundamental analysis. You can backtest strategies in
Wealth-Lab just one symbol at a time or over a complete DataSet of symbols in a true
Portfolio Simulation that uses real-world rules.
Trigger Threshold
In the Quotes tool, stop and limit orders trigger Alerts when price has met (100%) or
exceeded the stop or limit price. The trigger threshold allows you to adjust the
percentage for early or late triggering by setting a value less or more than 100%,
respectively.
Trigger (trade)
A trigger is the final condition required to initiate a trading decision. Typically, but not
necessarily, a trigger is an isolated event such as a CrossOver/Under or TurnUp/
Down.
U Top 321
Update
A data update - from the Data Manager or by an on-demand request - accesses the
most-recent data available and saves it to disk. Whenever possible, Wealth-Lab
stores price history data from integrated data providers locally; making it unnecessary
to continually request the same data for backtesting or for streaming chart backfill.
V Top 321
W Top 321
X Top 321
Y Top 321
Z Top 321
19.11 Acronyms
Acronym Description
API Application Programming Interface
ANN Artificial Neural Network
BH (or B&H) Buy and Hold
CAGR Compound Annual Growth Rate
DS DataSet
FO Full Optimization
GICS Global Industry Classification Standard
IS In-sample (Optimization)
MAE Maximum Adverse Excursion
MC Monte Carlo
MCV Monte Carlo Visualizer
MDI Multiple Document Interface
MFE Maximum Favorable Excursion
MS Microsoft
MSB Multi-Symbol Backtest
NN (See ANN)
OCO One cancels other (bracket order)
OHLC/V Open, High, Low, Close, and Volume
O.C. Optimization Control
OM Order Manager or Orders tool
OOS Out-of-sample (Optimization)
PP Paper [Trading] Provider
PV Preferred Values (for Strategy Parameters)
RP Raw Profit
SM Strategy Monitor
SIM Symbol Info Manager
Strap(s) Strategy Parameter(s)
TIF Time in force
TSSN Trading System Subscriber Network
WLE Wealth-Lab Extension
WFO Walk-Forward Optimization
Colors 206
Commissions 228
-P- Decimal display 239
Printing 238
Paper Accounts
Round Lots 233
Configure 202
Slippage 233
Paper Trading
Sounds 236
Features Not Supported 180
Streaming Data 210
How Orders Are Filled 180
How To 180 Preferred Values 136
Set PVs from Sliders 304
Overview 180
Strategy Rankings 158
Purpose 180
Quotes 161 Price Triggers
add 162
Parameter sliders
Strategy Builder 99 Print
Strategy Code 111
Parameters
Strategy Rankings 159
Create 304
Expose 304 Printing
Preferences 238
Parse Error 41
Priority (Position) 125
Partial Fill 198
Process
Percent, Losers 214
Stock Split 60
Percent, Winners 214
Profit 213
Performance Visualizers 211
Profit, Net 213
Place 184
Profit, per Bar 213
Plot
Fundamental data 92 Push
Dropped Indicators into Code 63
Indicators 86
MACD 87 PV 136
Point and Figure (Chart Style) 84
Polygon (drawing) 68
Portfolio Simulation Mode
-Q-
when to use 116 Quarantine 50
Portfolio Simulation Mode (sizing) 299 QuickRef (WealthScript) 309
Portfolio Synch 198 Quotes
Portfolio Synchronization 186 add 162
PortfolioSynch 186 Employing 168
Position Paper Trading 161
Priority 125 Providers 160
Position Size Workspace 160
100% of Equity 127 Quotes for Paper Trading 162
Control 296
Position Sizing
Monte Carlo Visualizer 255 -R-
tips for trading 296
Random
PosSizers 300 Position Priority 125
Preferences 205
Rankings 157
Advanced 238
Raw Profit Mode
Backtest Settings 230
when to use 116
Chart Annotations 209