Forex



Go Back   Forex Trading > Trading systems > Martingale/Average Cost and Hedging
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 10-23-2006, 11:28 PM
kokas's Avatar
Senior Member
 
Join Date: Jun 2006
Location: Portugal
Posts: 284
kokas is on a distinguished road
Arrow HedgeEA

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)
Attached Files
File Type: mq4 HedgeEA_v5.7.mq4 (17.5 KB, 1694 views)

Last edited by kokas; 11-05-2006 at 03:47 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 10-24-2006, 02:20 AM
kokas's Avatar
Senior Member
 
Join Date: Jun 2006
Location: Portugal
Posts: 284
kokas is on a distinguished road
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???????????!!!!!!!!!!!!!!!!!!
Attached Files
File Type: htm Statement.htm (6.0 KB, 1723 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 10-24-2006, 02:39 AM
Senior Member
 
Join Date: Jun 2006
Posts: 744
yeoeleven is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #4 (permalink)  
Old 10-24-2006, 02:43 AM
kokas's Avatar
Senior Member
 
Join Date: Jun 2006
Location: Portugal
Posts: 284
kokas is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #5 (permalink)  
Old 10-24-2006, 03:22 AM
Member
 
Join Date: May 2006
Posts: 51
cturner is on a distinguished road
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.
Attached Files
File Type: mq4 HedgeEA_v5_1.mq4 (12.1 KB, 508 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #6 (permalink)  
Old 10-24-2006, 04:01 AM
Senior Member
 
Join Date: Jun 2006
Posts: 744
yeoeleven is on a distinguished road
Forward Testing

Quote:
Originally Posted by 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #7 (permalink)  
Old 10-24-2006, 04:37 PM
Senior Member
 
Join Date: Sep 2006
Posts: 189
tomstaufer is on a distinguished road
Post Hedge Trader with BB

Quote:
Originally Posted by 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #8 (permalink)  
Old 10-24-2006, 05:55 PM
Member
 
Join Date: May 2006
Posts: 51
cturner is on a distinguished road
Quote:
Originally Posted by 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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #9 (permalink)  
Old 10-24-2006, 08:00 PM
BluePearl's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 206
BluePearl is on a distinguished road
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.
Attached Files
File Type: mq4 HedgeEA_v5_2.mq4 (14.9 KB, 442 views)

Last edited by BluePearl; 10-24-2006 at 10:51 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #10 (permalink)  
Old 10-24-2006, 08:11 PM
Nicholishen's Avatar
Senior Member
 
Join Date: Dec 2005
Posts: 531
Nicholishen is on a distinguished road
correlation function

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

PHP Code:
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+1shift>=0shift--){
      
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-;>= ;i--){
         
+= DiffBuffer1[shift+i]*DiffBuffer2[shift+i];
         
+= PowDiff1[shift+i];
         
+= PowDiff2[shift+i];
      }
      if(
l*>0)Correlation[shift]=u/MathSqrt(l*s);
   }   
   return(
Correlation[CorrelationShift]);
   return(-
1); 

__________________
"Anyone who has never made a mistake has never tried anything new." -Albert Einstein
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks

Tags
hedgeEA, hedgeEA v6.1


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump


All times are GMT. The time now is 07:28 PM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.