Additional statistical arbitrage expert advisors

To have more and quicker signals i have now 2 additional expert advisors using statistical arbitrage strategy running at the same time.

EA1: trading gbpusd-eurusd
EA2: trading gbpjpy-eurjpy
EA3:trading audusd-nzdusd

Statistical arbitrage Expert advisor 2 and 3 are the new ones, EA 1 was already trading.

Stat arb EA2 – the yen trade:

Stat arb EA 3 – asia pacific trade:

Tags: , , , , , , , , ,

Mixed results

Using linux machine to make trades, 2 trades were done until now for the gbpusd-eurusd pairs, results are mixed. one trade failed when differential reverted back to the mean while the other one (a lot shorter in time) dropped profits.

tarde 1 losser entry:

trade 1 exit at mean 4 days later the entry was made and the result is - 54 USD but i was -100 usd down at some moments of the trade!

Now, in a more shorter in time trade made later:

and it exit just a few hours later at the mean:

the second trade made 31 USD

statement

Tags: , , , , ,

Neutral Hedge end of the week

For the end of the week only 1 more trade was opened, again the expert advisor opened only one side of the hedge, buying gbpjpy when the normalized deviation indicator was at -100:

The trade ended here with $30.31 of profits:

$115 since the test started, in 3 trades, all winners, not bad: Statment

The errors to fix are clear after this week of test:

- try to make sure both sides of the trade opens, the code right now says if one side is open do nothing, this haves to change to if one side is open open the other. if both sides are open do nothing.

- automatic date change in the indicator, it can’t be done by hand and the expert can’t stop working.

- check stop loss and profits targets, check if they get executed correctly.

Tags: , , , , , ,

First Neutral Hedge Conclusions

Finally the test for the neutral hedge strategy in the linux machine started this sunday (october 3th) with the asia session opening, the expert advisor using forex.com as broker is currently running since then trading eur-jpy and gbp-jpy.

Only 2 times since the test started the criteria to open trades was met, it sound as to little but it is enough for taking some conclusions.

The first trade was made on monday:

The oscilator pass the -100 limit and a hedge trade should be open, unfortunatly the expert advisor some times fails on opening the 2 trades and open just one, in this case only GBP-JPY was opened in the long side. It is expected to this pair to go up sooner or later, this is what happened and the trade was closed with 30 pips of profits.

At that point the trade was closed with a profit of  $30.01. As a first fix i will have to change the expert to make sure that both trades are open and not just one.

A second trade was opened by the expert, this time both trades were open, long gbp, short euro:

See how it looks like the oscilator touched the -100 before and no trade was opened, this is because meta trader zooms in or out the screen as the market advances depending on the volatility of the market. I didnt saw this trade in real time but i think that the oscilator never really touched that -100 while running and that is why no trade was opened.

It was a wild movment after the entry as we can see in the image of the close of the trade:

On this trade the gbp made $34.63 and the euro made $20.31. I am suspecting that the expert code exit the trade when one  pair is at 30 and not when the overall profit is 30. The movemt looks very wild in the charts, this can be another explanation for this, i will see what happens in future trades. The bank of japan made statments this week, they cutted interest rates to virtually 0, maybe this was at the time of that announcement.

Another thing is that the oscillator needs a starting date to work, i am working with about 10 days in the past but i am updating the date manually as time pass. this is because the oscillator stop working when the starting date is to far away in time. As a modification of the expert i have to make the expert update this date automatically to feed the oscillator.

Here is the statement of this 2 trades:  statement

Finally, i got an email today from forex.com, i contacted them and they told me i will need around 280 USD on the account just to be able to open a mini lot of euro-usd … for a hedge trade probably double of that should be in the account just to open the trade. That is just the minimum, i think i will need at least 1000 usd now to trade this strategy instead of the just 250 needed before.
This situation will make me search for investors when the moment of trading in real came, at the moment the strategy gets defined and the chances of success are high. The other option i have is to try to look for other broker.

If someone is interested on investing with me and with this strategy in the future please use this contact form.

from forex.com

We contacted you last week to inform you of an upcoming change to your FOREX.com account. Effective Monday, October 18, 2010 a new CFTC regulation will go into effect that limits the maximum leverage in the retail forex markets to 50:1.

The new margin requirement is 2% (50:1 leverage) for the major currencies and 5% for all other currencies (20:1 leverage). Metals will be offered at 100:1. View full list of currency pairs.

The new CFTC regulation is intended to protect retail investors in the US by preventing excessive use of leverage by traders who may not have an adequate understanding of the associated risks. We support their intention and have always provided customers with the ability to employ lower leverage ratios, based on their

Tags: , , , , , , , ,

Neutral Hedge Oscillator for Expert Advisor development

Reading the “Handbook of pairs trading” i found an oscillator is described called “Normalized deviation”, in the forex factory thread ( http://www.forexfactory.com/showthread.php?t=85097 ) a similar concept is presented as Neutral Hedge Oscillator by Swing Man.

This oscillator is a lot better tool to develop the expert advisor (oscillator is working on bottom window, it haves the same behavior as the overlay top one):

While the oscillator is up to 1000 a sell signal is triggered for the GBP-JPY and a buy one for the EUR-JPY. The number 1000 can be adjusted. If oscillator is at -1000 a buy signal is triggered for the GBP-JPY.

I now have the expert advisor, next week i will be testing it, i will make it look prettier also with corrected information in the top left information box.

Tags: , , ,

Hedge trading first conclusions

After a few days using the MyHedge Expert advisor i can now have some conclusions to make. First, the Hedge strategies haves to be tested live in demo accounts, this means that we cant use the strategy tester because it don’t allow to test stuff in 2 symbols at the same time. We also know there are clever ways to break this limit but i will leave that apart for now.

So trading in demo with myHedge i was playing around with the variables and modifying the script to make it work property, i can say now that i have the EA fully working on my computer.

My strategy until now was:

- use 60 min timeframe to calculate correlation between eur-jpy and gbp-jpy, if this correlation is equal or greater to 0.90 the EA open a long position in the gbp while it sells the eur or vise versa, i tried both ways.

This strategy is again to simple, some times work, some times don’t, so no edge using just that. Hedge minimize risk but it is not a strategy on its own, there is something else needed and i am now trying to find it to have better results.

Also, here is a screenshot of an indicator i am using to overlay 2 charts, it is very useful to see how 2 currencies correleted move, the indicator for the meta trader can be downloaded here:

http://codebase.mql4.com/2757

Tags: , , , , , , ,

Robot Optimization

Optimization of expert advisors will help me find the right parameters for different variables of the program in a period of time. It is better to use the 20 ema crossing the 200 ema or the 30 ema crossing the 193? all this kind of questions can be replied with the optimization process.

I will use control points instead of every tick so the process will be faster, we will use Expert Advisor 9 for optimization. I will run the optimizator with data of the current year, starting january 1 and ending july 31.

The 2 moving averages for the cross will be optimized, the take profits variable, the stop loss variable and the trailing stop will all be optimized as well. the mql build in optimizer will combine all this and display a report.

There is no need to use the same values for short and long trades, what it works good for long it don’t necessarily haves to work for short trades so i made 2 optimizations runs and here are the results:

Long Optimization Reports

Short Optimization Reports

It looks that the optimizer found great results for short trades, the draw down is of 20% and the expected payoff is high. This is what we look in an expert advisor, big payoffs and small drawdowns.

With this new optimized values:

StopLoss=250     TakeProfit=1850     Period_MA_1=9     Period_MA_2=171     Tral_Stop=750

i make a new expert advisor optimized for short sales, when i run it in the strategy tester using the most precise data now we get this curve from january 1st 2010 to today:

Details

Tags: , , , , , , ,

Strategy tester new results

The best i had until now was the expert advisor that uses the 21 and the 200 EMA cross with a 20 pips of stop loss and 30 of take profit (expert 5) and the expert where the same entry criteria was used but with a trailing stop moving in the direction of the trade after an amplitude of 40 pips is given (expert 7).

Now is time to test this 2 with the new historical consistent data:

Expert 8

and

Expert 9

The expert advisor code is the same as 5 and 7, i just want to difference the test results but they are actually the same code.

We can see that the earnings are less than with the original trades but that is of course ok if the test can be trusted.

Tags: , , , , ,

Auto trading the cable

I changed the automatic robot to run in the gbp-usd market instead of the euro so i can have the euro free for manual trades.  With the robot running, only one trade can be done in a given market at the same moment. So the robot will be trading the sterling while i will be able to still find strategies using my favorite market, the euro against the dollar.

Remember, the trades done by this first robot can be found here:  11 – 31 Moving Averages Difference for Trend Development info and operations

At 10:09 am EST the robot start running, at the same time criteria is found so the robot get in the market without hesitation:

The robot fails but criteria still there, the EA opens another trade:

This time the EA worked good and the trade is a winner, robot is in even now:

Another winner, EA is at +20 now:

Fails, EA at even now, 4 trades made for now in the US session, it is 11:58 am EST now:

Criteria was correct, EA won 20 again and it is at +20 now.
This time the robot don’t open a new trade as criteria ended, it is 2:04 pm EST now:

2:34 pm EST criteria is present again, EA makes a new trade:

robot fails but criteria still present for a new chance:

Fails again and criteria ends:

It is hard to know if this robot will work in the long term. Mql4 provides a feature to test the EAs using historial data,  lets do that to the robot before making any modifications to it.

Tags: , , , , , , , ,

Robot iron discipline

I had read this in many books and articles, “if there is no pattern present the best is don’t trade” or “do you have what is needed to don’t trade?”, things like that are very common in the trader literature.

The thing is, that is of course a lot more easy to say than to really do.  Emotions control me during real trading session, the robot will always follow the pre established rules.

In a very quiet day like today the difference between the 2 moving averages was never 18 pips so the robot just did nothing in the hole American session.

I will be leaving the robot running overnight to see if he can catch some move, i will know tomorrow:

Tags: , , ,