Showing posts with label robot. Show all posts
Showing posts with label robot. Show all posts

Friday, October 23, 2009

Robot Trading: Six Weeks In

Things are going well. As you can see BREAD (Basic Robot Earning All Day) is starting to look like a winner.

   Return   Day
0.1900% Sun 13 September
3.2339% Mon 14
3.1616% Tue 15
3.2615% Wed 16
2.1510% Thu 17
0.4442% Fri 18
--------------- 13.05%

0.1850% Sun 20
2.0259% Mon 21
0.9016% Tue 22
1.1536% Wed 23
0.2460% Thu 24
0.1338% Fri 25
--------------- 4.72%

0.0000% Sun 27
0.1900% Mon 28
0.6862% Tue 29
2.3444% Wed 30
0.3317% Thu 01 October
0.7376% Fri 02
--------------- 4.44%

0.7311% Sun 04
1.0346% Mon 05
1.0587% Tue 06
1.9310% Wed 07
1.6854% Thu 08
0.9897% Fri 09
--------------- 7.75%

0.0915% Sun 11
1.2179% Mon 12
1.4263% Tue 13
1.9298% Wed 14
1.3023% Thu 15
1.2064% Fri 16
--------------- 7.38%

0.2985% Sun 18
1.6787% Mon 19
2.1774% Tue 20
2.3200% Wed 21
2.3552% Thu 22
1.2715% Fri 23
--------------- 10.52%
Looking back, this system was too aggressive during the first week. Later tweaks reduced this aggressiveness to some degree but also lead to lower earnings. At the moment aggression is scaled based on market factors so that in some situations it will take a larger slice.

Although the last week of earnings was great it's really too early to know how this robot will perform in the long term. As mentioned in a recent post I know that BREAD will earn the most during a consolidation period with prices confined in a range that ends in an upward break. I do expect the AUDJPY to exhibit this behavior a lot but it certainly won't do this all the time.

Now what?

This thing has been trading live for a while now. The only thing I plan to do is keep on letting it run until I'm able to create something better. ARTFAB (A Rising Tide Floats All Boats) is the latest attempt...

UPDATE: Something I'm curious about is if I'll notice a longer term cycle in robot behavior. For example, the last time BREAD earned more than 10% in a week there were a couple of weeks that then underperformed. It is possible that the market will exhibit behavior that is clearly visible through trading profits.

UPDATE: I have discovered this very good blog... Hack the market. From there I've noted the following graph:


This suggest to me that I can gauge my daily returns against that of the bigger players to see whether not I'm doing well. Notice that the smallest group seems to have much better returns -- and thus is where I should be comparing my results. Perhaps my stretch goal of 2.5% is a little two low? Regardless, I'll be happy to up my goal when I reach it.

Saturday, October 17, 2009

New Robot Rules Fermenting

It's late Friday night, the markets are closed, and all through the house not a creature is stirring. Well, nobody but the scheming trader hatching up another robotic system.

As someone who designs software systems for a living I can assure you that, in terms of making improvements, nothing is more helpful than watching a system in action. The key point here is the concept of "seeing" the results. While this arena is a bit of a different animal I've always been proud to claim that if I could see the problem I could fix it. You see, no matter how complex the problem there is usually something along the lines of a paradigm shift which greatly changes the nature of available solutions.

So, at the end of the week, when I'm not at work, I can review charts, apply various indicators, and see how various changes might affect trading and earnings. During the week I can see or hear positions open and close and watch the daily results tally up. Simple but powerful stuff.

Anyway, the thing that is keeping me awake at night, in a good way, is a relatively easy way to increase the profit per trade. I believe so anyway. Hopefully we'll find out next week... as I'll be developing this new ARTFAB robot pronto.

I do already have a robot trading at an average return of 1.2% per day over the last five weeks (BREAD - basic robot earning all day) but I've set an aggressive stretch goal of averaging 2.5% per day. BREAD just isn't going to get there. Assuming that other people have done much better than my paltry goal really gets the creativity flowing -- as you simply know it's possible if others have done it. There must be a way to get there while strictly controlling risk levels.

