Two titans of the forex robot trading industry are squaring off in the search for higher profits.
In the green corner we have BREAD (Basic Robot Earning All Day) with consistent earnings of approximately 1.2% per day. In the other green corner we have the relatively new ARTFAB (A Rising Tide Floats All Boats) with very promising early results. Already today ARTFAB has locked in over 3.0% returns.
Wait, before you change the channel, neither of these robots is for sale and I do not want to manage your money. Relax, it's safe here.
In a macro sense BREAD and ARTFAB work using very different concepts. BREAD attempts to time the market and move money in and out during cyclical movements. This allows a small amount of risk to be taken, hopefully profited from, and then put back to work during another apparent down cycle.
ARTFAB, on the other hand, doesn't care about cycles when opening positions. It accumulates small positions and releases them when larger price moves have made them significantly profitable. However, cycles are examined with respect to determining when it may be a good time to close a position.
Both of these strategies appear to be working reasonably well. I'm hoping that ARTFAB will prove to consistently earn more than BREAD, such that I am enticed to move capital from one robot sub-account to the other. However, I have to keep in mind that BREAD functions best during a consolidation while ARTFAB's best earnings occur during a market move.
Of course, as I trade the AUDJPY currency pair almost exclusively both of these robots are trading it. As I have mentioned from time to time my trading account is with Oanda (which let's me scale trade sizes down to the unit level) and I'm using the FxSpyder platform to create and run robots. I prefer Oanda's platform for discretionary trading.
Wednesday, October 21, 2009
Forex Robot Wars: BREAD vs ARTFAB
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.
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.
Posted by FOREX Rookie
at
10:24 AM
0
comments
Labels: ea, fxspyder, programming, robot
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.
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%
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.
Posted by FOREX Rookie
at
1:21 PM
0
comments
Labels: fxspyder, profitable, robot
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
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!
Posted by FOREX Rookie
at
12:34 PM
0
comments
Labels: ea, fxspyder, oanda, profitable, robot
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.
Posted by FOREX Rookie
at
5:14 PM
0
comments
Labels: ea, fxspyder, oanda, profitable, robot