Wednesday, June 29, 2005

Why Trend Lines Irk Me

Trend Lines

The above is a 5 minute chart of the Euro (EURUSD). I've drawn what I think are all reasonably valid support and resistance lines, and trend lines.

You can't trade with all those lines on the chart. There's no room anywhere for a decent profit between lines.

So maybe you won't agree with my placement, and that's one of my points - these puppies are mostly subjective.

It doesn't really matter anyway. Sure, on occasion the lines act as valid support and/or resistance levels. But when it feels like it, the price justs busts through them like they weren't even there. Because there not actually there, I just drew them on my computer.

Your (well, my) trading systems need to work without considering these "lines". Or at least create a way to identify the major ones mechanically.

Monday, June 20, 2005

MQL 4

I read this page about the Metrader programming language, MQL 4. It details how to use that language to write automated trading systems.

That software, especially its charts, will always have some advantages over anything I spit out. On the other hand, seeing that page helped re-affirm my decision to go down the path I have.

If you've little computer knowledge, don't know or don't want to know about programming, or simply agree that time should be spent designing and experimenting new trading systems instead of trying to figure out how to code them, selecting options from pull-down lists seems much easier. And quicker.

Thursday, June 16, 2005

Record Management Question

As a record management tool, I can understand why you would want to use the software to record the details of old trades, whether that trade was with a broker who had an API or not. Maybe you made that trade years ago. That's fine.

Can anyone think of a reason why you would want to record the details of old orders?

There haven't been any requests for this feature, I'm just asking if it would be useful. If there are no comments, I'll just assume there is no point to keep track of old orders.

Thanks in advance for any comments.

Sunday, June 12, 2005

More On Thinking Stuff

I've gleaned a lot of good ideas and information out of the Currency Secrets website (see also the link in the sidebar). Its author, Ryan Sheehy, kindly gave my program a look over and posted some questions. So, here are the answers.


1. Where does the program pull its data from to generate live buy and sell signals?

I've set it up so it can store data from multiple providers. And you can specify which provider's data to use for making trading decisions, even if the account to trade with is with someone else.

For example, you can use the Oanda data to make trading decisions with, but you actually make the trades with your FXCM account.

I'm not sure when this scenario would occur, but I made it possible anyway. Well, maybe your system works better with Oanda's data, but FXCM might provide better spreads (hypothetically, and in no way implying that FXCM's spreads are or are not better than Oanda's). Or something.

But as for where the data *actually* comes from *right now*, that'd be from Gain Capital, the company you recommended for free forex data. I managed to find the link to the historical data files by reading through the Oanda messageboard. Make sense?

The program reads in the text files and stores the tick data. Then it runs over the tick data and creates the interval data. Out of the files I've processed so far, (all of the EURUSD and USDJPY ones) I've found only a couple of obviously erroneous ticks, and one file which was formatted slightly differently to all of the others.

When I purchase the Oanda API, I'll be storing data from that as well.


2. Can the process be tested on Oanda's FXGame platform before going live?

Of course. You'd set up your system to first trade with your Oanda FXGame account. Then if you're satisfied, a few mouse clicks changes the account to be the real Oanda one. Or you could just add another account, and then it would trade in both the real and game.

Here we are looking at the Accounts tab of the window where you create your system. You can see that this system will trade the EURUSD and USDJPY in the Oanda BT a/c ("BT" = Back Testing).

Thinking Stuff System Update Screen - Accounts


If you want to change this, highlight the row to change and click the Edit... button. That brings up the Change Settings window, where you change the Account by selecting from the pull-down list, and click Save:

Thinking Stuff Change Settings Screen - Accounts

Thinking Stuff Change Settings Screen - Accounts


That's it.


3. Can the user input their own system? Or will they need you to program it for them?

Well, the user can mix and match any rules I've already coded. And if I haven't coded something they want, then yes, I'd have to code it and send out a new version of the executable. But that's the trade-off from trying to make the system as easy to use and as far away from coding as possible.

It'll have all the "normal" indicators. But if someone had some fancy indicator they'd created by themself, they'd have to tell me how it worked so I could code it for them.

Here's a bit of an example of creating/modifying a system. I was going to modify a system I'd already made, and then I thought, well, I should copy this system before I go about making any changes. So I clicked the Copy button, and this little window popped up:

Thinking Stuff System Copy Screen


Entered the new ID and description and clicked Save.

That brought me to this screen:

Thinking Stuff System Update Screen - Trading Rules


