To automate or not to automate?

If you don't know where to start, start here! Don't be afraid to ask questions.

Moderator: moderators

alichambers
rank: 50+ posts
rank: 50+ posts
Posts: 79
Joined: Wed Nov 08, 2006 4:46 pm
Reputation: 0
Gender: Male

Postby alichambers » Thu Mar 06, 2008 4:36 pm

Hello,

My 2 pence (not cents, I'm British!) on this matter.

I started off by buying lots of trading eBooks and courses to "teach" me trading. Some were good, some not so good. However, I always wanted to create my own system that would run on autopilot, so I stuck in there, got in loads of screen time and slowly but surely, my own system started to come together.

I had a few variables/indicators at my choice (some I created myself), and wanted to compare how they backtested together to get an idea of which combination worked best. So not owning any charting software I did the following:

1. Wrote a backtest utility in Visual Basic - slow as a dog. Try # 1
2. Used Amibroker to write my backtester. Good software, but couldn't do what I really wanted.
3. Considered learning C++
4. Decided against C++, but found a language called Powerbasic. You write in BASIC, but it compiles to .exe - and it's darn fast

So...

1.5 yrs down the line, I now have a *very* powerful backtester utility that can run 500-1000 optimisations a second. It takes into account commissions, spreads (esp. for intraday scalping), limit orders, take profit orders, and does exactly what I want it to do! I am now in the process of using it to test out my ideas.

I recommend writing your own backtester. It's not difficult - just load the OHLC values into memory as an array and loop thru the array using pointers - or use excel. However, you will need to focus, as it has taken me the best part of 1 year. If you really want speed, convert all floating point values to long integers and perform your calculations on them (eg: GBPUSD 1.9005 becomes 19005) - Pentiums can rip through long integers, but FPs are much slower. My core buy-sell engine is so fast with Powerbasic and long integers, I reckon it beats commercial equivalents.

I'm a Medical Doctor an not a programmer by trade - and I managed to do it (although I am pretty handy with coding though :twisted: ). You can buy DLLs that calculate the indicators for you - or use Neoticker/Amibroker/Ninjatrader, whatever... and export the indicator values. Either way you need to do your own due diligence and backtesting, esp. if you are considering auto-trading.

Sorry, but I'm not offering the code around because it isn't "non-Alex" friendly at all - and I don't want to have to document the hundreds of routines in it and how they interlink. This is not me being awkward - just if you don't know what it's doing, it could really mess up for you.

I will keep you posted when backtested systems.

Hope that helps,
Alex

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

User avatar
eudamonia
rank: 500+ posts
rank: 500+ posts
Posts: 536
Joined: Thu Jun 15, 2006 9:50 pm
Reputation: 0
Location: Rocklin, CA
Real name: Edward Heming
Gender: Male
Contact:

Postby eudamonia » Thu Mar 06, 2008 9:31 pm

Alex,

Those are some great tips. Another thing to consider when you are optimizing is the ability to run some walk-forward testing with out of sample data. This will reduce curve fitting your results and the resultant anguish.

Keep in mind - if your system doesn't make any sense it probably won't survive. If you can't understand why it is doing something or why it should work then it probably won't. Even if it was statistically significant in the past.

In my opinion there are three ways to trade a market that work - 1) trend/breakout, 2) momentum reversal, 3) reversion to mean (i.e. arb). Lastly don't forget that you might have a great methodology (ie trend/breakout) but on the wrong market/timeframe (ie Daily eMini S&P 500).

Edward
Eudaimonia (pron.: you-die-moan-e-a) (Greek: εὐδαιμονία) is a classical Greek word commonly translated as 'happiness'. The less subjective "human flourishing" is often preferred as a translation.

alichambers
rank: 50+ posts
rank: 50+ posts
Posts: 79
Joined: Wed Nov 08, 2006 4:46 pm
Reputation: 0
Gender: Male

Postby alichambers » Fri Mar 07, 2008 10:45 am

Ed,

Thanks. For those who intend to write their own backtesters, I *really* recommend Powerbasic. It's just so fast - for example, it allows you to place a few long and FP type variables on the CPU registers directly (just by declaring the var with REGISTER varname as LONG or EXT). Now that's speed!

