I'm at step 0 regarding systems.

Discussion in 'Strategy Development' started by rainmonkey, May 29, 2011.

  1. Hello,

    I've been looking around to figure out how exactly to design, code/create, and backtest a trading system.
    However I noticed that most of the programs that allow you to backtest systems must be purchased such as MetaStock, Tradestation, TradingBlox, or the like.

    I'm not too concerned with automating the buying and selling aspect yet because I'm pretty sure I wouldn't trust a system I developed until I"ve actually used in in live trading.

    So basically my question is this:
    How do people get started in developing and testing their systems?

    If you could point me in the direction of a website, a free/open source program or something to that effect, it'd be greatly appreciated.

    Also, on another note, would it be feasible to learn Python and write a program to take in historical prices, run them through my set of rules and generate a report of trades made, average profit, loss, etc...?
    I'm looking to learn Python because I hear it is a relatively simple language to learn yet it is still powerful.

    I know I'm asking a lot, and I really appreciate any help that you can provide.

  2. Been designing strategies and backtesting on Ninjatrader now for a while, it was pretty easy to get started with the coding and backtesting etc.

    Now when I am trying to take the strategies live I have run into so much trouble with eg:
    -strategies dont sync properly or remember their positions and orders between crashes or restarts of either NT or TWS
    -Unreliable data originated from somewhere between TWS and NT resulting in wrong executions.
    -Weird, inexact and unreliable behavior in general

    So I have started seriously looking at Multicharts.
  3. The easiest to start with would probably be Sierra Charts. They have a "WORKSHEET SYSTEM FOR TRADING" which is designed around excel. So if you know basic excel functions such as

    = AND ( A2 > 6 , A4 < 5 )

    you should be ok. Although, very easy to learn.

    They also have C++.

    I have to warn you though. After putting years of my life into this I am very weary of most system design applications.

    The parts you will probably not be estimating correctly is slippage, commission costs etc. These will take any profitable program and turn it upside down.

    There are also only a million small details that will come to haunt you when you turn your system "live".

    Good luck either way. IMO, I wouldn't risk a dime until you have had multiple years of design under your belt.
  4. PHP combined with a MySQL Database is an extremely easy way to develop a back-testing framework. It is also a very effective way to mine data, something that you really can't effectively do in the commercial platforms. The biggest advantage is that this method allows the numbers to speak for themselves, not letting the charts get in the way. Not to mention the speed of development and testing.

    Create functions for the strategies and use variables for inputs on all aspects possible. With the database, you can test multiple symbols in seconds.

    I haven't looked at Python, but it is probably easy as well.

    Are you looking to back-test Intra-day strategies or Holding Positions for longer periods of time?

    If you are looking for intra-day, you can just read the file. If you have a lot of data, this may take a bit longer - (however, nowhere near as long as any commercial platform), but you can setup the PHP on your local server not to time out. You will also want to use CHROME as your browser! Especially if you are going to print the trades to the page.

    Good Luck!
  5. try googling something like "free software for building and testing trading strategies", there may be some simple freeware apps to get started
  6. trhudson,

    This is really new to me, I've never heard of using SQL and php for a trading system.
    I was digging around a bit and I found a tutorial, but I'm under the impression that following it requires a good deal of technical know how when it comes to setting up and running an sql server. I know virtually no code and was just wondering how efficient this solution would really be.

    Let me know if the following are what I would need to do to set this stuff up:
    1. learn SQL and how to run, maintain and customize an sql server. (does this mean i need to purchase the sql software too?)
    2. import/upload data downloaded from yahoo finance or google finance (open, close, high, low, etc...)
    3. learn php to write a script to process data


    Oh, and to answer your question, I'm not looking to day trade, I'm looking to test systems for trend following.
    And yes, I'm a chrome convert :p

  7. I am using PHP / MySQL for research and testing, not order placement.

    If you are going to learn a language, learn something useful.
    I have tried all software platforms. I can code, and all software packages had their downfalls and they all focus on technical analysis. This is fine, but they can't mine data and find probabilities of things occurring. That is where they all fail. Not to mention, they are SLOW! In PHP you can test 40 years of data in SECONDS, not minutes. You can change your inputs in forms, not in the code.

    Once you get used to testing with PHP, you won't go back to any commercial software. Unless you need it to trade for you. However, with PHP you can extrapolate your entry / profit / stop before it happens and you could enter the orders pre-market or as MOC orders, if you needed to.

    I discovered the process while looking for ways to back-test Larry Connors ETF strategies in two books that he wrote. I developed the pages in just a few days, added a graph and all the statistics and I can get the results in 20 seconds for almost any of his strategies. Better yet, I can extrapolate the entries and exits based on current prices.


    Download XAMPP and install it. It comes with PHP / MySQL.
    All you will need to do is get the data into the database with SQL.

    Where ever you want to get it from...and there is plenty of software available to do this. XAMPP comes with PHPMyAdmin and it's a database administrator...easy to use.
    Yes, and this is not really that difficult.

    I have quite a few technical indicators already written as functions in php and am working on others. While I don't use them, someone will want them.

  8. Another popular option for getting started without risking capital is to use Daily Summary data (Open, High, Low, Close, Volume, and Open Interest) in Excel. It may not be pretty or have gobs of pre-built, other people's ideas, but it is easy and has a short learning curve.

    Matlab is also a good choice for those with an Engineering/Scientific background.

    I have written order management and commercial back testing packages. All products target a way of trading and have limitations. They upside is that it is pretty easy to start with your friend's trading strategy. The downside is that it isn't your trading strategy.
  9. Excel is not even an option if you want to test across a lot of symbols. With today's tools, it would almost be a waste of time. With a PHP / MySQL platform you already have the data, you just process it and you can do it on any symbol in your database - in seconds. With excel, you have to load the data and keep up with numerous spreadsheets. In excel, there is likely to be an enormous amount of redundant code. As well as many worksheets to sort through.

    The variables could be adjustable in excel, but this could be very tricky. However, this is hardly even a comparison to developing a form for variable and strategy entry as inputs and passing that to a PHP page and getting the results in seconds.

    Lets suppose you want to test for a condition that exists above an X day moving average...in excel this is a bit tricky, in PHP, you can enter X in a form, create a function to test for the MA condition, select your other conditions and it's done. Lets say you want to test for a different MA, just enter the number...it's much more convenient than anything commercially available. Same thing for all other indicators, enter your parameters in a form (as long as there is a function for the indicator), press submit and let the code do the work.

    Most commercial applications were developed for discretionary traders, this is evident with such an enormous dependence on charts. The problem with the charts are two-fold:

    1. When you look at them, you are usually looking for something specifically. This is not a stage of discovery, which is what you could refer to as data-mining. While many will disagree, data-mining when used properly is the process of finding out what has a probability of occurrence.
    2. The charts are a bit confusing and what you think you see, really isn't there. Most people are looking for the big moves and they overlook all the times they would have lost with the small moves. There is too much human intervention in the discovery phase using charts as opposed to pure price-action based data-mining.

    Not certain if anyone that trades them, but lets suppose you are interested in trading off Pivot Points. This is an extremely easy calculation. Before you trade intra-day, wouldn't you want to know what the probability of a stock trading and closing above or below the pivot is? Is there a 50/50 chance? Wouldn't this be the first place to start?

    The case is the exact same with the ACD Methodology from Mark Fisher...find out first what the likelihood of the event happening, then move into trying to develop a strategy to make it profitable.

    I was quite amused late last week when I read in THESE forums that someone mentioned they had 5 years of data for testing. One response said that with that much data, you can back-test 2 years and walk forward 3. WTF? Are the people here really this STUPID? Back-testing is NOT walking backwards in time. It is going back in time and walking forward.
  10. gianno


    You will be wasting your time and end up with nothing of value. System Writer Plus was invented in 1987 by a company called Omega Research, nowadays called Tradestation Technologies. I think the price was about 2K then. This is probably close to 15K in today's money after what Bernanke has done to debase the USD.

    Using that program and others that came after it like Trading Blox and Metastock, to name a few titles, traders were able to extract every possible edge that can be extracted by backtesting.

    Now, you come and you want to go back 30 years in the past, and use excel or some free tools that everyone else is using, I mean hundreds of thousands like you who have no money to spend and think that putting 0, I mean zip, down, can make them money.

    Learn this simple mathematical fact, you will need it in your life:

    0 x N = 0

    where N is any number > 0

    This is what traders use nowadays and it may not even be enough:


    Good luck, you will need it:)
    #10     Jun 3, 2011