# (Semi-) Automated trading systems



## FlyingFox (25 May 2013)

I was wondering if anyone uses an automated trading system? In another thread there was a mention that futures and forex are the best suited instruments for such trading strategies. Are there any others?

I am thinking of putting together a system. This will be more of an exercise that forces me to learn more about the markets. Not sure which instrument to target. I will be building it from the ground up.


----------



## Lone Wolf (26 May 2013)

I'm no expert in the field so hopefully others with more experience will chime in for you.



FlyingFox said:


> In another thread there was a mention that futures and forex are the best suited instruments for such trading strategies. Are there any others?




Did they say that automated systems do best on futures and forex? Or that futures and forex are best traded using an automated system? 

Brokerage on equities would be the killer. Compared to equities, futures/forex have more price movement and much lower brokerage. So they are your best options for an automated system.

Your best option for forex is probably Metatrader. MT4 being the one that is most commonly used and there are heaps of code examples out there for it. MT5 is more recent, but I believe the code is incompatible with MT4. I'm not sure how well MT5 has been adopted by the community, my impression is that people are still hanging on to MT4.

If you've never seen MT4, many brokers out there offer demo accounts where you can trade with live data with a sim account. So the platform is free, the data is live and free. You can write strategies for it in MetaQuotes Language (MQL) and set them to auto trade.

MQL is quite complex (I believe it's based on C++, might be wrong). But how hard you personally find it will depend on your previous coding experience.

One advantage of MT4 would be that most MT4 brokers allow you to trade very small lot sizes. So when if comes time to take your first step into live trading, you can run it on a real account with low risk.

For futures I'd recommend MultiCharts. There are two versions. The standard one that uses "easy language" a simple programming language. You can down load a free trial, but I don't think there is a free full version available.

The second version of MultiCharts is ".NET". With the .NET version you program in either C# or Visual Basic. So if you already know a .NET language then that would be a good solution. If you have no programming background or interest in programming, then learning C# just to write a trading strategy would be a waste of your time in my opinion. The .NET version is also available as a free "Starter Edition" which is limited to two symbols at a time in the database.

NinjaTrader is free and is also C# (but code in NinjaTrader still isn't compatible with code in MultiCharts .NET). I have heard talk about NinjaTrader being unsuitable for running automated strategies. But I have never looked into it so don't take my word on it. I do believe that NT has a pretty user friendly strategy development utility. So you might be able to test ideas in NT, then pay to have them written up in another language if needed.

Data for futures is not free. NinjaTrader has a market replay option where you can download historical intraday data from their server and play it back. This is as close to free data as I've found. Otherwise you'll need to sign up with a broker and use their data, AMP futures with CQG data for example. Or pay for data from eSignal or IQFeed.

Beyond that there are a host of issues once you get to the live trading stage. You need a reliable PC with a reliable internet connection and a way to mitigate the risk of hardware/software/data failure. A big concern if you were intending to run it overnight while you sleep.

It all might sound a bit complicated, and it kind of is. But it's true that you can learn a great deal about what works (or more like what doesn't work) from backtesting strategy ideas.


----------



## FlyingFox (26 May 2013)

Lone Wolf said:


> I'm no expert in the field so hopefully others with more experience will chime in for you.
> 
> 
> 
> Did they say that automated systems do best on futures and forex? Or that futures and forex are best traded using an automated system?




Thanks for the reply, it is quite helpful. I believe it was the later or rather futures and forex are most suited for automatic systems. 



Lone Wolf said:


> Brokerage on equities would be the killer. Compared to equities, futures/forex have more price movement and much lower brokerage. So they are your best options for an automated system.




I don't necessarily want to make an intraday trading system (although this one of the possibilities) but rather explore possibilities. In this case the equities are not out of the question. Obviously both the designs would be quite different.



Lone Wolf said:


> ...
> 
> It all might sound a bit complicated, and it kind of is. But it's true that you can learn a great deal about what works (or more like what doesn't work) from backtesting strategy ideas.




I was planning to roll out my own system. I would consider myself an above average coder  (have programmed in C,C++,Java,Python etc) but by no means among the best. At this point forex is not of a great interest to me for daily trading but I will look into it at some point. As to choice of broker's, will most likely go with IB as I have a bit of any idea about their API.

My reason for doing the above is that while very difficult it provides me with the greatest flexibility and ability to program and test strategies that may not be possible in any of those systems.


----------



## CanOz (26 May 2013)

FlyingFox said:


> Thanks for the reply, it is quite helpful. I believe it was the later or rather futures and forex are most suited for automatic systems.
> 
> 
> 
> ...




F.Fox there are literally thousands of ideas for trading all kinds of markets. As I once heard Nick say "the only limit is your imagination". 

