How To Create And Test A Trading Strategy, Part II

by Mark Williams on January 29, 2009

In Part I of this series, we took a look at the beginning brainstorming phases of our project, to create and backtest our trading strategy. Today, we are going to take a look at fleshing out our ideas and making what we have easily available for us to code, OR have someone else code for us 😉

So, we have done our mindmap. Now, it is time to take that mindmap, and turn our idea from the abstract to the grounded — to give some order and guidance for our next step of the game.

Now, depending on the type of personality that you have you can do the following:

  • Either completely WRITE out your plan in detail, in ENGLISH (or whatever your native tongue is) or
  • Do a flowchart

Either way it goes, you are going to have to do BOTH to continue on, but you should choose between the above two methods to get you and your mind started (yes, I know the above was REALLY bad english syntax).

So, let’s again take my mindmapped example:

So taking the above mind map, here is my whole strategy:

My variables are:

  • Account Size
  • Shorter Volatility Period
  • Longer Volatility Period
  • Number of bars to look for to get in for trade
  • % of account to trade on each trade (little did I know that this one factor would have the LARGEST effect on my overall gains)

Current Bar is defined as the time frame that I am using per update period. For example, if I am using daily as my time period, then current bar is the daily time period. If I am using minutes, and I want to have bars representing 15 min segments, I can do that as well.

I will use the following formula every bar :

  • Volatility Adjusted Bar = (My number of bars to look at) X (Shorter Volatility / Longer Volatility)
  • Longer Volatility is equal to the Average True Range Moving average of the Longer Volatility Period
  • Shorter Volatility is equal to the Average True Range Moving Average of the Shorter Volatility Period

(Note: the more volatile the security, the more days I want to have to determine breakouts therefore, I am not whipsawed as much due to having periods of higher volatility)

  • If the HIGHEST HIGH of the current bar is greater than the HIGHEST HIGH of the “my number of bars to look at”, then I want to buy ie. GO LONG.
  • If the LOWEST LOW of the current bar is greater than the LOWEST LOW of the “my number of bars to look at”, then I want to GO SHORT.
  • If I GO LONG, or GO SHORT, here is my buying criteria:

Number of share to buy = (Account Size X percentage of account)/ (current price of security X margin, if any)

Of course if number of shares to buy is less than zero, then we are not going SHORT or LONG.

Finally once I am LONG, if the current bar is less than the LOWEST LOW of “my number of bars to look for” DIVIDED by 2, then I will sell.

If I am SHORT, if the current bar is greater than the HIGHEST HIGH of “my number of bars to look for” DIVIDED by 2, then I will buy back the security.

Once I am out, I will update my Account Size with the P/L.

So, now I have taken it from the abstract to the linear. If you gave this to most programmers, they should be able to handle it.

However, there is one more thing you need to do to make sure that you have all of your ducks in a row — to make sure everything flows very well.

FLOWCHART!!!

A flow chart is an easy way for whomever is doing the coding of the strategy get a handle on what it is that you want to accomplish.

So, how do you go about making one?

Well try here.

Gliffy is a FREE online flowcharting software.

Okay, it’s not EXACTLY free. If you want to make more than 10 FLOWCHARTS, then you have to pay, but it is not too bad of a service if your job requires you to make a lot of flowcharts for organization /plug 😉

Here is my first flowchart of my strategy:

So, now that both the written statement and flowchart are made it is coding time. Time to hire a programmer, or crack your knuckles, dig in and do it your self.

In Part III, I will show you the different routes to go through to hire quality programmers, and give you advice on how to do the coding yourself.

My personal advice? If you are NOT BROKE, hire a programmer.

If you are broke, hunker down, and learn the coding of the platform that you are working from.

You are going to learn very quickly, that when it comes to the online world, those without time had better have money, and those WITHOUT MONEY, had better have a lot of time.

I use Ninjatrader and Genesis Trade Navigator, and these are where my examples are going to come from.

Ninjatrader is free, BTW — as long as you are not going to use it to do your actually trading. Once you are ready to trade, then you have to pay.

However, for something that is free, it is VERY powerful.

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

{ 0 comments… add one now }

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site is using OpenAvatar based on

Disclaimer | Privacy Policy © 2007-2008 YouSuckAtTrading.Com All Rights Reserved.