Correlation charts

Regarding the last week analysis of the correlations we have the follwing chart for the USD:

We can see that correlation is going up for this pairs and it will be probably at 0.90 in the next week. As the correlation is going up we are having some little better results trading the usd pairs last week.

In the other pairs, we have the chart:

We can clearly see that in this case we are getting lower values regarding correlation.

Tags: , ,

End of the week and month pairs trading analisys

My neutral strategy to trade forex has been running in a demo account of forex.com since 2010-10-04, almost a month of trading. We are facing losses but this is not problem right now, the problem is to fine tune the strategy.

So, lets take a look at the statement: Statement from 2010-10-04 to 2010-10-29

As a pair trader i need to treat the long and short position opened when hedging as a single trade and examine the overall result of the 2 securities. I transformed manually the html default statement from the meta trader to a comma separated csv file. i added a blank space to separate the pairs trades. Note that there are trades with one leg only, this were trades opened befoe the expert advisor modification to avoid this situation. scrolling down i can see how the last trades are all opened in pairs as they should.

Another thing to note is that some trades don’t get closed after the pair lost 77 usd or earned 30 usd. This is because a few trades were closed manually, this is avoided at all cost at later trades. If the trade ends at for example -80 usd it is probably because we were facing high volatility at the moment of close and the slippage caused to dont exit at the exact wanted price.

The CSV file of trades for october

After this i passed the csv to a standard 2003 excel file, this way i can add colors and also make some calculations with the columns. I painted in green the winners and in red the loosers.

Excel painted file

I calculated in the spreadsheet that 30 trades were made in total,  15 trades were winners and 15 were losses. With this in mind we know that 50% percent of the trades are winners and 50% are lossers, this explain the overall lost:

77 x 15 = 1155

30 x 15 = 450
——————–

705  usd of loss. It is clear that the stop loss is to big and the main reason of the overall strategy.

Consider the following equation:

(NW x MW) – (NL x ML) = 0

NW = number of winning trades
MW = magnitude of a winner trade
NL = number of losser trades
ML = magnitude of a losser trade

The equation assumes we will end up with 0 profit, we of course want to win money but for now lets try to don’t loose.

If the number of total trades is lets say 100, we have 50 winners and 50 lossers, we resolve the ecuation for ML:

- (50 x ML) = – 50 x 30 = -1500
ML = 1500/50= 30

It is pretty obvious that the stop loss should be placed at 30 usd to this strategy of 50-50 end up with no loss.

This 30 usd will be the stop loss used for my strategy from now one to start november, i already changed the stop loss value in both expert advisors (eurusd-gbpusd and eurjpy-gbpjpy) to 30 usd.

New stop loss = 30 usd
Profit taker = remains 30 usd

Lets now assume that in the same 100 trades we will like to make for example 500 dollars. What will be the stop loss value in this case ?

(30×50) – SLx50 = 500
- (SL x 500) = 500 – 1500
- SL = -1000/50 = 20 usd

To make 500 usd in theory we should have the stop loss at 20 usd and the take profits at 30 usd. In that case we have a winner strategy in design.

Tags: , , , , ,

Personal Correlation Tables

At the beginning of last week i created an expert advisor to export correlation coefficients every one hour to a csv file. With this data i will be able to create my own correlation history and not depend from any internet site or external reference.

At the end of the week i will provide charts for the correlation and take conclusions, this is the chart for the correlation coefficient on my system from 2010.10.17 to 2010.10.22 using the 60 minutes timeframe:

During this week the coefficient oscillated from 0.76 and 0.80 to end up at 0.79 on friday. Here is the csv of data collected on the week: CSV

Is this correlation high? low? compared with historical values ? i really don’t know it yet, as i get a new data set next week i will have a better idea but i will need a lot more than 2 weeks samples to really know what is high or low for this 2 pairs.

The other pair in question is the EURJPY-GBPJPY:

It looks like a really low correlation, during the week the coefficient oscillated between 0.4 and 0.33 ending up at 0.33 friday. Again i don’t know if this is really low with a first data set, i will have a better idea in the next weeks. Let’s see how it goes and the most important … is this low correlation coefficient the reason why my neutral hedge strategy is failing in the last 2 weeks ? I hope it is ;)

The CVS for eurjpy-gbpjpy here

Tags: , , , , , ,

UnCorrelated pairs season

As we continue trading the pairs trading strategy using the normalized deviation of  what we think  are related pairs, we are still in an uncorrelated season which is bringing  losses to the overall invested capital.

Regarding the EURUSD-GBPUSD the correlation coefficient is right now 0.79 for the 60 minutes period and it is climbing, i am expecting to be in 0.80, 0.81 very soon. I expect to start earning at that levels, or at least see money move in the same way as oscillator.

In the other hand the EURJPY-GBPJPY correlation is each day lower and it is right now at 0.35 levels, this is a very low coefficient, it haves sense that the strategy is not working at all at this levels.

Here is the statement of the situation of both experts now: STATEMENT

One other thing i adjusted to the experts this week is that sometimes only one side of the hedge was opened. I adjusted the code to double check this and now it is opening the 2 sides of the hedge yes or yes, so there will not be more one pair only trades.

Finally, i created other experts to export correlation values to csv files for future studies. I need my own historical values and my own standard deviations, more details on this coming soon.

Tags: , , , , , , , ,

End and start of the week neutral updates

For the end of last week we continue in the loser stream. Remember we are waiting until the correlation came back to higher levels to see if this is affecting the overall strategy.

starting this new week, a trade was opening in the early asian session:

Just to end losing -77 even if the oscillator went down:

Correlation was at 0.76, still to low.

Statement Down 226 USD right now.

Some money management considerations:

Initial deposit: 10000 usd – 100 %

Profit taker: 30 usd – 0.3 %

Stop loss: 77 usd – 0.77%

Currenttly:  226 usd down – 2.26% of the initial deposit was lost.

Tags: , , , , , ,

eurusd gbpusd first hedge

Regarding the expert running in the gbpusd and eurusd a first trade was made last night at a correlation of 0.74.

While gbp ended with -20 the euro earned 53 for a total of $33 in the trade.

Here is the statement until now: Statement

Finally this same expert is now inside a trade selling gbp and buying euro, boths against the US dollar, it was made intermediate after the last one as the exit of the last one was over 100 units of the oscillator.

This trade, like the last one made in eurjpy/gbpjpy is also failing, the oscillator crossed the neutral line of 0 several times and no profit was showed.  This trade was not closed manually i am just letting it there until the stop loss catch it or a profit can be collected.

Note that i extended the oscillator history from 1500 bars to 2300 to fill all the screen of the linux.

Tags: , , , , ,

More pairs trading trades.

More trades were made by the neutral expert advisors, not really very good results this week, here is one trade made by the eurjpy-gbbjpy expert advisor:

Bacause the correlation coefficient is in this case 0.51 (to low) i think i am not getting good results, this made me exit the trade manually, the gbp made 58.68 while the eur -47.70 for a total of $10.98.

As the image shows the oscillator when down to 0 and crossed to the negative side without reaching my profit level, that was the reason of the exit, i will try to don’t close trades manually anyways from now on.

Tags: , , , ,

Pairs trading eurusd and gbpusd

In a testing period of a strategy i think it is better to make as much trades as possible to see what are the results. It will be good if we don’t have to wait 2 or 3 days for a trade to show up.

Similar to my picked pairs until now (eurjpy and gbpjpy) we have the same 2 but against the dollar instead of the yen. this 2 pairs are almost all the time correlated, higher than 0.70 so they are great candidates.

Let’s see how this new expert do, here is the EA working in the linux tester machine:

Note how the correlation coefficient in the 60 minutes timeframe is 0.75 at the moment of taking the image, In theory it should have better chances of success if a trade opens with 0.75 than if one is opened at 0.54.

Tags: , , ,

Problems neutral hedge startegy

For this week i am running the same as expert advisor i was using last week with only one modification, the date on the oscillator rolls automatically and it is the date and time of the bar 1500 in the past. As the time pass this date has be changed and i was doing manually before this. No other changes were made, last week 3 trades made, $115 of profits.

Expert is running since the start of the asian session on monday october 11 and we are now at 4 pm EST tuesday 12. The expert made 2 trades until now and both trades were stopped by the stop loss.

By accident, I deleted the chart images from the first looser trade. On this first trade the gbpjpy was bought and the eurjpy was sold, the gbp ended in -66.03 and the eur -9.78.

In the second one:

And here is the trade ending:

One side lost -$99 while the other earned $22.  The stop loss it is not really at 70 as the code says but it gets executed close.

Statment

It is clear that something is wrong, the source of the strategy is make the trade when the amplitude is high, as the amplitude start to be smaller your trade became profitable, when the oscillator is cero is time to get out.

I am thinking on 2 possible reasons for this situation, first it was working as expected last week, what is different now ? the date change addition i made or could be something else, the correlation.

In trades made last week the correlation coeficient of the 60 minutes timeframe was at least at 0.66, this trade was made at 0.54. It is possible that trades made with low correlation coeficient, lets say less than 0.70 haves more chances to loss money. It haves some sense, lets just keep the expert running all the rest of the week to see what happens in future trades.

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: , , , , , ,