I also have a few good book titles that won't give you the holy grail but it will give you ideas to think about. 

To get you started here are a few of my conclusions about mechanical trading systems based on the testing i have done:

1.) EOD is the smallest time frame for a robust system to stand the test of time. i.e. Intra-day systems need more work and re-invention over time as the market changes. You can verify this yourself with testing
2.) Seasonal influences, psychological effects, contrary POV, etc. work better than indicators. Eg, buying on the open after the fifth down bar in the first week of the month...just an example.
3.) Equities are likely easier to work with than Futures or Forex. Forex is very correlated as are the futures. 
3.) Portfolios of strategies on futures work better than one system across many different instruments.

That should get you thinking....

Cheers,


CanOz


----------



## FlyingFox (26 May 2013)

CanOz said:


> F.Fox there are literally thousands of ideas for trading all kinds of markets. As I once heard Nick say "the only limit is your imagination".
> 
> I also have a few good book titles that won't give you the holy grail but it will give you ideas to think about.
> 
> ...




 As always, great advice. Point 2 is one of the main reasons for building my own system from the ground up (and something that can be semi-automated). Some of those are rather difficult to automate I imagine and I intervene if/when needed.


----------



## Lone Wolf (26 May 2013)

When you said "putting together your own system" I thought you meant to write your own trading strategy using an existing platform such as MultiCharts, Amibroker or NinjaTrader.

But it sounds like you mean to write your own software which directly interfaces with IB's API. Is that right?

If so, I can't offer any help in that area. Just be careful that you aren't putting your efforts in the wrong place. Writing software from the ground up will absorb much of your time. If your primary goal is to make money trading a system then it seems more efficient to use an existing platform and devote your time and effort into experimenting with different trading ideas.



FlyingFox said:


> My reason for doing the above is that while very difficult it provides me with the greatest flexibility and ability to program and test strategies that may not be possible in any of those systems.




I'd suspect that there is very little that can't be tested using one of the more powerful existing platforms. But coding limitations isn't my area. waza1960 seems to be experienced in the coding/systems area. He might be able to tell you what the limitations of existing platforms are.

But don't let me put you off. I'm only guessing that it would be hard to write your own software from the ground up. And everyone has their own objectives. If you make something good enough you might even be able to sell it. After all, they say that the best way to make money in the markets is to sell software/advice to people who are trying to make money in the markets.


----------



## CanOz (26 May 2013)

FlyingFox said:


> As always, great advice. Point 2 is one of the main reasons for building my own system from the ground up (and something that can be semi-automated). Some of those are rather difficult to automate I imagine and I intervene if/when needed.




The really good performing systems i have seen and/or tested are usually amazingly simple...i.e. the 20% Flipper.

I would be very happy to help you in any way possible, to build a profitable trading system.

Don't be afraid to ask for anything you need.

Have you decided on a platform yet?

CanOz


----------



## FlyingFox (26 May 2013)

Lone Wolf said:


> When you said "putting together your own system" I thought you meant to write your own trading strategy using an existing platform such as MultiCharts, Amibroker or NinjaTrader.
> 
> But it sounds like you mean to write your own software which directly interfaces with IB's API. Is that right?




That's right. I want to code up my own software.



Lone Wolf said:


> If so, I can't offer any help in that area. Just be careful that you aren't putting your efforts in the wrong place. Writing software from the ground up will absorb much of your time. If your primary goal is to make money trading a system then it seems more efficient to use an existing platform and devote your time and effort into experimenting with different trading ideas.




It will take up a lot of my time I know and my primary goal at this point is not to make money but to learn. I am one who likes to tinker and I prefer it this way. I agree however that platforms are very powerful and so they should be.




Lone Wolf said:


> I'd suspect that there is very little that can't be tested using one of the more powerful existing platforms. But coding limitations isn't my area. waza1960 seems to be experienced in the coding/systems area. He might be able to tell you what the limitations of existing platforms are.
> 
> But don't let me put you off. I'm only guessing that it would be hard to write your own software from the ground up. And everyone has their own objectives. If you make something good enough you might even be able to sell it. After all, they say that the best way to make money in the markets is to sell software/advice to people who are trying to make money in the markets.




I am sure that is the case. I will have a brief look at some of these before I start. LOL. I don't intend to sell anything probably ever. Just to satisfy my innate curiosity. I do scientific computing for a living so I am interested to see how well or badly some of those ideas translate. Easier for me to have my own code base to implement them.


----------



## FlyingFox (26 May 2013)

CanOz said:


> The really good performing systems i have seen and/or tested are usually amazingly simple...i.e. the 20% Flipper.
> 
> I would be very happy to help you in any way possible, to build a profitable trading system.
> 
> ...




