DEEP LEARNING PRICE ACTION LAB
Home Manual Purchase Demo Support Blog Contact

Contents

Introduction

   An Introduction to DLPAL S

   Using DLPAL S

   An introduction to price action strategies

   Software capabilities and  limitations

   Data format and sources

   Data Conversion FAQs

   Reporting problems

Discovering Strategies with DLPAL

   Program FAQ

   Tips for quick start

   Creating a T/S file

   Creating a search workspace

   Running a search

P-indicator Calculations

Program Results

   Search workspace results

   Interpreting search results

   Database results

   Code results

   System Tracking results

Backtesting, Out of Sample Testing and Robustness Analysis

   Back-testing Strategies

   Test Strategies

   Robustness Analysis

Generating Code

   EasyLanguage code generation

   Quantopian code generation

   NinjaTrader code generation

   Amibroker code generation

Building Trading Systems

   Adding systems to System Tracking

   System Tracking reports

   Viewing Trading Systems

   Generating  System Open Positions

Converting Data

   EOD Data Conversion

   Metastock Multiple Conversions

   Intraday Data Conversion

File Maintenance,Test and Creation

   File Maintenance

   Data File Test

   Data Partition

Tools

   Win Rate Calculator

   Position Size Calculator

   Price Series Statistics

   Random Trading Simulation

Tips for Advanced Users

   Searching for  Strategies Across Multiple Instruments

   Creating workspaces for multiple searches

   Creating trading systems using grouping methods

   Using multiple trading signals effectively

   Using Trade Input Delay

   Reducing Data-mining Bias

Disclaimer Information

   Disclaimer

References

   References

Contact Information

   Contact information

Copyright Notices

   Copyright notices






An Introduction to DLPAL S


Deep Learning Price Action Lab S (DLPAL S ) Manual

Introduction

Deep Learning Price Action Lab (DLPAL) identifies strategies in historical price data that fulfill user-defined performance statistics and risk/reward parameters. The program uses primitive attributes of price action, and specifically the open, high, low and close, to extract features types in an unsupervised learning mode based on general feature clusters. Then, the program uses the extracted features in supervised learning mode to identify strategies and systems of strategies that fulfill the user objectives. This procedure is outlined below:



DLPAL  is used to search for strategies in historical data of any timeframe. The strategies can be grouped into systems. The program can generate strategy and system code for a number of popular trading platforms. For the daily timeframe, the system tracking module of the program can be used to monitor signal generation of the strategies and systems going forward in time and as new data are available. DLPAL is  a meta-system that discovers trading systems.

Deep Learning Price Action Lab generates code for strategies and systems for the Quantopian platform, Tradestation (EasyLanguage), Multicharts (EasyLanguage), NinjaTrader 7 and Amibroker AFL..

Development and upgrade history

DLPAL S was based on DLPAL that in turn was based on a program originally developed by Michael Harris in 2010. The most important changes in DLPAL were an optimization of the deep learning algorithm, the addition of a progress monitor that can warn the user if program execution must be aborted, among other things and a change in terminology to comply with advances in quantitative trading and machine learning. DLPAL S is a reduced version of DLPAL that allows generating unlimited strategies based on parameter-less price action features, also called price patterns in technical analysis.

DLPAL S v1.0 Released May 1, 2017.

DLPAL S v2.0 released  June 19, 2017

- Search algo improvement
- Different tabs to show equity and trades
  in backtesting and Test Strategies
- Improved Test Files tool


Top




Using DLPAL S


Using DLPAL

Below is a diagram of the general use of DLPAL



The training and testing step uses the data and parameters provided by the user to identify strategies and systems of strategies. The program generates code for the strategies and systems internally and for use with popular trading platforms.

The next step involves the validation of the output to minimize data-mining bias for the purpose of in turn minimizing the probability of a Type-I error (false discovery). This bias arises from various sources but primarily from over-fitting, selection bias and data-snooping bias.

Out-of-sample tests are not very effective in reducing Type-I error due to the multiple comparisons in machine learning processes. Multiple comparisons involve testing a large number of features and rejecting those that fail to contribute to performance while keeping those that improve performance. This process has selection bias and data-snooping bias if the out-of-sample is used repeatedly to evaluate new results. In addition, when many features are involved in the development of strategies and systems, there is always danger of overfitting to noise.

Although DLPAL provides tools the user can use to validate results out-of-sample, it is recommended instead to use the out-of-sample in the train and testing phase and validate the results using data from a portfolio of comparable securities.

If out-of-sample tests are desirable, Robustness tests on out-of-sample performance may be used to evaluate the significance of the results. DLPAL provides tools for Robustness analysis of the identified strategies.

It should be clear from the above diagram that validation is a user task. Validation is both an art and a science. Any claims that validation can be accomplished in automated mode are motivated by a lack of understanding of the complexity of this process. As a result, DLPAL does not may any claims of identifying "final strategies" for use in trading. This is a task of the user. DLPAL provides the machine learning and analysis tools only to generate candidate strategies for validation by the user. Part of a trading edge comes from a robust process of identifying anomalies in price series and part comes from the trader ability to validate the results. 


Top




An introduction to price action strategies


An introduction to price action strategies

Definition: A price action strategy involves a proper combination of price action features that are based on price action primitive attributes (O,H,L,C) in a given lookback period. Below is an example of a combination of features for a 3-bar lookback period.


       Figure 1.

There are three consecutive bars labeled 0, 1 and 2 in figure 1. The most recent bar in the formation, bar 0, is also called "today". Bar 1 is called "yesterday" and bar 2 is called "2 days ago", and so on.

Each bar has Open, High, Low and Close price. In the example above, it is easy to see that the close of the last bar, or close of today, is higher than the high of bar 2, or the high of 2 days ago. This may be expressed as:

Close of today > High of 2 days ago

Using the same reasoning one may notice that:

Close of 2 days ago > High of yesterday

If the same reasoning is followed, a complete description of the price action formation shown above is obtained:

High of today > Close of today AND
High of 2 days ago > Close of 2 days ago AND
Open of today > Low of today AND
Close of today > High of 2 days ago AND
High of yesterday > Open of yesterday AND
Low of today > Open of 2 days ago AND
Open of 2 days ago > Low of 2 days ago AND
Close of yesterday > Low of yesterday AND
Open of yesterday > Open of today AND
Close of 2 days ago > High of yesterday AND
Low of 2 days ago > Close of yesterday

The set of the eleven inequalities are the price action features and define a price action formation shown above apart from any ambiguity. Using this description of the formation in Figure 1 it is possible to test for occurrences price action data. In fact, any price action formation made of three consecutive price bars is a candidate before a matching is made. If any of the inequalities in the set is not satisfied, then there is no match.

The price action features that define the formation in Figure 1 can be combined with appropriate risk management, trade entry point, trading time frame and market selection to create a strategy. Here is an example:

Time frame: daily, Market: XYZ Stock
If High of today > Close of today AND
High of 2 days ago > Close of 2 days ago AND
Open of today > Low of today AND
Close of today > High of 2 days ago AND
High of yesterday > Open of yesterday AND
Low of today > Open of 2 days ago AND
Open of 2 days ago > Low of 2 days ago AND
Close of yesterday > Low of yesterday AND
Open of yesterday > Open of today AND
Close of 2 days ago > High of yesterday AND
Low of 2 days ago > Close of yesterday then
Buy tomorrow on the open 1 contract with profit target at the entry price + 2% and stop-loss at the entry price - 2%

With the concept just illustrated, price action can be modeled using he primitive attributes O,H,L,C and features extracted from them can be coded, tested and used to generate trading signals.

Note: when intraday data is used, "days" correspond to "bars", "yesterday" corresponds to "1 bar ago", "today" corresponds to "this bar" and "tomorrow' corresponds to "next bar".

Strategies With Trade Input Delay

Definition:  The number of bars that should be skipped before placing a trade after a price action formation is called the Delay and the associated strategy a Delay Strategy.


                       Figure 2.

In figure 2 above, bars 3,4 and 5 define the price action formation and bars 2 and 1 are the delay. The trade is placed at the open of bar 0. This is exactly the same price action formation as with the one shown in figure 1 above, delayed by 2 bars. In figure 1, the trade input is the open of next day (not shown), which corresponds to bar 2 in figure 2. Adding a delay of 2 bars, produces a signal at the open of bar 0. 

The new description of the price action formation with the delay added is then:

High of 3 day ago > Close of 3 days ago AND
High of 5 days ago > Close of 5 days ago AND
Open of 3 days ago > Low of 3 days ago AND
Close of 3 days ago > High of 5 days ago AND
High of 4 days ago > Open of 4 days ago AND
Low of 3 days ago > Open of 5 days ago AND
Open of 5 days ago > Low of 5 days ago AND
Close of 4 days ago > Low of 4 days ago AND
Open of 4 days ago > Open of 3 days ago AND
Close of 5 days ago > High of 4 days ago AND
Low of 5 days ago > Close of 4 days ago


In certain situations, the addition of a delay can turn a losing trade into a winning one. In the example in figure 2, if the trade were to be placed immediately following the price action formation (bars 3, 4 and 5) and at the open of the next bar (bar 2), it would turn into a open position loss by the close of bar 1, even hitting a stop-loss, depending on the price levels. Placing the trade at the open of bar 0, instead of bar 3, filters out the price correction and results in a better (lower) price for the long signal. Of course, the opposite could happen, i.e., the price could increase resulting in a worse (higher) price for a long position signal at the time the trade is executed. Therefore, any application of delay trade input must be done carefully and after a detailed analysis of the parameters involved. In the case of strategies with delayed input, DLPAL determines the best value of the delay.


Top




Software capabilities and  limitations


Software capabilities

The search function can be used to discover strategies in historical daily or intraday data that fulfill user-defined performance statistics and risk/reward parameters. The strategies can be grouped in any way the user desires and in the case of daily data they can be added to the system tracking module of the program for monitoring signal generation as new data are added. Alternatively, the program can generate code for several popular trading platforms so that the strategies can be implemented there. When the search function is used, DLPAL serves as a meta-system that discovers trading systems automatically.

Below are some of the capabilities of the search function:

Discover strategies in historical daily or intraday data that fulfill user-defined performance statistics and risk/reward parameters. This is the primary use of the program.
Discover strategies in historical daily or intraday data that fulfill user-defined performance statistics and risk/reward parameters and are in addition profitable across several other securities.
Identify in which markets there are short-term trading opportunities by noting the number of short-term strategies the program generates.
Determine best profit target and stop-loss levels for particular markets by running a search with multiple parameters.
Determine best timeframe to trade by running different searches in different timeframes.
Use code generation to implement systems in various platforms and the raw code generation option to generate a file to be used as input machine learning algos.
Perform a portfolio backtest to identify robust strategies.
Identify mean-reverting strategies. Instead of finding robust strategies that maintain their profitability, one may identify high win rate strategies with a tendency to degrade.

Software limitations

Like any software developed, DLPAL has limitations:

- The program can read only ASCII text files.
- File names, excluding the path and the .txt extension, must be less than 26 characters.
- The back-testing algorithm calculates a limited number of performance parameters.
- The system tracking function does not keep a log of the trading signals generated.

We are working on some of the above limitations as improvements for future versions. If you have any suggestions for any additions or enhancements to the program you may contact us using the appropriate e-mail address listed in our website: http://www.priceactionlab.com



Top




Data format and sources


Data format specifications

DLPAL can read ASCII files with .txt (also .asc extensions can be specified in conversion routines). The data must be in ascending order so that the first line in the file has the oldest date.

Important: File names, excluding the path and the .txt extension, must be less than 26 characters.

The data fields can be single-spaced, comma or semicolon delimited and have the following order:

Date Open High Low Close

with the date in  YYYYMMDD format (example, 20020415). In the case of intraday data, an 8-digit increasing integer index must be used in the place of the Date field [example: index starts at 10000001] and no time field is allowed.

The following is part of a valid daily data file with single space delimited fields:

20020927 30.69 30.72 25.25 26.63
20020928 26.38 30.25 25.59 29.88
20020929 29.19 29.63 27.63 27.94
20021002 28 28.19 25.03 25.25
20021003 25.88 26.13 23 23.25
20021004 22.88 24.81 21.81 24.31
20021005 23.88 24.38 20.38 21.5
20021006 20.94 22.5 18.3 20.81

The following is part of a valid daily data file with comma delimited fields:

20050321,434.50,434.60,429.20,431.40
20050322,431.00,432.80,430.80,431.60
20050323,425.00,428.40,424.50,425.40
20050324,425.50,426.50,424.30,424.80
20050328,425.00,426.20,423.40,426.00
20050329,426.50,426.60,425.90,426.00
20050330,426.20,428.00,426.00,426.90
20050331,430.30,431.40,429.70,431.10
20050401,429.70,431.50,427.10,428.30

The following is part of a valid intraday data file with each line showing the open, high, low and close of a time period (5, 15, 30 minutes, etc.). The time field is not included in the file when converting intraday data to this format:

10002824 1338.00 1338.00 1338.00 1338.00              
10002825 1338.00 1338.50 1338.00 1338.50              
10002826 1338.50 1339.00 1338.50 1339.00              
10002827 1338.50 1338.50 1338.50 1338.50              
10002828 1338.50 1338.75 1338.50 1338.75              
10002829 1338.25 1338.25 1338.25 1338.25              
10002830 1338.50 1338.50 1338.50 1338.50

The following is part of a valid daily data file with semicolondelimited fields:

20050211;37.03;37.85;36.93;37.7
20050214;37.7;37.94;37.69;37.87
20050215;37.9;38.48;37.82;38.12
20050216;38.03;38.16;37.83;37.98
20050217;38.05;38.14;37.43;37.47
20050218;37.48;37.57;37.26;37.35
20050222;37.03;37.55;36.79;36.89
20050223;37.04;37.07;36.7;36.94
20050224;36.85;37.44;36.76;37.41

Using tick data with the gold add-on

The data fields can be single-spaced, comma or semicolon delimited and have the following order:

Index Last Last Last Last

Index is an 8-digit integer in the place of the Date field [example: index starts at 10000001] and no time field is allowed. You may convert tick data with a date and time stamp in the following format

Date Time Last Last Last Last

to the required format (Index Last Last Last Last) with the use of the Intraday File Creation tool of the program.

Note! DLPAL can search for strategies in tick data with a length from 7 to 9 bars maximum but depending on volume of data the search speed may be too slow. In general, the program developer does not recommend use of the program with tick data and also with very short timeframes of less than 5 minutes.

Data conversion tools

Three tools for converting daily and intraday ASCII text files between popular formats are provided in the Tools option of the main menu



Sample data files are included in the program setup. You may use a simple text editor such as Wordpad to open those files and view the format.

There are several data vendors that offer software with the capability of downloading and automatically updating data files in the format required by DLPAL. For more information and a list of data vendors look at the support section of our website or contact us. URL: http://www.priceactionlab.com

Note: At least 10 years of daily data or 10,000 bars of intraday data is recommended for discovering statistically significant strategies. The more data that is available, the better it is in principle because the power of statistical tests increases.

A rule of thumb for determining the minimum number of bars for intraday data search is the following:

Nbars = 2,000 x Np

where Np is the number of bars in the intraday time frame. For example, in the case of hourly US stock data Np = 6.5 and hence Nbars = 13,000.

In the case of hourly Forex data, Np = 24 resulting in Nbars =48,000

Besides the number of bars a file should contain so that statistical significance is achieved, the minimum number of trades for the search should be adjusted to reflect the impact of the timeframe chosen. A rule of thumb is as follows:

Ntrades = 20 x Np

where Np is the number of bars in the intraday time frame. For example, in the case of hourly US stock data Np = 6.5 and hence Ntrades = 130

In addition, one should make sure that in the selected time period in the historical data file there are significant up and down trends so that a good mix of long and short strategies can be identified. These are empirical guidelines and better rules can be determined through experience.


Top




Data Conversion FAQs


Data Conversion FAQ

Can I use Tradestation data with DLPAL?

There are 2 steps involved in converting daily or intraday Tradestation data to files that can be used with DLPAL:

Step 1: Generate a text file from Tradestation

Tradestation historical data can be saved in a .txt file using the following command sequence: View, data window, show all, save
For daily data files you can also use the following function:  print( file( "C:.txt" ), dateformat( "YYYYMMDD", ""), ",", O, ",", H, ",", L, ",", C);
For intraday data files you can also use the following function:  print( file( "C:.txt" ), dateformat( "YYYYMMDD", ""), ",", time, ",", O, ",", H, ",", L, ",", C );
where directory is a directory on your C: drive to save the file and filename the name of the file.

Step 2: If a conversion is required (often applies only to intraday data), use the appropriate conversion routine from Tools menu to generate a file compatible with DLPAL: 

- Open the saved file from Step 1 in Notepad and DELETE any header if present. A header is a line with the names of the fields in the file. There should be only data in the file and nothing at the start or end of it, including any blank lines. Also make a note of the particular format of the file, like the date format and what type of delimiter is used.

The following steps apply to intraday data and daily data that include a TIME field:

-From the main program menu select Tools and then Intraday File Creation.
-Select the source file saved in Step 1 and specify the correct file format. UNCHECK the option "Metastock Compatible" if CHECKED.
-Hit Convert and select a new directory to save the new file generated by DLPAL (or you can use the same directory with a different file name) and then click Save to complete the conversion.

The following steps apply to daily data only (saved data from Tradestation that do NOT include a Time field):

- From the main program menu select Tools and then Data file Conversion.
- Select the source file saved in Step 1 and specify the correct file settings.  Make sure you UNCHECK "Metastock Compatible".
- In the target file settings leave the default DLPAL format and hit Convert. Select a new directory to store the file (or you can use the same directory with a different file name) and click Save to complete the conversion.

For Tradestation 5 or earlier version:

For daily data:

Step 1: Create a text file using TS data server by outputting the fields DATE, OPEN, HIGH, CLOSE, LOW. Then, use your editor, for example, Wordpad, to determine the exact format of the file generated by TS and remove any data header if present.

Step 2: Convert the TS text file to DLPAL format using the conversion Tools. 

- From the main program menu select Tools and then Data file Conversion.
- Select the source file and specify the correct file settings.
- In the target file settings leave the default DLPAL format and hit Convert. Select a new directory to save the converted file (or the same directory with a different file name) and click Save to complete the conversion.

For intraday data:

Step 1: Use the TS data server to generate an ASCII intraday text file with the option to output the following fields only: Date, time, open, high, low, close. Then, remove the file header using your editor (the first line in the file with the field names) and then use the Intraday File Creation option from the Tools menu to convert that to an intraday file. In that case, the date will be replaced by an increasing integer number and the time will be omitted.

Step 2: Convert the TS text file to DLPAL format using the conversion Tools. 

- From the main program menu select Tools and then Intraday File Creation.
- Select the source file and specify the correct file settings (mm/dd/yyyy and comma).
- Hit Convert and select a new directory to save the converted file (or the same directory with a different file name) and click Save to complete the conversion.

In both cases above, daily or intraday data, there should be no header in the data file ( The first line of the file is often a header that defines the content of the fields in the records that follow.)

Does DLPAL have an interface to eSignal data?

There is no direct interface directly to eSignal but there is a small program Qcollector that converts eSignal data to DLPAL compatible format. You can use that with both daily and intraday data. To download a demo please visit: www (dot) mechtrading (dot) dom

For daily data:

In the options of Q-Collector specify to output the fields Date, Open, High, Low, Close. The fields can be either comma or single space delimited and for the date use the format YYYYMMDD. The output file can be used by DLPAL directly.

For intraday data.

In the options of Q-Collector specify to output the fields Date, Time, Open, High, Low, Close. The fields can be either comma or single space delimited and for the date use the format YYYYMMDD. The time field must have the format hh:mm. The output file cannot be used by DLPAL directly. You must use the Intraday File Creation tool from Tools menu to convert the file to DLPAL intraday format. In both cases above, daily or intraday data, there should be no header in the data file ( The first line of the file is often a header that defines the content of the fields in the records that follow. QCollector gives you the option of whether or not to include an ASCII header in your data files.)

What are the steps for converting data from excel to DLPAL format?

There are two steps involved in using data from excel.

Step 1: Format the date column and then save the file in text format. Make sure the text file has no header line.  In excel, right click on the date column name and then select Format Cells. While at the Number tab, select Custom and then m/d/yyyy. Click OK and the date column cells should be displayed in the right format. Then, select Save as from the File menu and save the file after selecting Text (Tab Delimited) in the drop down Save as type menu. Next, open the file in Notepad and make sure there is no header line present. If there is one delete it and save the file. Make sure no empty lines are present at the top or bottom of the file.
Step 2: Convert the text file to DLPAL format using the conversion Tools from the main menu:

For daily data the procedure is as follows:

- From the main DLPAL menu select Tools and then Data file Conversion.
- Select as the source file the file saved in the previous step. For Source files Setting mark mm/dd/yyyy as the date format and Comma as the separator (Tab is treated as a comma by the conversion tool). Make sure that Metastock compatible box is NOT checked. In the Target File Settings leave the default DLPAL Compatible format and hit Convert. Select a new the directory to save the converted file and click Save to complete the conversion. You may use Windows Explorer to create a new directory.

For intraday files that include a TIME field the procedure is:

- From the main DLPAL menu select Tools and then Intraday File Creation.
- Select the source file and specify the correct file settings (mm/dd/yyyy and comma). Make sure that Metastock compatible box is NOT checked.
- Hit Convert and select a new directory to save the converted file (or the same directory with a different file name) and click Save to complete the conversion.

Can I use data from NinjaTrader with DLPAL?

Data can be exported from NinjaTrader as follows:

(1)  Click Tools, select Historical data and then click Export.
(2)  Select the Instrument to export historical data for and the Data series starting and ending date
(3)  Click OK and then select the data directory and file name
(4)  Click Save to export the historical data

Daily data

DLPAL can read directly the ASCII text format used by NinjaTrader to export historical daily data.

Intraday data

With intraday data export, NinjaTrader does not place a delimiter after the date. Data are exported in the following form (see the NinjaTrader manual under "export"):

20061023 004400;1377.25;1377.25;1377.25;1377.25;86
20061023 004500;1377.25;1377.25;1377.25;1377.25;27
20061023 004600;1377.25;1377.25;1377.25;1377.25;24
20061023 004700;1377.50;1377.50;1377.25;1377.25;82

Note that there is no delimiter after the date.

There are at least two ways of converting the data to a format that can be then converted to DLPAL intraday file:

1. Use a script to output the data in text file in a format that can be converted to DLPAL format. Output the date, time, open, high, low, close separated by a comma. Then use the Intraday File Creation tool from the DLPAL main menu to convert the file to DLPAL format.

2. Use Wordpad and Search and Replace (recommended for quick conversion)

Export a .txt file from NinjaTrader and then open it in Wordpad. Input commas in the space after the date on each line by using Edit-Replace. Just input a space in "Find what" (hit spacebar once) and then input , in "Replace with". After you replace the blank space after the date with a comma on each line, replace all ; with , using the same method.  Then, convert the file using the Intraday File Creation tool for DLPAL main menu.

You can use the text files generated by NinjaTrader  in DLPAL to search for strategies.

Can I use data from MetaTrader with DLPAL?

You can use the ascii text files exported from MetaTrader to search for strategies with DLPAL but you must first delete the header line, save the file in .txt format and then convert it to DLPAL compatible format. Note that both daily and intraday data exported from MetaTrader are converted by DLPAL as intraday data but that makes no difference to the search. The complete steps to export data from MetaTrader and convert it to DLPAL format are outlined below:

Step1: Data export from MetaTrader:

(1)  Click Tools and then select History Center or hit the F2 key
(2)  Double-click on the instrument to export historical data for and then select the periodicity (for example EURUSD - M5)
(3)  Click Export,  select ASCII Text (*.prn)  in the Save as type field  and specify the target directory and file name
(4)  Click Save to export the historical data

Step 2: Delete header and change the file extension from .prn to .txt. In detail:

(1)  Run Notepad
(2)  Open the MetaTrader text file you saved. Make sure you select All Files as the File or type
(3)  Delete the header line and then make sure there are no empty lines at the beginning or at the end of file.
(4)  Click Edit and then Select All.  Right click mouse and select copy.
(5)  Click File and then New. Select No to ignore changes.
(6)  Right click mouse and select Paste. Warning: make sure there are no blank lines at the start or end of file. If any, delete them.
(7)  Click File and select Save as to save the file. Type in a file name and click Save.

Step 3: Convert the historical data format to DLPAL format

(1)   From the main DLPAL menu select Tools and then Intraday File Creation.
(2)   Select as the source file the file saved  in Step 2 and specify the correct file settings (yyyymmdd and comma)
(3)   Hit Convert and select a new directory to save the file (or the same directory with a different file name) and click Save to complete the conversion.

Now you can use the newly created  text file in DLPAL to search for daily or intraday strategies. Note: Daily data files exported from MetaTrader include a default Time field so they must be converted using the same procedure as with intraday data files.

How to check for errors in data files?

DLPAL has a tool for checking data files for errors, like open and close values outside the High-Low range and spikes. For more details look for "Data File Test", under the Tools section of the program manual.

Does daily data use result in misleading backtesting results?

This is how, in principle, the back-testing algorithm of DLPAL works. At every bar the program checks if there is an open position. The loop goes as follows:

For current bar:

If open long position then

If open of this bar < stop price then
exit at the open
go to next bar
else
If low < stop price then
exit position at stop price
go to next bar
else
if high > target price then
exit position at profit target price
go to next bar

else

if open short position then

If open of this bar > stop price then
exit at the open
go to next bar
else
if high > stop price then
exit position at stop price
go to next bar
else
if low < target price then
exit position at profit target price
go to next bar

go to next bar

The program checks for the stop-loss before it does for the profit target and this produces the most conservative results since one cannot know whether the low or the high of the day occurred first intraday

Should I avoid dividend-adjusted data?

Yes, because they distort price series. Only split-adjusted data should be used.

Can I use point stops with stocks?

Point stops with stock data should not be used when splits in the stock price have been accounted for.

What is the recommended number of bars for the in-sample?

A rule of thumb for determining the minimum number of bars for intraday strategy search is the following: Nbars = 2000 x Np

where Np is the number of bars in the intraday time frame. For example, in the case of hourly US stock data Np = 6.5 and hence Nbars = 19,500.

In the case of hourly Forex data, Np = 24 resulting in Nbars =72,000

Tick data use is not recommended since the Open, High, Low and Close have the same value. Also, it is unlikely that tick data strategies can have any statistical significance at all.

How could the use of non-continuous futures data affect DLPAL?

If continuous data cannot be used for some reason and if the rollover changes are small, the performance of a strategy will only be affected if it has a trade open when the rollovers occur. For a trading system with a sufficient large number of strategies, the average error due to rollover will be close to zero because some trades will gain and some will lose. The problem arises only with individual strategies with a small number of trades.

How to deal with negative values in continuous futures?

Some continuous futures contracts include negative values that arise from the rollover adjustments. Negative values should not be used with DLPAL. A simple way of adjusting this type of contracts for use with DLPAL if via an upward shift that involves adding a positive value to all price fields that is equal to the largest negative value. However, when such method is used the profit target and stop-loss must be always expressed in points and not as a percentage of price because in the latter case the performance results will be misleading as percentages of adjusted data do not equate to percentages of unadjusted data. To see this consider a profit target of T% of the entry price P which equates to a target of PxT/100. If P is shifted upwards by an amount equal to s then the new profit target is at (P+s)xT/100 and it is now different. When T is in points, the profit target price is still equal to T when data is adjusted by s and thus the backtest results are invariant under a simple data shift in conjunction with point exits and in the case of future contracts that have a fixed tick value. If a data shift is not desired for some reason, the part of the data file that involves negative values can be removed if it occurs in the far past.

How can I update my data files and where can I save them?

Data for DLPAL can be saved as a text file in the proper format in any directory on the hard drive. The data files included with the program are just examples. Normally a script or some type of program is required to download data from a vendor and update files in the directories on the hard drive. There are many ways of generating data for DLPAL because the data format it uses is simple and easy to define and handle.


Top




Reporting problems


Reporting problems

To report any problems with the software e-mail technical support. For the proper e-mail address to use check our website:

http://www.priceactionlab.com

Include your name, user name and date of purchase with your e-mail. in Case the website is not operational use:

priceactionlab@gmail.com

Suggestions for improvements or additions to the software are always welcome.





Top




Program FAQ


General

Is DLPAL a neural net program?

DLPAL is not a neural net program. It uses a deep learning algorithm for supervised and unsupervised learning developed by Michael Harris.

If everyone uses DLPAL will that affect the strategy performance?

There are so many different markets, so many different strategies and so many different ways traders can approach strategy development  (in terms of profit targets, stop-loss, profitability, risk management, etc.) that makes this question a philosophical one rather than practical. Of course, trading very liquid markets reduces the risk of being part of a hypothetical "herd" using the same system.

Are the strategies discovered by DLPAL particular to a certain market?

Although with DLPAL you can discover strategies particular to a certain stock or futures contract, it turns out that many of those strategies work for a group of stocks or even future contracts. DLPAL can discover strategies that are common to a large universe of securities.

Are the strategies found by DLPAL preprogrammed in a database?

There are no hard coded strategies in DLPAL. Instead, DLPAL uses deep learning principles guided by major cluster types. DLPAL does not look for traditional chart strategies but for price action strategies. Some of the strategies the program finds may look similar to traditional chart formations.  Strategies have up to 9 price bars lookback period. That does not include the delay bars. The program finds strategies dynamically as it goes through a data file of historical prices and they are specific to the data used although it may turn out that some of the strategies work for a group of securities.

Can DLPAL consider volume or other indicators in the search for strategies?

DLPAL discovers price strategies that fulfill user-defined risk/reward and performance criteria. The strategies do not consider volume information, only the open, high, low and close of price bars. There is a way of modifying the input data to identify volume strategies.

How do I go about developing advanced systems based on DLPAL strategies?

Many sophisticated users of DLPAL do not rely on signals from individual strategies but instead develop systems based on the concepts described in the "Tips for Advanced Users" section of the help file.

For example, some users require that two or more strategies generate signals at the same time. Some others consider as signals those that come one or two bars after another signal. There are all sorts of ways and methods to try to increase the probability of success of individual strategy formations.

Can I use DLPAL with intraday or tick data?

Finding statistically significant strategies in very fast timeframes, for example 1 - 10 minute bars may turn out to be hard or even impossible due to the presence of noise and the demand for large samples.  There are also several parameters that can affect the performance of strategies in out-of-sample backtesting or actual trading, including the target/stop ratio and short-term volatility. 

It is unlikely that tick data strategies can have only statistical significance at all.

What is out-of-sample/forward testing and how to do it in DLPAL?

Testing in out-of-sample or a forward test is a method used for validation machine learning results. It involves splitting the historical data file into two or more parts, usually two. The first part is called the in-sample, which is used to search for strategies. It is usually 2/3 of the original data file. The second part is called the out-of-sample, the remaining 1/3 of the data file. DLPAL offers a tool for generating in-sample and out-of-sample data files from individual files or from or groups of files.  The Tool is found is called Sample File Creation under Tools. The in-sample is used with a search workspace to find strategies that satisfy the performance criteria specified on the search workspace. When the results are generated, the out-of-sample is used with the "Test Strategies" tool to analyze performance.

What is the best way of generating signals from the search results?

As soon as you have done a validation test and you have decided to use specific strategies from the search results, you have a few choices.

Choice A. If the strategies are from daily data, you can mark the strategies you want to use and add a system to System Tracking. Then, you need to update the data files EOD and run System Tracking.

Choice B. If the strategies are from intraday data and/or you want to you another platform anyway, in Tradestation for example, you can generate the code for the strategies you want. In this case, you may keep each strategy as a separate system, especially when the profit-target and stop-loss values are different. If the exits are the same, a simple way is by combining the conditions using OR, separately for long and short strategies. Make sure you set the target and stop values in the strategy code to proper values.

For example:

Strategy 1: if c[4] > h[2]  AND  c[3] > l[2]   AND h[2] > c[3]  AND c[0] > c[1] AND l[2] > c[0]  then begin
Strategy 2: if h[0] > h[4]   AND h[2] > l[3]  AND l[3] AND h[4] > h[2] > l[1]  AND l[1] > l[5] then begin

Combination using OR:

if (c[4] > h[2]  AND  c[3] > l[2]   AND h[2] > c[3]  AND c[0] > c[1] AND l[2] > c[0]) OR (h[0] > h[4]   AND h[2] > l[3]  AND l[3] AND h[4] > h[2] > l[1]  AND l[1] > l[5]) then begin

The parentheses were used to enclose each condition. Note that the program also generates a text file with raw code you can use with strategy builder in TS to automate this process. The raw code generation applies only to the Search and Database results. Two files with identical content are saved automatically in sub-directory "...Results" after you generate EL code from search results:

(1) A file called GeneratedCode.txt which is overwritten each time new code is generated.

(2) A file saved as : RawCode_mm_dd_yyyy_hh_mm.txt

This last file is overwritten only if new code generation takes place during the same minute mm that the file was initially generated. You can edit this file using a regular editor like Notepad, add what you wish to it and use it in TS. You may also add other indicators and systems to filter out and/or confirm signals.

What is the recommended way of running multiple instances of DLPAL?

The recommended way of running multiple instances of the open/lifetime license is to create multiple installations of the program in different directories, such as in: C:Priceactionalb1, C:PriceActionLab2, C:PriceActionLab3, etc. One important restriction is that each instance of the program when it runs must NOT share data files from the same directory with any other instance.

Important note: The multiple instances were designed to run workspaces that are created and saved only after the instance is loaded. This is because in some Windows systems the relevant directory is only shown under "Create New Workspace. All other options use the last directory stored in the Registry. If you start a new instance and select "Open Existing Workspace", the directory shown depending on your system configuration may be the one of the last saved workspace and its corresponding instance, not of the current instance. You can however get around this by selecting the MyWork sub-directory of the particular instance. If you do not know in which directory the instance is located, you can just select Create New Workspace and you will see the relevant directory. You can then exit and select open workspace, go to the relevant directory and select the workspace you want. In addition, when you save the workspace you must make sure it is saved in the relevant directory because in some system the directory of the last instance will apply.

Alternatively, there is a way to simplify the process as follows: You can create a common directory for all instances to save the workspaces, like "C:DLPALWRK" and another common directory to save all results, like "C:DLPALRES"

After installing a new instance you can create the workspace you like and save it in the common directory, by the name WRKn, for example, where n is the instance number. Then, after running each instance, you can open the workspace from the common directory.

The above takes some initial work but the time is negligible compared to the time saved running the multiple instances. It has also the advantage of aggregating workspaces in one place.

What is the difference between Test Strategies, Back-test, Back-Test Portfolio and Portfolio Backtest?

1. Test Strategies: This function calculates the performance of all strategies in the results on a data sample that has the same file name as the one shown in the results and it can be used for out-of-sample testing. Selection from results is ignored.
2. Back-test (right mouse click): back-tests single strategies from the search or system tracking results.
3. Back-test Portfolio (right mouse click): This function calculates the performance of single strategies on a portfolio of symbols.
4. Portfolio Backtest: This tool calculates the performance of each of the strategy in the search esults on a portfolio of symbols. It is equivalent to applying #3 for all strategies without the performance details.

Hint: Option #3  above will generate the same results as #1 if the portfolio contains only one symbol that is the same as that in the results

DLPAL cannot find the file when I try to use the Backtest or Test Strategies tools

The name of the file used with the back-test or Test Strategies tools must be identical to that shown on the results workspace. Otherwise the program will generate an error message that the file was not found. The same error message is generated if the file name, excluding the path and the .txt extension, is greater than 26 characters. Important: Always double-click on a directory to select it. Only the directory structure is shown, not the files.

How to implement DLPAL strategies and systems in NinjaTrader?

As soon as you find a system you like in DLPAL using the historical data you export from NinjaTrader (NT), you can generate code for the strategies in NT script and then you can implement a system with the extra code you desire (with money management, position sizing, etc). Then this system generates the orders through the broker you use with NT when the signals are generated.

What are "common strategies" and what is their objective?

Common are defined in DLPAL as strategies in one instrument that satisfy the criteria set on the workspace for that instrument and also show positive performance in all other instruments using the risk/reward parameters of the original instrument. The objective of applying the original instrument risk/reward criteria to all other instruments is to determine whether a given strategy with given profit target and stop-loss is profitable (at least marginally) in another comparable security. If the original profit target and stop-loss were to be changed it could raise curve-fitting issues. In effect this is a method of validation but it does not guarantee positive forward performance but only reduces the chances of curve-fitting or random strategies. Specifically, in the case of a 2% profit target and stop-loss in SPY and a strategy with profit factor 1.8, one should not expect to get the same performance in QQQ but it would be nice to have a profit factor at least greater than 1. This does not directly imply the strategy will work in forward testing but the idea is that a random, or curve-fitted one, will not. Note that the common strategy test is a very conservative validation method.

Why DLPAL does not have an option for exits based on ATR?

According to the system development philosophy of DLPAL any exit that "adapts" to market conditions may produce fitted systems. Specifically, by adjusting exits to adapt to short-term volatility, which is what ATR accomplishes, the entry part of a system tends to become less significant. By selecting exits that fit any signals to the data random systems may be developed. Instead, the philosophy of DLPAL is that signals should perform well for small constant exit thresholds and if a security shows strictly increasing volatility as a function of time then it should not be used for creating automated systems not because it cannot be traded but because adapting to the volatility during the design phase will create fitted systems. Fortunately, most popular securities and markets exhibit volatility cycles. The profit-target and stop-loss can be calculated as the average of actual changes or percentage:

daily changes: abs(close - close of n bars ago)                                         percentage changes: 100 x abs[(close/close of n bars ago )-1]

where abs stands for the absolute value and n is set to the expected average trade duration, which must be less or equal to maximum strategy length of 9 bars in DLPAL. It has been determined in the finance literature than memory in price series is slowly lost after 4 to 5 bars and as a result any type of exits that close positions after many bars may contribute to the creation of fitted systems.

Can DLPAL use multiple CPU cores in parallel?

DLPAL is not a multithreaded application because a substantial investment is required for rewriting the code to use multiple cores in an effective way and not in some pseudo manner done by other applications. With that price would have to increase beyond levels that the average trader can afford. However, we offer an alternative solution for those users that have already determined that DLPAL suits their needs in the form of an upgrade that allows multiple instances to run on the same machine.

Why I do not get any search results in intraday or daily data?

There are several reasons for not getting any results. Below are a few recommendations:

(1) The markets and timeframes tried may have become too efficient for the parameters specified, including the target and stop levels. Usually futures and forex markets, especially in intraday timeframes, provide very few tradable strategies.
(2) The stop-loss must be set outside the 1-bar volatility range. Stops are checked immediately before profit targets to produce conservative backtests and if the stop-loss is too low no significant strategies will be found.
(3) Test Sample size setting:  For daily data the default of 500 bars should be good enough but for intraday data values greater than 1,000 are appropriate depending on timeframe.
(4) Properly back-adjusted continuous data for futures contracts must be used.
(5) Appropriate values for the profit-target and stop-loss must be used. In the case of futures point values should be used in the T/S file. More details can be found under "A short note on using targets and stops" in "Creating a T/S File" in the program manual.
(6) Workspaces must be created by first selecting the exit type and then creating a search line? It is always a good idea to check the search lines to see if the proper parameters are selected before running the workspace.

Workspace FAQ

How to determine the minimum % profitable for long and short?

The formula for the minimum profitability P is:  P = 100/(1+ Rwl)

where Rwl is the ratio of average winner to average loser and for fixed dollar size trades it can be approximated by the ratio of profit target to stop loss. P is the ratio of winning trades to total trades times 100.

To account for slippage, commissions and other things it is better to use the following adjusted formula: P > 100/(1+ 0.6*Rwl)

Example 1: for profit target to stop-loss ratio of 2:1 the minimum P is 33%. The recommended value is: P > 45%
Example 2: for profit target to stop-loss ratio of 1:1 the minimum P is 50%. The recommended value is: P > 62.5%

For a desired profit factor PF value, the above formula becomes:

P = (100xPF)/(PF+Rwl)

One can solve the above formula for the minimum profit factor required as a function of profitability P and ratio of avg. win to avg. loss Rwl:

PF = (P x Rwl) / (100 - P)

DLPAL includes a Profitability Calculator in the Tools of the main menu. The calculator can be used to get an estimate of the minimum profitability P to use on a search workspace when an estimate of Rwl is available along with the desired profit factor.

How to select the proper profit target and stop-loss values?

DLPAL discovers strategies formed by market price action, not some strategies one would like to see formed. Profit targets and stop-loss levels should be set at reasonable levels and outside of the daily or intraday volatility range. If the exits are set too low, then stops are hit very frequently and the program cannot find profitable strategies.  It takes some parameter adjusting to get to the point of identifying strategies successfully. That's exactly the reason the DLPAL program was developed as a development tool.
It is best to first try setting exits with a ratio of profit target to stop-loss of one. In the same T/S file you may include smaller and higher ratios and notice the results. For example, in the case of T-Bond futures, you may set the profit target and stop-loss both equal to 1.00 ($1,000 per contract) but also include the pairs (1.5 , 1) and (1, 0.5). This is easily done in the same T/S file. In the case of stocks, you may want to try sets like (2%, 2%), (3%, 2%) and (5%, 3%) for example. When the search completes, you may select those strategies that better reflect your trading style.

In the case where points are used instead of percentage, for long positions, a constant number is added to the entry price to determine the profit target exit price and a constant number is subtracted from the entry price to determine the stop-loss exit price.

Case 1: The entries in the T/S file are determined based on a number of ticks:

The formula in this case for the calculation of the correct entries in the T/S file is:  T/S = (number of ticks x tick value) / Full point value

Examples: In the case of bond futures a full point is $1000, the tick value is $31.25 and  for 3 ticks target and stop the formula gives T/S = (3 x 31.25)/1000 = 0.09375. If the stop must be set to 4 ticks then the value to input in the T/S file is: S = (4 x 31.25)/1000 = 0.1250

In the case of the ES mini, a full point is $50, the tick value is $12.50 and for 5 ticks target and stop the formula gives T//S = (5 x 12.50)/50 = 1.25.

Case 2: The entries in the T/S are determined based on a fixed dollar amount

The formula in this case is: T/S = (profit or loss)/(full point value)

If in the ES mini case the target/stop is $62.50 then the formula gives:  T/S = 62.5/50 = 1.25. For the bond futures for $250 target and $125 stop the formula gives: T = 250/1000 = 0.25 and S = 125/1000 = 0.125.

The formulas in both cases (1) and (2) assume that the prices used correspond to the full point values definition, i.e. that an increment of 1.00 in the price corresponds to a full point.

What does the option "Test Sample Size" mean?

DLPAL uses the Test Sample to validate strategies. The default setting is 500 bars. Changing this parameter impacts the time taken to complete the search.  A minimum of 250 bars is recommended for daily bars. Note that this parameter is not related to the back-testing range used during the search, which considers the full available price history.

Are commissions and slippage included in the search for price strategies?

Commissions and slippage are not included in the search for price strategies since the program deals only with strategy formations and their number of occurrences rather than with equity performance, which is something that depends on many factors some controllable and some random. If the profit factor is sufficiently high (see the help file section on the Profitability Calculator), the impact of commissions and slippage on profitability is minimal. Note that the strategies will form whether or not commission or slippage is considered. These parameters have more to do with the equity performance of the strategies rather than with their presence in historical data. DLPAL can generate code for popular backtesting platforms and you can test the performance of the price strategies with commission and slippage added. When backtesting single strategies and systems of strategies in DLPAL you can specify commission per share/contract, big point value and initial capital.


Top




Tips for quick start


Tips for quick start

In order to use DLPAL to search for strategies you need to specify the following on a search workspace:

1. A data file of the price history to use in the search for strategies. The file must have appropriate format and length.

2. The minimum performance of the strategies and risk/reward objectives to apply.

The software setup includes sample historical daily and intraday data files in compatible format. These files are located in the DATA subdirectory of the program.

Sample search workspaces are also included in the MYWORK subdirectory. You may open the workspaces and view the parameters specified in them. Results are also included. in RESULTS subdirectory.

The following two steps are required in order to run a search: for strategies

1.    Create a T/S file

This file contains the profit target and stop-loss values to be applied to the search. Each line in a T/S file corresponds to a pair of profit target and stop-loss values used in the back-testing of strategies for determining historical performance. The values in a T/S file may stand for percentages of the entry price or points added to the entry price and the choice between the two options is made on the search workspace.  Sample files can be found in the TRS subdirectory.

2  Create a search workspace

In the workspace you specify the T/S file to use, the historical data file and the trade parameters and performance constraints. Note: If the option to search for common strategies is selected, all data files on the workspace must have the same point value in the case point stops are used.

When creating a search, workspace you may introduce multiple search lines each with different data file(s), T/S file and parameters.

Note: The best way to become familiar with a program is by actually working with it. There are many ways to use DLPAL depending on user's experience.


Top




Creating a T/S file


Creating a T/S file

To Open an existing T/S file

Click T/S Files from the main menu and then click Open. Select the file from the list and click Open



To create a new T/S file

Click T/S Files and then click Create.



In the input fields under Target and Stop you may type the desired profit target and stop-loss values. The numbers inputted represent absolute values and correspond to percentages of the entry price or points added to the entry price. Note that all values in a specific T/S file must be used as the same type, percentages or points. Mixing is not allowed.

You may input up to 10 sets of profit target T and stop-loss S values. DLPAL will use each set separately when evaluating the historical performance of the strategies and systems.

When pts (points) is selected for Exit in Trade parameters then the profit target and stop-loss price are calculated as follows:

For long positions:

Profit target price = Entry price + T
Stop-loss price = Entryprice - S

For short positions:

Profit target price = Entry price - T
Stop-loss price = Entryprice + S

When % (percent) is selected for Exit in Trade parameters then the profit target and stop-loss price are calculated as follows:

For long positions:

Profit target price = Entry price x (1+T/100)
Stop-loss price = Entryprice  x (1 - S/100)

For short positions:

Profit target price = Entry price x (1-T/100)
Stop-loss price = Entryprice x (1+S/100)

When NC (next close) is selected for Exit in Trade parameters then the exit price is calculated as follows:

For long or short positions:

Exit price = close of the day following the price action formation

Saving a T/S file

The T/S file created can be saved by Clicking File and then Save As. Convenient names to denote the contents of the T/S files are recommended. For instance, a file containing the value 7 for the target and stop can be named as "7" and shown by the program as "7.trs".

A short note on using targets and stops

The use of points added to the entry price for profit target and stop-loss values deserves some attention. In the case of stocks, the use of point stops is straightforward. However, use of percentages, as opposed to points is recommended in the case of stocks. Point stops are often used in conjunction with futures contracts. The appropriate values to select depend on the position of the decimal point in the ASCII data used with the program. For example, in the case of the Euro currency CME futures contract, a full point increment for profit target and stop-loss should be typed in as "1" if the data have the format of a two digit decimal (ex. 84.47 to mean 0.8447 cents per Euro). If the data has no decimal point, (ex. 8447 to mean 0.8447 USD per Euro) then 100 is the appropriate increment for a full point profit target and stop-loss. Some programs that export ASCII text files may even use a full decimal number for the particular contract example. (.8447, i.e. 0.8447 cents per Euro). In this last case, 0.01 is the appropriate value to use for a full point profit target and stop-loss. In general, it is recommended to check the ASCII data file values used before creating the T/S files. You may use an editor such as Wordpad to inspect the contents of data files in order to determine the correct values to use in T/S files.

Case 1: The entries in the T/S file are determined based on a number of ticks:

The formula in this case for the calculation of the correct entries in the T/S file is:  T/S = (number of ticks x tick value) / Full point value

Examples: In the case of Bond futures a full point is $1000, the tick value is $31.25 and  for 3 ticks target and stop the formula gives T/S = (3 x 31.25)/1000 = 0.09375. If the stop must be set to 4 ticks then the value to input in the T/S file is: S = (4 x 31.25)/1000 = 0.1250

In the case of the E-mini, a  full point is $50, the tick value is $12.50 and  for 5 ticks target and stop the formula gives T//S = (5 x 12.50)/50 = 1.25.

Case 2: The entries in the T/S are determined based on a fixed dollar amount

The formula in this case is: T/S = (profit or loss)/(full point value)

If in the ES mini case the target/stop is $62.50 then the formula gives:  T/S = 62.5/50 = 1.25. For the bond futures for $250 target and $125 stop the formula gives: T = 250/1000 = 0.25 and S = 125/1000 = 0.125.

The formulas in both (1) and (2) assume that the prices used correspond to the full point values definition, i.e. that an increment of 1.00 in the price corresponds to a full point.

Using multiple profit target/stop-loss pairs

T/S files with multiple entries for the profit target/stop-loss values can be created and saved. The program will identify the strategies that satisfy the performance parameters specified by the user for each pair in the T/S file. This may be useful in determining the sensitivity of strategies and systems to various profit target/stop-loss values. Alternatively, one may create and save different T/S files with a single pair of values and multiple search lines to accomplish the same task.


Top




Creating a search workspace


Creating a search workspace

To open an existing search workspace or create a new one

Click File and then click Search Workspace. Select Open Existing Workspace and then click OK. Select a file and then click Open.



To Create a new workspace

Click File, then click Search Workspace, select Create New Workspace and click OK.  Then, click on the first empty search line to start the process of parameter selection.



The following must be specified on the workspace for each separate search line:

1. T/S file
2. Data file (must have proper format)
3. Trade parameters: Exits based on percentages (%) or points (pys) of entry price, trade inputs on Open or Close and option to apply trade input delay
4. Performance Constraints: Minimum success rate for long and short strategies, minimum Profit Factor (sum of winners/sum of losers) minimum number of historical trades and maximum number of consecutive losers
5.Major Features Cluster: Choice of major features cluster
6. Test Sample Size: The number of bars in the data file, or bars, to be used for test sample. Recommended value is the default of 500 bars for daily data. In the case of intraday data the value will depend on the timeframe.

To Select a T/S file

Select a T/S file from the appropriate directory. Click on a file to highlight it and then click the hand icon pointing down to move it in the selection field. Alternatively, you can just doubleclick a file and it will automatically get selected. To change the T/S file click the hand icon pointing up and repeat the selection process.



To Select a data file

Select a data file from the appropriate directory. Click on a file to highlight it and then click the hand icon pointing down to move it in the selection field. Alternatively, you can just doubleclick a file and it will automatically get selected. To change a data file click the hand icon pointing up and repeat the selection process.



Trade Parameters and Performance Constraints

Specify the type of exits (profit target and stop-loss) to use by selecting either % for percentages of entry price or inc for points (pts) added to entry price. Specify the type of trade input by selecting either Open or Close. If Open is selected then the entry price will be the open of the bar following a signal generation by a strategy. If Close is specified, then the entry price will be the close of the bar where a signal is generated.

Specify if you want to apply a delay in the trade input of strategies. To select a delay, check the On option under Delay and specify the delay range. Allowable values are 1 - 5.



Note: If you check On for the delay and specify a range for this variable DLPAL will determine the best value for the delay to apply for each strategy. In many cases, DLPAL may discover more strategies as compared to a search with no delay applied.

Warning! Activating the delay option may slow down the search considerably. It is recommended that the default range (1-5) is used.

Specify the minimum % profitable (success rate) for long and short strategies by inputting the appropriate value to use in the fields. This parameter is equal to the number of winning trades divided by the total number of trades multiplies by 100. (The defaults are set to 66.00.) Then, specify the minimum Profit Factor, which is equal to the sum of winning trades divided by the sum of losing trades). Next specify the minimum number of trades strategies must generate in the train and test sample combined. (The default is 20 trades). Finally, specify the maximum number of consecutive losers each strategy is allowed to have in the combined data sample, max Consecutive Losers. (Default is 3 consecutive losers and shown as "< 4"). These performance constraints will apply to all strategies identified by the program and only those that meet them will be reported on the results..



File Data Range



As soon as a data file is selected, the date range of the combined sample, train plus test, is automatically shown in the First Date and Last Date fields. These fields cannot be changed.

Major Cluster Types



Extended: 120 sub-clusters with 2-6 bar lookback
Close:  67 sub-clusters with 3-9 bar lookback. Only the Closing prices are used in features
2-bars:  24 sub-clusters with 2 bar lookback
3-bars:  41 sub-clusters with 3 bar lookback
4-bars:  31 sub-clusters with 4 bar lookback
5-bars:  47 sub-clusters with 5 bar lookback
6-bars:  54 sub-clusters with 6 bar lookback
7-bars:  74 sub-clusters with 7 bar lookback
8-bars: 114 sub-clusters with 8 bar lookback
9-bars: 171 sub-clusters with 9 bar lookback

Note that: Number of sub-clusters in Close+Mixed+High Low+Open Close = Number of sub-clusters in Deep

Test Sample Size, Common Features Only, Common Profit Factor, Minimum Common % and Default Workspace



The default Test Sample Size is 500 bars. Changing this parameter impacts the time taken to complete the search.  A minimum of 250 bars is recommended in the case of daily data. Note that this parameter is not related to the back-testing range used during the search, which considers the combined sample.

Checking the option Common Features Only instructs the program to look for strategies in each instrument on the workspace that are also profitable in all other instruments. This works as follows: when the program finds a strategy in one instrument that satisfies the criteria set on the workspace, it also backtests its performance in all other instruments using the parameters of the original instrument (target, stop, etc.). If the profit factors calculated is greater than the minimum Common Profit Factor (default is 1.00), then the strategy is reported in the results. Notes: (1) The chances of finding strategies with common features decreases with the number of instruments and as the Common Profit Factor value is increased.  (2) When this option is selected, all data files on the workspace must have the same point value in the case point stops are used. For example, when using currency pairs with point stops (pips), often EURUSD and USDJPY have different point values. These must be adjusted in the historical file before the search for common features so that a point stop of 0.01 in EURUSD ( 100 pips), for example, also corresponds to the same number of pips in USDJPY.

The default Minimum Common % is 100. In this case each strategy found will have the minimum profit factor specified in all instruments tested. This value can be set to anything between 0 and 100. For example, if the value is set to 75, then all strategies with common features reported will have the minimum profit factor in at least 75% of the instruments tested.

Note: Use "Common for first line only" to find common features for symbol in first search line.

Note: The Test Sample Size, delay option values and the parameters related to common features are not saved when the workspace is saved.

Default workspace

You may mark a workspace as the default workspace of the program by checking the box next to Make this my default workspace.

Creating a Search Line

To create a new search line, click on the first empty search line. After the file and parameter selections click on the hand icon pointing downwards. To delete a search line, click on that line and hit the DEL key, or use the hand icon pointing upwards to remove it.



Saving the workspace and Running a search

Click Save to save the workspace. Click Run or hit the F3 key to start the search.


Top




Running a search


Running a search

To start a search click Run after you create and save the workspace.  The progress bars will indicate the progress of the search:



The first progress bar, Applying Feature Sub-Clusters, shows the sub-cluster from the major cluster that the program is using at that moment and the particular search line number

The second progress bar, Processing Data, shows the progress of the search in the specified Test Sample Size and the data file processed

The third progress bar, Applying Target and Stop, shows which profit target and stop-loss pair is applied from the T/S file in the relevant search line

Useful information about the learning process is found below the progress bars.

The main cluster type is shown and the percent of search completed that takes into account all active search lines.

The deep learning efficiency can be low, average, high and very high.  If percent completed is more than 50% and efficiency remains low, this should be a warning that it may be advisable to terminate the search.

Suggestion can be None or Abort, in case there is indication that the learning process does not converge.

Total features tested refers to strategies tested and Total accepted features refers to strategies that fulfill the performance constraints. In addition that total number of accepted long and short strategies is shown.

Total predictions is related to the number of signals generated by accepted strategies. Total successful predictions is the number of signals that reached their profit target. In addition, the combined hit rate of all accepted strategies is displayed and the approximate (expected) profit factor of all strategies combined.

The above information allows the user to evaluate the search progress in real-time and decide whether to continue or abort to save development time.

Clicking Abort terminates the search. Results are NOT not saved.



Top




Search workspace results


Search workspace results

When a search is completed, the results are displayed on the screen.

In the case no strategies are found

In the case no strategies are found based on the search parameters specified, the following message is shown:



Clicking Help offers general advice on what could be done to increase the chances of finding strategies in the specific data file.



Click OK to close the popup window

In the case that strategies are found

The strategies found by the program are displayed on the results form. Each line represents a strategy with some of its key performance parameters.



Saving the results

To save the results click File on the main menu and then Save.  You can also select specific strategies to save them in a new results file. For example, you can sort the results for highest number of trades and then select only those strategies with 40 or more trades. In the following example, the results of a search for common strategies in FANG stocks are sorted for highest number of trades. You may click first on File Name label to deselect all strategies, then sort then strategies. To deselect all strategies from the results click on the File Name column label on the workspace results form. To select all strategies click again on the File Name column label.

To select specific strategies click the sign of a strategy line so it turns into the sign.:



After it is opened, the new results file will look like the one below:



Opening saved results files

To display results already saved click Results from the main program menu, then select Search Results and then Open. Open Last displays the most recent results generated by the program.

Search Results Options

The results form offers several options:



Add to Database adds all strategies found to the program database

QuantopianCode generates Quantopian code for selected strategies.

EasyLanguage Code generates EasyLanguage code for selected strategies.

NinjaTrader Code generates condition code for NinjaTrader selected strategies.

Amibroker Code generates code in Amibroker AFL selected strategies.

System Tracking allows defining a trading system consisting of selected strategies for monitoring signal generation

Test Strategies allows simple system testing and displays the new results

Portfolio Backtest allows testing all strategies in the results on a portfolio of securities. (Warning: for the results to make sense, all securities in the portfolio must have the same point value)

Reverse Long/Short allows reversing the LONG and SHORT type designations of all strategies in the results for the purpose of analyzing inverted/mean-reverting systems

Restore Last results can be used to reload the results generated by the last search. Useful after operations are performed on the results, such as portfolio backtest or Robustness.

Change File Name allows changing the file name on the results for testing the strategies on different symbols.

Save Distinct Only may be used to save the distinct strategies from the results.

Change File Name

Click Change File Name and type in a new symbol in the field that will appear. The file extension is assumed to be .txt and should not be specified:



Click Go to have the file name changed to the new name specified:



Now all the strategies in the results are associated with this new symbol.

Note: In case there are different file names in the results, they will all be changed to the new name.

Save Distinct Only

This tool can be used to identify and save only the distinct strategies from results. The number of distinct strategies is always indicated on the results caption. For example, in the following results there are 104 strategies but only 100 of them are distinct.

To save only the distinct strategies in another results file Click on Save Distinct Only and specify a new file name. The resulting file when opened contains only the distinct strategies:



Raw Code Generation

Raw code generation in a text file is available automatically when code is generated from Search Results. Each line of the file contains the following:

Strategy Code;File;Type;TradeOn,Target;Stop;C

where File is the filename, Type is LONG OR SHORT, TradeOn is Open or Close, Target is the profit target, stop is the stop-loss and C is % or pts. Strategy Code is the formula code used by the native language of the various supported platforms.

The raw code may be displayed on the screen but in addition two files with identical content are saved automatically in sub-directory .../Results:

(1) A file called GeneratedCode.txt which is overwritten every time new code is generated.

(2) A file with the name: RawCode_mm_dd_yyyy_hh_mm.txt

This file is overwritten only if new code generation takes place during the same minute mm that the file was initially generated.

The text files containing raw code can be deleted using a new tool added to File Maintenance under Results and called "Code .TXT FILES".

Strategy Back-testing

To back-test a strategy, select the strategy line by clicking on it and hit the F3 key or click the right mouse button and select Back-test. To back-test a strategy on a portfolio of securities, select the strategy by clicking on it, then right click mouse and select Back-test portfolio  (Warning: In the case of multiple symbols in the results for the portfolio back-test to make sense all symbols must have the same point value).

Merging Search Workspace Results

Workspace results can be merged using the Merge tool available in File Maintenance under Workspace results. For more details look under File Maintenance in this manual.

Saving results in .CSV format

The results can be saved in >CSV format by clicking File from the main menu and then Save in CSV format.







Top




Interpreting search results


Interpreting the results

Each line on the search and system tracking results corresponds to a strategy that satisfies the criteria specified on a search workspace.

Example of search results



File Name is the data file used in the search

Index is used internally to number sub-clusters. This number is used by the program for strategy classification purposes.

Index Date is the date of the most recent trade of a strategy in the data file for Search results.

Trade on is either Open or Close and refers to the trade entry point. In the case that the Delay option was activated in search, these fields will show as Open(n) or Close(n) (ex. Open2, Close1). The value of n is the best delay for the specific strategy and it is determined based on highest profitability.

P is the percent profitability (success rate) of strategies. P = winning trades x 100/total trades

PF is the Profit Factor (sum winners/sum losers) and shown in search results. Profitable strategies and trading systems in general require that PF > 1.

CL is the number of maximum consecutive losers of the strategy.

Type is either Long or Short.

Target shows the profit target value used in the search

Stop shows the stop-loss value used in the search

C indicates the type of exit applied, % stands for percentages and pts for points.

Last Date is the most recent date (last) in the data file

First Date is the first date (oldest) in the data file

Sorting the results

Clicking on the column labels sorts the results by File Name, Index, Index Date, percent profitability P, consecutive losers CL, number of Trades, Target or Stop and Last Date in case of p-indicator results.

Note: Although one may find evidence against the randomness of a strategy or set of strategies via the use out-of-sample testing or portfolio backtesting, including cross-validation and robustness tests, this deals only with half of the problem. The other half of the problem is that the next trade, or series of trades, can generate a loss even if the probability for that is low. This is similar to tossing a coin with a winning bias towards heads; the next toss can generate tails but in the longer-term heads will outnumber tails. From a risk management perspective, long-term statistics are not very useful when the focus is on the next few trades. The probability of win must be maximized as much as possible to minimize the risk of a large drawdown resulting from a long streak of consecutive losers in the short-term.  Trading is the art and science of dealing with probabilities. A high win rate in conjunction with satisfactory portfolio backtest results increases the chances of profitable strategy or system. But as in the case of tossing a coin with a winning bias, the next trade or series of trades may generate losses. This is the nature of probabilistic trading. It is recommended that long signals are avoided if the market opens with a large up gap and the same applies to short signals if at the open there is a large down gap because the signal momentum may be exhausted at the open.  Furthermore, it is important to analyze the significance of these signals in the context of recent price action.


Top




Database results


Database results

Strategies stored in the program database may be retrieved by clicking on Results from the main program menu and selecting Database



Select a file name from the list and click OK



A list of all strategies by file name will display with options for generating code for the strategies and for adding selected strategies in the form of a system to System Tracking.  You may delete all strategies linked to a certain file name by clicking on File from the main Database Results menu and then Delete File. The database may be erased completely by clicking on File and then Delete All Files.



File Name is the data file used in the search

Index is used internally to number sub-clusters. This number is used by the program for strategy classification purposes.

Index Date is the date of the most recent trade of a strategy in the data file for Search results.

Trade on is either Open or Close and refers to the trade entry point. In the case that the Delay option was activated in search, these fields will show as Open(n) or Close(n) (ex. Open2, Close1). The value of n is the best delay for the specific strategy and it is determined based on highest profitability.

PL is the percent profitability (success rate) of strategies. PL = winning trades x 100/total trades.

PS is the percent profitability (success rate) of strategies for long positions. In this case PS = 100 - PL

PS is the percent profitability of strategies for short positions. In this case PL = 100 - PS

CL is the number of maximum consecutive losers of the strategy.

Type is either Long or Short. Strategies with a Long type are used for taking long positions and Short types for taking short positions.

Target shows the profit target value used in the search.

Stop shows the stop-loss value used in the search.

C indicates the type of exits applied, % stands for percentages, and pts for points.

Last Date is the most recent date (last) in the data file

First Date is the first date (oldest) in the data file

Sorting the results

Clicking on the column labels sorts the results by File Name, Index, Index Date, percent profitability PL and PS, consecutive losers CL, number of Trades and Target or Stop.

Database results options



Quantopian Code generates Quantopian code for selected strategies.

EasyLanguage Code generates EasyLanguage code for selected strategies.

NinjaTrader Code generates condition code for NinjaTrader selected strategies.

Amibroker Code generates code in Amibroker AFL selected strategies.

System Tracking allows defining a trading system consisting of selected strategies for monitoring signal generation

To select all strategies from the database results click on the File Name column label on the results form. To deselect all strategies Click again on the File Name column label. To select specific strategies click the sign of a strategy line so it turns into the sign.


Top




Code results


Code results

Click on Results from the main program menu and select Code



From the drop-down list select the file type



The following choices are available for retrieving saved code results.

Easylanguage files

Quantopian Files

NinjaTrader Files

Amibroker Files

Select a file from the list and click Open to display the saved code


Top




System Tracking results


System Tracking results

Click on Results from the main program menu and select System Tracking



Select a file and click Open to retrieve saved system tracking results.

The files contain results from systems added to System Tracking.


Top




Back-testing Strategies


Back-testing strategies

To back-test a strategy select the strategy line from search or System Tracking VIew results by clicking on it and hit the F3 key or click the right mouse button and then select Back-test.



The program extracts the information for the data file needed to perform the back-test from the results. You may change the data file to apply to a back-test by selecting a new directory where the new file can be found, provided that the name of that file is the same with that shown in the results. The back-test range is indicated in the back-test window.



All backtests by default are point tests per share/contract. To calculate dollar values you must check the option "Calculate dollar performance per contract/share" and specify the appropriate values for the starting capital per share/contract, the applicable commission per share/contract per side and the big point value BPV. For stocks BPV is 1.0. 

Click OK for a point back-test. The results show the equity curve and the values of several performance parameters:




Click Trade LIst for a list of trades. The results show details about each trade and the values of several performance parameters:



The profit-target and stop-loss can be changed when backtesting for studying the sensitivity of the strategy to various exit levels. Click "Change Target and Stop" to activate this option:



Only the profit target and stop-loss can be changed with this option. Trade entry choice "Trade on" and exit type C (%, pts or NC) cannot be changed.

Below is an example of backtesting a strategy from the GBPUSD search results shown below:



The first strategy in the above results will be backtested for starting capital of $20,000 per standard lot and $10 commission that corresponds to 1 pip spread. BPV is 100,000:



Click OK to backtest the strategy. The results are in dollar terms except the trade P/L which is always in points:



Strategies added to System Tracking can be back-tested by selecting the system from the list first, then clicking on View and following the process described above. 

The back-testing function is useful for determining past entry/exit days and other useful performance parameters of strategies. As more data is added to a historical data file, the back-testing function can be used to monitor the performance of strategies previously discovered. This can be done either from the original results file or from System Tracking.

Note: the back-testing function takes into account any open position in calculating the performance parameters. The search does not consider open positions and thus the performance parameter values may differ slightly in such case. The back-testing function skips any multiple signals.

Back-testing single strategies on a portfolio of securities

To back-test a strategy on a portfolio of securities select the strategy line from search results by clicking on it and then select Back-test Portfolio:



You may change the target directory to that of the data files of the portfolio. The original data file of the strategy is not necessary to be stored in the selected directory. The profit-target and stop-loss can be changed for studying the sensitivity of the strategy to various exit levels. Click "Change Target and Stop" to activate this option:



Below is an example of a portfolio backtest of a single strategy on all Dow-30 stocks. Click OK to back-test. The results show details for each security in the portfolio and the values of several important performance parameters along with an equity graph:



The Win Rate on the top indicates the percentage of securities in the portfolio that generated a profit factor > 1 (equivalent to a positive expectation). The portfolio win rate is the number of all winning trades in all securities divided by the total number of trades.

The expectancy parameter for each security is equal the average trade and given by the equation: Expectancy = Average win x w - Average loss x (1 - w) = (Sum wins - Sum losses)/N, where w is the win rate and N the total number of trades for the particular security.

The payoff ratio is the ratio of average win divided by average loss. All other parameters have their usual, known interpretation. The Back-Test Portfolio results for single strategies are always based on a points test.

Warning: When using this test, all instruments in the results must have the same point value. If that is not the case, you can save the results for each instrument separately and repeat the test.

Portfolio Backtest

The Portfolio Backtest option offers a quick way of back-testing all strategies in the results on a portfolio of securities, instead of using the Back-test Portfolio tool for each one separately. The Portfolio Backtest results are based on a points test. The win rate P, the profit factor PF and the total number of trades of the portfolio backtest are displayed under P, PF and Trades columns. The portfolio expectancy is displayed under the Port E column which replaces the Last Date column of the original results and the Win Rate, which is the proportion of data files with positive profit factor in the portfolio, is displayed under the First Date column of the original results. Click on Portfolio Backtest from the search results options and select the target directory where the portfolio data files are saved:



The profit-target and stop-loss cannot be changed when using this tool. Click OK to back-test. The results will change for each security to those of the portfolio backtest results:



In the above results, a few strategies show a negative expectation and a profit factor less than 1. These results must be interpreted in a proper context. Usually, several portfolio backtests results must be performed along with robustness analysis and tests on multiple symbols to minimize data-mining bias and curve-fitting.

Portfolio Backtest Sort

The sorting option is especially useful when there are many strategies in the results, hundreds or even thousands. To activate the option, mark "Portfolio backtest sort" and set the parameter values, as shown in the example below:



Below are the results. Only those strategies that satisfy the sorting criteria are listed:



Warnings:

-The portfolio backtest results cannot be saved. If you would like to save results from a portfolio backtest, you can use the Test Strategies tool to recover the results for the date range you desire and then save the marked strategies. To restore the original results, you can re-open the results form. If the results were from the last search, you can use the Restore Last results option.
-When using this test, all instruments in the results must have the same point value. If that is not the case, you can save the results for each instrument and repeat the test.


Top




Test Strategies


Test Strategies

Note: Test Strategies provides an indication of the performance of all strategies in the results. For separately long or short strategies the backtest in Test Strategies is quite accurate but for systems of long/short strategies this function provides only approximate performance because the objective is to see what signals are generated, not to determine how a particular system performs. Test Strategies is not a backtest of a particular system of strategies because there are many ways of combining strategies, for example the OR method is the simplest but there are many much more complex methods.  For more accurate performance a backtesting program should be used such as Tradestation, Amibroker or NinjaTrader, along with the generated code. This is actually the purpose of the generated code, i.e., to provide code for further analysis.

Note: Test Strategies takes into account all strategies in the results irrespectively of any user selection. In order to use Test Strategies with a specific group of strategies from the results, those strategies must be selected and saved in a new results file. Then the new file must be opened.

In the search results example shown below, the SPY strategies were found using historical daily data from 19930129 to 20081231: 



In order to test all strategies in an out-of-sample data starting on 20090102, click Test Strategies. The program will prompt you to select a directory where the out of sample data file(s) can be found:



The directory is selected by double-clicking the appropriate folder. You can select the Timeframe for proper calculation of the annualized return CAR. You also have the choice to specify no multiple positions for the backtest. In this case, multiple closed positions will be ignored from the calculations of the results. All backtests by default are point tests per share/contract. To calculate dollar values you must check the option "Calculate dollar performance per contract/share" and specify the appropriate values for the starting capital per share/contract, the applicable commission per share/contract per side and the big point value BPV. For stocks BPV is 1.0.  Click OK to test the strategies shown in the results:



You can also specify that you want the backtest to include only the long or only the short strategies by checking the appropriate boxes. A list of trades is obtained by clicking Trade List.

Notes:

(1) Equity graphs are provided only of systems of strategies that involve only one data file (Data Files: 1 in caption of results). If more than one files are involved, summary statistics are only generated. Below is an example for FANG stocks:



You may save results for particular symbols (files) and then use Test Strategies to get an equity curve and backtest results.

(2) If there are more that 10,000 trades generated in the data sample chosen, then only summary statistics are provided.

Warning:  When there are many strategies in the results, usually more than 50, the Test Strategies function may take long to execute. In addition, any request for no multiple positions will further delay execution.

When using Test Strategies the original performance parameters in the results are replaced with the ones that correspond to the data file selected after the backtest. Click "Return to results" for the new results:



Below is an example of GBPUSD search results obtained in daily data from 19990104 to 20100531, evaluated using Test Strategies in an out-of-sample data from 201310102 to 20131231. The minimum capital is set to $20,000, the commission per standard lot to $10 per trade per side to reflect a 1 pip spread and the big point value BPV is set to 100,000:



After clicking OK the following results are obtained:



Warning: When using this test with multiple data files in the results, all instruments must have the same point value. If that is not the case, you can save the results for each instrument in a separate file and repeat the test.




Top




Robustness Analysis


Robustness Analysis

Single strategy robustness

You may use this function to analyze the robustness of strategies to variations in the profit target and stop-loss. Two graphs are generated along with performance data showing the win rate and expectation variation.

To analyze the robustness of a strategy select the strategy line from search results by clicking on it and then right mouse button and select Robustness:



The program extracts the information for the data file needed to perform the analysis from the results. You may change the data file to use by selecting a new directory where the new file can be found, provided that the name of that file is the same with that shown in the results. The date range is indicated on the window. The profit-target and stop-loss can also be changed for studying the sensitivity of the strategy around new exit levels. Click "Change Target and Stop" to activate this option:



Only the profit target and stop-loss can be changed with this option. Trade entry choice "Trade on" and exit type C (%, pts or NC) cannot be changed.

The analysis is performed by changing the profit target and stop-loss around their initial values while maintaining their ratio. The results list each profit target and stop-loss pair and show the win rate, profit factor, number of trades, payoff ratio (ratio of average win to average loss) and expectation. The Robustness performance index is equal to the number of positive expectations in the results divided by the total number of results times 100:



Hint: The flatter the win rate curve and the flatter or linearly increasing expectation curve the better the robustness of the strategy. The higher the Robustness index the better the sensitivity of the strategy to variation in exit levels and the lower the probability that the strategy was fitted to the data. For example, the results below show a potential curve-fit because of the shape of the expectation curve:



Robustness of all strategies in the results

You may use this function to analyze the robustness of all strategies to variations in the profit target and stop-loss. This function is available in Search results.

To analyze the robustness of all strategy in the search strategy select any strategy line by clicking on it and then right mouse button and select Robustness All:



The program extracts the information for the data file needed to perform the analysis from the results. You may change the data file to use by selecting a new directory where the new file can be found, provided that the name of that file is the same with that shown in the results. The date range is indicated on the window. The profit-target and stop-loss cannot be changed:



The robustness of the strategies in the results is displayed in the last column, in place of the First date column:



The above results can be sorted for highest or lowest robustness but they cannot be saved. After selecting strategies based on robustness you can use the Test Strategies tool to recover the results and save the selected strategies to a new results file. If you would like to restore the results, you can re-open the results form. If the results were from the last search, you may use the Restore Last results option.

Please note Robustness analysis is just one method of analyzing strategies. This method is subject to false positives and false rejections and it must be supplemented by alternative methods, for example an out-of-sample test and/or a portfolio backtest. In certain cases well-fitted strategies may show high robustness. Therefore, if the robustness is low this is an indication that a strategy is fitted but if it is high we still cannot be sure whether it is random or not. As a result this is a method for rejection of strategies only.



Top




EasyLanguage code generation


EasyLanguage code generation

From the search or system tracking results select the strategies for code generation and click EasyLanguage Code.



Select the code version (TS2000i or TS) and click OK. An example of Easylanguage TS code generation for selected strategies is shown below



The generated code may be saved by clicking on File and then Save.

You may copy and paste the code into Tradestation. You may have to remove some blank or other characters causing errors when verifying the signal.

In the case of strategies with a delay in trade input all bars in the code are shifted according to the delay value. Therefore, the delay is already accounted for when a signal is generated for the appropriate entry point (open or close).

Note: the input variable values are initially set to zero in the generated code and they must be specified in Tradestation.

Raw Code

Click on "Raw Code" from search results to generate raw code for selected strategies:



You may copy and paste the raw code in a line editor for further manipulation. Raw code is also generated automatically and saved in two text files. Each line in the files contains the following:

Strategy Code;File;Type;TradeOn,Target;Stop;C

where File is the filename, Type is LONG OR SHORT, TradeOn is Open or Close, Target is the profit target, stop is the stop-loss and C is % or pts. Strategy Code is the formula code used by the native language of the various supported platforms.

The raw code generation applies only to Search and Database results. Two files with identical content are saved automatically in sub-directory Results:

(1) A file called GeneratedCode.txt which is overwritten every time new code is generated.

(2) A file with the name: RawCode_mm_dd_yyyy_hh_mm.txt

This file is overwritten only if new code generation takes place during the same minute mm that the file was initially generated.

The text files containing raw code can be deleted using a new tool added to File Maintenance under Results and called "Code .TXT FILES".

System Code

Click on "System Code" to generate system code for selected strategies:



Note: System code can be generated only when there is one symbol (data file) in results and with strategies that have the same exit parameters. If there several symbols, results for each can be saved in a different results file to be used for code generation.

FAQ: What values should be used for the input variables in the generated Easylanguage code for selected strategies?

In the generated Easylanguage code for selected strategies, the input variables are set equal to 0 and must be set to the correct value manually by the user.

(1) In the case of percent (  "%" )  targets and stops:

You need to set the proper values of the following input variables according to the values used in the T/S file shown in the generated code header:

input: ptarget(0), stopl(0);

For example, if the target is 3% and the stop 2% then:

input: ptarget(3), stopl(2);

The correct values are always shown in the headers of the generated code for each strategy. For example:

LONG , % , TARGET : 8 , STOP : 6 , ENTRY PRICE : CLOSE , DELAY : 0

In this particular header, the target is 8% and the stop is 6% and the line should change to:

input: ptarget(8), stopl(6);

(2) In the case of point ( "pts" ) targets and stops:

You need to set the proper values of all input variables according to the values used in the T/S file shown in the generated code header and the appropriate price scale of the instrument traded:
If the target is 75 pips and the stop is 50 pips then:

input: targetpoints(0.0075), stoppoints(0.0050), multiplier(10000);

The correct values are always shown in the headers of the generated code for each strategy. For example:

LONG , pts , TARGET : 0.01 , STOP : 0.01 , ENTRY PRICE : OPEN , DELAY : 0

In this particular header, the target is 0.01 and the stop is 0.01:

input: targetpoints(0.01), stoppoints(0.01), multiplier(10000);

In the above example the multiplier value was set to 10000 to reflect that the values are related to eurusd forex trading where the price scale is often equal to 10000. In general, the multiplier is related to the price scale. For example, for equities the price scale is 100, for bond futures 32 and for eurusd forex 10000 in most cases. Please consult your Easylanguage manual to find out how the variables should be adjusted in the case of point targets and stops.

Note that in the case of system code, the input values are inserted by the program.



Top




Quantopian code generation


Quantopian code generation

From the search or system tracking results select the strategies for code generation and click Quantopian Code.



An example of Quantopian code generation for selected strategies is shown below



The code generated may be saved by clicking on File and then Save.

You may copy and paste the code into a Quantopian strategy. Indentation is taken care off in the code but a few adjustments may be required.

In the case of strategies with a delay in trade input, all bars in the code are shifted according to the delay value. Therefore, the delay is already accounted for when a signal is generated.

Raw Code

Click on "Raw Code" from search results to generate raw code for selected strategies:



You may copy and paste the raw code in a line editor for further manipulation. Raw code is also generated automatically and saved in two text files. Each line in the files contains the following:

Strategy Code;File;Type;TradeOn,Target;Stop;C

where File is the filename, Type is LONG OR SHORT, TradeOn is Open or Close, Target is the profit target, stop is the stop-loss and C is % or pts. Strategy Code is the formula code used by the native language of the various supported platforms.

The raw code generation applies only to the Search and Database results. Two files with identical content are saved automatically in sub-directory Results:

(1) A file called GeneratedCode.txt which is overwritten every time new code is generated.

(2) A file with the name: RawCode_mm_dd_yyyy_hh_mm.txt

This file is overwritten only if new code generation takes place during the same minute mm that the file was initially generated.

The text files containing raw code can be deleted using a new tool added to File Maintenance under Results and called "Code .TXT FILES".

System Code

Click on "System Code" to generate system code for selected strategies:



Notes:

- System code can be generated only when there is one symbol (data file) in results and with strategies that have the same exit parameters. If there several symbols, results for each can be saved in a different results file to   be used for code generation.
- On Quantopian strategy the exits are evaluated on 1-minute data.
- In the case of intraday strategies, the frequency of data must be changed in the code


Top




NinjaTrader code generation


NinjaTrader code generation

From the search or system tracking results select the strategies for code generation and click NinjaTrader Code.



An example of code generation for a single strategy is shown below



The generated code may be saved by clicking on File and then Save.

In the case of strategies with a delay in trade input, all bars in the code are shifted according to the delay value. Therefore, the delay is already accounted for.

Raw Code

Click on "Raw Code" from search results to generate raw code for selected strategies:



Raw code for selected strategies may be displayed on the screen by clicking on "Raw Code". You may copy and paste the raw code in a line editor for further manipulation. Raw code is also generated automatically and saved in two text files. Each line in the files contains the following:

Strategy Code;File;Type;TradeOn,Target;Stop;C

where File is the filename, Type is LONG OR SHORT, TradeOn is Open or Close, Target is the profit target, stop is the stop-loss and C is % or pts. Strategy Code is the formula code used by the native language of the various supported platforms.

The raw code generation applies only to the Search and Database results. Two files with identical content are saved automatically in sub-directory Results:

(1) A file called GeneratedCode.txt which is overwritten every time new code is generated.

(2) A file with the name: RawCode_mm_dd_yyyy_hh_mm.txt

This file is overwritten only if new code generation takes place during the same minute mm that the file was initially generated.

The text files containing raw code can be deleted using a new tool added to File Maintenance under Results and called "Code .TXT FILES".

System Code

Click on "System Code" from search results to generate system code for selected strategies:



Note: System code can be generated only when there is one symbol (data file) in results and with strategies that have the same exit parameters. If there several symbols, results for each can be saved in a different results file to be used for code generation.



Top




Amibroker code generation


Amibroker code generation

From the search or system tracking results select the strategies for code generation and click Amibroker Code.



An example of Amibroker code generation for selected strategies is shown below



The generated code may be saved by clicking on File and then Save.

In the case of strategies with a delay in trade input all bars in the code are shifted according to the delay value. Therefore, the delay is already accounted for when a signal is generated for the appropriate entry point (open or close).
Raw Code

Click on "Raw Code" from search results to generate raw code for selected strategies:



You may copy and paste the raw code in a line editor for further manipulation. Raw code is also generated automatically and saved in two text files. Each line in the files contains the following:

Strategy Code;File;Type;TradeOn,Target;Stop;C

where File is the filename, Type is LONG OR SHORT, TradeOn is Open or Close, Target is the profit target, stop is the stop-loss and C is % or pts. Strategy Code is the formula code used by the native language of the various supported platforms.

The raw code generation applies only to the Search and Database results. Two files with identical content are saved automatically in sub-directory Results:

(1) A file called GeneratedCode.txt which is overwritten every time new code is generated.

(2) A file with the name: RawCode_mm_dd_yyyy_hh_mm.txt

This file is overwritten only if new code generation takes place during the same minute mm that the file was initially generated.

The text files containing raw code can be deleted using a new tool added to File Maintenance under Results and called "Code .TXT FILES".

System Code

Click on "System Code" from search results to generate system code for selected strategies:



Note: System code can be generated only when there is one symbol (data file) in results and with strategies that have the same exit parameters. If there several symbols, results for each can be saved in a different results file to be used for code generation.


Top




Adding systems to System Tracking


Adding systems to System Tracking

From search or database results select the strategies you would like to include in a system and then click Strategy Tracking:



Click Yes to confirm or No to abort. If you click Yes you must specify the name of the new system and the directory where the data file is found, in the case you would like to define a different directory than the one specified in the results. If you specify a different directory, the file name must be the same as the one shown in the results.



The new system appears in the System Tracking list of systems:



You may group strategies in the results in any way you choose and then add a system to System Tracking. In the following example, results for QQQQ are used to create two systems, one with long strategies only and another with short strategies only. Each system must be assigned a different name.

Example: Defining a system by including only long strategies from the results

Select all short strategies:



Click on System Tracking to add the system. You will need to confirm the addition and then specify a name for the system and a location for the data.





Click Exit to close the system tracking window and then repeat the same procedure for adding a new system with short strategies only.

Deleting systems and changing data location

You may delete a system by selecting it from the system tracking list and then pressing the Del (Delete) key on the keyboard. The directory of the data file(s) for a specific system can be changed by selecting it first and then pressing the Ins (Insert) key on the keyboard.


Top




System Tracking reports


System Tracking reports

In order to get a report of new signals generated by the systems added to System Tracking, you must first update all data files used by those systems in the Data Locations shown in the System Tracking list. Then, from the main program menu click System Tracking



Click Run to generate a report of new trading signals. Below is an example of a typical System Tracking report



SIGNAL can be THIS CLOSE, NEXT OPEN or NEXT CLOSE

THIS CLOSE applies to trading signals generated as of the close of the last bar in the corresponding data file. The problem with this type of signals is that by the time the system tracking report is generated it is too late to place the trade. Therefore, one must track the signals listed as NEXT CLOSE and determine any trades needed to be placed on the next bar close, according to the conditions listed under the CONDITIONS column. This type of signal is generated when the Close is specified as the trade entry point on a search workspace.

NEXT OPEN applies to strategies that generate a new position at the open of the next trading day. If the signal is due to a strategy with a trade delay input, the delay has been factored already in signal generation and any new positions are for the open of next day. The delay value will be shown in the CONDITION column.

NEXT CLOSE refers to strategies that are candidates for generating a position at the next close depending on that day's range or for strategy with entry at the Close and with delay input. The conditions that must be met in order to generate a signal are listed under CONDITIONS. If the signal is due to a strategy with trade input delay, the delay value will be shown in the CONDITION column.

POSITION can be either LONG or SHORT depending on the strategy type.

SYMBOL indicates the data file name.

SYSTEM shows the system name.

SAVED indicates the date the system was saved in system tracking

TARGET is the profit target

STOP is the stop-loss

LAST DATE is the last trading day in the data file used by the system tracking

CONDITION is active in the case there are candidate strategies for generating a trading signal at the close of the next trading day. The conditions needed to be satisfied are listed

INDEX refers to the sub-cluster of the major cluster used in the search. This number is used by the program for classification purposes.

Index Date is the date of the most recent occurrence of a strategy in the data file and it is used for classification purposes

The system tracking report can be saved by clicking Save. To print a report select print.




Top




Viewing Trading Systems


Viewing Trading Systems

To view the strategies in a trading system in System Tracking, click System Tracking from the main program menu.



Select a trading system (highlight it). In this case the first system SPY is highlighted:



Click View to get the list of the strategies in the system:



File Name is the data file used in the search.

Indexis used internally for strategy classification purposes.

Index Date is the date of the most recent occurrence of a strategy in the data file and it is used for classification purposes

Trade on is either Open or Close and refers to the trade entry point. In the case that the Delay option was activated, these fields will show as Open(n) or Close(n) (ex. Open2, Close1). The value for (n) is the best delay for the specific price strategy and it is determined based on the best historical profitability.

PS is the success rate of strategies for long positions. In this case PS = 100 - PL

PS is the success rate of strategies for short positions. In this case PL = 100 - PS

CL is the number of maximum consecutive losers of the strategy.

Type is either Long or Short. Strategies with a Long type are used for taking long positions and Short types for taking short positions.

Target shows the profit target value used in the search.

Stop shows the stop-loss value used in the search.

C indicates the type of exit applied, % stands for percentages and pts for points.

Last Date is the most recent date (last) in the data file

You can choose any of the following options::



Quantopian Code generates Quantopian code for selected strategies.

EasyLanguage Code generates EasyLanguage code for selected strategies.

NinjaTrader Code generates condition code for NinjaTrader selected strategies.

Amibroker Code generates code in Amibroker AFL selected strategies.

Test Strategies allows simple system testing and displays the new results

Change File Name allows changing the data file name in a system

Change File Name

Change File Name is useful when one desires to have a system developed for symbol XYZ, for example, to generate signals for symbol ABC. In the following example we start with a system SPY2p5 from System Tracking results. Then, we also add another system called DIA2p5 from the same SPY results. After that we will change the symbol in the DIA system to DIA.txt. The result is two systems with identical strategies generating signals for two different symbols.

Warning: If multiple files names are present in a system, the function described below will change all to the same file name.

Step 1. System added to System Tracking



Step 2 Now we add another system from the same results and name it DIA. Of course, the system will have the same strategies and file name



Step 3. Two identical systems were added, SPY and DIA



Step 4. Highlight system DIA and click on View. Click on Change File Name and type in the field DIA. Then click GO. File name of system DIA is changed to DIA.txt



Step 5 File name is changed from SPY.txt to DIA.txt.
 



After this change the DIA system has the same strategies as the SPY system but it generates signals based on DIA data.

Note: This option is useful when developing system for futures because futures contracts change based on month expiration. When a rollover to a new contract occurs, the file name in a system can be changed to agree to that.

Back-testing strategies in System Tracking

To back-test the strategies of a system saved in System Tracking, select the system first and then click View. Then, highlight a strategy to back-test and right click on mouse or hit the F3 key. You must specify the directory where the data file for the specific strategy can be found by the program.



Use Test Strategies to test all strategies in the system.






Top




Generating  System Open Positions


Generating System Open Positions

To get a list of open positions for a particular system that is listed in System Tracking, highlight it and then click View:





The open positions (if present) can be seen by clicking Test Strategies and then scolling to the bototm fo the report. The option No Multiple Positions must be unchecked to see all open positions generated by all strategies in the system. You must select the directory with the update data file(s) is different from default and click OK.

Notes:

1) This function should be used only after all data files are properly updated in the directories specified in System Tracking

2) The function can be used with systems that do not include multiple data files and risk/reward parameters

3) Only one system at a time can be checked for open positions

4) This function is more suitable for use with daily data



Top




EOD Data Conversion


End-of-Day Data Conversion

Form the main program menu click Tools and then Data File Conversion



Select the Source file to convert and specify its format in the Source File Settings. It is recommended to use a text editor in order to determine the format of the file before attempting to make the conversion. Select the Metastock compatible option if the source file was created by Metastock.



To convert to DLPAL compatible format mark the DLPAL Compatible option in the Target File Settings. Click Convert, select the file extension desired (.asc or .txt), the directory to store the new file and the new file name. Click Save to complete the conversion.



The following ASCII formats can be converted to a format compatible with DLPAL or to other formats:

Metastock ASCII files. These files should include a header line of the form

<TICKER>,<PER>,<DTYYYYMMDD>,<OPEN>,<HIGH>,<LOW>,<CLOSE>

Date format: YYMMDD with the OPEN, HIGH, LOW AND CLOSE fields all space or comma delimited, no header line

Date format: MM/DD/YYYY with the OPEN, HIGH, LOW AND CLOSE field all space or comma delimited, no header line

Note::  After converting Metastock ASCII files to DLPAL compatible format the header will be removed from the target file.
Warning!   No Time Field. If there is a TIME field, then the Open field of the file converted to ASCII text will have zero values for the Open price throughout the data file.

Converting Metastock ASCII text format to DLPAL format using Tools

- From the main program menu select Tools and then Data file Conversion.

- Select the source file that was converted by the downloader from the directory it was saved and make sure the Metastock compatible option is marked in the file settings.

- In the target file settings leave marked default DLPAL Compatible format and click Convert. Select a new directory to save the file in DLPAL format (or the same directory with a different file name) and click Save to complete the conversion.


Top




Metastock Multiple Conversions


Metastock Multiple Conversions

You may use Metastock ASCII Conversion from the Tools menu to convert several EOD daily data files from Metastock ASCII text format to DLPAL format.

Before using this conversion utility, the Metastock downloader must be used to create the ASCII text files and save them, each with a different name. When using the Metastock downloader you have the option to convert several files at once by specifying  *.txt  as the target file. (Please refer to the Metastock downloader manual).

From the main menu select Tools and then Metastock ASCII Conversion



First elect the directory where you have saved the Metastock converted files to ascii text:



Then select the files to convert (or mark the Select All check box). Specify a different target directory to save the converted files to. A confirmation message indicating completion of the conversion will then appear.


Top




Intraday Data Conversion


Intraday Data File Conversions

Intraday data are used in DLPAL in a way similar to EOD daily data. The program does not consider time in its deep learning and this speeds the execution time significantly. In order to use intraday data an ASCII text file must be created with the time field is omitted and the date field is replaced by and increasing 8-digit integer. Below is an example:

10000001 1492.25 1493.50 1486.75 1489.25
10000002 1489.00 1489.25 1482.50 1485.50
10000003 1485.75 1488.00 1484.00 1484.75

You can use the Intraday File Creation tool from the Main menu of the program to convert several different intraday data formats to an intraday file for use with DLPAL. Note: When using DLPAL with tick data and since the Open, High, Low and Close have the same value the only major cluster types that can be used are "Tick Data" and "Close". 

Form the main program menu click Tools and then Intraday File Creation



Select the Source file to convert and specify its format from the Source File Settings. It is recommended to use a text editor in order to determine the exact format of the file before attempting to make the conversion. Select the Metastock compatible option if the source file was created by Metastock.



Click Convert, select the the directory to store the new file and the new file name. Click Save to complete the conversion.



The following intraday ASCII formats can be converted to a format compatible with DLPAL using the Intraday File Creation tool:

1. Metastock ASCII files.  These files must include a header line of the form: <TICKER>,<PER>,<DTYYYYMMDD>,<TIME>,<OPEN>,<HIGH>,<LOW>,<CLOSE>

2. Date format: YYMMDD with the TIME, OPEN, HIGH, LOW AND CLOSE fields all space or comma delimited, no header line

3. Date format: MM/DD/YYYY with the TIME, OPEN, HIGH, LOW AND CLOSE field all space or comma delimited, no header line


Note 2: When converting Metastock ASCII files to DLPAL compatible format the header is not present any longer in the target file.

Converting Metastock ASCII text format to DLPAL format using Tools

- From the main menu select Tools and then Intraday File Creation.

- Select the source file that from the directory it was saved and make sure the Metastock compatible option is marked in the file settings.

- In the target file settings leave checked the default DLPAL compatible format and click Convert. Select a new directory to save the file in DLPAL format (or the same directory with a different file name) and click Save to complete the conversion.


Top




File Maintenance


File Maintenance

From the main program menu click Tools and then File Maintenance.



You can use the File Maintenance tool for housekeeping purposes. Clicking the appropriate button provides a list of related files. You can delete files by marking the box next to them or you can delete all files by marking Select All.



If you have saved workspaces, results, T/S or data files in directories of your choice, click the appropriate button on the left to activate the file extension and then search for the directory where the files are located.

Warning! Deletion of files is permanent and they cannot be recovered. Exercise caution when deleting files, especially with extensions .txt or .asc, as they may be not related to DLPAL. By using this tool you confirm that no one associated with the development and sales of DLPAL will be held responsible for files deleted when using this tool.

Merging Search Workspace Results

This function is very useful especially when combining different results files from multiple instances or runs of the program. Click Search Workspace under Results files, go to the directory where the results files to merge are located and mark the one to merge:



Click "Merge Files" and specify a name for the merged results:



Click Save to complete the operation







Top




Data File Test


Data File Test

From the main program menu click Tools and then Data File Test:





You can use the Data File Test tool to check for errors in data files such as:

1. Bad format
2. Open and/or Close outside High-Low range
3. High less than Low
4. Zero values
5. Change in Open, High, Low or Close larger than 40% from the previous bar

A list of all files in the default DATA directory is first displayed but you can select any directory you like by doublecking it. You can select the files to test by marking the box next to them or you can have all files tested by marking Select All.

Note: The errors reported on the screen are also saved in a text file called Errors.log which can be found in the default Results directory.


Top




Data Partition


Data Partition

From the main program menu click Tools and then Data Partition:



You can use this tool to create in-sample and out-of-sample files from original data files. This tool greatly simplifies data partition for single or multiple files at a single click. Just select the source directory and the parent target directories for in-sample and out-of-sample as well as the date that separates the two samples and the tool does the rest. The in-sample and out-of-sample directories are automatically created if they do not exist and are named Insample and Oosample, respectively.



For proper operation of the tool you must select the source directory and mark the file(s) you want to include in the partition and the parent target directories for the in-sample and the out-of-sample. All files in a directory can be partitioned by checking the Select All box. You may elect to create only an in-sample file or only an out-of-sample file or both. The date that separates the samples must be defined in the appropriate box. In the following example, fourfiles are marked (DIA, QQQ, TLT and SPY) from which to generate an in-sample and out-of-sample files. The out-of-sample in all of the files will start after 20100101:



After clicking Create, the following message is generated:



After clicking OK the directories are refreshed with the new sub-directories and files:



Note: The Create button becomes inactive after samples are created to prevent any errors from repeated operation. The tool must be closed and reloaded to create new file samples.

Hint: You can create in-samples of in-samples and out-of-samples of out-of-samples or insamples-of out-of-samples and out-of-samples of in-samples, or any other combination,  by specifying the proper parent directories.

Warning! Be careful when using this tool as files are overwritten and older files cannot be retrieved. By using this tool you confirm that no one associated with the development and sales of DLPAL will be held responsible for any files deleted when using this tool.


Top




Win Rate Calculator


Win Rate Calculator

From the main program menu click Tools and then Win Rate Calculator



Input the value for the desired profit factor and the values of the profit target, stop-loss and then click Calculate to see the approximate value of the win rate.



The equation for the win rate as a function of the profit factor and ratio of average winning to average losing trade is the following:

P = 100 x PF/(PF + Rwl)

where P is the win rate, PF is the profit factor (equal to sum of winning trades divided by the sum of losing trades) and Rwl the average winning to average losing trade. A modified formula is used in the Win Rate Calculator as follows:

Pa = 100 x PF/[PF + k x (T/S)]

where Pa is the approximate win rate, T is the profit target, S the stop-loss and k is a factor that accounts for trading friction, set at 0.75 in the formula. In the case of short-term strategies, the theoretical and approximate values of the win rate are close for k=0 (no trading friction), provided a sufficiently large sample of trades is available.

You can access the Win Rate Calculator while creating a search workspace in order to determine the appropriate value for this parameter. The profit target T and stop-loss S can be specified either as percentages of the entry price or increments added to the entry price (points) and must correspond to the values specified in the T/S file. If the T/S file contains multiple sets of profit target/stop-loss values, then the maximum value for the calculated win rate must be used.

Note: Local Regional Settings are overwritten with English Regional Settings conventions. Use "."  for the decimal point.

Warning: T and S must be both specified as percentages or increments (points). Mixed values (one specified as percent and the other as increment) may give misleading figures for the win rate.


Top




Position Size Calculator


Position Size Calculator

From the main program menu click Tools and then Position Size  Calculator:



The calculator determines the number of shares for given trading capital value, risk percent per trade and stop-loss value either in points or as a percentage of the entry price. The calculation requires the approximate entry price in the case of percent stop-loss. Results are rounded to the next integer value.

This is an example of number of shares calculation for a 100K account, 2.75% risk per trade and 2 points stop-loss. The entry price is $52.50.



This is an example of number of shares calculation for a 100K account, 2% risk per trade and 4% stop-loss. The entry price is $25.



The equations used are as follows:

For stop-loss in points:  N = (R x M)/(100 x SL)

where N is the number of shares, R is the risk percent per trade (fixed), M is the trading capital and SL the stop-loss in points.

For stop-loss percent: N = (R x M)/(SL x P)

where N is the number of shares, R is the risk percent per trade (fixed), M is the capital at risk, SL the stop-loss as a percentage of the entry price and P the approximate entry price.

Allowable shares = M/P

Note: the calculator can be used in the case of contracts (futures or Forex) provided that the stop-loss corresponds to the amount at risk





Top




Price Series Statistics


Price Series Statistics

From the main program menu click Tools and then Price Series Statistics:



Select a price series from a data directory in proper format:



Click Open and then Calculate Statistics:



The calculated statistics include the following:

Start date of the series, End date of the Series, Number of bars in the series, Mean value based on the closing prices, the minimum price, the maximum price, the date of the minimum price, the date of the maximum price, the number of up bars, the number of down bars, the percent change from the first to the last date and the change in points.

The price line chart of closing values also shows horizontal line at the mean closing value.

To Zoom a chart area, hold the left mouse button and draw a rectangle around selected area. To restore the zoom, drag a rectangle in the opposite direction (up/left)

The chart of arithmetic returns plotted on the bottom are calculated at each bar n as follows: Return[n] = 100 x (C[n]/C[n-1] - 1)

The first differences are calculated as the difference C[n] - C[n-1]

Below the chart of percent arithmetic returns the statistics displayed include the mean value, the standard deviation and the percentage of returns that fall within two standard deviations of the man.

Use of Price Series Statistics

This tool may be used to determine the proper values of the target and stop-loss to use in search. Normally the stop-loss must be outside the range of the 1-bar volatility range in order to avoid hitting it too often and the profit target must be inside that range. In the above example it appears that the percent stop-loss should be larger than 2.33% to avoid hitting the stop on the same day, on the average:

In the GBPUSD example below it is more appropriate to use the first differences because they correspond to pips. This analysis suggests that the stop-loss values should be larger than 200 pips:



This tool may also be used with intraday data after they are properly converted in DLPAL format. Below is an example from 30-minute EURUSD data:



In this case the statistics for first differences indicate that 94.96% of all first differences fall within -0.0024 and +0.0024, or 24 pips. This may be used as a starting value for the stop-loss,

Warning: Descriptive statistics such as the mean and standard deviation do not always reflect market risks due to tail events. Please read the Disclaimer included in this manual before the program.


Top




Random Trading Simulation


Random Trading Simulation

This tool can be used to get an estimate of the significance of the performance of a strategy or a system of strategies. The test statistic is the net return. This is accomplished via a simulation of a large number of random traders that go long at the close of a bar, daily or intraday, when the result of a coin toss is heads and exit and reverse when the result is tails. The distribution of the returns of the random traders allows ranking the return of the system under study.

From the main program menu click Tools and then Random Trading Simulation:



Select a price series in proper format:



Click open to select the price series. In this example, a data file with continuous daily data for the E-mini futures contract is selected. Click Run to start the simulation:



The following parameter values must be specified for a proper simulation:

Margin per contract : In the case of futures contracts this is the initial or intraday margin requirement in dollars per contract. In the case of forex pairs this is the margin value as determined by leverage. For example, if leverage is 50:1 and the standard lot has a value of $100,000, the margin is $2,000. The default value is 0.

Big Point Value BPV: The dollar value of a full point of price movement. In the case of stocks this number is equal to 1. In the case of futures it varies. For the E-mini futures contract a full point corresponds to $50. In the case of forex the BPV is in most cases $100,000. The default value is 1.0.

Comm: The commission per share/contract per side in dollars. For stocks this will be in cents per share and for futures and forex in dollars per contract. This value may be increased to include slippage.

No. of simulation runs: The number of random traders to be simulated. The net return of all those traders will be used to plot a histogram. At least 10,000 runs are recommended but this may be unrealistic when there are many bars in a file, especially in the case of intraday data. The default value is 20,000.

Capital: The initial capital for each simulated trader. In the case of stocks this is the capital that is used to calculate the number of shares. In the case of futures and forex this is the capital per one contract. The default value is $100,000

Test: A return value to test for significance. The default is 10%. This is typically the net return of the system or strategy we want to test.

Long only: When this option is checked only long positions will be taken by the random traders.

Short only: When this option is checked only short positions will be taken by the random traders.

Bias: the bias of the coin used to generate the entries and exits of the random traders. When Bias is 0 (default value) the coin is fair and long and short signals have the same probability. In this case the average holding period of trades is 1 bar. The maximum value of the Bias is +100 and this will make long trades last longer as it corresponds to a probability of heads of 0.99 instead of 0.5. The minimum is -100 and corresponds to a probability of heads of 0.01 and thus making short trades last longer. The average holding period of the trends will vary but it is approximately equal to the Bias value.

Futures/forex: This box must be marked when simulating random traders on futures or forex data otherwise the results will not make any sense.

Cumulative P/L (equities): When this box is marked position size is determined based on the available closed equity. Otherwise position size is determined based on the amount specified in the Capital field. This option applies only to equities.

Results

The price series is plotted on the top chart and the histogram of the returns of the random traders is shown on the bottom along with the following parameters and statistics:

Start date is the start date of the price series

End date is the end date of the price series

Buy and hold return: The buy and hold return is calculated based on the starting and ending closing prices in the case of stocks and starting and ending equity values in the case of forex and futures.

Min.  return: The minimum net return generated by a random trader during the simulation

Max. Return: The maximum net return generated by a random trader during the simulation

Mean return: The mean of the returns

St. dev. of returns: The standard deviation of the returns

Kurtosis: The kurtosis of the returns. Note: if the kurtosis cannot be calculated try changing the number of simulation.

Skewness: The skewness of the returns. Note: if the skewness cannot be calculated try changing the number of simulation.

Significance level: This is the percentage of random traders with a higher return than the Test return.  Normally this number should be as low as possible (see warning at the end.)

p-value: The probability of obtaining a return as extreme as the Test return given the hypothesis that the return was drawn from a distribution with 0 mean. Normally this number should be as close to 0 as possible (see warning at the end).

MIn. significant return: This is the minimum return for a significance level of 5% and a p-value of 0.05.

Positive returns: This is the percentage of positive net returns in the simulation.

Above buy and hold: This is the percentage of returns above buy and hold return.

Stopped: This is the percentage of traders that were stopped. In the case of stocks this occurs when there is not enough equity to buy 1 share. In the case of futures/forex this occurs when the equity drops below the margin value.

Ruined: This is the number of traders ruined because the equity does not suffice to buy any shares or it turns negative, as in the case of stocks, or it drops below 95% of initial capital in the case of future/forex even if margin is still adequate.

In the previous example of the E-mini futures contract it may be seen that the 100% test return in the simulation period shown is significant with p-value of 0.0026. Below is an example for SPY since inception:



In this case the test return of 100% is significant at tabout the 2% level. No traders managed to produce a return above buy and hold and this shows the difficulty in matching long-term buy and hold performance of stocks and possibly the reason that so few funds and advisers succeed in that. Only 13.07% of tarders had positive performance and this shows that in an upwardly biased market taking short positions is detrimental to performance. This can be further explored with this tool is the same simulation is repeated with long-only traders:



It may be seen that in this case 94.31% of the random traders profit but the minimum return for significance increases to about 156%, meaning that random long-only position trading would have to generate a return avove that level to reject the hypothesis that they are random at the 5% level. 

Notes:

- Outliers (values beyond 3 standard deviations from the mean) are not displayed in the histograms to avoid data clustering.

- Although this method of analyzing significance is based on simulations of random traders, it is also true that the market does not know when a system buys or sells whether the trades were generated by an algorithm or a coin toss. Many of the trade sequences generated by algorithms on actual data will match or be very similar to those generated by a coin toss. This is especially true in the case of intraday and short-term trading traders.
Warning: Highly curve-fitted systems will always rank high on in-sample data and related tests are useless. The ranking must be performed in an out-of-sample or forward sample. If the system ranks too low on unseen data, then it is either a highly curve-fitted or a non-intelligent system, or both. However, even this method of analyzing the significance of trading system performance is subject to data-mining bias if the data are used multiple times to develop system because eventually one that ranks high by chance may be found. Therefore, this method must be supplemented by other methods that reduce data-mining bias.


Top




Searching for  Strategies Across Multiple Instruments


Searching for Strategies Across Multiple Instruments

DLPAL allows searching for strategies that are profitable across a number of instruments, also called "common strategies" in the software. This feature provides another powerful validation method in the sense that the significance of strategies that are profitable across several instruments is higher. This is true due to the fact that common strategies perform well not only with one instrument - something that can be the result of selection bias - but across many instruments and as a result any selection bias is reduced as a function of the number of the instruments involved.

How it works

Checking the option Common Features Only instructs the program to look for strategies in each instrument on the workspace that are also profitable in all other instruments. When the program finds a strategy in one instrument that satisfies the criteria set on the workspace, it also backtests its performance in all other instruments using the parameters of the original instrument (target, stop, etc.). If in all cases the profit factor calculated isgreater than the minimum profit factor for common strategies (default is 1.00) then the strategy is reported in the results. DLPAL allows specifying the Minimum Common % for common strategies. If it is set to 100, each common strategy must have the minimum profit factor specified. This value can be set to anything between 0 and 100. For example, if the value is set to 75, then all common strategies reported will have the minimum profit factor in at least 75% of the instruments tested.)

Example: Identifying profitable strategies across FANG (FB, AMZN, NFLX, GOOG) stocks .The search workspace setup is shown below:



The results for common strategies are shown below. In this case, 104 strategies were found:



Notes:

(1) The chances of finding common strategies decreases with the number of instruments and the Common Profit Factor value are increased. 
(2) When this option is selected, all data files on the workspace must have the same point value in the case point stops are used. For example, when using currency pairs with point stops (pips), EURUSD and USDJPY have different point values. These must be adjusted in the historical file before the search for common strategies so that a point stop of 0.01 in EURUSD (100 pips), for example, also corresponds to the same number of pips in USDJPY.
(3) Checking the option Common for first line only will  find common features for the symbol in first search line only.


Top




Creating workspaces for multiple searches


Creating workspaces for multiple searches

The multiple search lines on a search workspace can be used to create multiple searches for the same or different data files with different parameters. Different search lines may be created to with a different mix of the following:

1.        T/S files with different profit-target and stop-loss objectives
2.        Percentage or point profit-targets and stop-losses
3.        Different criteria for the success rate, minimum trades and maximum consecutive losers.
4.        Different trade input points (Open or Close) and delay ranges
5.     Different data files



Each line is created separately. The Test Sample Size, Common Features Only, Common Profit Factor and Maximum Common % options are the same for all search lines and are not saved.

Tip: A single Search Workspace may be created to contain all markets of interest and associated parameters. The multiple search may be executed regularly, for example every six months, to reflect the new data and the results may be used to update systems added to system tracking or their code in other platforms.


Top




Creating trading systems using grouping methods


Creating systems using grouping methods

Systems developed by grouping strategies may exhibit some very interesting properties. Each individual strategy or a group of strategies can be considered as a sub-system. There are many different ways the grouping can take place, depending on any common characteristics of the strategies involved. Different sub-groups can be grouped to form new groups, and so on. The possibilities are endless.

The practical implications from this property of strategies developed by DLPAL are many and allow increased flexibility in managing trading risk, among other things. For example, one possible grouping may be based on the maximum number of consecutive losers, as follows:

Group 1: Based on maximum consecutive losers

Sub-group 1:   Strategies with less than 2 consecutive losers
Sub-group 2:   Strategies with less than 4 but more than 1 consecutive losers
Sub-group 3:   Strategies with less than 6 but more than 3 consecutive losers

The above grouping may be called a CL Group (Consecutive Losers Group.  Another possible grouping is by profit target and stop-loss level:

Group 2: Based on profit target and stop-loss

Sub-group 1: Strategies with profit target less or equal to 2%
Sub-group 2: Strategies with profit target greater than 2%
Sub-group 3: Strategies with stop-loss less or equal 4%
Sub-group 4: Strategies with stop-loss greater to 4%

The above may be called a Profit and Loss Grouping (PLG).

Groups may not be mutually exclusive, i.e., members of one group can be also members of another.

Grouping and sub-grouping allow increased flexibility in managing trading risk.


Top




Using multiple trading signals effectively


Using multiple trading signals effectively

Systems based on DLPAL strategies generate signals in numbers proportional to the number of strategies involved. The more strategies present in a system, the more trading signals are generated. One may define three different types of trading signals:

1.  Signals indicating a position in the opposite direction of an already open position
2.  Signals indicating a position in the same direction of an already open position
3.  Signals that occur at exactly the same time all indicating a position in the same direction

Type 1 above can be handled by closing the open position. A riskier approach is to reverse position, by closing the open position and initiating a new one in the opposite direction.

Types 2 and 3 give rise to some interesting properties of strategies based trading systems and provide flexibility in managing the size of a position and its risk.

Successive are called signals with open positions that do not overlap. A new trading signal comes after the position of the previous signal is closed by either hitting a profit target or a stop-loss.

Coincident are called signals with overlapping open positions. A new trading signal indicates a position in the same direction of an already open position.

Clustered are called signals that are generated simultaneously and all in the same direction. Each trading signal in the cluster may have a different profit target and stops-loss.

There are several ways one can deal with the different types of strategies and take advantage of multiple trading signals:

A.  Ignore coincident signals. This is the simplest way of using systems based on DLPAL strategies. Whenever a signal is generated in the same direction with that of an already open position, that signal is ignored.

B.  Use coincident signals to increase position size.

C.  Use coincident signals to move the stops-loss/profit-targets. This is a useful application of coincident signals. When a coincident signal arrives, it may be used to move a stop-loss to a new level, in accordance with the new signal entry price. The same applies to the profit target.

D.  Use of clustered signals for confirmation. When clusters of trading signals are generated, they can be interpreted as either a confirmation of an existing position or as a new position with increased probability of success.


Top




Using Trade Input Delay


Using Trade Input Delay
Strategies with a trade input delay are often useful in short-term trading because the delay  can act as a filter of price corrections. DLPAL determines the best value of the delay for the strategies it discovers based on the range of values specified by the user. With the delay option activated, often more strategies that satisfy the performance criteria set in the search workspace can be found. If a delay is not used, some strategies may suffer an immediate correction after forming and generate more losers than winners due to profit taking. The delay often acts as a filter to corrections, allowing prices to recover before a position is established and resulting in a higher profitability for a system.

When specifying a delay in a search workspace, the results may include strategies with and without delay. The following are recommended:

A. Using a delay in the range of 1 - 5

B. Creating separate models for strategies with and without delay and adding those to system tracking.

A. Using a delay slows down the search process because DLPAL must determine the historical performance of each candidate strategy for each value in the range specified for the delay.

B. Clicking the Trade On column label in search results workspace allows sorting strategies according to delay values. Different systems may be added to system tracking by selecting patterns with and without delay, or according to delay values. In the following example for GBPUSD, only strategies with delay 1 are selected to save and/or add to system tracking:



More information about strategies with a delay in trade input can be found in the introduction of this manual.


Top




Reducing Data-mining Bias


Reducing Data-mining Bias

Results obtained from machine learning are in many cases fitted to the price series. This is not bad in principle but it is often hard to differentiate the few potentially good systems from a very high number of random and curve-fitted ones. The data-mining bias introduced by the repeated use of an in-sample to search for profitable combinations of features and associated strategies almost guarantees that eventually some random system(s) will pass out-of-sample test(s) by luck alone. But when market conditions change and the over-fit is no longer in effect, then the performance of these system(s) deteriorates fast. Essentially, those who choose the best performer(s) out of a large number of candidates that result from the repeated use of an in-sample are often fooled by randomness and data-mining bias.

Below are some criteria one can use to minimize the possibility of a random system due to selection and data-mining biases:

(1) The underline process that generated the equity curve must be deterministic. If randomness and stochasticity are involved and each time the process runs the system with the best equity curve is different, then there is high probability that the process is not reliable or it is not based on sound principles. The justification for this is that it is impossible for a large number of edges to exist in a market and most of those systems must be flukes. DLPAL employs a unique deterministic machine learning algorithm and each time it uses the same data with same parameters it generates the same output.

(2) The system must be profitable in an out-of-sample for small profit target and stop-loss just outside 1-bar volatility range. If not, then the probability that the system possesses no intelligence in timing entries is very high. This is because a large class of exits, such as for example trailing stops, curve-fit performance to the price series. If market conditions change in the future the system will fail.

(3) The system must not involve indicators with parameters that can be optimized to get the final equity curve. If there are such parameters, then the data-mining bias increases due to the higher number of parameters involved making it extremely unlikely that the system possesses any intelligence because it is most probably fitted to the data.


(4) If results of an out-of-sample test are used to reset the machine learning process and to start a fresh run, data-snooping bias is introduced. In this case validation in an out-of-sample beyond the first run is useless because the out-of-sample has become already part of the in-sample. If an additional forward sample is used, then this reduces to the original in-sample design problem with the possibility of the performance in the forward sample obtained by chance.



Top




Disclaimer


Disclaimer

PLEASE READ CAREFULLY THE FOLLOWING DISCLAIMER

The trading strategies and systems developed using the Deep Learning Price Action Lab (DLPAL) software do not and cannot guarantee that you will make profits, or minimize losses of new or existing market positions. Any trading strategies or systems developed or included in the software are intended merely as examples and none is recommended. Note that results based upon hypothetical or historically-tests do not necessarily compare to results of actual trading. No hypothetical or historical trading record can completely account for all risk factors present in actual trading. There is no guarantee that any hypothetical or simulated trading results will produce comparable actual trading results. On the contrary, there are many known and unknown factors which may contribute to wide deviations between hypothetical and actual trading results, such as market liquidity and human emotions. Trading involves substantial risks, including possible loss of principal and other losses. The DLPAL software is designed to provide a training tool for trading system development. It is licensed to you with the understanding that its author of the program is not engaged in rendering any investment or other professional advice. If investment or other professional advice is required, a licensed professional should be consulted. No one, whether an employee, agent or representative of the author is authorized to provide any such advice, and any such advice, if given, is in violation of the author policy.

U.S. Government Required Disclaimer - Commodity Futures, Trading Commission Futures, Derivatives and Options trading has large potential rewards, but also large potential risk. You must be aware of the risks and be willing to accept them in order to invest in the futures and options markets. Don't trade with money you can't afford to lose. This is neither a solicitation nor an offer to Buy/Sell futures or options. The past performance of any trading system or methodology is not necessarily indicative of future results.

CFTC RULE 4.41 - HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT BEEN EXECUTED, THE RESULTS MAY HAVE UNDER-OR-OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY. SIMULATED TRADING PROGRAMS IN GENERAL ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFIT OR LOSSES SIMILAR TO THOSE SHOWN.



Top




References


References

For further reading you may consider the following book:




Date: 09/01/2015
Language: English
270+ pages (6? x 9? )
74 high quality charts 

http://www.priceactionlab.com/Blog/the-book/




Top




Contact information


Contact information


Web site: http://www.priceactionlab.com/





Top




Copyright notices


Copyright notices

© Copyright 2016 Tradingpatterns.com

Parts of this help file were developed with Shalom Help Maker

Get tour free copy here www.danish-shareware.dk/soft/shelpm/

The Software and its documentation contains registered and unregistered trademarks of Tradingpatterns.com and trade names of other companies. In certain cases, registrations therefof are pending.

Quantopian is a registered trademark of Quantopian

EasyLanguage® and Tradestation are registered trademark of TradeStation Technologies, Inc.

NinjaTrader is a trademark of NinjaTrader, LLC.

Amibroker is a trademark of Amibroker.com

Warning: This computer program is protected by copyright law and International treaties. Unauthorized reproduction or distribution of this program, or any portion of it, is strictly prohibited and may result in severe civil and criminal penalties.

Top


Disclaimer

Terms and Conditions

Privacy policy