Best Thread Algorithmic trading experiences

Just a quick thought on this. Thinking out loud and typing quickly so apologies if it's garbage....

Are you also scaling in? What I was wondering was, if you scaled in in say clips of 1/5 your standard position for example, would you also then not have 5 different trades (with associated stops). That way, to reduce the overall position, you simply close one of these smaller partial positions. I don't know whether you have the stop for the whole position set at the same level, but either way doesn't seem to matter to me.

If you want to go 100% size on the way in, but simply scale on the way out surely that's just a case of doing 5 smaller trades at the same level when you get in. Only downside I could possibly see is if you pay a 'per ticket' rather than volume based transaction charge, as that will up your transaction costs (incidentally, that would be one more thing I would add to the otherwise pretty comprehensive list of points to conider that was posted earlier - really understand the costs involved with doing business).

My $0.02

GJ

Gamma - that got me all excited for a few minutes... good suggestion but I think I'll still have the same problem.

The trouble is that regardless of how many trades this goes through as, you still end up with a position - say 100 shares, with a stop loss on those 100 shares. When you want to sell 75 shares, you have to remove the stop loss on the remaining 75 shares before you sell the 75. In TS, you can't link the stop loss cancellation and the sell and so both orders hit the servers at pretty much the same time & occasionally the cancel stop loss order hasn't been processed by the time your sell goes on. This is using order entry macro's and not strategies.

I am looking at some APIs right now that have the right kind of orders and will work with TS. The problem is that TS has some very basic order handling functionality as far as I am aware.

My solution to this would not be to re-write the whole of Tradestation but rather to write a proper trading API with better trading features. That way - the only wheel I am re-inventing is the wonky one :cheesy:
 
Actually I can see both sides of the argument here. Pedro is of course entirely right in saying that you will get zero bonus points for re-inventing the wheel, and if there's a product out there that does PRECISELY what you're doing, then you should potentially embrace it. However....

1) It may not do precisely what you're going to do yourself, and if this does turn out to be the case, I personally would be wary of letting the architecture / functionality of a third party piece of software shape the direction of my venture (whatever it is).

2) You will, if you use that software, be beholden to that provider, both in terms of the quality of the product, its future direction, and on a day to day basis, beholden in terms of support for it when it goes down etc. If you're already working at a high level of technical competence yourself (and it sounds very much like you are), you may be perfectly capable of building something better and more robust.

3) Flipside to this of course is that someone else will be DOING all the support etc. So it's not cut and dried whether this is a good thing or not.

My $0.02

GJ

p.s. for what it's worth, if you held a gun to my head, I would probably come down on the side of doing it all myself, and therefore knowing / owning all the code. But that really is just my personal preference.

My thoughts are
1 - you are looking at probably a years work to get this right
2 - you then need to write every indicator yourself - no more downloading indicator scripts off the internet
3 - you then need to write APIs, strategy monitors, backtesting tools - add another few years

OR - use a tool that does most of what you need & focus your efforts on writing APIs for the things you want it to do better.
 
My thoughts are
1 - you are looking at probably a years work to get this right
2 - you then need to write every indicator yourself - no more downloading indicator scripts off the internet
3 - you then need to write APIs, strategy monitors, backtesting tools - add another few years

OR - use a tool that does most of what you need & focus your efforts on writing APIs for the things you want it to do better.

Personally I want to write the indicators myself & not download them off the internet - I'm doing medium/long term stat analysis not traditional technical trading. I think the timescales can be a lot shorter, especially if you have experience in software engineering. As an example, I wrote the FX part of my system in a few weeks - this includes conneting to GAIN's forex platform; subscribing to 10 ccy pairs, saving ticks to my own SQL Server database; a sampler to store daily data; the indicator itself which generated trade recommendations; an execution component which sent the trade requests to GAIN and finally a reporting module which emails out daily stats on P&L, VaR, volatility etc.

Again, I'm not saying that everyone should go ahead and write their own software. I just found it a interesting experience and I'm pleased with the result, so happy to help anyone else looking to follow the same path.
 
Is this similar to importing the data using a web query in Excel? Just curious.

GJ

I'm not sure what a web query in Excel does. What I do know is that if I send some parameters to the yahoo URL it returns me a csv file which I then extract the data from and then load into my dB.

Try is by hitting this - http://finance.yahoo.com/d/quotes.csv?s=CNA.L+VOD.L&f=snab which should return you Vodafone and Centrica stock code, name, bid and ask

