Calling all System Developers...

Systems Development

Hi


Sorry this is kind of off topic. I read your posts with some interest, so much so that I would like to develop a system of my own. The only problem is, that I only have a rather rudimentary knowledge of IT. Do you guys use any programming languages such as Csharp or Visual Basic in developing your systems? Are there any courses specifically catered to trading you can recommend?

Any suggestions would be greatly appreciated.
 
Hi


Sorry this is kind of off topic. I read your posts with some interest, so much so that I would like to develop a system of my own. The only problem is, that I only have a rather rudimentary knowledge of IT. Do you guys use any programming languages such as Csharp or Visual Basic in developing your systems? Are there any courses specifically catered to trading you can recommend?

Any suggestions would be greatly appreciated.

Spreader,

IMO its definately not necessary to know any specific programming languages although a basic understanding of programming (such as looping, etc) would be useful.

Each charting software will have its own language. Some are more easier to learn than others. I think one of the easiest to learn is probably Metastock as it is very close to actual "english". Its a powerful package but due to its simple "language" probably doesn't have the long-term flexibility in terms of what can be programmed compared to other products such as Amibroker. However, those on here which are very experienced will probably disagree though! ;) Also, bare in mind that everyone has different requirements so if you only intend to keep the system simple then stick to one of the easier packages.

I would suggest you make a list of what you want to achieve from your trading and pick a software package which offers you what you're after. For example, will you be looking to backtest your ideas and if so, what kind of analysis do you want to do? Some packages offer better features than others!!

From there, I would start off with coding some modified indicators or a very simple system and slowly build up your experience from there.

There are plenty of forums on the net with experienced people who can offer help and advice.... Just don't try to run before you can walk!! ;)

Regards,

Chorlton
 
Spreader, you can also try Excel for backtesting in the beginning, just to train your algorithmic thinking.
 
Hello All,

I've been tweaking the system initially posted on here and as a result I have a question about Stops.

The System currently uses a tight Trailing-Stop which is activated once the Price's CLOSE falls below it. Basically, the trade is exited on the Next Bar once the stop is activated. Using this method results in a MaxDD of 2.7%, which is IMO very low.

The problem is that I would like to Spreadbet this system, so as to take advantage of leverage.

Consequently, given the fact that Spreadbetting is leveraged I want to ensure that a Stop Loss is always in place in case of adverse Market Movements.

However, as my current stop relies on the Close to assess whether it has been activated, this is no longer a valid method. As a result, I have looked at modifying the Stop so that it relies on the price's LOW so as to take into account intraday movement. Then if the LOW of the price bar dips below the Trailing Stop level, the Stop is activated. This way, I can set the Stop Loss in advance at the level of the previous bar.

The problem with this is that not only does the MaxDD increase to 16% but much more worrying the probability of loss with the system jumps from 0% to 94% :( So err... no good!!!

Consequently, can anyone offer any other ideas on how I can proceed? One obvious idea is to start looking at other types of stops, which I am currently doing. Problem is that none of them to date, offer the same level of low risk compared to my existing tight stop.
 
Hello Chorlton,

I still did not have time to work on my Backtesting FAQ, but I am around ;)

I think this Stop thing is a major problem, to be honest. Let me make sure that I understand you correctly. This is how it works now:

1. You enter position at the Open.
2. You set the Stop condition to compare Close with your Stop level and exit on the Open of next bar if Stop level is breached.
3. On the open of next candle you move your Stop level.

In this way effectively you have no stop at all... It is more of an "exit condition" than stop, as during each candle you might suffer unlimited drawdown and even face a margin call and you would not exit the position. This kind of a strategy might work 90% of the time and then the remaining 10% could kill you.

I can't really say how to improve the situation, as I do not know the rules of your system. However for the beginning you could simply widen your stop considerably (in order to avoid being stopped out to often on the lows) and see what happens with the results.

Another trailing stop caveat - if you do not have intraday data, you cannot really test it. It is probably obvious to you, but let's show it anyway.

Let's assume you open your position at the opening of the candle at 1.5000.
You set your trailing stop to 20 ticks, so the initial level is 1.4980.
Let's say the candle turns out to be a large move up, with the open=low=1.5000 and close=high=1.5100.
If your method for testing if the Stop was triggered involves comparing with either Low or Close, then you think that you were not stopped out. However in reality it might be so. Imagine the intrabar price action:
Move up to 1.5050, the stop moves to 1.5030
Move down to 1.5010, the stop gets hit
Move up to 1.5100
So you had a great winning position but you got stopped out because of the use of the trailing stop...

