listi.net

Listi.net

             


 Content for Scott Eric Kravatz > Hobbies > Software I've Developed >

Backtester



Webpage:http://Backtester.net - this was web address I was going to use.

Overview



This document is a brief introduction to the BackTester product.

BackTester is an investing tool that helps you:
  • Verify which strategies work and which don't
  • Make money by alerting you to strategies and stocks that have a higher potential for return
  • Help you test a trading idea that you may have
  • Shows you methods to turn a small amount of money into a huge amount
  • Find one trading strategy that could make you  rich
  • Verify strategies which you create to see if they work or some close relative works

    Background



    I started investing in the late 90's during the dot-com craze.   I would read Investor's Business Daily, watch CNBC, purchase investing books, but how did I know what the talking heads were saying was true? I also noticed that when you look a chart with technical analysis on it, it appears to work.  I ran a few tests using market data on the Yahoo website and found that there appeared to be misinformation being disseminated and the graphs did lie.  So I started developing a program to test this information.   I also wanted to see if I could "beat" the market.  The idea for Backtester was born.

    My first goal was to be able to download the data from Yahoo and be able to use it for my studies.  I developed a program called GetData.exe.  This program's purpose was to accept a request for data and download the data to a database that could be used by BackTester.

    I had a few missteps while developing the tool.  One time I thought I would be a millionaire, from a strategy I tested that appeared to perform very well.  It was very exciting to thing this, but low and behold a calculation mistake separated me from the big bucks.  I realized that any winning strategy had to be extensively verified before I would risk any money on the trade.  

    Three problems with BackTester:
    1. If it works, I won't sell it, I'll trade it and if it doesn't work, I can't actually sell it, quite a dilemma.
    2.  Some problems that conflict with BackTester is the EMH or the Efficient Market Hypothesis, which basically states that if there is any opportunity to make money in the market, then smart investors will find the opportunity and it eventually will no longer exist.
    3. While working at Instinet, I came to know a number of math experts who aren't trying to beat the market.  They have extensive experience with statistics and don't believe you can predict the market.

    Fundamental vs. Technical Analysis



    Fundamental analysis uses a companies "fundamentals" such as revenues, costs, profit margins, growth rates, intrinsic value to find undervalued stocks.  Technical analysis uses past price movement and market indicators and concepts such as support and resistance, and chart patterns such as "head and shoulders", "trend-lines", Volume/Price movement to predict the market.  I don't favor one method over the other but I do believe that they are really the same thing.  Both use the past to predict the future.   Technical analysis is easier to work with, but fundamental analysis can be codified just the same as long as you have the data to test against.  BackTester is based on the concept of finding patterns that work and using these patterns to give you an advantage.  Whether technical or fundamental, can the past data predict future performance?

    Does it work?



    I don't know.  I haven't made or lost a penny while working on the software, as I haven't traded it.  I feel it needs more testing.  In addition, I lost lots of money in the dot.com era in the stock market and I'm a little hesitant to risk any more money in it.  System also hasn't been optimized in any way, which I think could improve its performance, but could actually hinder performance.

    In forward testing currently has produced some interesting results.  The system, on October 13, 2003 is up an annualized rate of 23.9% and a total of 41.1% over 625 days.  There are three problems with this result.
    1. No transaction costs have been taken out of this return
    2. System uses end of day prices, which can be difficult to achieve and may not be easily incorporated into a trading model.
    3. There hasn't be any real world trading which could easily change what the system has accomplished.

    How does it work?



    At 6:30 PM every day the BackTester program starts automatically and runs in its "Pick and Post" (Pick stocks and Post to the Internet) mode.  Pick means it will manage a portfolio of 10  stocks.  The system was started with a 10 stock portfolio on Jan. 29, 2002, using a hypothetical $100,000  with 10 accounts funded with $10,000 each.  It uses the following algorithm:
    1. It selects stocks by first randomly selecting a stock from a universe  of stocks.
    2. It then applies any number of preprogrammed strategies on this stock by back testing it over some previous time period.
    3. If the return of the stock has performed better than some predetermined value using one of these strategies the stock is added to the portfolio with the closing price used and the purchase price and a hypothetical trade is made using the trading signal.  System can go short or long.
    4. If none of the strategies give the specified return then the stock isn't traded and system goes to step 1 again
    5. This process is continued until 10 stocks are selected
    6. These picks are then posted to the StockG.com website via automated FTP (http://www.StockG.com/TodaysPicks.htm) and a historical list of trades is maintained at (http://www.StockG.com/PreviousPicks.htm).  The information is converted to JavaScript code

    On day two through current day, the system does the following:
    1. It examines all open trades to see if there is a change in the trading signal.  If the trade was long and now a short signal is calculated, the system will close out the trade.
    2. This will continue for all 10 stocks.
    3. After this has taken place, there will be a number of accounts that have been closed out.  These accounts will have new stocks selected based on the algorithm above starting with step 1 by selecting a random stock.

    After all the stocks have been selected, the system analyzes 5 stocks that have been following with fixed trading strategies.  System also lists the trading signal (i.e. Sell if Nasdaq closes below 1509.23 on Thursday.)  System also posts statistics for the trades such as:
  • Stock Ticker
  • Stock Name
  • Annualized return
  • Total return
  • Current signal ( Long or short)
  • Date signal first occurred
  • Percent win/loss rate
  • Average win percent
  • Average loss percent
  • Average number of trades per year
  • What $100,000 would become
  • The buy and hold investor's:
  • Dollar return
  • Annualized return
  • Price that a signal reversal will occur if it can be calculated
  • A link to a page that has the hypothetical trades for the stock

    Where did the strategies that BackTester uses, for "Pick and Post" come from?



    BackTester has a back-testing mode.  The system in this mode will take a number of pre-specified strategies and back and forward test them bases on the following algorithm:
    1. BackTester randomly selects a date in the past and assumes it is the current date
    2. For each strategy, it
    2.1 Back-tests the strategy for a time period up to the randomly selected date
    2.2 Forward tests the strategy from the randomly selected date for some time period
    2.3 Records the results to determine what strategy best predicted a future return

    The resulting data will show which strategies have performed the best in the past.

    Where did the BackTester strategies used for Back-testing come from?



    BackTester allows you to test trading strategies quite easily.  Say you want to see how well an investment in Microsoft would have been had you traded it on the 40 day moving average.  The system can also find which of the moving averages would have performed the best over a specified time frame.

    What else can it do?



    Backtester Options



    While testing a strategy, there are a number of options that can be set.
  • Logging - you can specify what variables to log for additional analysis
  • 46 different variables
  • General Options
  • User Level
  • Back-testing
  • Number of years
  •   to go back
  • to back-test
  • to forward-test
  • Return before using the strategy
  • Max days from return high point
  • Strategies to test
  • Stock Universe
  • Minimum and Maximums
  • Volume
  • Spread
  • Market Cap
  • Price
  • P/B
  • P/E
  • Beta
  • Weekly Price Change
  • Volatility
  • Trading Options - Reflects information on broker to make trade with
  • Broker
  • Home page
  • User Id
  • Password
  • Commission information
  • Shares to trade
  • Round Lots (y/n)
  • Don't exceed % of volume
  • Use ADV for volume calculation (y/n)
  • Max % cash for long trades
  • Max % cash for short trades


    What is the status of BackTester?



  • Prototype is available
  • System's UI needs work
  • Error when installing on Windows XP

    What is left to do with the system?



  • I need to understand statistics better to help determine if my trading system works or is just a random fluke.
  • Run so system removes trading costs and makes its picks before the market close
  • More and better testing is needed for the system
  • An improved user interface is needed which was started but not completed
  • A business plan is needed
  • System needs to run faster
  • Do real world testing
  • System should be able to run across multiple PCs to help find strategies faster
  • Improved charting
  • Clean up of user interface

    Technical issues



  • System runs completely stand-alone with low operator intervention
        
  • FTP of data to the internet
  • User must register system


    blog comments powered by Disqus
  • Home

    Sign In
    Sign Up

    FAQ
    About
    Help
    Contact Us
    Terms and Conditions

    Tweet List

    Link to us