@Pedro & GJ - I've got a similar view to Pedro tbh. I used to own and run a software company and know that if there is good application/open source stuff out there that can be embedded into your own apps then it makes perfect sense to use it. It basically boils down to whether 3rd party apps meet your needs. If they do, use them and focus on the things that give you value add. If they don't then write stuff yourself. If you want to know exactly how your system works, write it yourself from scratch. I suppose I'm lucky insofar as I'm a professional engineer and have the knwloedge & tools to build whatever I want. Most people don't have that luxury and hence Pedro's position is emminently sensible.

The controlling element of me does lean towards GJ's and adamscj's.

The process of monitoring the market in real time, building my own indicators,writing my own strategies and then trading them in real time (well 15mins off the pace) is helping me learn about an environment I know little about. Just by analysing why my rather simple buy/sell strategies are working/not working is giving me a feel for how the market behaves and equally as importantly just how it can really screw an automated system up.

Building the app is forcing me to analyse to a level that I suppose people don't automatically do when they use off-shelf charts/trading systems when they're new to the game which is probably why the failure rate is so high for newbie's I suspect.

It's taken me about 4 weeks to write all this. I suppose the real test is whether it makes a profit on trades. We'll see.
 
Daft question here. Is it normal to set stop for profit as well as losses? I've set stop-loss at 1.5% but do people normally set stop-profits or just ride the trend until the trend is no longer your friend?
 
Daft question here. Is it normal to set stop for profit as well as losses? I've set stop-loss at 1.5% but do people normally set stop-profits or just ride the trend until the trend is no longer your friend?

It depends on your trading style and timeframe. Some people will put in a trailing stop and are happy to lose a few pips when they get stopped out on a retractment, others may prefer to have a target price in mind and set a fixed take profit order. If you're day trading automatically then it probably makes sense for your algorithm to work a trailing stop order (based on local volatility).

Personally I'm trading longer term & systematically so I dont use stop losses or take profit orders - I just trade the signal coming from the trend.
 
It depends on your trading style and timeframe. Some people will put in a trailing stop and are happy to lose a few pips when they get stopped out on a retractment, others may prefer to have a target price in mind and set a fixed take profit order. If you're day trading automatically then it probably makes sense for your algorithm to work a trailing stop order (based on local volatility).

Personally I'm trading longer term & systematically so I dont use stop losses or take profit orders - I just trade the signal coming from the trend.

Reason I ask is I'm watching Rio Tinto which the system entered at 1480p and I'm watching it up at 1623 and reckon if it breaks 1627 then it will carry on up for a while longer. If I'd have set a stop at say 5% I'd not be maximising this trend and just wondered how people cope with this. Trailing stop sound like the kind of thing I'm after.
 
Not always - sometimes the singal might suggest a flat position;-)

I wrote something similar over the week-end - giant function whose output is 'up', 'down' or 'range' - seems to be working well today and has stopped the effects of ranging I saw last week which threw me in and out of the market losing money at a ridiculous rate of knots.
 
Personally I want to write the indicators myself & not download them off the internet - I'm doing medium/long term stat analysis not traditional technical trading. I think the timescales can be a lot shorter, especially if you have experience in software engineering. As an example, I wrote the FX part of my system in a few weeks - this includes conneting to GAIN's forex platform; subscribing to 10 ccy pairs, saving ticks to my own SQL Server database; a sampler to store daily data; the indicator itself which generated trade recommendations; an execution component which sent the trade requests to GAIN and finally a reporting module which emails out daily stats on P&L, VaR, volatility etc.

Again, I'm not saying that everyone should go ahead and write their own software. I just found it a interesting experience and I'm pleased with the result, so happy to help anyone else looking to follow the same path.

Why on earth would you want to write the indicators yourself ? Lets say you wanted to test out the adaptive stochastic indicator as part of your strategy. Using TS, I can try it out, backtest it & apply it to different symbols in hours. For you to do it, you'll take days, plus how will you ever know that your adaptive stochastic indicator is putting out the right data ? What will you test it against ?

I run a software company, I have been in the game for 20 years, I can only recommend that you look at what is out there & compare it to what you achieved in the few weeks you spent. I run teams of developers, we develop our own programming languages, so I have a pretty good idea of what can and cant be done in a few weeks. If you don't first understand what is out there and how it works, you may end up burning a lot of time and achieving less than what you could have got for free.

Can you honestly say that you understand what these industry standard tools do ?
 
