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!
Hedge Arb EA
-
joancb
Hedge Arb EA
You do not have the required permissions to view the files attached to this post.
Last edited by joancb on Thu May 03, 2012 2:38 pm, edited 2 times in total.
-
jboy
- Trader
- Posts: 57
- Joined: Sat Dec 17, 2011 7:18 am
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.
-
MichaelM
- Trader
- Posts: 117
- Joined: Sun Dec 04, 2011 11:04 pm
Re: Hedge Arb EA
This will be fun to play with 
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();
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();
-
joancb
Re: Hedge Arb EA
As you asked I put some magic in post #1jboy 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.
-
joancb
Re: Hedge Arb EA
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.MichaelM wrote:This will be fun to play with
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();
Thank you for your input.
-
MichaelM
- Trader
- Posts: 117
- Joined: Sun Dec 04, 2011 11:04 pm
Re: Hedge Arb EA
BTW, isn't this just the same as trading EURGBP or AUDNZD, but with twice the lots for each "trade"?
-
joancb
Re: Hedge Arb EA
Hey I'm a coder not a trader LOL and not very good on bothMichaelM wrote:BTW, isn't this just the same as trading EURGBP or AUDNZD, but with twice the lots for each "trade"?
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.
-
MichaelM
- Trader
- Posts: 117
- Joined: Sun Dec 04, 2011 11:04 pm
Re: Hedge Arb EA
LOL, okay dude... have fun
-
jboy
- Trader
- Posts: 57
- Joined: Sat Dec 17, 2011 7:18 am
Re: Hedge Arb EA
^ A little off topic, but Mike, I love that Avatar. It's funny.
-
garyfritz
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