• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 6:32pm
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 6:32pm
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Overlay in MetaTrader 23 replies

Overlay 2 replies

Futures and Forex charting package with overlay 0 replies

Overlay Indicators - I've seen this lots of times but..... 3 replies

Histogram Overlay 1 reply

  • Trading Systems
  • /
  • Reply to Thread
  • Subscribe
  • 68
Attachments: Overlay Positive Hedging EA
Exit Attachments

Overlay Positive Hedging EA

  • Last Post
  •  
  • 1 1314Page 151617 20
  • 1 14Page 1516 20
  •  
  • Post #281
  • Quote
  • May 16, 2012 7:43pm May 16, 2012 7:43pm
  •  iwjw
  • | Joined Mar 2011 | Status: Member | 464 Posts
Quoting Dirtybrown
Disliked
Well jus tbecause you enter on a grid doesn't mean you have to exit on a grid.. Dare I, for the first time on the thread bring up an indicator. But maybe you can use the EA to check the pair that is in profit. For the profitable pair, check it against a Laguerre indicator. For Laguerre, when price crosses above .15 buy, crosses below .75 sell. It can be very accurate for manual trading. So maybe an mt5 version of this could be used to stay profitable trade pairs??
Ignored
been there, done that...not Laguerre but several other indicators
I didn't get an edge and always ran into the spikes
even random choice of long/short combination led to an overall positive outcome
it has to go into the supply/demand direction i think, but that's rather complicated for now (at least for me)
 
 
  • Post #282
  • Quote
  • May 16, 2012 8:14pm May 16, 2012 8:14pm
  •  iwjw
  • | Joined Mar 2011 | Status: Member | 464 Posts