I wrote something similar over the week-end - giant function whose output is 'up', 'down' or 'range' - seems to be working well today and has stopped the effects of ranging I saw last week which threw me in and out of the market losing money at a ridiculous rate of knots.

For FX I have a trend indicator that applies a few moving averages to previous log returns. The output value is then multiplied by a volatility factor which results in a target position. Obvisouly if the trend signal is weak or the volatility is high then this target position will tend towards zero so it naturally leads me out of a position as the trend comes to an end.
 
Hi guys interesting thread...

Quick question. How many lines of code would i need to run a simple intraday strategy that works in all market conditions and what would my min bal have to be to run it?

TIA.

Paul.
 
Hi guys interesting thread...

Quick question. How many lines of code would i need to run a simple intraday strategy that works in all market conditions and what would my min bal have to be to run it?

TIA.

Paul.

Depends on your language - I could probably write it in about 50 lines of Perl;-)

Joking aside, I wouldn't get too concerned with program conplexity based on lines of code. One of the main points we were making above is that technology risk is quite large, so you need a lot of defensive code especially around placing and managing orders. Some brokers offer decent api connectivity so this takes care of much of the code around prices feeds & placing orders, leaving you free to spend time writing your strategy. As an exmaple, the main program loop I have that applies my trend following strategy runs to about 500 lines of Java code.
 
I think adam might be better placed to answer this one. I can give you the stock geek answer which is:

"Depends.........."

but that's probably not that useful.

I can only speak from my recent experience which is:

50 for fetching and storing data
200 lines for pre-processing simple(ish) indicators, oscillators, etc
about 100 lines per strategy (and mine aren't complicated) to make a decision
about another 100 lines to figure out how much to buy/sell for money/risk mgmt
50 for execution, confirmation and logging

It's a real 'piece of string question' tbh.

There's about 3000 line in my app but that to me is a tiny application. Professionally I work on systems with >500k lines of code easily and probably closer to 1m.
 
Thanks guys.

I notice some posters have talked about 'bundled' or 'off the shelf' components. Is there an inherent danger to any system when using easily picked coding that the system may become ordinary or non competitive?

How can this be overcome using just a purely technical approach?
 
Thanks guys.

I notice some posters have talked about 'bundled' or 'off the shelf' components. Is there an inherent danger to any system when using easily picked coding that the system may become ordinary or non competitive?

How can this be overcome using just a purely technical approach?

This is the point that Pedro was making. For grunt work like data capture and other 'basic' functions there probably is no harm at all in using other people's code/work/apps/api's this leaving you to focus on the bits that are most important/lucrative/devilishly fiendish.

So adam's a good example for indicators. He's using his own rather than off the shelf, hence he's written them himself.

Horses for courses.
 
Thanks guys.

I notice some posters have talked about 'bundled' or 'off the shelf' components. Is there an inherent danger to any system when using easily picked coding that the system may become ordinary or non competitive?

How can this be overcome using just a purely technical approach?

I guess it depends on which parts of an application you're buying. Something that is essentially a commodity, like historic data, live rate subscription, order execution etc can be bought without any fear of it being too generic, as this is exactly what you want (all that testing for free). However you may have a point when it comes to indicators & strategies - that's where you can use your brain as competitive advantage and try to come up with something unqiue that siuts your own trading style. I know there are people out there who have been very successful trading other people's strategies & indicators but personally I'd always rather write something myself that I understand and feel comfortable with.
 
Because I'm not trading off the shelf indicators or something you can read in a book, they're ideas I've had myself.

I see

At some point, you will come to the realisation that a lot of the stuff that is out there is of value.

For instance, on the TT forum, there is a fantastic piece of code for position sizing based on volatility. The theory (and a good theory at that) is that you should base the size of your position on the volatility of the instrument you are trading. If the instrument moves an average of $1 a day, you can stake more than if the instrument moves $10 a day.

This uses Average True Range, something that the trading world uses a lot.

With any indicator, there's a thousand ways to use it - so don't think that using an indicator as part of your strategy means that someone else will have a similar strategy to you.

It seems you are saying that not ony will you code everything from scratch but that you will not benefit from the research that thousands have done before you. This leaves you with an even larger task.

I would presume that volatility based position sizing is something you hadn't considered yet and I think it's safe to presume it's something you may never have come up with on your own, yet it is a very smart idea. There are hundreds of such things you need to know about and incorporate into your strategies,depending on how you trade.

I fully understand the 'go it alone' mentality but you will eventually come around to using mainstream tools & methods as they exist for a very good reason.
 
Top