HedgeEA

To add comments, please log in or register
kokas
503
kokas  

Some time ago, on Elite section cturner and me begin the development of an Hedge EA that allow to hedge two currencys taking profit from the swing and from the swap. I think that for now there are too many people busy with the championship so, I 've decided to bring the EA to the public zone so everyone could participate on the development of it...

I believe that this is one of the best strategies that you could use, almost fail proof if you are not trading accounts too leveraged, and with a good money management.

So, for the EA to work, you have to put in on Experts folder and put the correlator indicador on the indicators folder. This indicator was developed by Igorad. I do not know too much about it. I would like to include it as a function on the EA, but I do not know how to...

I'm not an expert coder, this was my first experiment, as we are getting good results with it, so...

You can test it with default settings. Please make sure that you are getting GBPJPY and CHFJPY on market watch window. If you are using a mini account like IBFX you have to change the currency names to GBPJPYm and CHFJPYm

You can test with Correlation enabled or disabled.

We have actually a sub version on test that uses besides correlation indicator, Bollinger bands, but this is not a stable version for now.

regarding auto take profit (we are testing it with $50), we need ideas to how this could be set. I'm thinking in a way of make this number dependent of the total number of lots in the hedge. Account leverage must be take to this equation too.

Live Test Statement with MM:

http://www.forexforums.org/eatests/test2/statement.htm

Live Test Statement without MM

http://www.forexforums.org/eatests/test1/statement.htm

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

After today I will mantain in this post the actual version of the EA.

first v used code from (EA's by Igorad,waltini) by kokas,cturner

v5.0 latest greatest version by kokas

v5.1 10-23-06 added bollinger filter, micro account by cturner

v5.2 10-24-06 added logic to catch and fix 1 of the 2 trades not being placed due to error

v5.3 10-24-06 correlation logic built in by Nicholishen

v5.4 10-24-06 bug fixes on open orders by cturner

v5.5 10-30-06 added short/long option that was missing by cturner

v5.6 10-30-06 added Autotrade, to stop entering automatic after exit, by kokas

v5.7 31-10-06 MM routine corrected, by kokas (fully support of micro accounts)

To do list:

1 - Integrate AutoTakeProfit

2 - Integrate another Entry signal (any sugestions? BB?) ALMOST DONE

3 - Built in correlator as a function DONE

4 - Send email on new hedge entry (and profit report for the old one)

Files:
kokas
503
kokas  

Big Surprise!

Well I've got a big big surprise today...

I was deleting demo accounts, I by mistake I've entered one account that I had open prior to the current on test...

that was a big surprise... It was with $500 profit, and the Ea was not monitoring it... on a $5.000 deposit trading 0.4 + 0.8 Lots!!!! And this on 2 F***G days!

I attach a statment here so you can check... This had freak me out... we need a trailler for this one, and a very good MM routine. If it goes all way up, it can go all way down too

Anyone can help???????????!!!!!!!!!!!!!!!!!!

Files:
yeoeleven
840
yeoeleven  

Missing pair

The InterBankFX platform that I have made available to test this EA does not have CHFJPY as a chart option. Is there a way to make that pair available?

John

kokas
503
kokas  

I'm Interbank Client and I have it on my platform... Maybe it is hidden...

right click the market watch window (where you have the quotes), and select "show all"

This will do it ... I think

cturner
151
cturner  

i added bb filter to v5 and micro option. works good on fxdd test so far. the bb filter if on will place order when the bollinger pair is below the middle boll line. this idea was from gmt site. it tries to enter when pairs on neg swing. if trying pairs other than default, you may need to alter code. if any mods made to code, please put comment near top so we can follow what is going on.

Files:
yeoeleven
840
yeoeleven  

Forward Testing

kokas:
I'm Interbank Client and I have it on my platform... Maybe it is hidden...

right click the market watch window (where you have the quotes), and select "show all"

This will do it ... I think

Thanks that worked fine.

I have set it to work on M30 with default settings. Immediately it opened on GJ with a counter trade on CJ with information on that chart.

John

tomstaufer
174
tomstaufer  

Hedge Trader with BB

cturner:
i added bb filter to v5 and micro option. works good on fxdd test so far. the bb filter if on will place order when the bollinger pair is below the middle boll line. this idea was from gmt site. it tries to enter when pairs on neg swing. if trying pairs other than default, you may need to alter code. if any mods made to code, please put comment near top so we can follow what is going on.

Hi cturner,

I would like to test it. What timeframe should I use ?

Is setup procedure the same like previous versions ?

BTW Everyone interested in hedge trading should read this:

http://homepage.mac.com/billbarnsley/FileSharing50.html

password: Friend

cturner
151
cturner  
tomstaufer:
Hi cturner,

I would like to test it. What timeframe should I use ?

Is setup procedure the same like previous versions ?

BTW Everyone interested in hedge trading should read this:

http://homepage.mac.com/billbarnsley/FileSharing50.html

password: Friend

i been running on 1 min time frame. yes setup the same. try anything and everything with it, see how it does. if you get a problem, fix it and post updated version or post the prob u having and we try to fix it. good luck.

BluePearl
170
BluePearl  

HedgeEA_v5_2.mq4

i've added logic to take care of errors generated while orders are being placed. in the old logic if there was an error during the placement of one order then only one order would be set leaving the pair unhedged.

Files:
Nicholishen
1016
Nicholishen  

correlation function

Here is the correlation as an internal function. This will speed up the processing time for the EA.

extern int cPeriod=20;

// CorrelationShift returns the shift value for the correlation indicator

double Correlation(string Symbol1,string Symbol2,int CorrelationShift=0){

double Correlation[],DiffBuffer1[],DiffBuffer2[],PowDiff1[],PowDiff2[];

ArrayResize(Correlation,cPeriod+1);ArrayResize(DiffBuffer1,cPeriod+1);

ArrayResize(DiffBuffer2,cPeriod+1);ArrayResize(PowDiff1,cPeriod+1);ArrayResize(PowDiff2,cPeriod+1);

for( int shift=cPeriod+1; shift>=0; shift--){

DiffBuffer1[shift]=iClose(Symbol1,0,shift)-iMA(Symbol1,0,cPeriod,0,MODE_SMA,PRICE_CLOSE,shift);

DiffBuffer2[shift]=iClose(Symbol2,0,shift)-iMA(Symbol2,0,cPeriod,0,MODE_SMA,PRICE_CLOSE,shift);

PowDiff1[shift]=MathPow(DiffBuffer1[shift],2);

PowDiff2[shift]=MathPow(DiffBuffer2[shift],2);

double u=0,l=0,s=0;

for( int i = cPeriod-1 ;i >= 0 ;i--){

u += DiffBuffer1[shift+i]*DiffBuffer2[shift+i];

l += PowDiff1[shift+i];

s += PowDiff2[shift+i];

}

if(l*s >0)Correlation[shift]=u/MathSqrt(l*s);

}

return(Correlation[CorrelationShift]);

return(-1);

}
Muddyguy
7
Muddyguy  

Hedge info

tomstaufer:
Hi cturner,

I would like to test it. What timeframe should I use ?

Is setup procedure the same like previous versions ?

BTW Everyone interested in hedge trading should read this:

http://homepage.mac.com/billbarnsley/FileSharing50.html

password: Friend

Hi guys,

I just noticed this reference to my personal web page. Hope the pdfs are helpful. I have a thread with lots of Q&A on hedge and grid trading in this forum in the commercial section. Search for "MuddyGuy" and you will find the thread.

My robots are free in demo accounts. (I believe you should understand a system and want to use it before buying anything) I use these robots to trade for my small investment club in real accounts, fyi.

Have fun,

Bill