I'm sure there are many ways. I intend to find one of them.

Friday, October 16, 2009

Meteoric AUDJPY Rise

I'm starting to get more than a little cautious about the stellar increase in the AUDJPY over the last several days.

While it's true that markets can continue to move higher or lower for long periods of time it's important not to get too caught up in recent events. In fact, though we all react to these things at different rates, you can consider it a warning whenever there is something to get caught up in.

Insidiously, it is often those things that happen over a very long period of time that we forget to take notice of. For example, the smart phone has been growing in leaps and bounds and will probably do so for years, but at some point it is likely to turn into the next PC. If you haven't noticed PC's are now relatively cheap commodity products which leaves PC makers turning to the service sector in an attempt to fuel continued growth.

In any case, this is a point at which I have to resist ramping up the aggression factor in my trading robot... and the notion that it might be a good idea to take a bigger bite out of upward movement needs to serve as a warning to me.

Monday, October 12, 2009

Robot Upgrades: Preliminary Results

On weekends I like to either tweak existing robots or create new ones. While it's very early in the process I think the most recent tweaks are going to have a noticeable positive effect.

I woke up around 4:00am this morning and thought I'd check on the computer. What did I see? A nice AUDJPY move from 81.10 to 81.50 for now. Anyhow, this weekend's tweaks were operating on the dip and return.

Returns are clearly higher over this move than they would have been without recent changes. This is great news. Something as apparently minor as pushing average daily returns from 1.2% to 1.4% would have a huge effect on compounding.

Anyhow... let's wait and see how things look by light of day.

Friday, October 9, 2009

BREAD's Trading Results

Yes, for lack of a better name I am calling my robot BREAD. This is short for Basic Robot Earning All Day. It has been given minor tweaks from time to time but it still continues to follow the same system and strategy... taking advantage of constant price oscillations in the AUDJPY.

While the results don't look all that spectacular I invite you to investigate how this ends up in a compound interest calculator. And, finally, the results for the last four weeks are:

    ReturnDay
    0.1900%Sun 13 September
    3.2339%Mon 14
    3.1616%Tue 15
    3.2615%Wed 16
    2.1510%Thu 17
    0.4442%Fri 18
     
    0.1850%Sun 20
    2.0259%Mon 21
    0.9016%Tue 22
    1.1536%Wed 23
    0.2460%Thu 24
    0.1338%Fri 25
     
    0.0000%Sun 27
    0.1900%Mon 28
    0.6862%Tue 29
    2.3444%Wed 30
    0.3317%Thu 01 October
    0.7376%Fri 02
     
    0.7311%Sun 04
    1.0346%Mon 05
    1.0587%Tue 06
    1.9310%Wed 07
    1.6854%Thu 08
    0.9897%Fri 09
So far the average rate of return over the life of the robot is ~7.20% per week. I'd like to make improvements but it is difficult to make changes that don't have unintended consequences.

Monday, October 5, 2009

Robot Strategy / Development

Without getting into detailed specifics I thought I'd try to answer a recent question about the strategies I'm trying with my various robots.

First, a bit of background in case this is the first post you see on this blog:

  • I design software and systems for a living
  • I've been trading for years -- learning through the heart of the downturn.
With that out of the way I'd suggest looking at one of my posts about microtrading.

You may also want to consider the fact that the Australian economy seems to be doing very well with respect to the rest of the world. I've been pointing that out on my blog from time to time. Also, if you follow AUDJPY as I do, you may notice that the RBA just hiked interest rates by 25 basis points. This bears out a previous post about the long term carry trade prognosis dated September 2008.

Anyway, what this all means is that I'm happy to open long positions in AUDJPY, to some pre-defined level of risk, and then wait for this currency pair to give me some profits. To get down to brass tacks, the AUDJPY trading robot looks for what appears to be decent entry points, perhaps via stochastics and/or moving average crossovers, and then opens up micro-positions.