Anyway, back to trading systems...

I have found using Optimisations that the best fit "curves" usually involve long periods of small loss, then 1 or 2 massive gains. This is fine if you are just trading for a hobby.

However, I would like to trade for a living, so I will need cashflow. I am experimenting with a way of backtesting that I have invented called "Cashflow Optimisation". This optimises secondarily for largest gain, but primarily for regular and consistent profits. This should solve most problems associated with walk forward optimisations.

Of course, the debate always arises - just because it has worked in the past, it doesn't mean it will in the future. Agreed. If we could predict the future we'd all be billionaires. However, most decisions in life are based on future anticipation of previous events, so I don't see why trading will be any different, as long as the trading method is fairly sound.

I also think there are loads of different ways to trade a market. All you have to do, as Avery says, is to find a method that gives you the edge. My methods involve basic trend identification, buying on breakouts in the trend direction and a few extra things I have invented to (try!) and keep me out of reversals and ranging markets. I am not using them live yet, but manually eyeballing charts has proved to look good, so I intend to start testing soon then trading in the next few months.

In fact, writing a backtester from scratch is a great way to learn loads about the market itself - factoring in spreads, commissions, etc... However, it is not a substitute for spending time looking at price charts and trying to identify what is going on at any one point in time.

Cheers,
Alex

User avatar
michal.kreslik
rank: 1000+ posts
rank: 1000+ posts
Posts: 1047
Joined: Sat May 13, 2006 2:40 am
Reputation: 36
Location: Monte Carlo, Monaco
Real name: Michal Kreslik
Gender: Male

Postby michal.kreslik » Sat Mar 15, 2008 11:18 am

Ali,

I have written my own optimizer as well. There's simply no software in the world that works the way I need it to work. I have written it in C#.NET 3.5 and I'm loading data from MS SQL into it for testing. It's the millisecond precision data that I'm collecting on my servers as, once again, there is no data source in the world that delivers this precise tick by tick data. I've got hundreds of millions ticks in the SQL by now.

My optimizer is about 400x faster than the one in NeoTicker. Besides, the NeoTicker optimizer doesn't behave correctly under certain conditions and does not take the bid/ask spread into account, so for Forex testing it's virtually unusable.

Michal

Aldo
rank: <50 posts
rank: <50 posts
Posts: 18
Joined: Sun Feb 10, 2008 11:13 am
Reputation: 0
Gender: None specified

Postby Aldo » Thu Mar 27, 2008 1:33 am

As a brief update on my "quest" so far ... I've read a lot, I've written some code (NinjaTrader), and I've learned a lot more about both automated and discretionary trading (with minimal actual trading).

However, that being said ... I'm not sure I'm that much further forward, but I'm certainly more knowledgable. I have a few strategies I've written in Ninja as a learning process but I've yet to iron out all the code to see just how unprofitable they are in backtesting lol. (Yes I know it will be inaacurate, but it's a start)

I'm getting a bit frustrated with Ninja (inability to plot different timeframes/instruments mainly) so perhaps NeoTicker is the way forward. However, I'm somewhat reluctant to spend the money to purchase or lease NeoTicker along with a data feed (Just using OpenTick at the moment) until I can prove that this is a worthwhile exercise.

Either way, I'm determined to succeed (or too stubborn to quit). The main frustration at the moment is knowing what/where to focus my energies on and not being able to discuss ideas and strategy with a peer.

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

User avatar
eudamonia
rank: 500+ posts
rank: 500+ posts
Posts: 536
Joined: Thu Jun 15, 2006 9:50 pm
Reputation: 0
Location: Rocklin, CA
Real name: Edward Heming
Gender: Male
Contact:

Postby eudamonia » Thu Mar 27, 2008 2:58 pm

Aldo,

If you are patient enough you can collect free tick data from an MBT demo account and store that data in NeoTicker. Obviously you will have to collect the data in real time so it could take you a few months to get a decent inventory of tick data. Of course if all you need is minute data you can get 6 months of that right off the bat.