And then I thought, well, I should delete all the Short rules to remove some clutter, to make it easier for people to see what I'm doing. Highlight a row to delete, click Delete button.

Thinking Stuff System Update Screen - Trading Rules


That system don't go short no more.

And now we're all set to "start" the explanation :-)

Thinking Stuff System Update Screen - Trading Rules


To explain the system in the screenshot above, it's kind of a "counter-intuitive" system. You can see it wants to go long when the price closes below the lower Bollinger band. I didn't think this would work, and it doesn't, but that's the point of the software - to test new theories, to experiment, to know myself how well a system I've bought actually does before using real money.

The second entry rule is that the RSI has to be in oversold. Nothing amazing about that. If both entry rules are satisfied, the entry order will be placed at the lower Bollinger line. The initial stop loss is X pips below the entry, and initial take profit set at the upper Bollinger line.

Every bar we move the take profit to keep it the same as the new value of the upper Bollinger line.

So we backtest that, and find it doesn't do very well. Or for whatever reason we want to experiement, and we want to change that second entry rule to be using the MACD Histogram instead of RSI.

Select the second entry rule, and click Edit...

Thinking Stuff Change Settings Screen - Trading Rules


Select "MACD Histogram" from the Config Family pull-down list. Select "MACD Histogram In Oversold" from the Config Type pull-down list.

Thinking Stuff Change Settings Screen - Trading Rules

Thinking Stuff Change Settings Screen - Trading Rules


The default settings of 12, 26, 9, 0, 0 are populated:

Thinking Stuff Change Settings Screen - Trading Rules


If you just want to use the default, click Save. That's it. Back to the previous screen and you see the changes were saved:

Thinking Stuff System Update Screen - Trading Rules


And then you decide that you'd like a bit of upward pressure before setting the long order. So we want the entry bar to be a Bullish Bar - that is, where the price opened in the lower third of the candle, and closed in the upper third. Click Add... and the Change Settings window opens again, but this time it's empty:

Thinking Stuff Change Settings Screen - Trading Rules


Select "Long - Entry Rules" from the Rule Type pull-down list. Select "Bar Formations" from the Config Family pull-down list.

Thinking Stuff Change Settings Screen - Trading Rules

Thinking Stuff Change Settings Screen - Trading Rules


Select "Bullish Bar" from the Config Type pull-down list. Select "Daily" from the Interval pull-down list.

Thinking Stuff Change Settings Screen - Trading Rules

Thinking Stuff Change Settings Screen - Trading Rules


Note I also selected "3" as the Rule Ordering. Actually this doesn't do anything functional - it just improves the readability on the previous screen when everything's shown in a list.

Click Save. That's it. Back to the previous screen and you see the changes were saved:

Thinking Stuff System Update Screen - Trading Rules


We just added a new entry rule, and it took 7 clicks of the mouse.


4. Is there a system that can strangle the markets at a specified time entered by the user? This would be a great feature to have as sometimes I'd like to strangle the market when economic announcements are released but cannot physically BE in front of the computer when these announcements ARE released. An example of this system would be... at 827 NY EST (3 minutes BEFORE the 830 NY EST announcement) place a buy entry stop and a sell-entry stop at 20-day 2-StDev Bollinger Bands distance away, or the highest high of the last 20-days (and lowest low of the last 20-days), or maybe just an arbitrary figure like 20pips away from whatever the closing price is 2-3 minutes prior to the announcement! I guess the possibilities are endless!