Sure, often the robot is wrong for some period of time. Who cares? With confidence that the AUDJPY will eventually rebound, and/or pay decent carry trade rates, it doesn't hurt to wait. Besides, when the robot is wrong, trades entered at even lower levels can often be closed for a profit, repeatedly, prior to a later price rise allowing the short-term carry trade to be closed for a profit.

In case you are thinking this sounds like throwing darts here are a few of the strategic points that guide this strategy:
  • The fundamentals over the next period of years points to a rising AUDJPY.
  • A future period of panic is unlikely to exceed the unwind that occurred during the recent financial crisis.
  • A rising AUDJPY will eventually allow any position to be exited profitably during a new high.
  • Using microtrades allows frequent trading within precise levels of accumulated risk.
  • Adding logic to enter positions at what will often be an opportune time greatly improves the odds of taking profit from a position quickly.
Another robot, currently experimental, trades the EURCHF. The idea here is that this currency pair is relatively stable compared to some others. Here I'm basically trying to play a mathematical game. If one were to open a very small long or short position every few moments the price would eventually make at least one trade direction profitable.

The reason this is interesting is that you can define the rate of return you want. Trade N positions at size S per hour at P pips profit and you will earn $D. Of course, it isn't so simple, but that's where the challenge lies. How do you keep from accumulating all your long positions at a recent top and all your short positions at a recent bottom? How do you keep from accumulating positions during a lull in price movement? How can you goose profits during active periods to make up for price movement lulls?

This thing is a work in progress, is not significantly capitalized, and probably is a pure dart throwing exercise. However, it does keep me busy. This is important. If I don't keep busy I'll worry too much about what's happening in my AUDJPY sub-account and either make discretionary trades or tinker with something that is already working well enough.

Anyway, all strategies face the same basic issues. These include:
  • Prices will eventually move up and down in varying amounts.
  • Accumulation of positions incurs increasing levels of risk.
  • Avoidance of risk decreases maximum theoretical gains.
  • Carry trades have long term pressure supporting the carry trade.
  • Carry trade pairs have periodic unwinds.
  • Long term economic fundamentals are plainly visible to all but very often misunderstood.
Traditional robot development is based on the same concepts as discretionary trading. Find a high probability entry point, based on risk versus reward, set an appropriate stop-loss, and then wait to see the result.

In a nutshell -- my current robot strategy is to look for long term predictability and then try to take advantage of that predictability as often as possible using small individual units of risk.

A final word of advice. If I'm wrong about the AUDJPY, and it doesn't have a long term rising trajectory, then I'll have an unproductive robot sitting on some carry trades. Similarly, if you decide to take advantage of a longer term trend, make sure you have a solid basis for your predictions.

Saturday, September 26, 2009

Forex Robot Mania

As suggested in my last post...

As a side note, I'm planning to make opposing robots this weekend. They will trade long and short positions in different sub-accounts.
I've put together yet another robot. It will trade the same currency both long and short in separate sub-accounts. I'll have to wait until Monday or Tuesday to activate it.

A few points I feel are worth mentioning:
  • I've been developing software and systems for my entire career -- I don't expect everyone can just snap together trading robots.
  • There are rate limitations, position size limitations and margin use limitations built into a common framework used by all the robots I'm putting together.
Anyway, each robot I make has customizations in several areas. Basically these all involve trade entry and exit conditions -- which can range from very simple to very complex.

Here is a chunk of common code used in each of my robots. Basically, I call the set of information relating a sub-account and a currency pair a trading context. Here is part of a function that gathers this context:

