HedgeEA - page 41

 
dcraig:
I hedge GBPUSD / USDJPY and I'm down about $1500 from yesterday. There were some pretty big moves which went against us. I wonder what we can do to prevent or offset large moves like this? It seems that the correlation loosens during these periods, lessening the psuedo hedge we set up. Doug

I agree, you can have some big drawdowns, I've heard that referred to as "Pucker Factor" (PF). My indicator can give an indication of drawdown, especially if you choose percent. It also shows range. The goal is to get into buys at the bottom of the range. You can also determine risk based on where in the range you get in. If it's near the top, use lower percentage. For the blind entry, (FreedomRocks reccommends) 5-10%. The advanced trader can use over 50%.

 

Hedge indicator info ?

bodshyipmonitor:
Stevensign,

Can explain abit how to use the Indicator???

Like.. to put it on which chart? Default settings.. What to expect...

How do we use the information?

Thanks.

I've attached a new version that fixes the refresh problem.

It only uses the candles duration from the chart. The default settings will calculate the lots for the GBPUSD versus the USDJPY (See the "Global Variables" under "Tools".

Ask me questions. I'm not working on a user guide yet because I'm improving and developing more "stuff". Be sure to read some of my previous posts.

Files:
 
kokas:
Many posts back we define a to do list to the EA:

1. Modify the autoration section to utilize Stevensign's suggestions.

2. MM - implement ratio in order to keep the hedge in balance wrt to margin requirments.

3. Possibly add code to allow the EA to utilyze SWAP to continually open small positions.

4. "Fix" BB in order to allow traders to utilize this function with different currency pairs.

5. Learn more about how to interpret the "net P/L" between the two pairs in order to improve success potential when new trades are opened. (i.e. do we open when correlation is high or near zero? How is correlation related to this net P/L?)

1) Per my post in #342, improve entry points based on opposite bollinger band.

2) figure out how to use correlation, refer to post 343.

3) maybe entry should be based on a BB using low, not close

4) maybe take profit should be based on BB using high not close.

5) Try BB settings of 8,2 or 13,2. Different settings may be optimum for entry or exit points.

for now, I will be happy if we could write a function to calculate ratios. Actualy ratios on autoratio option are calculated:

if (UseAutoRatio) {

Ratio = PipCost(Symbol1) / PipCost(Symbol2);

}

So how this could be done to include Steven sugestions on post 308.

if (UseAutoRatio) {

Ratio = ...

}

IF someone has any sugestion please post

I'm not sure who modifies the code but I've chopped out pieces of my code that may help. Whomever modifies the code plase contact me if you want assistance. Of course my variable names may be different. I'll just show for the GBPUSD and USDCHF. (there may be syntax errors in my chopped code)

/*Comment for the following code

1) calculate total lots available, LETS ASSUME 3.00 LOTS

The rest is based on on 1 lot for each pair

2) calculate ratio of (daily) range of both currencies.(90/120=0.75) (Range_Ratio)

3) normalize so USDCHF is $1/PIP (Multiply by 1.20, (assume USDCHF=1.200).

4) The ratio is 0.75/1.2=0.625

4) so, based on calculations, use 0.75 lots for GBPUSD and 1.20 lots for USDCHF. This is a total of 1.95 lots but you want to use 3 lots so scale the numbers 3.0/1.95=1.54. so use 1.54 x 0.75 = 1.15 GBPUSD and 1.54 x 1.20 = 1.85 lots of USDCHF

So now your total lots = 1.15 and 1.85= 3.0 and your ratio = 1/15/1.85=0.622. This is the target.

I may have chopped too much out of the code but it's close.

*/