Thanks CanOz, much appreciated. I intend to start with simpler systems. As I mentioned earlier, I plan to write my own "platform" so to speak which I expect will be a long and arduous journey. So not expecting any profits any time soon. Currently the plan is to use IB as a broker.


----------



## CanOz (26 May 2013)

Ahh ok, i see what you want you to do now....

so basically you're going to a write a charting application with the ability to handle algorithmic buy/sell strategies and then interface with IBs API...that is a huge amount of work...

I know a guy in St.Louis did the same... He trades through it to this day, and codes for NinjaTrader on the side.

CanOz


----------



## FlyingFox (26 May 2013)

CanOz said:


> Ahh ok, i see what you want you to do now....
> 
> so basically you're going to a write a charting application with the ability to handle algorithmic buy/sell strategies and then interface with IBs API




That's the idea 



CanOz said:


> ...that is a huge amount of work...




Tell me about it. Maybe I am a masochist and don't know it yet lol. I find that its the best way I learn and stay interested.


----------



## waza1960 (26 May 2013)

> I was wondering if anyone uses an automated trading system?



I have run auto systems on MT4 /MT5 /Ninja Trader and have tested systems on Amibroker and Multicharts.



> I am thinking of putting together a system. This will be more of an exercise that forces me to learn more about the markets.
> I plan to write my own "platform" so to speak which I expect will be a long and arduous journey. So not expecting any profits any time soon. Currently the plan is to use IB as a broker.




  I'm still not clear about your goals here and I'm not sure you are...............

 If you want to design a platform/API and code it as an intellectual exercise then good on you and credit to you for having the ability to do so.
  But I doubt if your learning much about the markets by doing so.

  I agree with all Canoz and Lone Wolfs previous posts .

 Here's some of my views as well..................
 Instruments: Forex,Futures,ETF's,Equities are all feasibly traded using systems but I still don't see why you would trade equities due to the excessive cost to trade.
So here's some options not coding your own platform (use either of these). my ............

 Platforms: Amibroker if your trading EOD systems.

               MultichartsNet if your trading Intraday systems.

  These two are superior platforms IMO to the others but aren't as popular due to less support for inexperienced programmers.

  If your up for a challenge and a good coder why don't you concentrate on coding great systems on either of these platforms?
  There's enough ideas that can be implemented in AFL/ C# to satisfy anyone's craving for a challenge.
  What about a Neural Network or coding the DOM into a Strategy.

  However if your set on producing your own platform consider the following:

 You could no doubt improve on the existing platform API's .

  As well as producing a platform that has charts indicators etc.
  What about the analysis side of the platform?
  Are you going to allow for proper backtesting?
  Optimisation including genetic/ MonteCarlo /Trade Metrics


----------



## FlyingFox (26 May 2013)

waza1960 said:


> I'm still not clear about your goals here and I'm not sure you are...............



fair point.







waza1960 said:


> If you want to design a platform/API and code it as an intellectual exercise then good on you and credit to you for having the ability to do so.
> But I doubt if your learning much about the markets by doing so.




again fair point. I think of it as a fact finding mission. Trying to discover what if anything works for me.


waza1960 said:


> I agree with all Canoz and Lone Wolfs previous posts .
> 
> Here's some of my views as well..................
> Instruments: Forex,Futures,ETF's,Equities are all feasibly traded using systems but I still don't see why you would trade equities due to the excessive cost to trade.
> ...




Thanks. Will look into these.


waza1960 said:


> If your up for a challenge and a good coder why don't you concentrate on coding great systems on either of these platforms?
> There's enough ideas that can be implemented in AFL/ C# to satisfy anyone's craving for a challenge.
> What about a Neural Network or coding the DOM into a Strategy.




Interesting. Generically, some of these are not very hard to implement. I have a bit of a background on machine learning methods and there are many different libraries for doing these sort of things. Trying to get them to work nicely with a product would be much more difficult. 



waza1960 said:


> However if your set on producing your own platform consider the following:
> 
> You could no doubt improve on the existing platform API's .
> 
> ...




My choice of language will be python. This already includes many packages for charting, analysis e.g access to R, machine learning etc. Yes I will allow for proper back testing. Looking at a few frameworks for this but I need to dig deeper; might have to write my own.

Haven't thought much about optimization as yet.


----------



## waza1960 (26 May 2013)

> My choice of language will be python. This already includes many packages for charting, analysis e.g access to R, machine learning etc. Yes I will allow for proper back testing. Looking at a few frameworks for this but I need to dig deeper; might have to write my own.
> 
> Haven't thought much about optimization as yet.



If you do go down the path of Platform building I'm more than happy to contribute some ideas to make the ultimate platform as I am aware of a lot of the deficiencies of the existing ones.


----------