that's long audusd vs. short nzdusd
It's working in 2012...didn't test prior because of missing historical data (and that's a big big issue with MT5)
but you always run into a spike that is big enough to kill the account
Attached Image (click to enlarge)
Click to Enlarge

Name: audusd_vs_nzdusd.png
Size: 18 KB
 
 
  • Post #283
  • Quote
  • May 16, 2012 8:18pm May 16, 2012 8:18pm
  •  iwjw
  • | Joined Mar 2011 | Status: Member | 464 Posts
long nu/short au
Attached Image (click to enlarge)
Click to Enlarge

Name: nzdusd_vs_audusd.png
Size: 18 KB
 
 
  • Post #284
  • Quote
  • May 16, 2012 9:24pm May 16, 2012 9:24pm
  •  Dirtybrown
  • Joined Mar 2008 | Status: Cointegrated Member | 621 Posts
updated these settings with layer level = 1, was 0

Mt4i link in my signature reflects these settings.

Quoting Dirtybrown
Disliked
Live statement here is a setup as you described. Notice the 2 separate magic numbers..

http://www.mt4i.com/users/heliosphan here are the templates

EDIT: Sorry the layers updated to 0 and restarted.
Ignored
Skype: heliosphan187
 
 
  • Post #285
  • Quote
  • May 16, 2012 9:33pm May 16, 2012 9:33pm
  •  jajano
  • | Joined Feb 2009 | Status: Super Trader | 447 Posts
those result above looks like have huge drawdown tho
 
 
  • Post #286
  • Quote
  • May 16, 2012 9:36pm May 16, 2012 9:36pm
  •  Dirtybrown
  • Joined Mar 2008 | Status: Cointegrated Member | 621 Posts
Drawdown should be limited to this range while getting consistent profit, we will see.

Quoting jajano
Disliked
those result above looks like have huge drawdown tho
Ignored
Skype: heliosphan187
 
 
  • Post #287
  • Quote
  • May 16, 2012 9:41pm May 16, 2012 9:41pm
  •  jajano
  • | Joined Feb 2009 | Status: Super Trader | 447 Posts
Quoting Dirtybrown
Disliked
Drawdown should be limited to this range while getting consistent profit, we will see.
Ignored
what about backtest result ??

and btw how long u've been using this EA ?

is this ea hedging with some martingale or averaging ?
 
 
  • Post #288
  • Quote
  • May 16, 2012 9:52pm May 16, 2012 9:52pm
  •  Dirtybrown
  • Joined Mar 2008 | Status: Cointegrated Member | 621 Posts
Read post #1 and see this: http://www.forexfactory.com/showthre...12#post5673312

Can't backtest multi pair hedge with standard means, so forward test only. Call it what you want, it's a pure hedge strategy no indicators just numbers and math.

Quoting jajano
Disliked
what about backtest result ??

and btw how long u've been using this EA ?

is this ea hedging with some martingale or averaging ?
Ignored
Skype: heliosphan187
 
 
  • Post #289
  • Quote
  • May 16, 2012 10:31pm May 16, 2012 10:31pm
  •  jajano
  • | Joined Feb 2009 | Status: Super Trader | 447 Posts
Quoting Dirtybrown
Disliked
my local PC version statement, pls refer to my earlier posts regarding directional trades that were taken that have contributed to the profit. Standard Paulss settings now being used again after those trades were closed out.
Ignored
thats doing great...
is that real account ?

btw, how can i set this ea for mini account ?
 
 
  • Post #290
  • Quote
  • May 16, 2012 10:33pm May 16, 2012 10:33pm
  •  KingHigh
  • | Joined Aug 2009 | Status: Member | 98 Posts
I have went through the code and think I understand it. There are some peculiarities that do look strange.

For Clarification: everything in this EA is based of Points and not Pips. Pips are thrown around in post 1 when in fact he means Points - for Levels, for TP, etc.

I have commented the code as can be viewed below. IMHO there is no question that orphan trades could be generated. For each pass, we could match all of the Buy/Sell orders by level and close orphans - easy-peasy.

Here is what I think needs to be done.

1. We need to automate the identification of a significant GAP in software between Pair1 and Pair2 before opening any new hedge - a buy and a sell. I have software that can do this.

2. We need to establish the market trend from the Dailys using an RSI approach so that we are not blindly running both sides when we are trending. When we are ranging we can/should run both sides - BUY1SELL2 & SELL1BUY2 - which is 70% of the time.

3. We should check both the BUY1 and the SELL2 to see if they are both in profit and if so close both to minimize the build up of DD. We now need to want for another GAP opportunity before opening a new BUY1/SELL2.

4.Everytime we open one side at T0 and the other side at T1, we are building in DD that has to be overcome.

3. If we closed one of the two, we need to open an opposing order for whatever was sold to minimze the loss that we may have to overcome.

4. For every tick we are taking a look at our P&L based on the status of the last two hedge buy & sell orders - ONLY. The lower levels are ignored unless they pop to the top level. We need to go through all of the lower levels and look for opportunities to close levels a predetermined amount/pips lost/ elapsed time or whatever.

Regarding using different Lot Sizes for the two Pairs - The reduced lotsize for GU reduces the profits possibilites and increases the DD possibilities from the more volitile Pair. So - if we are planning on having a higher win rate from this EA then we have more to gain from wins that we are going to lose from DD - IMHO. WE should run equal Lotsizes.

With Regards,


KingHigh

PHP Code
    //////////////////////////////////////////////////////////////////////
   // Check For No Open Trades in Buy1Sell2 Mode - Open initial Buy/Sell
   //////////////////////////////////////////////////////////////////////
   
if( Buy1Sell2 ) 
   {
      
// New!! - Wait For GAP with Sell2 > Buy2 with idea that the pos corr will bring them back together.
      
if( GetBuyOrderCount( Pair1, MagicNo ) <= 0 )
         
SendBuy( B1S2, Pair1, ScaledLots, 1, MagicNo );
      
// With GAP Found, we always Sell2
      
if( GetBuyOrderCount( Pair1, MagicNo ) == 1 && GetSellOrderCount( Pair2, MagicNo ) <= 0 ) 
         
SendSell( B1S2, Pair2, BaseLots, 1, MagicNo );
      
// First we never add a level beyond the MaxLevel
      // AND if we find a loss in "Pts" >= preset amount we investigate whether to Buy/Sell
      
if( GetFloatingPts( BUY1SELL2 ) <= ( -NewLevelTriggerInPts ) && GetBuyOrderCount( Pair1, MagicNo ) < MaximumLevel ) 
      {
         
LstBuyTicket = GetLastBuyTicket( Pair1, MagicNo );
         
LstBuyLevel = GetLastBuyLevelNbr( Pair1, LstBuyTicket, MagicNo );
         if( 
GetBuyOrderCount( Pair1, MagicNo ) <= LstBuyLevel ) // Only Buy if our Buy ct matches what we expect
            
SendBuy( B1S2, Pair1, ScaledLots, LstBuyLevel + 1, MagicNo );
         if( 
GetBuyOrderCount( Pair1, MagicNo ) == LstBuyLevel + 1 && GetSellOrderCount( Pair2, MagicNo ) <= LstBuyLevel ) // Only Sell if our Sell ct matches what we expect
            
SendSell( B1S2, Pair2, BaseLots, LstBuyLevel + 1, MagicNo );
      }
      
// Regardless, we always check for PROFIT - and Buy/Sell accordingly
      
if( UseTakeProfitByPts == TRUE && GetFloatingPts( BUY1SELL2 ) >= TakeProfit ) 
      {
         
LstBuyTicket  = GetLastBuyTicket( Pair1, MagicNo );
         
LstSellTicket = GetLastSellTicket( Pair2, MagicNo );
         if( 
LstBuyTicket > 0 && LstSellTicket > 0 ) 
            
CloseLastBuy( LstBuyTicket, Pair1 );
            
// Here is the first problem, we calculated the profit using both the BuyFloat and the SellFloat, but we only closed the BUY.
            // To me, both should be closed to keep balance, no orphans, etc.
            // At this point we don't really know if the profit came from the Buy side order.
      
}
      if( 
UseTakeProfitByUSD == TRUE && GetFloatingUSD( BUY1SELL2 ) >= TakeProfitInUSD ) 
      {
         
LstBuyTicket  = GetLastBuyTicket( Pair1, MagicNo );
         
LstSellTicket = GetLastSellTicket( Pair2, MagicNo );
         if( 
LstBuyTicket > 0 && LstSellTicket > 0 ) 
            
CloseLastBuy( LstBuyTicket, Pair1 );
            
// Here is the first problem, we calculated the profit using both the BuyFloat and the SellFloat, but we only closed the BUY.
            // It is asumed that the Buy Float is positive without actually checking.
            // We don't really know if the profit came from the BUY1 side order or the SELL2 side order.
            // To me, both should be closed to keep balance, no orphans, etc.
            // Maybe, we are using Buy1Sell2 because we believe that we are in a BUY TREND, leave the sell order as is and capture a new profit from up trend.
            // The problem is that EU and GU will naturally trend together - why leave behind a sell that probably will trend up.
      
}
      
//////////////////////////////////////////////////////////////////////////////////////////////
      // OK up until now we have been doing the every tick bookkeeping, Checking for no open trades, 
      // Checking for new Level to open a new hedge, Checking for Profits.  Pretty easy to understand so far.
      //////////////////////////////////////////////////////////////////////////////////////////////
      
LstBuyTicket  = GetLastBuyTicket( Pair1, MagicNo );
      
LstBuyLevel   = GetLastBuyLevelNbr( Pair1, LstBuyTicket, MagicNo );
      
LstSellTicket = GetLastSellTicket( Pair2, MagicNo );
      
LstSellLevel  = GetLastSellLevelNbr( Pair2, LstSellTicket, MagicNo );
      if( 
LstBuyLevel > LstSellLevel ) 
      {
         
BuyFloat = GetBuyFloatInPts( LstBuyTicket, Pair1, MagicNo );
         if( 
BuyFloat > 0 ) // If we have extra BUY1 and that last Buy is in Profit - any amount - we close it.
            
CloseLastBuy( LstBuyTicket, Pair1 );
         else 
// Otherwise we send a Sell2 order to true up Buy asell count.
            
SendSell( B1S2, Pair2, BaseLots, LstBuyLevel, MagicNo ); // Otherwise we try to balance the trades by adding a Sell order
      
}
      if( 
LstSellLevel > LstBuyLevel ) // This is just the reverse of the previous block of code More Buy1s than Sell2s
      
{
         
SellFloat = GetSellFloat( LstSellTicket, Pair2, MagicNo );
         if( 
SellFloat > 0 ) 
            
CloseLastSell( LstSellTicket, Pair2 );
         else 
            
SendBuy( B1S2, Pair1, ScaledLots, LstSellLevel, MagicNo );
      }
   } 
 
 
  • Post #291
  • Quote
  • Edited at 10:57pm May 16, 2012 10:39pm | Edited at 10:57pm
  •  Dirtybrown
  • Joined Mar 2008 | Status: Cointegrated Member | 621 Posts
Wall street has been pairs trading for years, morgan stanley started it in the 80's read the attached for more background. This isn't some hokey BS martingale strategy, read up on the first part of this PDF and you will get a theoretical background of why this kind of trading can make you rich.

I use 7bit's python interface that loads data from metatrader to R in realtme and generates mean reversion plots like this:

Attached Image (click to enlarge)
Click to Enlarge

Name: arboUSD.png
Size: 77 KB


Note that you have to reverse the sign on the hedge ratios. so that 100 should be -100, so short. Something backwards in the code, but it really does work. My bias would be to short dollar based on mean reversion of this chart now, so that may make me want to open directional short dollar trades for a short period based on other directional indicators, close them out some in profit some loss. Then start all over again, that's what happened (sort of by mistake) on my local PC demo. Note don't get confused with the default way most are running, this is one of my own variants, trying as many settings as possible is my goal now.
Attached File
File Type: pdf pairtrading.pdf   127 KB | 5,341 downloads
Skype: heliosphan187
 
 
  • Post #292
  • Quote
  • May 17, 2012 3:12am May 17, 2012 3:12am
  •  Simihouse
  • | Joined Apr 2011 | Status: Member | 53 Posts
Dear Iwjw,

your backtests are wonderfull indeed. This is the demonstration that the system works on the long run. You must also think that with the settings that i suggested above, the DD is reduced as it's hedged and the DD in one way is the gain in the other.

I want ask you if you can backtest on MT5 the EA with the same settings but without the layers, using layers=1.

Thanks
"If you want something go down, let it go up first" Lao-Tzu
 
 
  • Post #293
  • Quote
  • May 17, 2012 4:36am May 17, 2012 4:36am
  •  iwjw
  • | Joined Mar 2011 | Status: Member | 464 Posts
Quoting Simihouse
Disliked
Dear Iwjw,

your backtests are wonderfull indeed. This is the demonstration that the system works on the long run. You must also think that with the settings that i suggested above, the DD is reduced as it's hedged and the DD in one way is the gain in the other.

I want ask you if you can backtest on MT5 the EA with the same settings but without the layers, using layers=1.

Thanks
Ignored
to not get confused, the BTs posted are not from the EA from post #1
it's my own development but based on the same principle
so testing your settings isn't possible
as I posted earlier it's no longer possible with MT5 to have a long and short at the same time...they close each other out
also you can only have a single position/pair and that's why the MT5 version of the overlay EA doesn't work without major changes
 
 
  • Post #294
  • Quote
  • May 17, 2012 4:48am May 17, 2012 4:48am
  •  vastavista
  • | Joined May 2012 | Status: Member | 8 Posts
Hey KING HIGH...

I know its good for add RSI for entry...

When u can update function check orphans orders..?
 
 
  • Post #295
  • Quote
  • May 17, 2012 8:25am May 17, 2012 8:25am
  •  Dirtybrown
  • Joined Mar 2008 | Status: Cointegrated Member | 621 Posts
Thanks for all of the notes - I'll surely be spending (part of) the weekend going through it.



Quoting KingHigh
Disliked
I have went through the code and think I understand it. There are some peculiarities that do look strange.

For Clarification: everything in this EA is based of Points and not Pips. Pips are thrown around in post 1 when in fact he means Points - for Levels, for TP, etc.

I have commented the code as can be viewed below. IMHO there is no question that orphan trades could be generated. For each pass, we could match all of the Buy/Sell orders by level and close orphans - easy-peasy.

Here is what I think needs to be done.

1. We need to automate...
Ignored
Skype: heliosphan187
 
 
  • Post #296
  • Quote
  • Edited at 8:59am May 17, 2012 8:48am | Edited at 8:59am
  •  iwjw
  • | Joined Mar 2011 | Status: Member | 464 Posts
I'm currently playing around with an indicator that's showing me the price difference between now and xx bars back
On M15 with xx=24 (6 hours) im currently getting
EURUSD: -51 pips
GBPUSD: -111 pips
EURGBP: +24 pips

So assuming I would have opened a short gu/long eu (what would be considered as long eurgbp) 6 hours ago, I would have +60pips/$60 on the hedge, but only +24pips/$39 on a long in eurgbp

Does this example show me that trading the hedge really is something different than trading the cross or am I missing something?
 
 
  • Post #297
  • Quote
  • May 17, 2012 10:29am May 17, 2012 10:29am
  •  charvo
  • Joined Dec 2006 | Status: Backtest is meaningless (to me) | 2,175 Posts
u missed the lotsize, probably.

it should be (1 eu + 0.8) gu vs 1 eg.

therefore, 51 - 111*0.8 = 37.8 pip (eu gu) vs 24 pip (eg)

now consider pip-value:

1 pip eu = 1 pip gu = 1$.

1 pip eg = 1$ * 1.27 (current eu price)/0.80xx (current eg price) = 1.58 $ (in fact, gbp's usd price)

now calculate:

37.8 * 1 (eu gu) = 37.8 $

24 * 1.58 (eg) = 37.9 $

what's the difference here??? just a few cents.......

funny thing is ppl wouldn't believe what i'm keep posting. most of the efforts here probably will end-up in vain. this is not the 1st thread dreaming about this.

Edited: i'm not bashing the overall pair trading idea. what i try to say is that most of the demo being run are meaningless since the EA is running with a bias (either long or short).

a EA can deal with both directions with little DD should be what to look for.

what i guess are important is to realise these few things in the EA:

1. identify a widening gap(spread) of two pairs, which this EA does NOT;
2. deal with BOTH long and short and have a way to exit (not only TP, but also SL); which again, the EA does NOT

Last note: this EA may only work on 1minute or 5minute timeframe, because the eurgbp may be trending on longer timeframe. in other words, the so-called correlation could be gone long enough (months) to kill an account. (pull a chart of eurgbp, why deny it?)

Quoting iwjw
Disliked
I'm currently playing around with an indicator that's showing me the price difference between now and xx bars back
On M15 with xx=24 (6 hours) im currently getting
EURUSD: -51 pips
GBPUSD: -111 pips
EURGBP: +24 pips

So assuming I would have opened a short gu/long eu (what would be considered as long eurgbp) 6 hours ago, I would have +60pips/$60 on the hedge, but only +24pips/$39 on a long in eurgbp

Does this example show me that trading the hedge really is something different than trading the cross or am I missing something?
Ignored
 
 
  • Post #298
  • Quote
  • May 17, 2012 10:42am May 17, 2012 10:42am
  •  pogibaby
  • | Joined Mar 2005 | Status: Member | 59 Posts
I have been testing since Sunday with the EUR (pair 1) at 0.09 buy and GBP (pair 2) 0.10 sell. I made EUR pair one because it had a larger ADR. I also set manual ADR to false. I am up 4.5% or $255 for the week. The down draw was 9.5% about $450. Broker is FXDD. I am happy with it so far.
 
 
  • Post #299
  • Quote
  • May 17, 2012 11:22am May 17, 2012 11:22am
  •  scooby-doo
  • Joined Jul 2009 | Status: Member | 2,158 Posts
It doesnt work mid to long term. The reason it may work now is down to what is happening in the market and allot of luck.

Wait and see what happens when the carry trade unwinds. Your accounts will be empty in a short period of time.

You need to work out what is the carry trade in a given period. Yes, the big boys do it but they have the benefit in knowing what carry trade to use based on interest rate differentials between say USD, JPY etc etc.

A strategy in which an investor sells a certain currency with a relatively low interest rate and uses the funds to purchase a different currency yielding a higher interest rate. A trader using this strategy attempts to capture the difference between the rates, which can often be substantial, depending on the amount of leverage used.

Scoobs
 
 
  • Post #300
  • Quote
  • May 17, 2012 12:07pm May 17, 2012 12:07pm
  •  joancb
  • Joined Aug 2011 | Status: Member | 633 Posts
Quoting scooby-doo
Disliked
It doesnt work mid to long term. The reason it may work now is down to what is happening in the market and allot of luck.
Ignored
VastaVista has been trading this for six months with success, maybe he can tell us how has he been doing this.


Quoting vastavista
Disliked
Hello..

I have experience using this Overlay Hedging EA in 6 months...

After I use this EA 3 months...slippage can kill your account because orphans orders and too much floating...

This is is good and best for make money...

But this need modifiaciton:-

[size=4][color=darkred]1- Add function check orphans orders..If one coulpes have only one pairs, so...
Ignored
 
 
  • Trading Systems
  • /
  • Overlay Positive Hedging EA
  • Reply to Thread
    • 1 1314Page 151617 20
    • 1 14Page 1516 20
0 traders viewing now
  • More
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2022