One of the very frustrating things for automated traders is that automated trading is like a secret society. Nobody who knows anything of substance is willing to share unless you can prove that you have something valuable to share with them. What this means is that if you are looking for help from other automated traders YOU will often be the most knowledgeable person in the room.

Now with that discouraging bit having been said, there are some fantastic resources at the NeoTicker forum. Bruce Devault in particular is an amazing trader and programmer.

If you are interested in discussing trading ideas and wish to keep them confidential feel free to drop me a PM. Although I don't autotrade (anymore) I can give you some pointers (on concepts not code) as I have tried nearly every trick in the book.

Edward
Eudaimonia (pron.: you-die-moan-e-a) (Greek: εὐδαιμονία) is a classical Greek word commonly translated as 'happiness'. The less subjective "human flourishing" is often preferred as a translation.

Aldo
rank: <50 posts
rank: <50 posts
Posts: 18
Joined: Sun Feb 10, 2008 11:13 am
Reputation: 0
Gender: None specified

Postby Aldo » Thu Mar 27, 2008 4:50 pm

Edward, Thanks again for taking the time to post, it's much appreciated and I may just take you up on that suggestion.

Cheers,
Allan

User avatar
eudamonia
rank: 500+ posts
rank: 500+ posts
Posts: 536
Joined: Thu Jun 15, 2006 9:50 pm
Reputation: 0
Location: Rocklin, CA
Real name: Edward Heming
Gender: Male
Contact:

Postby eudamonia » Fri Mar 28, 2008 10:32 pm

Allan,

MBT seems to have changed their policy and their demo data may not be reliable (doesn't affect me since I collect my data from a live account). Just wanted to pass this on since I had recommended using it before.

Edward
Eudaimonia (pron.: you-die-moan-e-a) (Greek: εὐδαιμονία) is a classical Greek word commonly translated as 'happiness'. The less subjective "human flourishing" is often preferred as a translation.

User avatar
michal.kreslik
rank: 1000+ posts
rank: 1000+ posts
Posts: 1047
Joined: Sat May 13, 2006 2:40 am
Reputation: 36
Location: Monte Carlo, Monaco
Real name: Michal Kreslik
Gender: Male

Postby michal.kreslik » Fri Mar 28, 2008 11:43 pm

eudamonia wrote:Allan,

MBT seems to have changed their policy and their demo data may not be reliable (doesn't affect me since I collect my data from a live account). Just wanted to pass this on since I had recommended using it before.

Edward


MBT/EFX demo data is different from the live data. The difference is not dramatic, though. The live data contains more price changes.

Also, you can't count on the live data being 100% fillable. If your order cannot be matched on the ECN, it gets taken out of ECN and sent out to some liquidity provider. During this process the liquidity provider might have already withdrawn that price so your order would get back to the ECN pool, still not being filled, but in the meantime the price on the ECN would match or even exceed your limit order level, because at the time when your order was travelling back and forth between the ECN and the liquidity provider, it was not technically present on ECN.

I agree to Ed concerning the secret society ring :) However, if you would discover the way on how to turn lead into gold, you would not be willing to share the exact formula neither I guess. It's the constant inner battle of being famous for what you've found and being rich/independent thanks to what you've found. I prefer the latter.

Michal

User avatar
eudamonia
rank: 500+ posts
rank: 500+ posts
Posts: 536
Joined: Thu Jun 15, 2006 9:50 pm
Reputation: 0
Location: Rocklin, CA
Real name: Edward Heming
Gender: Male
Contact:

Postby eudamonia » Sat Mar 29, 2008 5:59 am

Michal,

Thanks for those insights regarding the differences in the MBT/EFX demo data feed.

Also, I wasn't criticizing when saying that automated trading is like a secret society. Just pointing out that it is a difficult path to follow as much of the work must be done alone. Either you are too new to the path to be able to contribute or you know too much and you dare not share your secrets.

Edward
Eudaimonia (pron.: you-die-moan-e-a) (Greek: εὐδαιμονία) is a classical Greek word commonly translated as 'happiness'. The less subjective "human flourishing" is often preferred as a translation.

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.


Return to “beginners forum”