Well, you can do this with the Holidays functionality. I made this functionality so the system would *stop* trading when a major announcement was coming up (if I'd enabled that setting for that particular system).

But it could be used in reverse as well - create a "holiday" that finishes 5 minutes before the announcement. Then, taking your three examples in the question, have your system set up as below. (Remember that you're just selecting all this stuff from pull-down lists. The only typing needed is to enter the Bollinger period, number of Std Devs, etc):

Bollinger Band Example
    Long - Entry Rules - Every Bar
    Long - Entry Values - Upper Bollinger Band
    Short - Entry Rules - Every Bar
    Short - Entry Values - Lower Bollinger Band

Breakout Example
    Long - Entry Rules - Every Bar
    Long - Entry Values - Highest High of Last X Bars
    Short - Entry Rules - Every Bar
    Short - Entry Values - Lowest Low of Last X Bars

Arbitrary Pips Example
    Long - Entry Rules - Every Bar
    Long - Entry Values - Close of Current Bar
    Long - Entry Values - Pip Offset (20)
    Short - Entry Rules - Every Bar
    Short - Entry Values - Close of Current Bar
    Short - Entry Values - Pip Offset (20)
(It's ok - the Pip Offset setting knows whether to add or subtract the amount specified)

So that's all well and good for the entry. But when to get out? I guess maybe you'd add something like this as well to the systems above (where you specify X):
    Long - Init. S/L Values - X Pips Below Entry
    Long - Init. T/P Values - X Pips Above Entry
And reverse for shorts.

Sounds good so far? Well, now it's problem time. You set your system up to throw an entry signal on every bar. When the trade you wanted to make (on the announcement) is finished, the software is going to keep throwing entry signals. You'll need to create another holiday which begins soon after the announcement, and ends in the year 2999 (or whatever). Then when you get back to your computer, you could just switch off the "live" setting for this system.

So a combination of holidays and the "Every Bar" rule (normally used for trade management), the system does in fact do what you want.

However, this scenario highlights that while I've made this software as easy to use as possible (i.e. selecting rules from pull-down lists rather than having to learn some kind of simplified programming language), the user still needs to think hard about what they've set the system up to do. In this case, without the second holiday, the system is going to keep throwing entry signals when you probably don't want it to.


5. Is it possible to set up an OCO order? I know Oanda doesn't allow this, but let's say that if a system mentioned in step 4 were able to be created and I wanted to strangle the market - would it be possible to cancel the order that wasn't hit to prevent any whipsaw action that may happen?

Hmmmm, it's a little bit difficult. The way I've set it up is that every bar it calculates whether the system should create a long order or not, and whether it should create a short order or not.

You can have both a long order and short order at the same time, that's fine. But to cancel one when the other is entered? Hmmmm, hmmmmm...

I mean, to cancel an order when a trade in the opposite direction is entered is quite easy. Simple. The problem is that next bar is coming along, and it's probably going to want to create the order again.

I mean, to check that a trade in the opposite direction is still open and therefore don't create the new order is quite easy. Simple. The problem is that the trade previously entered may well be closed. So now there is no trade in the opposite direction, so it's probably going to want to create the order again.

Unless that holiday is there, saying don't trade anymore. We're a bar or two away from the announcement now anyway...

So I add a checkbox or something that says "Cancel/don't create orders if a trade in the opposite direction is entered", and I think it would work fine for your announcement scenario, assuming you've got a holiday in place straight after the announcement as I recommended in the answer to the previous question.

But the next bar comes around and there's no holiday, and no trade in place, then there is nothing to stop a new order being created if the rules say to do so. Again, the software is only going to do what you tell it to do, so it's important to think about how you've set up your system.


6. If an OCO cannot be set up would it be possible to cancel at a specified time? Or at times different to Oanda's? I guess it would need to rely on the computer's own internal clock (wouldn't want there to be a power surge... but that's okay, I've got a laptop... which brings up another interesting question...)

The holiday thing has the options:
    - Don't make new orders/enter new trades during the holiday period
    - Get out of all trades when the holiday starts
    - Get out of trades when the holiday starts unless the trade has X pips profit

By "holiday" I don't necessarily mean a holiday such as New Years Day. You can create whatever "holidays" you like. Maybe you don't want the thing to trade between 5AM and 10AM on Tuesdays. Or no trading on Thursday. Or between 11:16AM and 11:17AM on 27-Nov-2005. You can punch in whatever you like.

It relies on the computer clock.


7. Would it be possible to read the amount of battery power left in a laptop and to have some preset configuration where if the laptop gets to within 10% remaining on its battery life all open positions are closed or all pending positions are closed (or both... depending upon the users settings)? Ok, maybe I'm getting a bit too carried away now!

I'll think about it for the future :-)

I should say though, that actually the system doesn't create new orders if you don't have an Initial Stop Loss Value specified. i.e. There is *always* a stop loss in place. This should prevent a disaster in the case of power failure or other unexpected happenings.


8. With your systems are they all on the same time frame? Or can the user select their own time frame?

You can choose whatever time frame you like, assuming you want to use any of these time frames:
    - 5 Minutes
    - 15 Minutes
    - 30 Minutes
    - Hourly
    - 3 Hours
    - Daily
    - Weekly
    - Monthly

To continue the example, let's say you want to change the interval of the system to be 5 Minutes instead of Daily. Select any of the rules that use an interval, and click the Edit... button. Select "5 Minutes" from the pull-down list, check the "Apply Interval change to all rules" checkbox, and click Save. Done.

Thinking Stuff System Update Screen - Trading Rules

Thinking Stuff System Update Screen - Trading Rules


The screenshot on the left is the "before" shot - you can see down the right hand side that all the rules are "Daily". Then on the right is the "after" shot - everything is now 5 Minutes. That took about 6 clicks.

Why nothing less than 5 Minutes?

Because the 4 years of data I have now, without 1 minute data, takes up about 1.5Gb for each currency. Multiply that by maybe 5 or 6 currencies you might want to backtest on, it all adds up very quickly.

Add to that the time it would take to backtest a system based on 1 minute data.

Add to that Oanda's API gives you about 500 candles of history, it means if the computer/internet/electricity went down, you'd have only 500 minutes (~8.5 hours) in order to get it up again before you'd start having holes in your historical data.

Taking all that into consideration, I decided that 5 minutes was the "safest" minimum interval. 500 x 5 minutes is about 1.7 days. If you're still not online after that time, you'll be making the call to Oanda to purchase their ridiculously expensive historical data (like $40 per month per currency or something).


9. Can orders that have been executed be sent to an email address? The benefits of this would be to receive an alert via my mobile phone when I'm out (just need to make sure that the email message doesn't have any more than 150 characters!). Hopefully the alerts that are sent via email are also within the 150 character limit!

In Japan we can receive emails on our mobile phone. When I left Australia they had only SMS. Has it changed? Anyway, yep, email alerts are included, if you specify. I'll make sure the message is brief.

You can specify zero, one or many email addresses to send the alert to. Alerts are triggered on Order Placement, Order Cancelled, Trade Entered, Trade Exited. You specify which of those you want to be informed about.


10. Just to confirm: this program allows you to automatically trade any system that is programmed into it?

This program allows you to create trading systems by specifying, one-by-one, the rules that you want.

Rules are created by selecting options from pull-down lists, and sometimes entering numbers, like the Bollinger period (yes, sorry, a bit of typing involved :-).

It can then backtest that system. It spits out Excel files with the summary, and a listing of all trades it would have entered. Then an Excel Macro I created pretties up a nice chart so you can see exactly what the system is trying to do.

If you're satisfied with that, you let it loose on your demo account.

And if you're satisfied with that, you let it loose in the real world.

With the backtesting, you just need data from somewhere. Anywhere. But with the demo and real trading, you need the API from that company.


11. Lastly, would it be okay if I informed my visitors about your site?

Please. The more comments/free discussion the better. But...

I guess I'm maybe 2 months away from getting this working for myself.

Then maybe another 4 months after that (give or take) to getting it to something resembling a commercial application (if I decide it's worthwhile to make it into a commercial application).

And then, if I did decide to sell it, there's the thing of money. It uses a MySQL database, which is free for personal use, but needs a licence if it's used with a commercial application. I'm not sure of the exact price, but that'd be a couple of hundred dollars.

Then the Oanda API is $600 to buy. The DynaOrder one, for use with FXCM and the like, is cheaper ($250), but has no historical download facility that I can see. Well, it can get the latest Bid and Ask prices, but I can't see anything like Oanda's "Get the last 500 candles" function.

So before I get a cent of money, the poor user has already forked out $800-$900.

Troubling.


Well, that's all for now.

 

Tuesday, June 07, 2005

Thinking Stuff

So here are some screen shots and a bit more of an explanation of what I've been working on for the last 5 months. Hopefully it might inspire someone else to start making one of their own. If so, feel free to reverse-engineer what I've done here. "More life to all", as they say. If so, please contact me somehow - either through leaving a comment or through the Contact Me link to the left.

When you're looking at the screen shots though, remember that it's not finished, and that the numbers you're looking at aren't real.

First off, it stores orders and trades. And, if the company you've selected has an API available, you can send that order or modification to the trade off to the broker.

The order screen is relatively easy:

Thinking Stuff Order Screen


But there were so many fields for a trade that I decided to split them into different tabs:

Thinking Stuff Trade Screen - Details

Thinking Stuff Trade Screen - Entry


Thinking Stuff Trade Screen - During

Thinking Stuff Trade Screen - Exit


Now to the Systems area. A trading "rule" is something like "RSI in overbought". A bunch of rules form a "system".

However, a system is not just about the rules for when to buy and when to sell. There's also rules for how much money to use, times of day you shouldn't buy, and so forth. These extra bits are so very incredibly important, and these are the things which prevent the loss of all your capital.

Briefly, a complete system should have:

  • Entry rules - they generate a "buy" or "don't buy" signal;

  • Entry value - the exact price at which to buy;

  • Initial stop loss value - the exact price at which you are going to sell if the trade goes against you. You ALWAYS have a stop loss - you know exactly your $ at risk;

  • Initial take profit value - the exact price at which you are going to sell if the trade goes in your favour. This is optional. Either you have a take profit, or you rely on your trade management;

  • Trade management rules - when to move your stop loss to a position of decreased risk, to a position of break-even, and eventually to locking-in profits;

  • Trade management values - the exact points at which to move the stop loss;

  • Exit rules - they generate a "get out right now" or not signal;

  • Money management - the exact amount of money you're prepared to risk on this trade. Often people go by the rule of "never risk more than 2% of your entire trading bank on any one particular trade". Or 1%. Or 3%. Or whatever;

  • When not to trade rules - tell you to stay out, even if all of the above looks fantastic. Such rules might be "don't enter any trades less than 2 hours before a major announcement" (with "major" having also been defined). "Don't bother trading 1 week before Xmas, until 1 week after New Years"-kind-of-thing;

Anyway, that's roughly how a system should be. So here are the screenshots:

Thinking Stuff System Screen - Money Management

Thinking Stuff System Screen - Trading Rules


The screen on the left (above) is the Money Management tab. The Last Gasp setting specifies what to do when the price has jumped so quickly that we couldn't get in at our calculated entry. Do we just get in whatever the price is now? Or not?

The screen on the right (above) is the Trading Rules tab. That's the magical part of this software. It allows me to experiment with different settings just through clicks of the mouse, rather than chopping and changing code.

You'll see in that screenshot that I just have one rule each for Long - Entry Rule, Long - Entry Value, etc. But the way I've set it up means you can have as many rules as you like. For example:
    Long - Entry Rules - Close Above High Of Last X Bars
    Long - Entry Rules - Price Closes Above MA(20)
    Long - Entry Rules - MA(3) Crosses Above the MA(5)
    Long - Entry Rules - Slow Stochastic In Oversold
    Long - Entry Values - Close of Current Bar

All Entry Rules must evaluate to being true for the signal to be thrown, and if it is then the entry value is set at the close of the current bar (in this example). Just one of the rules being false and there is no signal. I mean, that's the point of having rules, right?

For this reason there is no "OR" in the entry rules. Actually if you have an OR in your entry rules, like this:
    Long - Entry Rules - Close Above High Of Last X Bars; OR
    Long - Entry Rules - Price Closes Above MA(20)
    Long - Entry Values - Close of Current Bar

Effectively that's two different systems - one where you go long if the close is above the high of the last X bars, and one where you go long if the price closes above the 20-day moving average. If you want to do that, just create two systems with all other settings the same.

That's for entry rules. For exit rules it's a touch different. It's perfectly valid for a system to to have more than one exit rule. Let's say you wanted to exit at market if just one of the following were true (T/P stands for "Take Profit"):
    Long - T/P Mgmt Rules - Close Below High Of Last X Bars; OR
    Long - T/P Mgmt Rules - Price Closes Below MA(20)
    Long - T/P Mgmt Values - Exit At Market

Buuut, my software doesn't throw a signal unless ALL rules evaluate to being true. The above would only exit at market if both of the above rules were true, not if just one of them was.

What I did to get around this was create a secondary setting. Like this:
    Long - T/P Mgmt Rules - Close Below High Of Last X Bars
    Long - T/P Mgmt Values - Exit At Market

    Long - T/P Mgmt Rules #2 - Price Closes Below MA(20)
    Long - T/P Mgmt Values #2 - Exit At Market

But that's it - only two. If I ever come across a case that I *really* can't live without having a 3rd, I might program it in then. But low priority now.

But you can have many different value settings? Like this:
    Long - Entry Values - Close of Current Bar
    Long - Entry Values - Value of MA(20)
    Long - Entry Values - High Of Last X Bars

How does that work? Well, this is where I had to make an assumption, and the assumption is that if indeed there are more than one value to choose from, the system will use the highest entry value, the highest stop loss value, and lowest take profit value (for longs, reverse for shorts).

If you click Add..., or select a Trading Rule and click Edit..., below is the screen where you modify the settings:

Thinking Stuff Systems Update Screen


Next is the Long Description tab (below left). Because the Trading Rules window could get pretty cluttered and hard to read with a lot of rules, I thought I'd automatically generate a description in plain English. But it's low priority so hasn't been implemented yet.

The No Trading tab (below right) specifies, you guessed it, when not to trade. These particular settings make sure the system has been successful enough in the past that I'm prepared to allow it to keep going. Remember that I plan to be drinking beers while this software is doing its thing, so it needs some checks and balances. I also plan to put a couple more fields here, like "Stop altogether if the system has lost $X", where I specify what "X" is.

Thinking Stuff System Screen - Long Description

Thinking Stuff System Screen - No Trading


Profit Factor is (Av Win / Av Loss) * (Pct Winners / Pct Losers). If it equals 1, the system has neither lost nor made money. If it's less than one then the system is losing money, more than one and the system is making money. The bigger the number, the "better" it is. But this calculation falls down in that it doesn't take into account the total number of trades, or the total amount won/lost.

(5/4) * (55/45) equals (500000/400000) * (55/45).

It does.

Really.

Further, just because the last 5 trades have a Profit Factor of 2, doesn't mean the next trade is going to be any good. In fact, a scenario of events could take place where this rule keeps you out of the good trades and let's you get in on all the bad trades. That's why I'm going to add the "stop altogether if..." rule I mentioned above.

And why is it split out between Long Trades (where you profit from the price rising) and Short Trades (where you profit from the price falling)? Because in my back-testing to date, I've discovered that the markets are not mirrored.

Most trading systems I've come across have the exact opposite rules for going long as they do for going short. They've mirrored them, maybe for "neatness" or something. But no, unless those rules have been backtested as mirroring being the best way to go, it should not be this way. Effectively the rules for long trades and the rules for short trades create two different systems - just most people think of them as one system.

If you don't have them mirrored though, you run the chance that your rules tell you to be in both a long trade and a short trade at the same time. Indeed. This is called "hedging". If you are hedging with equal amounts of units purchased, effectively you will neither be making nor losing money, whatever the direction the price is going. Not such a big problem. Unless...

You're using Oanda, who don't allow hedging in the one account - what would happen here is that whatever you did second would close out whatever you did first. You wouldn't be in two trades - you'd be in zero trades. And probably you'd get angry that happened. Fortunately you can create multiple accounts with Oanda, and use one for Long trades, and the other for Short trades. Simple enough to set up with my software - you'd just create your system for the Long trades, then click the Copy button which will copy all the settings across to a new system. Modify the Trading Rules to be for going short ins tead of long, modify the account to be used. That's it. As I said, my theory is that the Long and Short Trading Rules are effectively two systems in one anyway.

By the way, a very simple example of a "mirrored" system is using a Moving Average (MA) of the close price. (I won't go through *all* the rules needed to make a system):

For Longs:
If the old close price was below the MA, and the new close price is above it, go long. Set the initial stop loss to the value of the MA. Every bar adjust the stop loss so it remains at the same value as the MA.

For Shorts:
If the old close price was above the MA, and the new close price is below it, go short. Set the initial stop loss to the value of the MA. Every bar adjust the stop loss so it remains at the same value as the MA.

With this system, the long trade is closed by its stop loss when the price falls through the MA. If the close of that bar is still below the MA, a short trade is entered. And vice versa. It's all very neat, and we can never be in both a long and short trade at the same time.

But as I said, my theory is that the markets are not mirrored. It's worthwhile to have two accounts so you can have different rules for going long than for going short.

Back to screenshots. No, wait - Risk To Return. With a stop loss AND take profit set, you can know exactly before the trade what your potential risk to potential return is. That's not what I'm talking about here. If you don't use a take profit then you can't calculate this. So my setting is based on actual results from the past X trades - how much did we actually risk vs how much did we actually get. If that number is falling too low, might be better to sto p until things get back to normal.

Okay, now back to screenshots. Holidays (left) allows you to specify dates/times that the system should stop trading. Major announcements can cause extreme spikes in the price, even if 20 minutes later it's back to exactly where it started. It could be annoying. Liquidity is thin during holidays. So, here you can tell the software when to not take any new trades, and when to get out if it's in one.

The Accounts tab is where you can specify which accounts to use, which currencies to trade in those accounts, and whose data feed to use to make the decisions.

Thinking Stuff System Screen - Holidays

Thinking Stuff System Screen - Accounts


Finally, the Alerts tab (left). You can specify an email address, or many, to send an email to when the system does stuff - any or all of Place Order, Cancel Order, Enter Trade, Exit Trade. Or the alerts could go to the screen. Or both.

If the alerts goes to the screen, it comes up in this Messages window (right). Nothing really interesting to say about that one.

Thinking Stuff System Screen - Alerts

Thinking Stuff Messages Screen


Phew. Once that's all set up, you go to the Back Testing screen (left). Select one or many systems to test, the time period to test them over, and click Start.

The results are spit out in comma-separated format, but with extra commas so it formats well in Excel. The software has no charting facility at present, but if you specify to make a data file as well, I have an Excel Macro which pretties up a nice chart (right). I can see exactly what the system is trying to do.

You can see on this particular chart that the system didn't do too badly for Long trades, although it missed a major upward move in the middle. On the other hand, Short trades were dismal. Which made me think (along with many other experiments) that the markets are not mirrored.

Thinking Stuff Backtest Screen

Thinking Stuff Sample Chart



And that's pretty much it. Might show how easy it is to create/modify/copy a System at a later date.

Please, I'd appreciate any comments.

 

Saturday, June 04, 2005

But If They're So Rich, Why....

Bruce Willis came to Japan recently, to promote his new movie "Hostage". Nothing so special about that, but it's the other thing he did in Japan that got me thinking...

I've been to two seminars about trading. One was about trading options on the ASX. The other was about trading currency on the forex markets.

Both were very informative, although attending them has not made me a successful trader. After thinking long and hard about why following the rules I bought only seem to make me do exactly the wrong thing, I came to the conclusion that the fault lay with trend lines, and support-resistance (SR) lines.

Many of you are scoffing now - of course the rules don't work, because if they did, those guys wouldn't need to give seminars. People who can't do, teach -kind-of-thing. (Just don't say that around my aunt the high school teacher).

But bare with me about the SR line thing. Both seminars I went to, they talked about SR lines being very important. "If the stock is moving up, and everything looks fantastic for a trade but there's an SR not too far away, don't get into the trade. Most likely it will hit it's head on the SR line and drop back," they would say.

It all works fantastically at the seminar - even if they have a live data feed (i.e. not pre-arranged charts). And I come away from the seminar just with a "knowing" kind of feel about me - like everything's going to be okay from now on.

I get home, put the lines on my chart, and those lines keep me out of what would have been fantastic trades. So I start taking lines off the chart - only keeping the *major* SR lines, where the price has reacted to that price level many, many times - so many times it's obvious that everyone in the world has drawn a line at exactly the same spot. That means I'm free now to get in on trades where, sure, the price has reacted there before, but only a few times.

Whenever I open a trade like that, the price *always* hit its head and dropped away.

So I put the lines back. I'm more cautious again. Now I only get in on trades where there is a decent amount of room to move before the next SR line.

Even after having done that, though, as soon as I open a trade it seems to hit its head and drop away. I ask myself "oh, should I have put an SR line there? ... Yeah, oh, I see, there's a couple of times there it did the same thing. Silly me. Be more careful next time."

I add that SR line so it doesn't happen again. I go through and add SR lines wherever they might just even have the smallest possibility of being an SR line. Now my chart is so covered with lines that it's impossible to trade - there is not enough room anywhere between lines for a decent profit, and I am therefore not able to place any trades.

And this, dear reader, is what happens to me time and time again when I try to use SR lines. I start off with a couple. I end up with hundreds. Seemingly impenetrable lines are broken without effort if I'm not in the trade. Places where the price reacted just once before become impenetrable if I'm in the trade. "Oh dear, that didn't seem like an SR line to me", I might say (but probably with many swear words thrown in), when that happens. Then I go to the next seminar. Repeat.

So the placement, and how many SR lines you put on your chart, are subjective. Different people will put different numbers of lines, at slightly different places, to the other people. It all depends on their past experiences, their recent experiences, and how they felt when they got up in the morning.

I've discovered that I absolutely suck at subjective things. Way too left-brain for that. Using trend lines and SR lines to trade is, for me, a losing combination.

Moreover, trend lines and SR lines work exceptionally well, except when they don't. From before, there were seemingly impenetrable SR lines that get broken in an instant when the market feels like it.

Anyway, I need to find a trading system (bunch of rules which tell me when to buy and sell) which is completely, 100% objective. IF such-and-such a condition is true THEN buy. IF the price is near an SR line THEN don't buy looks on the face of it as objective, but because the placement of that SR line is subjective, the rule becomes subjective.

So my new requirement for a trading system is that it must be so objective that a computer could do it. No emotion. Just rule says yes, so do it. By the way, both of the seminar dudes recommended trading diaries - to keep track of how you were feeling while trading. Did you buy because the rules said to, or because you just really wanted to trade something? Then at the end of the month, read through your diary and try to remove the emotion from your trading. But my take on it is that if the rules were 100% objective, there is no need for such a diary.

And I thought, well, if my requirement is that a computer could trade the system, then a computer should trade the system. There's no need for me to sit and stare at the computer screen all day. And that's something I did glean from the second seminar - he said he had a business partner who had made a trading-bot based on his rules. Before hearing that, I didn't think such a thing was possible. As soon as I heard it was, my mind kicked into gear on how to go about making my own.

So for the past four to five months, I've been working pretty hard on my software which will interact with the forex broker, and automatically trade on its own based on the system that I've given it. So I could be getting a suntan at the beach (unlikely - more like drinking at the pub), and yet making money at the same time. Well, trading at least, making money if I'm lucky.

I guess a quick and nasty version would have been up by now. But I wanted to make it special. It does backtesting now, so I can test my systems before making them "live". And the way I've set it up is so that rules can be added to a system by a few clicks of the mouse.

There is similar software available, but they are generally in the thousands of dollars range, and all require the learning of a cut-down version of computer programming language. You code your system, each system, and plug it into the software. It doesn't appeal to me. Where there is coding there is chance of bugs. And if you want to change/add/delete a rule from the system, there is modification of code. And with modification of code there is chance of bugs.

So my software is all mouse clicks. Want a system based on the Directional Movement System (based on the interplay between three calculated lines)? Click click click. Done. A couple more clicks and it's backtested. Ok, it didn't work. Want to change it from buying when +D is above -D, to buying when ADX is below +D and also below -D? Click click click. A couple more clicks and it's backtested. Ah, much better. But let's change the period from 20 to 30. Click click click... You get the picture.

You can set up different accounts to trade with. You can use a different company's data feed to make trading decisions with. You can tell each system how much money it has to trade with, and what percent of that money to risk on each trade. You can even tell it to stop trading until the last X number of trades have a certain Profit Factor.

It's seriously cool, and I haven't seen anything else like it in the marketplace. I'll put some screenshots up soon so you can reverse-engineer it. Two places to get APIs for brokers are Oanda and DynaOrder.

So Bruce Willis must make about $10 million per movie. And maybe about one movie every year or so. That's a decent income. A lot more than the people that gave the trading seminars, I'm willing to guess. He came to Japan, and aside from promoting his new movie, he did a car commercial. Huh? But if he's so rich, why did he do a car commercial? Isn't $10 million per year enough?

The big soccer stars earn about $100 million every 3 years. Yet they continue to play after that contract is over.

Bill Gates rocks up to work even though he's a freakin' billionaire.

Does anyone yell out "Hey! Andre Agassi! If you're so rich, why do you keep playing?". Or "Hey! Clint Eastwood! If you're so rich from being an actor, why do you want to direct movies as well?".

Or, to give a more correlated example: "Hey <insert your favourite now-retired famous sportsperson here>! If you're so rich, why do you want to be a coach?"

No, people don't have a problem with any of those. In fact, people think it's quite a normal thing for a previous champion sportsman to become a coach. Nobody questions their motives. So why do people have such a problem with pro-traders who want to give seminars? Isn't it exactly the same?

It's another income stream. If you had knowledge that others are willing to pay for, you'd give seminars too. So get over it.

Those two seminars didn't turn me into a pro-trader, but they sure did set me on the path. You don't become a pro-anything after one weekend of tuition. The question is, does the seminar provide you with your moneys worth of information? How much money would you have to lose in the markets before you come to the same conclusions as taught to you in the seminar? And that varies from person to person.

Oh, and then there are some shonks. So be careful :-)

 

Wednesday, June 01, 2005

Warning: Adult Content

Hello there, and welcome to my blog.

This blog is for my thoughts on trading. Trading is quite an easy task to perform. Having a winning trade is sometimes easy. Being profitable week after week is definitely *not* easy. Common wisdom has 80% of traders not making money.

To hopefully put me in the other 20%, currently I'm creating some software to trade automatically based on the rules I input. I've named it Thinking Stuff, based on the concepts in Wallace D. Wattle's book "The Science Of Getting Rich". You can download it for free at this site (I don't get anything in return if you do, I just really want to recommend the book).

With this blog I've taken the road of "a man with nothing to hide, hides nothing". This blog is brutally honest. You might read something and think to yourself "wow, I can't believe he wrote that!".

And I enjoy my own writing, so there's a lot of it.

If these things do not interest you, then read no further.

Finally, put your mouse over the photos to see descriptions, and click on them to see bigger versions.

No one's making you read...

Back to Sharky's Trading Diary.