A solution could be just to use Stops at fixed-for-the-bar, but moveable levels (like previous candle's low). In this way you would have no ambiguity.
 
Hello Tadragh1,

Thanks for the reply. I have given my responses within your text.

Hello Chorlton,

I still did not have time to work on my Backtesting FAQ, but I am around ;)

I think this Stop thing is a major problem, to be honest. Let me make sure that I understand you correctly. This is how it works now:

1. You enter position at the Open.
2. You set the Stop condition to compare Close with your Stop level and exit on the Open of next bar if Stop level is breached.
3. On the open of next candle you move your Stop level.

The way I originally coded my system was to only exit the trade if the priced closed below the Trailing Stop Level. This Trailing Stop Level was based on the LLV (Lowest Low Value) of the previous few bars. As long as price CLOSED above this level the stop would not activate. Was this your understanding of my orginal explanation?

While this initially seemed to be OK, I noticed on my charts that in a lot of places the low of the price bar sometimes spiked below this level although the price still closed above it.


In this way effectively you have no stop at all... It is more of an "exit condition" than stop, as during each candle you might suffer unlimited drawdown and even face a margin call and you would not exit the position. This kind of a strategy might work 90% of the time and then the remaining 10% could kill you.

Yep, Possible Margin calls are what concerns me if I decide to Spreadbet this strategy.

I can't really say how to improve the situation, as I do not know the rules of your system. However for the beginning you could simply widen your stop considerably (in order to avoid being stopped out to often on the lows) and see what happens with the results.

That was my first idea. To date though, all other stops I have tried result in a much higher MaxDD %. Using my existing Exit strategy but replacing the CLOSE with the LOW actually results in a non-profitable system as due to the number of intraday low spikes, the trades get stopped out prematurely

Another trailing stop caveat - if you do not have intraday data, you cannot really test it. It is probably obvious to you, but let's show it anyway.

Let's assume you open your position at the opening of the candle at 1.5000.
You set your trailing stop to 20 ticks, so the initial level is 1.4980.
Let's say the candle turns out to be a large move up, with the open=low=1.5000 and close=high=1.5100.
If your method for testing if the Stop was triggered involves comparing with either Low or Close, then you think that you were not stopped out. However in reality it might be so. Imagine the intrabar price action:
Move up to 1.5050, the stop moves to 1.5030
Move down to 1.5010, the stop gets hit
Move up to 1.5100
So you had a great winning position but you got stopped out because of the use of the trailing stop...

Good Explanation but in my case the Trailing Stop level would NOT change during trading hours at it is calculated based on previous price data. If it happened to be set at 1.4980 then it would remain at this level for that entire day