// ***************************************************
// Given strings representing the account to trade and
// the pair to be traded generate a trading context.
// ***************************************************
function getTradingContext(useacct,usepair)
{
// Determine account ID from it's name
// -----------------------------------
var acctid = 0;
for (id in accounts)
{
if ( accounts[id].name == useacct )
acctid = id;
}

if ( acctid == 0 )
{
write("Account name '" + useacct + "' not found!");
return null;
}

// Capture sub-account details in the trading context
// --------------------------------------------------
var myContext = accounts[acctid];

Once we have the account details we can determine various trading limitations. Here I use the account balance as well as manually controlled "reserve" and "release" values that determine default lot size and margin limit values:

   // Calculate various balance values for various purposes
// -----------------------------------------------------
reserve = 0.00;
release = 0.00;
bal = myContext.balance;

// Avoid silly mistakes
// --------------------
if ( release > reserve )
release = reserve;

lsbal = bal - reserve; // lot balance
trbal = bal - reserve + release; // margin balance

ls = (lsbal/20) / 100000; // lots size
ml = trbal * 0.099; // margin limit

myContext.reserve = reserve;
myContext.release = release;
myContext.lsbal = lsbal;
myContext.lotsize = ls.toFixed(5);
myContext.trbal = trbal;
myContext.marginlimit = trbal * 0.095;

Before a trade can be made the current account margin usage will be compared to the margin limit determined above. When a trade is made the default size of the trade is the lot size determined above. Some other items loaded into the context are shown here:

   // Capture currency pair details
// -------------------------------
myContext.usepair = usepair;
myContext.pair = pairs[usepair];
myContext.pipsize = pairs[usepair].pip;
myContext.spread = pairs[usepair].ask-pairs[usepair].bid;

// Set a spread limit for various currencies
// -----------------------------------------
myContext.spreadlimit = (4.26 * myContext.pipsize);
if ( usepair == "CHFJPY" )
myContext.spreadlimit = (2.26 * myContext.pipsize);
if ( usepair == "USDJPY" )
myContext.spreadlimit = (2.26 * myContext.pipsize);
if ( usepair == "EURUSD" )
myContext.spreadlimit = (2.01 * myContext.pipsize);

Including the currency pair information, especially the spread, is significant. For example, I do not let my robots trade when the spread is above certain values. This is because higher spreads are generally present when significant news events occur.

Later in my robots, in a function that is called when price changes are detected, I'll have something like the following:

   longctx = getTradingContext("sub1",currentPair);
if ( longctx )
tradeLong(longctx);

shortctx = getTradingContext("sub2",currentPair);
if ( shortctx )
tradeShort(shortctx);

Generally, I'll use short term charts and limit robot operations to the opening of a new candle. This avoids needless processing but how you activate your trading functions is up to you. Notice how I can simply pass the context, as developed above, into a trading function? The trading functions have the job of deciding whether or not to open a position in a sub-account that it controls. It may or may not use all the details available to it.

There you go. While this isn't complete it is by far the majority of a basic robot framework. If you are a programmer you simply have to figure out the trading rules to apply and write one or more functions that embodies those rules. For example, you may want to apply indicators to a chart, examine previously opened orders, or even trigger an email signal.

Hey, as a bonus for reading this far, here is a function that examines current open orders to see how many fall within a price range. Basically, I use this function to make sure that my robots aren't able to accumulate positions around any particular price point. Notice that one of the parameters is the trading context developed above.

// ***************************************************
// How many orders are open between min an max prices?
// ***************************************************
function rangeOrderQty(ctx,min,max)
{
var qty=0;

for (ticket in activeOrders)
{
if ( activeOrders[ticket].accountId != ctx.id )
continue;
if ( activeOrders[ticket].pair != ctx.usepair )
continue;

if ( activeOrders[ticket].price >= min
&& activeOrders[ticket].price <= max )
qty++;
}
return qty;
}

Finally, the previous code is for the FxSpyder trading platform. This is what I'm using to write robots these days. I continue to trade via Oanada.

Friday, September 25, 2009

Friday Market Analysis

I am following CNBC regularly (via their web site) these days. I see many of the pundits advocating panic and doom. I suspect they all want to be able to claim they were right when we finally do experience some type of pullback.

However, these braying naysayers of doom really don't have much of import to say. All they really do is act as large forces on the emotions of market players. Everyone is appropriately skittish due to the massive bear movements over the last year or more. It's only natural.

All of these fools who only imagine one direction for the markets will be right from time to time. What they say is not important. What's important is to understand the volatility, or level of price fluctuation, and the amount of risk that this implies when you are trading.

For example, the odd negative number here and there doesn't mean all that much. This doesn't mean the market won't throw a tantrum, but it does mean that there could be a spate of good numbers in another week or two. These trends have variations in them as well. Perhaps because the media jumps on whichever bandwagon has the most passengers the market sentiment gets rapidly overblown.

So, sure, we could see some type of sell-off coming soon. So what? So, don't risk all your money on the notion that the markets, carry trades, risk appetite, GDP growth, corporate profits or whatever will only go up. In fact, cushion yourself by assuming a mini-panic could be right around the corner. Seriously, hasn't everyone been hiding under their sheets due solely to the fact that we're in September?

What am I going to do? I'm going to move more capital into my account. Any serious downtown represents a good opportunity to scale in. So, let it rain, I'm going to wait until all the overextended or panicked fools get forced out, then I'm going to take a peck at an opportunity here and there. Again, just make sure to nibble your way in at appropriate times.

Remember, fear and downward movement provides opportunity, but only if you don't assume you can predict the bottom and thus assume too much risk. When you aren't being pushed into making decisions by market movements you can make much better decisions.

So, early next week, fresh capital into my account. I can apportion this to my robot trading army (I know, but it sounds more fun this way) in small chunks as we come up to significant resistance levels. Unless the world collapses, and if it does my trading account will be the least of my worries, there will eventually be another upturn.

As a side note, I'm planning to make opposing robots this weekend. They will trade long and short positions in different sub-accounts. I expect that one of the two will be earning during up or down movements. I expect both of them will earn during periods that the market is moving sideways. You can't see it but I'm rubbing my hands together in a greedy manner -- think Mr Burns.

Good luck out there.

Thursday Robot Recap

Thursday was a very slow day.

The market was down. The yen crosses took a dive. Everyone is getting antsy about stocks, news reports, and the month of September. OMG, the risk! My robot snoozed for much of the day and had little chance to earn anything useful.

However, amidst all the whining I have to realize that being up about 4.5% for the week isn't so bad.

Regardless, I did tweak things a tiny amount. Basically, the idea is to keep the robot trading for a while longer during downturns. This can be done by shaving a little bit off of positions and forcing a little bit more space between trades.

It seems like a good trade-off. Earn a small fraction less during good days but enable more trading on poorer days. If things don't work out it will be very easy to reverse these minor tweaks.

I also created a new robot this evening. Of course, it's based on the current system, but somewhat simplified. It's running on it's own sub-account with a tiny amount of capital. So, rather than attempting major adjustments on something that is already proven, I'll once again get into an A/B situation and see if there is a clear winner between the two.

On another note, I'm wondering how simple a robot can be and still be effective. Something to ponder as I drift off this evening.

Thursday, September 24, 2009

Wednesday Status

Wednesday was a slow day.

The AUDJPY was very quiet, which left little opportunity for my robot to extract revenue. In fact, with the DOW drop at the end of the trading day today we may be looking at a bit of a downward correction over the next little while.

My robot is not very active during downward movements. So, I'll get bored, worry about long term profitability, and otherwise be motivated to "do something" or "fix something" when I shouldn't. I must resist!

Anyway, while today was very slow, my currency trading robot did pull in 1.1% with over 4.3% for the week.

On a different note, I need to name my trading system. It would be nice to call it something other than "robot" every day. I could name it ARTFAB (A Rising Tide Floats All Boats) or something? Hmm, maybe FARTBAD or BADSINE?

Hey, BREAD might work... Basic Robot Earning All Day. Okay, tentatively, BREAD v1.0 is on the job. Unfortunately, bread is pretty passive, getting sliced, diced and toasted regularly. Zzzzz. I'll sleep on it.

Tuesday, September 22, 2009

Monday Robot Review

If you are a new visitor I should let you know I'm reviewing my own proprietary forex robot -- I'm not providing a general review of robots.

The Good
Profitability continues. Sunday evening the robot earned 0.2% and over the course of Monday it earned 2.0% return. It's not obvious, but when capital is added to the robot old smaller positions provide less return when closed profitably. This means that it will take a little while to flush out those old trades and get accurate profitability numbers.

The Bad
The newly added meta-trading aspect didn't work. Well, I was able to get meta-trades to open in a separate account, but the platform hung after each purchase. I don't know if it's a platform issue or if I did something inappropriate with my code. Perhaps next weekend I'll have a chance to ferret out the details.

The Pending
The robot hasn't yet been in a situation where it has had to stop trading due to accumulated risk. So, at this point, I haven't had a chance to test the notification system under live conditions.

Sunday, September 20, 2009

Weekend Robot Development II

While not fully tested, as the market isn't open for trading, I have also completed both the meta-robot concept and a notification system.

The meta-robot will look at the trades made via the current profitable robot and impose rules that require trades to open at a better price. The required difference, in pips, will be divided in two and added to the meta-robot's take profit point. For example, if the existing robot makes 6 pips on a position then the new meta-robot may open two pips lower and require a take profit of 7 pips.

The combination of a lower entry point and a lower take profit point imply that the meta-robot will always get a better deal. It will also have a higher chance of getting out of it's positions faster. Heh, nothing wrong with making pips faster! Of course, this also implies that the meta-robot may have less ability to open positions as better priced positions may not always be available. There is a bit more complexity to it but I won't bore you with the details.

Anyway, as usual, real life trading will tell the real story.

Finally, the notification system is implemented as a request to a web site. The web site will be able to look at the request parameters and decide what to do. For now, the web site does nothing interesting. Once I've seen the system in action for a while, and I decide it's working well and that it's useful, I'll see about putting more effort into a delivery system.

Saturday, September 19, 2009

Weekend Robot Development

Now that the weekend is here it's time to put on the thinking cap and figure out how to increase earnings, reduce risk or both.

As mentioned in a reply to a comment on the previous post I've reallocated funds, put in a reserve amount and added a manual release amount.

The reserve amount holds back capital from the lot size calculation and the total margin available calculation. This capital is ignored such that the robot acts as if it only has balance - reserve under management.

The release amount, if any, adds capital into the margin available calculation but does not change the lot size calculation. The purpose of this is allow a series of discretionary actions to reactivate the robot once it has stopped trading due to an extended period of unhelpful price movement without adjusting the risk per trade.

The amount of capital released can be reduced as the price moves in a profitable direction. I'm also hoping that the robot will earn above it's target rate so that some capital can be painlessly shifted to reserved status each week.

Unfortunately, all of this might make it harder to report standard profitability numbers. Whether rightly or wrongly I'm going to use the unreserved capital balance as the measurement value of the account. It's what the lot size is based on and I intend to grow that amount X% per week. I'll also be using that value for my theoretical compounding calculations.

Remaining on the burner are concepts such as the meta-robot and email notifications to be issued when the meta-robot identifies various conditions suitable for discretionary decisions. If these turn out to be useful I might even set up some type of free mailing list.

Wednesday, September 16, 2009

Forex Robot Wars

As you can see by my last few posts I've had a couple of trading robots slugging it out for the last few days.

I'm happy to announce that the latest robot has absolutely thrashed my initial robot. Here are the recent earnings for this week:

    Sun 0.19%
    Mon 3.23%
    Tue 3.16%
    Wed 3.26%
Obviously, I'm going to retire the previous robot, which earned at an average pace of approximately 0.5% per day, and allocate it's funds to the newer robot.

The next question is... can I find ways to improve this robot's operation? I'll have to think about that.

UPDATE:

I do have an improvement idea. Basically, use the trading and positions of one account to act as signals for another account. This way you can spot the inefficiencies in one and adjust for them with another -- while coding for them directly might require much more effort.

I foresee a second robot that would open less positions but at a higher rate of risk. It could potentially have better performance characteristics based on what I'm seeing happen on my charts.

Maybe I'll dub this concept "meta-robot" in the event that I eventually build it and post about it.

Monday, September 14, 2009

Two Live Robots

Sunday evening I unleashed another trading robot.

Here's how I set up my sub-accounts to do this in a reasonably safe manner.

  • My initial or primary account is used to add or remove funds.
  • Each robot trades in it's own sub-account
This let's me track the returns for each robot in a trivial manner. It also means that each robot is 100% independent.

If you do this be sure to name your sub-accounts in a neutral manner. Personally, I'd be tweaked if I ended up with names related to robots that were eventually no longer in use.

Now that I have multiple robots I can do A/B testing between robots, under various conditions, and then scale funds into the robot that seems to be working best.

What are the results?

Currently, since last night, my new robot has about five times the return of my older robot. It's already over 2% for today. However, I do expect that this robot to be unable to trade in conditions that the slower robot is able to exploit. I have a turtle vs hare experiment here.

For those of you who may be new to my blog I trade with Oanda. I haven't purchased their API since I am using the FxSpyder platform for that instead. The FxSpyder software still has a few rough edges but I am comfortable with it. Finally, for discretionary trading I still prefer the Oanda platform.

Update: This robot finished up over 3.2% today!

Saturday, September 12, 2009

Oanda Robot Trading -- Cost Efficiently

If you are trading with Oanda, as I am, you are probably aware that you have to trade a fair amount before their monthly API fees are waived.

However, there is an alternative. The first time I tried their platform, probably shortly after it was released, I didn't find it very inviting. However, about a month ago I tried again. Guess what? While I might not use the platform for discretionary trading it seems like a good option for robot trading.

Which platform am I talking about? FxSpyder of course. While using FxSpyder with Oanda isn't free the cost is much less than Oanda's API fee.

FxSpyder connects to your Oanda account and can be used as a manual trading platform. While you won't find it exactly the same as what you are used to, that has no bearing on whether or not you'll be able to use it for robot trading.

Now, don't get all excited, robot trading doesn't seem to be the way to instant riches. Well, at least not with the robot that I've written and am trading with. At the moment my average return is about 0.5% per trading day -- this includes the partial trading days on Sunday and Friday.

Compared to traditional investments this represents a ridiculous rate of return. Assuming 20 trading days a month that would equate to 10% per month, compounded. I'm working on improving this but find that it's harder than it sounds. This is partially because my work and family duties keep me far busier than I am used to.

In short, I've got ideas but little time to implement them. Some day I hope I'll be able to transition to trading, or at least tweaking my robots, as my full time job. It would certainly give me back a lot of my time.

Thursday, August 20, 2009

Robot Trading

I'm finally trading my own proprietary forex robot.

The best part is that I have the sound of money chiming on my computer at work every time I have a position closed due to reaching it's take profit price.

Anyway, no, I have no other hype to push.

What I do have is the power of the robot mind to watch the market 24 hours a day. What do I mean? I mean that as long as my computer stays on and connected I have a trading system that has no emotion, does not tire, and never misses a single moment of opportunity.

It's late... I'll post again in the next few days and provide more details.

Wednesday, May 6, 2009

MT4 EA: Average Position Based Trading

While I don't have any pictures to show, yet, I am working on an EA that trades AUDJPY based on the market price relative to the average price of positions held.

The first few passes at this type of system were pitiful. My testing starts from September of last year to now while only opening long positions. As you can imagine this is a difficult period of time for a long only system!

However, late last night I was able to complete a test that showed profits.

The strategy behind this EA is basically as follows:

  • If you've just seen a recent downward movement open an initial position.
  • If the price is high enough above or below your average order open price, open another.
  • If the current price is above your average price close your lowest and most profitable position.
  • Try not to open any position while in a downward movement regardless of the above rules.
Obviously, the last item mentioned is not simple, but it is the key to account survival. If you open too many positions and the market falls too far you will get a margin call.

As ever, I'm basically using the AUDJPY for this. I am interested in strategies that can accumulate a safe quantity of long positions such that they pay me to wait for the eventual upturn.

I'll provide updates once/if I'm able to get appropriate results.

... continuing ...

Here's a chart showing this:


Notice the wicked looking draw down during challenging periods of AUDJPY decline?

Sunday, April 26, 2009

MT4 EA: Moving Towards Sustainability

Yesterday's experiments with creating an expert advisor to scalp the 5 minute chart show great profits and great risk.

I've been working to reduce the level of risk without taking away the reasonable chance of making reasonable profits.

Here is the most recent chart:


This is running from 01-Feb-2009 to 25-Apr-2009 and obviously surviving any ups and downs during that period.

I'm still not happy with the relative size of the larger draw downs. I believe I can tune it but I'll want to add back aggressiveness or the growth will start to drop more than I'd like.

... continuing ...

Alright, I'm in danger of curve fitting, but I've tuned the advisor to take less risk and earn less profit. However, right now, the earnings curve is getting near ideal. The draw down is acceptable and the profits are around $4,000 per month. Of course, remember that this is all somewhat theoretical and running in a test environment.


The question on my mind is whether or not I can somehow turn up profits without creating larger draw down. It's not easy but I'll fool around some more and see where I end up.

... continuing ...

Increasing aggressiveness did not help. Various other modifications were also unsuccessful.

I've run this starting 01-Nov-2008 and it dies a horrible death. This is not surprising, but it does imply you'd need to know when things were going horribly and stop it. If you are able to manually ascertain that the market should only be moving upwards then this EA should do okay. It only opens long positions.


Is it (ea 2009-04-m5-6.mq4) worth a try?

Saturday, April 25, 2009

MT4 EA: Aggressive 5 Minute Scalper

Well, it's the weekend, what else is a grown man to do?

I had an inspiration for an (overly) aggressive expert advisor today. Basically, it's a simple buy low and sell high machine using oscillators.

Scope out the chart. It does fairly well for a period of time and then when the market finds it's achilles heel it is undone.


All is not lost. I have some ideas for improving the aggression factor as well as tinkering with it's currently abysmal "take a loss" strategy.

... continuing ...

Theoretically, you could take out $1,000 per day and end up with more money than you started with. It ran for 20 days (01-Apr to 20-Apr) before it's massive death spiral.

... continuing ...

Check this out. By adding a pending purchase system to delay early purchases until the price is a bit better as well as turning off loss sales (a bad strategy to be fixed up soon) we get the following.


The balance, actually I mean equity, is over $77,800 by the 16th in this run. Certainly more profitable than last time around. If we can get an intelligent way to cut losses we might be able to reduce the risk of catastrophe.

... continuing ...

I'm also running on various different time periods to make sure I'm not just optimizing for a certain month. That would not be good.

... continuing ...

Okay, after some tinkering, the system is living through a three month period, but obviously there is a tradeoff involved:


This is 01-Feb-2009 through 25-Apr-2009. There are a couple of scary draw down events and a final equity of around $56,000. So, again, in theory, at about $15,000 of profit per month you could withdraw about $500 every day and calculate the likelihood of scarfing away more than $10,000 before the system has a fatal event.

Unfortunately, removing equity will make it more likely to crash during a draw down situation. Perhaps withdraw at a slower pace? More realistically, I'd like to find a predictor for the draw down events and reduce them. This would reduce overall profit but perhaps the system could trade more aggressively if the draw down situations could be avoided.

Time to look at the reports to find the important dates and then look at the historic data in various time frames.