stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Hedge Arb EA
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=535
Page 1 of 2
Author:  joancb [ Wed May 02, 2012 6:24 pm ]
Post subject:  Hedge Arb EA

Hello Everybody,

here is a piece of code I wrote last weekend and now it is in test mode, if you like it and you have new ideas to make it better step in!

Simple as that: buys one pair and sells another.

The EA places a pair of trades every x buffer pips, if the buffer input is set to 0 and continue to true a pair of trades will be placed every time the EA is reloaded in to the chart.

Maybe there's a point where enter again is highly effective, i.e. when the pair is positively correlated or when it is negative correlated, maybe following only one of the two pairs and treat it as the master, who knows..

It closes every trade when profit in $ is reached.

http://www.myfxbook.com/members/cusber/ ... u-b/298519
http://www.myfxbook.com/members/cusber/ ... u-s/298521
http://www.myfxbook.com/members/cusber/ ... -eu/298531
http://www.myfxbook.com/members/cusber/ ... -gu/298535
http://www.myfxbook.com/members/cusber/ ... u-b/298539
http://www.myfxbook.com/members/cusber/ ... zdu/298543
http://www.myfxbook.com/members/cusber/ ... y-1/298549
http://www.myfxbook.com/members/cusber/ ... -eu/298553
http://www.myfxbook.com/members/cusber/ ... u-b/298555

Cheers!
Author:  jboy [ Wed May 02, 2012 9:48 pm ]
Post subject:  Re: Hedge Arb EA

This is a cool new EA. Maybe we can put in Magic Numbers so we can put other EAs with this one, and they don't close every trade.
Author:  MichaelM [ Thu May 03, 2012 3:40 am ]
Post subject:  Re: Hedge Arb EA

This will be fun to play with :D

Found your first error in your EAs:

Don't do this or else your EA will close trades as soon as it opens them if your account profit is already >= "Profit":

if (AccountProfit()>=Profit) CloseOrders();


Do this instead:

if (AccountEquity()-AccountBalance()>=Profit) CloseOrders();
Author:  joancb [ Thu May 03, 2012 2:39 pm ]
Post subject:  Re: Hedge Arb EA

jboy wrote:This is a cool new EA. Maybe we can put in Magic Numbers so we can put other EAs with this one, and they don't close every trade.
As you asked I put some magic in post #1
Author:  joancb [ Thu May 03, 2012 2:50 pm ]
Post subject:  Re: Hedge Arb EA

MichaelM wrote:This will be fun to play with :D

Found your first error in your EAs:

Don't do this or else your EA will close trades as soon as it opens them if your account profit is already >= "Profit":

if (AccountProfit()>=Profit) CloseOrders();


Do this instead:

if (AccountEquity()-AccountBalance()>=Profit) CloseOrders();
Here I've changed how it calculates the profit, now it watches only the trades with the same magic number instead of the whole account.

Thank you for your input.
Author:  MichaelM [ Fri May 04, 2012 12:42 am ]
Post subject:  Re: Hedge Arb EA

BTW, isn't this just the same as trading EURGBP or AUDNZD, but with twice the lots for each "trade"?
Author:  joancb [ Fri May 04, 2012 6:06 am ]
Post subject:  Re: Hedge Arb EA

MichaelM wrote:BTW, isn't this just the same as trading EURGBP or AUDNZD, but with twice the lots for each "trade"?
Hey I'm a coder not a trader LOL and not very good on both :lol:

What if I put two instances of the EA buy/sell EURUSD/GBPUSD sell/buy GBPUSD/EURUSD ?

This will need some mods in the code, I'll do this later today.
Author:  MichaelM [ Fri May 04, 2012 6:46 am ]
Post subject:  Re: Hedge Arb EA

LOL, okay dude... have fun
Author:  jboy [ Fri May 04, 2012 7:16 am ]
Post subject:  Re: Hedge Arb EA

^ A little off topic, but Mike, I love that Avatar. It's funny.
Author:  garyfritz [ Fri May 04, 2012 2:10 pm ]
Post subject:  Re: Hedge Arb EA

I think you have to have teenagers (or be one yourself, mentally or chronologically) to fully appreciate it. :) See #9 at http://webtrends.about.com/od/profile1/ ... -Memes.htm
All times are UTC Page 1 of 2