if(Calculate_from_Now){

Total_Lots=AccountBalance()*Margin_Percentage*0.01*AccountLeverage()/MarketInfo(Symbol(),MODE_LOTSIZE);

if(Normalize_for_Range){

GBPUSD_Range= (iMA(GBPUSD,0,SMA_Value_for_Range,0,MODE_SMA,PRICE_HIGH,0)-iMA(GBPUSD,0,SMA_Value_for_Range,0,MODE_SMA,PRICE_LOW,0))/MarketInfo(GBPUSD,MODE_POINT);

USDCHF_Range= (iMA(USDCHF,0,SMA_Value_for_Range,0,MODE_SMA,PRICE_HIGH,0)-iMA(USDCHF,0,SMA_Value_for_Range,0,MODE_SMA,PRICE_LOW,0))/MarketInfo(USDCHF,MODE_POINT);

Print ("Ranges: " GBPUSD=",GBPUSD_Range," USDCHF=",USDCHF_Range);

xxxUSD_Range=GBPUSD_Range;

USDxxx_Range=USDCHF_Range;

Range_Ratio= USDxxx_Range/xxxUSD_Range;

Print ("xxxUSD_Range=",xxxUSD_Range," USDxxx_Range=",USDxxx_Range," Range_Ratio=",Range_Ratio);

} //Normalize_for_Range

// normalize for price (only for USD based pairs)

double Normalize_Ratio=Range_Ratio+MarketInfo(USDCHF,MODE_ASK);

Total_Lots=Total_Lots* 2/Normalize_Ratio; //Assumes starting with two lots

//Calculate lots.

GBPUSD_Lots = NormalizeDouble(Total_Lots*Range_Ratio,2);

USDCHF_Lots = NormalizeDouble(Total_Lots*MarketInfo(USDCHF,MODE_ASK),2);

 

Draw Down!

we experiance a big draw down in the market right now my demo GBP JPY just blow out .

we better not get gridy and use only 5%-10% from our margin to trade.

my 4 pair demo is -2670

mu other demo with GBP JPY is -4300

i got lucky that i didn't fund my account yet, i plan to trade with %20 but now i think to to trade only 10%

have great weekend all

 

Settings

Please which settings HedgeV5[1].7 for GBPJPY and CHFJPY.

I am testing Demo account is mini 5.000 USD.

Thanks,

 

Large loss

As many of you have also indicated, my demo got blown out of the water in the past few days using GBPUSD / USDJPY. There has been a drop in the GBPUSD in excess of 300 pips, and then there's the USDJPY to consider.

We all understand (or should) that this is not a perfect hedge, and in fact this imperfection is what we count on to make a large part of our profits. HOWEVER, there are going to be times when the central banks in one of the three countries (Britain, Japan, USA) is going to implement policy changes that the other two are not. At these times, the correlation will drop, and we will either make or loss money. Making money isn't a problem, but losing obviouly is. Furthermore, due to the "changes", while the correlation may return (i.e. strong +'ve or -'ve), the actual ratioof the two currency pairs may have "shifted" for the longer term. Accordingly, if we were on the losing end of the shift, we may not return to profitabilitly (with our original pairs' positions) for a long time. What's worse is that the "shift" in the ratio may be significant enough to wipe out a large part of our accounts.

I guess this is why we have the setting MaxLoss. I hadn't thought this setting was necessary, but now I'm rethinking that Yesterday in my demo account, I had a net P/L of almost -$2000 in a $3000 account. Anyway, had I set a maxloss setting (20% or 30% or more), I would have locked in a sizable loss. I would have been upset, but not as upset as when I got up this morning and realized that the account had been incinerated. I've never seen a negative marginbefore, and hope to never see one again. Of course in a real account, I simply would have had all my positions closed and possibley been left with enough $ for a coffee to cry into (maybe).

I'm now a believer in the MaxLoss. I strongly believe that "shifts" in ratio can occur suddenly and it's best to close positions at this time, as the "shift" may remain for days/weeks/months. Furthermore, I will ensure that I only risk a maximum of 10% of my account at any one time. The evils of greed seem to have bounced off my thick skull up to now. Consider me a convert from this point forward

Doug

(burnt to a crisp in my HedgeEA demo

 

HedgeEA_v6.0

Happy New Year to All!!!

Put your hands together to welcome HedgeEA_v6.0 with features suggested Stevensign being added.

Did some modifications to the Money Management as well.

Stevensign, please do try the EA by changing the Symbol to GBPUSD and USDCHF, I tested.. the values seems to be roughly to be the same as yours.

Using SMA 200,

GBPUSD Range: 22.18

USDCHF Range: 15.47

RangeRatio: 0.697

PipRatio: 1.236

FinalRatio: 1.772

Please verify these values. Thank you!!!

Have fun everybody and nice weekend ahead!

Feedback is definately welcomed!

hedgeea_v6.0.mq4

Files:
 

how do i add a box to my attachments that able to show no of views???

 

Thanks!!

bodshyipmonitor:
Happy New Year to All!!!

Put your hands together to welcome HedgeEA_v6.0 with features suggested Stevensign being added.

Did some modifications to the Money Management as well.

Thanks a LOT bodshyipmonitor!!! I can't wait to get home to take a good look at this and start a demo :):)

Doug

 

Most welcome. :P

Reason: