Modeling with Profit 8 and the SIP Indicators Part 2

January 31st, 2012 Comments off

This article describes the construction of a neural network system for trading the SP futures contract. The neural network modeling software used to construct the system is BioComp Profit 8. Profit 8 is based on BioComp Systems’ commercial Intellect 3.0 architecture. To be accurate, Intellect builds mesh models rather than neural network models. Mesh models are proprietary models that outperform both neural networks and state vector machines. The Profit 8 system described in Part 1 of Modeling with Profit 8 and the SIP Indicators stopped working due to a bug fix related to the R Squared Performance Metric that was used by the system.

The inputs to our models are the SIP indicators. The SIP indicators are published by Adaptive Trading Systems on a daily basis and are used for modeling the 3 to 15 trading day price trends of the SP futures contract. The SIP indicators include Buy Pressure, Sell Pressure, Net Pressure, High Buy Pressure, High Sell Pressure, Advancing Pressure and Declining Pressure. You can download the indicators by installing the ATS Mercury application that is available toward the bottom of the Trading Signals page. The indicator values are delayed by 1 trading day for non-subscribers.

Method:

Step 1. Adding the SIP Indicators to the Securities List

This step assumes that you have downloaded the SIP indicators to your computer. For further information on downloading the SIP indicators go to the Trading Signals page at AdaptiveTradingSystems.com.

Start Profit 8 and click on the Add Text File toolbar button to open the file selection dialog. Browse to the location of the SIP indicator text files and open the first file. The File Definition Dialog will then appear.

Step-1. Adding the SIP Indicators

Step-1. Adding the SIP Indicators

Click on the SIP indicator column name (in the example it is SIPAP) and click on the Close radio button in the Settings section. Click on Ok to finish adding the SIP indicator to the Securities list in Profit 8. Repeat this step for each of the SIP indicators.

Step 2. Adding the Data Series for Modeling

On the Data tab in Profit 8, double click on the security name of the data series that you are modeling. This example models the continuously linked non-adjusted SP futures contract data from Pinnacle Data Corp. Scroll down the list of securities until you see the the SIP indicators. Double click on each SIP indicator until they have all been added to the list of ‘Data to Use’.

Step 2. Adding the Data Series for Modeling

Step 2. Adding the Data Series for Modeling



Step 3. Setting the Data Import Dates

The most recent 2.5 years of data will held back for validating the models. This is referred to as the out-of-sample (OOS) period. To ensure that the last 2.5 years of data is not used, the end date for importing data is set to 07/15/2009.

Step 3. Setting the Data Import Dates

Step 3. Setting the Data Import Dates

The modeling end date of 07/15/2009 was chosen so that the modeling period overlaps the start of the ‘GFC period’ whilst providing for a reasonable amount of OOS data.

Step 4. Importing the Data

Click on the ‘Import Data’ toolbar button to import data from 07/01/1997 to 07/15/2009.

Step 4. Importing the Data

Step 4. Importing the Data



Step 5. Equity Engine Parameters

No transaction costs are applied in this example. Change the Slippage and Commission values to zero on the Equity Calculations tab.

Step 5. Equity Engine Parameters

Step 5. Equity Engine Parameters



Step 6. Setting the Trading Delay

Change the ‘Project the signal by’ to 1 to apply a trading delay of 1 bar. Signals generated on any given day are executed on the close of the next trading day when using a trading delay of 1 bar.

Step 6. Setting the Trading Delay

Step 6. Setting the Trading Delay



Step 7. Building the Predicted Series

The available inputs and predicted series used to build mesh models are defined on the Indicators tab in Profit 8. In this case, there is no need to modify the dates that optimizations are applied to because no optimizations will be run. Go to the Indicators tab and delete series SP.NON_VOLUME from the list of indicators. Apply the Ln() transform to series SP.NON_CLOSE, the transformed series will then appear at the bottom of the list of indicators.

Step 7. Building the Predicted Series

Step 7. Building the Predicted Series

Select the Ln(SP.NON_Close) series at the bottom of the list and apply the 1 period Chg transform. Making sure the same series is still selected, apply the 2 period Shift transform. This completes the construction of the target / predicted series. The target series represents an ideal trading signal. Profit 8 will attempt to predict this series using the SIP indicators as the model inputs.

Step 8. Nominating the Predicted Series

Select the Model Building tab and then select the newly constructed target series in the Indicators list. Click on the drop down menu above the Indicators list and select ‘Predicted’.

Step 8. Selecting the Predicted Series

Step 8. Selecting the Predicted Series



Step 9. Data Handling Settings

Change the modeling start date to 7/15/1997 and the modeling end date to 7/15/2009. Set the Modeling, Optimization and Selection percentages to 60, 20 and 20. Change the modeling parameters so that Random data points are used.

Step 9. Data Handling Settings

Step 9. Data Handling Settings



Step 10. Model Settings

The default Model Settings are used as pictured below.

Step 10. Model Settings

Step 10. Model Settings



Step 11. Performance Settings