A solution could be just to use Stops at fixed-for-the-bar, but moveable levels (like previous candle's low). In this way you would have no ambiguity.

This in "basically" what I already have in my original exit condition
 
I have found that with long only systems a filter on a daily or longer timeframe chart is the way to go. I have index trading systems that have not traded for quite a while now as a result. As for being able to "invert" the signals, I doubt this will be successful as the dynamics of short trades are really quite different that that of longs.
Chorlton, what package are you using to produce the results? Particularly interested in what you use to do the monte carlo. I have been using MSA and Rina but would like something a little simpler that I could use quickly in spreadsheet format. Any suggestion?
Looks like a good set of stats to me although will take some patience to trade it and easy to lose faith in something that does noto make a new peak for over 2 years. How has it performed in the last year?
 
have you tested placing your stops below the maximum adverse excursion?

Hello All,

Consequently, can anyone offer any other ideas on how I can proceed? One obvious idea is to start looking at other types of stops, which I am currently doing. Problem is that none of them to date, offer the same level of low risk compared to my existing tight stop.
 
I have found that with long only systems a filter on a daily or longer timeframe chart is the way to go. I have index trading systems that have not traded for quite a while now as a result. As for being able to "invert" the signals, I doubt this will be successful as the dynamics of short trades are really quite different that that of longs.
Chorlton, what package are you using to produce the results? Particularly interested in what you use to do the monte carlo. I have been using MSA and Rina but would like something a little simpler that I could use quickly in spreadsheet format. Any suggestion?
Looks like a good set of stats to me although will take some patience to trade it and easy to lose faith in something that does noto make a new peak for over 2 years. How has it performed in the last year?

Hi TWI,

Thanks for your comments.

With regard to a filter are you referring to something which is used to determine whether the System should be IN or OUT of the Market. If so, then I do have one included in my System. If I may, can I ask what kind of filters you use in your systems?

I agree with your comments about being unable to create SHORT Signals simply by inverting BUY signals. From my experience also, the set-up for a Short trade is normally quite different to that for a Long Trade.

Regarding Backtesting, I use TradeSim. There are different editions available but if you require Monte Carlo analysis then you need the Enterprise Edition. TradeSim is not a cheap product but IMO if one is serious about System Development it is a necessity.

I haven't had any experience with other Monte Carlo Testers but I do highly recommend TradeSim. It was originally designed to work seemlessly with Metastock but I actually use it with Amibroker with no problems.

One the TradeFile is loaded into TradeSim, I find it very quick to get results. As an example, to carry out 20,000 Monte Carlo Trade Simulations on my system took just 85secs !!

You also have full control over what Position Sizing Model you intend to use as well as many other parameters. I have realised that the profitability of a system is partly due to this alone!!! Without TradeSim I would have never realised this.

Regarding my System, can I ask what elements you liked and disliked about it? Also, can you clarify your comment shown in BOLD. Thanks....

The System has only been tested using In-Sample Data so far (up to Dec2004). I have left the last 3 years of data to one side for my Out-of-Sample testing once I am fully happy with the System. However, as its a Long System (but this might change in due course) I am reasonably confident that this Out-of-Sample data will continue to produce good results due to the fact that the FTSE Market was in a Bullish period. This will need to be confirmed with testing though...

Regards,

Chorlton
 
:eek:
have you tested placing your stops below the maximum adverse excursion?

Hi JM,

Thanks for your post.

As I have a very basic understanding of MAE, can you expand on it and more importantly how I can go about applying my stops below it?

My understanding is that it relates to the biggest loss occurred within a System. As this loss is governed by my Trailing Stop, how can I go about calculating where to re-position this stop??

Sorry but I'm a little inexperienced with using this as you can tell. :eek:


Thanks in advance,

Chorlton
 
Chorlton, just one small thought - the drawdown you are getting now is obviously larger, but I guess it is largely the factor of showing the unrealized drawdowns from the low spikes you did not show before.

About stops - I think stops like "a tick below the minimum low of last X bars" may yield good results in trend-following systems. Depends on your entry, though.

Have fun!
 
Hey Tadragh1,

I had an idea this morning which may or may not sound logically so here goes.

The main issue I have with my current Stop strategy is that any adverse intraday movements will not be picked up until the close of the bar, which by that time could result in big losses especially if I'm trading with leverage.

The first solution was to simply lower the stop level which, even though avoids these intraday spikes results in a higher MaxDD as I am not capturing as much of the previous gains in periods with no intraday spikes.

As a result, I am now considering using TWO trailing stops. One will be the original one I have and will be monitored at the CLOSE. As long at the CLOSING Price is higher than this stop the trade will remain active - as per my original strategy.

The other, will be a stop further away from price (and below the majority of these intraday spikes) and which will be monitored in real time. This will be achieved by using the stop's previous periods value. The only purpose of this stop will be to LIMIT possible losses in case of adverse Market conditions. If the Price's LOW drops below this predetermined level the trade will be closed out otherwise it will remain in play.

This way I should be able to keep the MaxDD low as most of the trades will exit using the first stop, while at the same time controlling my downside risk.

Does this sound logical?

Your thoughts (as always) welcomed....

Chorlton
 
:eek:

Hi JM,

Thanks for your post.

As I have a very basic understanding of MAE, can you expand on it and more importantly how I can go about applying my stops below it?

My understanding is that it relates to the biggest loss occurred within a System. As this loss is governed by my Trailing Stop, how can I go about calculating where to re-position this stop??

Sorry but I'm a little inexperienced with using this as you can tell. :eek:


Thanks in advance,

Chorlton

hi, yeah in a nut shell thats it.....its is a different concept of stop placing, so was suggesting as a different method to trailing. its not possible to explain how it works in a few paragraphs, but if u want to follow up would suggest reading sweeny and van tharp etc.

what data are u using for your testing, ftse cash or futures?
 
what data are u using for your testing, ftse cash or futures?

Hi,

Probably a stupid question but what do you mean by what data am I using? The data I have is Current & Historical EOD downloaded every night. I didn't realise one could purchase different types of data :confused:

Also, why do you ask? Would this make a difference to my System results?
 
Hello Everyone,

Firstly, Thanks for all the helpful and constructive comments to date and secondly, I just wanted to give those who may be interested an update as to where I currently am, so as to keep this thread flowing.

As you can tell from my recent posts, I've been having a few problems with my Trailing Stop choice. To overcome this I looked at various ideas but either Overall Profit or MaxDD was affected neither of which I was overly too happy about.

However, I decided that the factor of Risk was more important to focus on and as such chose a solution which affected Overall Profitability but which kept the MaxDD relatively low. This new solution resolved the previous issues I was experiencing with my Trailing Stop.

In parallel, I had also been developing a slightly different system to my initial one. Results of which were on par with my original system and MaxDD seemed relatively low again.

As an exercise (and just quickly out of interest), I decided to incorporate the Buy Conditions for both Systems into a new System. A Buy Signal for this new System would be created from either of these 2 sets of Buy conditions.

The System's overall parameters and testing conditions are identical to the first System posted. It is still only a Long Only System (at the moment) but my next job will be to look at developing "short" signals for it especially given possible future Mkt conditions.

From my point, there's a number of elements I want to re-check and possibly change but I'd welcome others thoughts....

Here is the first backtest / Monte Carlo Run.


Monte Carlo Report

Trade Database Filename
CCCC_4.csv

Simulation Summary

Simulation Date:
3/03/2008
Simulation Time:
10:51:11 PM
Simulation Duration:
111.97 seconds

Trade Parameters
Initial Capital:
$50,000.00
Portfolio Limit:
100.00%
Maximum number of open positions:
100
Position Size Model:
Fixed Percent Risk
Percentage of capital risked per trade:
1.00%
Position size limit:
10.00%
Portfolio Heat:
100.00%
Pyramid profits:
Yes
Transaction cost (Trade Entry):
$15.00
Transaction cost (Trade Exit):
$15.00
Margin Requirement:
100.00%

Magnify Position Size(& Risk) according to Margin Req:
No
Margin Requirement Daily Interest Rate (Long Trades):
0.0000%
Margin Requirement Yearly Interest Rate (Long Trades):
0.0000%
Margin Requirement Daily Interest Rate (Short Trades):
0.0000%
Margin Requirement Yearly Interest Rate (Short Trades):
0.0000%


Trade Preferences

Trading Instrument:
Stocks
Break Even Trades:
Process separately
Trade Position Type:
Process all trades
Entry Order Type:
Default Order
Exit Order Type:
Default Order
Minimum Trade Size:
$0.00
Accept Partial Trades:
No
Volume Filter:
Ignore Volume Information
Pyramid Trades:
No
Use Level Zero trades only:
Yes

Simulation Stats

Number of trade simulations:
20000
Trades processed per simulation:
371
Maximum Number of Trades Executed:
229
Average Number of Trades Executed:
216
Minimum Number of Trades Executed:
201
Standard Deviation:
3.78

Profit Stats

Maximum Profit:
$112,981.98 (225.96%)
Average Profit:
$82,061.23 (164.12%)
Minimum Profit:
$57,253.40 (114.51%)
Standard Deviation:
$7,090.50 (14.18%)
Probability of Profit:
100.00%
Probability of Loss:
0.00%

Percent Winning Trade Stats

Maximum percentage of winning trades:
60.78%
Average percentage of winning trades:
55.36%
Minimum percentage of winning trades:
49.78%
Standard Deviation:
1.47%

Percent Losing Trade Stats

Maximum percentage of losing trades:
50.22%
Average percentage of losing Trades:
44.64%
Minimum percentage of losing trades:
39.22%
Standard Deviation:
1.47%

Average Relative Dollar Drawdown Stats

Maximum of the Average Relative Dollar Drawdown:
$378.55
Average of the Average Relative Dollar Drawdown:
$262.63
Minimum of the Average Relative Dollar Drawdown:
$198.34
Standard Deviation:
$22.81

Average Relative Percent Drawdown Stats

Maximum of the Average Relative Percent Drawdown:
0.4791%
Average of the Average Relative Percent Drawdown:
0.3210%
Minimum of the Average Relative Percent Drawdown:
0.2517%
Standard Deviation:
0.0261%

Maximum Peak-to-Valley Dollar Drawdown Stats

Maximum Absolute Dollar Drawdown:
$4,836.20
Average Absolute Dollar Drawdown:
$2,671.91
Minimum Absolute Dollar Drawdown:
$2,050.37
Standard Deviation:
$491.29

Maximum Peak-to-Valley Percent Drawdown Stats

Maximum Absolute Percent Drawdown:
5.7154%
Average Absolute Percent Drawdown:
3.6452%
Minimum Absolute Percent Drawdown:
2.5628%
Standard Deviation:
0.5490%
 
Last edited:
As a quick test, I backtested the System over the period Jan 2001 to Dec 2002, during which the FTSE fell from around 6300 to 3600.

During this period, the System took an average of 27 trades (approx 1 per month) and even though only broke even, it didn't lose anything - see below


Profit Stats

Maximum Profit:
$1,244.88 (2.49%)
Average Profit:
$955.74 (1.91%)
Minimum Profit:
$662.16 (1.32%)
Standard Deviation:
$236.46 (0.47%)

Probability of Profit:
100.00%
Probability of Loss:
0.00%

Percent Winning Trade Stats

Maximum percentage of winning trades:
37.04%
Average percentage of winning trades:
35.80%
Minimum percentage of winning trades:
33.33%
Standard Deviation:
1.75%

Percent Losing Trade Stats

Maximum percentage of losing trades:
66.67%
Average percentage of losing Trades:
64.20%
Minimum percentage of losing trades:
62.96%
Standard Deviation:
1.75%

regards,

Chorlton
 
Last edited:
Chorlton, a couple of quick comments and follow up questions. It's been a while since you posted but perhaps you are still following this forum.

First, the simulation software you are using is reporting these #'s?
Probability of Profit:
100.00%
Probability of Loss:
0.00%

They results do not make sense in the real world - there is always a probability of a loss. There is probably a good reason mathematically why you are reporting those results; however, from a marketing and system creator point of view, one should never make claims such as "0% probability of loss" as it could get you in pot of hot water.

Lastly, have you tried following your system using an independent third party tracking site? Backtesting data is fine and dandy, but the true test is putting it to use with real market data. It will take several months to build a history but if you ever desire to market your system, it's the only way.
 
Chorlton, a couple of quick comments and follow up questions. It's been a while since you posted but perhaps you are still following this forum.

First, the simulation software you are using is reporting these #'s?
Probability of Profit:
100.00%
Probability of Loss:
0.00%

They results do not make sense in the real world - there is always a probability of a loss. There is probably a good reason mathematically why you are reporting those results; however, from a marketing and system creator point of view, one should never make claims such as "0% probability of loss" as it could get you in pot of hot water.

Lastly, have you tried following your system using an independent third party tracking site? Backtesting data is fine and dandy, but the true test is putting it to use with real market data. It will take several months to build a history but if you ever desire to market your system, it's the only way.

Hello Zig Zag,

I am still floating around here but currently in the process of redeveloping certain aspects of my system which, when finalised, I will repost on here.

In reply to your question (ref Probability of Loss/Profit), I agree that there will always be a statistical possibility of a system losing money. The numbers derived above came from 20,000 Portfolio Simulation Runs using a software package called TradeSim.

I want to make it clear that the results were posted in an attempt to create some discussion on here about the System with the goal of possibility looking to improve it based on others feedback. It was not done as a marketing exercise, as, once completed, the system would only be traded by myself and to my knowledge I have never suggested otherwise.

I agree that the "true test" of a system's performance is through live trading but as already stated this system is still in the development phase. Consequently, I find the backtested results useful in confirming my initial ideas and allowing me to make improvements before moving forward. This IMO is part of the natural development process.

The next phase is then to expose the system to out-of-sample data (albeit still historical) to see how it performs. Only after this has proven successful, would the system be exposed to new, live data. If the performance of the system remained with the boundaries defined by myself during this final stage, then the system would be officially "switched-on" and traded with real money.

Hopefully this clarifies things….

Regards,

Chorlton
 
OK that all makes sense. Your backtest results looked good and I was curious about your results since your last post in March but if you are still working on the system, there won't be any results yet.

Long term, if your #'s produce the results from above, there are many people who would pay to trade your system. And if you're not independently wealthy, then this is always an attractive path. And IMO, there is no better time than now to start testing trading systems on real time data. Paper trading is free and can be automated.
 
Top