The default Performance Settings are used as pictured below. Note that the Optimization Metric is set to Relative Accuracy. Use of the Relative Accuracy tends to result in systems with lower profit margins over the modeling period. However, use of the Relative Accuracy metric has a strong tendency to produce systems that are more robust post the modeling period. I spent a considerable amount of time comparing Profit 8 to other similar neural network and state vector machine software solutions and Profit 8 using the Relative Accuracy optimization metric was the clear winner.

Step 11. Performance Settings

Step 11. Performance Settings



Step 12. Start Modeling

Click on the Start Modeling button to begin the modeling process.

Step 12. Start Modeling

Step 12. Start Modeling

Check the Profit 8 status bar at the bottom left of the application window to see when model construction has completed.

Step 13. Change Import End Date

To view the performance of the system over the out-of-sample period the data importation dates need to be modified. Change the end date to the last date that you have SP data for.

Step 13. Change Import End Date

Step 13. Change Import End Date

After updating the end date, click on the Import Data toolbar button to import the data. The system will process the new data automatically.

Step 14. View the Results

Click on the Results tab to see the in-sample and out-of-sample performance. Finally, save the system if you haven’t done so already.

Step 14. View the Results

Step 14. View the Results

As a market timing model developer I like to see the shape of the equity curve and the percent of perfect trading statistic. The majority of people reading this article are probably wondering how many points the system hypothetically made over the OOS period. A total of 71 positions were taken over the OOS period. The first trade post the modeling end date was opened on 7/17/2009 and the last trade in the OOS period was closed on 1/17/2012. The net points made was 667.8. This equates to $33,390 if trading the ES contract and $166,950 if trading the SP contract. Note that these figures are not net of trading costs. To calculate the total hypothetical trading cost multiply your estimate of the cost per completed trade by 71 or the cost per side by 142.

What I like about this system is:
- The SIP indicators have been published daily with no in hind-sight adjustments for years.
- Absolutely no optimization of inputs is done.
- Absolutely no model ‘pruning’ post construction is required or done.
- The OOS period spans one of the most difficult trading periods to date.

What I don’t like about the system is:
- The percent of perfect over the in-sample and out-of-sample periods is a little on the low side.

Regards,

James
Developer of Trading Systems that Adapt

Performance Metrics Part VI – Sharpe Ratio

February 10th, 2011 Comments off

Part VI of the series of articles on trading system performance metrics describes the calculation of the Sharpe Ratio.

The Sharpe Ratio is calculated by subtracting the risk free rate from the compound annual growth rate and dividing the result by one standard deviation of the bar by bar returns. The risk free rate is a user defined equity engine setting. The one period standard deviation of log returns is initially calculated, annualized and converted to a nominal return to form the denominator. There is no need to take the risk free rate into account when calculating the denominator because it is constant in this implementation.

Formula / Pseudo Code:

    NominalStdDevReturns = e^(StdDevLogReturns x BarsPerYear ^ 0.5) – 1
    If (StdDevReturns != 0)
    {
        SharpeRatio = (CAGR – RiskFreeRate) / NominalStdDevReturns
    }
    Else
    {
        SharpeRatio = 0
    }

Example:

    Given,
        RiskFreeRate = 0.05
        StdDevLogReturns = 0.01092566
        CAGR = 0.27026727
    Compute the Sharpe Ratio,
        NominalStdDevReturns = e^( 0.01092566 x 252^0.5) – 1
        NominalStdDevReturns = 0.18938870
        SharpeRatio = (0.27026727 – 0.05) / 0.18938870
        SharpeRatio = 1.16304332

Regards,

James
Developer of Trading Systems that Adapt

Performance Metrics Part V – Compound Annual Growth Rate

January 6th, 2011 Comments off

Part V of the series of articles on trading system performance metrics describes the Compound Annual Growth Rate (CAGR) metric.

Compound Annual Growth Rate is calculated by accumulating the signal log returns over the lookback period, transforming the result to a nominal return and then calculating the corresponding annualized rate of return.

Formula / Pseudo Code:

    For (n = EndBar – LookbackPeriod + 1 To EndBar)
    {
        If (Signal(I& – 1)) > 0
            SignalSign = 1
        ElseIf (Signal(I& – 1) < 0)
            SignalSign& = -1
        Else
            SignalSign& = 0

        SumSignalLogReturns = SumSignalLogReturns + SignalSign * Log(Price(n) / Price(n - 1))
    }

    NbrYears = LookbackPeriod / BarsPerYear
    NominalReturn = e^SumSignalLogReturns - 1
    CAGR = (NominalReturn + 1) ^ (1 / NbrYears) - 1

Example:

    NominalReturn = 2.75 (275%)
    NbrYears = 5.88
    CAGR = (2.75 + 1) ^ (1 / 5.88) – 1
    CAGR = 0.25205776

A CAGR value of 0.25205776 is equivalent to a CAGR of 25.21% (rounded to 2 decimal places).

Regards,

James
Developer of Trading Systems that Adapt