HedgeHog System & EA - page 14

Hello all, i wanted to share a system that was shared on another site of which i have had good success in demo manual trades.

Here is the original link: http://www.strategybuilderfx.com/forums/showthread.php?t=16093&page=1&pp=8

The first post has the original rules, however the difference now is a 50 pip stop has been added. Here are the pairs i have found that work with it and their respected take profit.

Eur/Usd with 10 TP

Gbp/Usd with 10 TP

Usd/Chf with 10 TP

Usd/Jpy with 10 TP

Eur/Jpy with 12 TP

Gbp/Jpy with 15 TP

EurGbp with 10 TP

So far on FXDD using 1 lot starting trades (10$ /pip), a total of $6973 has been achieved at 22:00 and $7347 at 00:00 with the 7 pairs listed above on a demo account since the 16th of April.

The trades that i personally am having good success with are done at 22:00GMT (2pm PST) and 00:00GMT (4pm PST). Now for the 2pm i do them right after 2pm so that I don't get dinged the daily interest. The 4pm ones i do at 3:45pm so that they are in before the movement that sometimes happens at 4pm with Jpy based pairs.

Now the reason I am posting it here is to start work on an Expert Advisor, as there seems to be alot more successful programs/programmers here than anywhere else i have been.

Enclosed is EA version 1.1 In my opinion it is the best of the versions. The other versions can be found in the first 12 pages of the previously mentioned thread.

The main problem i have noticed with this EA is that it does not execute trades at either 22:00GMT or 00:00GMT on FXDD. I can get it to work at other times, but that doesn't help the system any. So any changes or input is greatly appreciated.



Didn't read the whole thread but did you get the EA to trade when you wanted to? Did you use this code? If you posted a new EA what post is it on? I'd like to forward test.



Each "Trading Time" zone 1 through 4 has a Start and an End.

To trade all day , set "day"...Start1=0 and "day"...End4=24. This is needed for each trading day.

To skip a full day, set "day"...Start1=0 and "day"...End4=0.

Note: EA is coded to use your Local PC Time.

Here is a Monday example.

MonTradeHourStart1 = 0; - (Trading Time zone 1 start)

MonTradeHourEnd1 = 8; - (Trading Time zone 1 end)

MonTradeHourStart2 = 10;

MonTradeHourEnd2 = 16;

MonTradeHourStart3 = 18;

MonTradeHourEnd3 = 20;

MonTradeHourStart4 = 22;

MonTradeHourEnd4 = 24;

In above schedule, EA trades from 00:00 (midnight) to 08:00, then from 10:00 to 16:00, then from 18:00 to 20:00, then from 22:00 to 24:00.

Non-Trading Time is from 08:00 to 10:00, then from 16:00 to 18:00, then from 20:00 to 22:00.


extern int SunTradeHourStart1 = 0; // 4 trading zones per day. To bypass a day, all zeros (=0)for that day.

extern int SunTradeHourEnd1 = 0;

extern int SunTradeHourStart2 = 0;

extern int SunTradeHourEnd2 = 0;

extern int SunTradeHourStart3 = 0;

extern int SunTradeHourEnd3 = 0;

extern int SunTradeHourStart4 = 0;

extern int SunTradeHourEnd4 = 24;

extern int MonTradeHourStart1 = 0;

extern int MonTradeHourEnd1 = 0;

extern int MonTradeHourStart2 = 0;

extern int MonTradeHourEnd2 = 0;

extern int MonTradeHourStart3 = 0;

extern int MonTradeHourEnd3 = 0;

extern int MonTradeHourStart4 = 0;

extern int MonTradeHourEnd4 = 24;

extern int TueTradeHourStart1 = 0;

extern int TueTradeHourEnd1 = 0;

extern int TueTradeHourStart2 = 0;

extern int TueTradeHourEnd2 = 0;

extern int TueTradeHourStart3 = 0;

extern int TueTradeHourEnd3 = 0;

extern int TueTradeHourStart4 = 0;

extern int TueTradeHourEnd4 = 24;

extern int WedTradeHourStart1 = 0;

extern int WedTradeHourEnd1 = 0;

extern int WedTradeHourStart2 = 0;

extern int WedTradeHourEnd2 = 0;

extern int WedTradeHourStart3 = 0;

extern int WedTradeHourEnd3 = 0;

extern int WedTradeHourStart4 = 0;

extern int WedTradeHourEnd4 = 24;

extern int ThurTradeHourStart1 = 0;

extern int ThurTradeHourEnd1 = 0;

extern int ThurTradeHourStart2 = 0;

extern int ThurTradeHourEnd2 = 0;

extern int ThurTradeHourStart3 = 0;

extern int ThurTradeHourEnd3 = 0;

extern int ThurTradeHourStart4 = 0;

extern int ThurTradeHourEnd4 = 24;

extern int FriTradeHourStart1 = 0;

extern int FriTradeHourEnd1 = 0;

extern int FriTradeHourStart2 = 0;

extern int FriTradeHourEnd2 = 0;

extern int FriTradeHourStart3 = 0;

extern int FriTradeHourEnd3 = 0;

extern int FriTradeHourStart4 = 0;

extern int FriTradeHourEnd4 = 24;

//----------------------- ENTER POSITION BASED ON OPEN

int EnterPositionBasedOnOpen()


int ret;

double myMA =iMA(NULL,MA_timeframe,MA_length,0,MODE_SMA,PRICE_OPEN,0);

double RVI=iRVI(NULL,0,10,MODE_MAIN,0)-iRVI(NULL,0,10,MODE_MAIN,1); // included by Renato


// Print(" Top, Bid ",myMA*(1+Percent/100)," ",Bid);

// if((myMA*(1+Percent/100))<Bid) Print(" Top, Bid ",myMA*(1+Percent/100)," ",Bid);


if(UseEquityProtection) EquityProtection();



int h=TimeHour(TimeLocal());

int trade=0;




if( (DayOfWeek()==0 && ((h >= SunTradeHourStart1) && (h = SunTradeHourStart2) && (h = SunTradeHourStart3) && (h = SunTradeHourStart4) && (h <= (SunTradeHourEnd4-1)))) ||

(DayOfWeek()==1 && ((h >= MonTradeHourStart1) && (h = MonTradeHourStart2) && (h = MonTradeHourStart3) && (h = MonTradeHourStart4) && (h <= (MonTradeHourEnd4-1)))) ||

(DayOfWeek()==2 && ((h >= TueTradeHourStart1) && (h = TueTradeHourStart2) && (h = TueTradeHourStart3) && (h = TueTradeHourStart4) && (h <= (TueTradeHourEnd4-1)))) ||

(DayOfWeek()==3 && ((h >= WedTradeHourStart1) && (h = WedTradeHourStart2) && (h = WedTradeHourStart3) && (h = WedTradeHourStart4) && (h <= (WedTradeHourEnd4-1)))) ||

(DayOfWeek()==4 && ((h >= ThurTradeHourStart1) && (h = ThurTradeHourStart2) && (h = ThurTradeHourStart3) && (h = ThurTradeHourStart4) && (h <= (ThurTradeHourEnd4-1)))) ||

(DayOfWeek()==5 && ((h >= FriTradeHourStart1) && (h = FriTradeHourStart2) && (h = FriTradeHourStart3) && (h = FriTradeHourStart4) && (h <= (FriTradeHourEnd4-1)))))





if(UseTradeScheduler==false) trade=1;

if(trade==0)text="Non-Trading Time";

I have been using the EA for forward testing for months now. It can be found at my website here and the research in the hedgehog area.

Hope that helps,


I have been using the EA for forward testing for months now. It can be found at my website here and the research in the hedgehog area.

Hope that helps,


Ok thanks. I'll check it out.


Read this until My Eyes POPPED!

Wow, lot of reading, but I have a question that goes back to the begining...

You open a "Hedge"..buy and sell order at the same time...00:00 gmt.

Set your TP for 14.

What do you do with the order that is now negative?

Do you open another Hedge at the TP level that was profitable?

I am lost on this....

Wow, lot of reading, but I have a question that goes back to the begining...

You open a "Hedge"..buy and sell order at the same time...00:00 gmt.

Set your TP for 14.

What do you do with the order that is now negative?

Do you open another Hedge at the TP level that was profitable?

I am lost on this....

The initial buy and sell remain only as is.

What the hedgehog EA was supposed to do was capitalize on the normal oscillation of the market during non-peak times, so usually both the buy and sell trades TP during certain times. Once they TP they aren't replaced by any other trades until the next trading day (unless you are using 3rd trade and/or bonus trade).

Hope this helps,



Anyone still using this, and which version is working for you...

Ver 1.1 or 1.3?

OK, here are the EA's from the original thread and settings/what they do. Now i was not part of the original process, however I would like to see an EA created that executes trades just like i have been doing manually with great success. For more info, answer to specific EA questions, and all credit due, goes to the original thread on post #1 of this thread. Support for these EAs are for resource purposes only, but are not supported or maintained here, only used as a reference. Below i post the EA name, post # and the blurb on that post. Enclosed is a .zip of all the EAs.

On to the EAs:

------------------- HedgeTest.mq4 --- post #2


Attached is an indicator which you can use to visually see how it would look on a chart.

If the RED or BLUE line is broken through by a tick it means the BUY/SELL LIMIT was reached. I use a 1 hour chart to view it on.


Offset=14; - Number of pips above/below days open price

TimeZoneOfData=0; - by default if time zone of data is at GMT 0 (timezone of your trading account

------------------- HedgeHog 1.0.mq4 --- post #40



I have attached a "rough draft" of an EA and the MAJOR problem I'm having at the moment is getting it to initiate a trade at 00:00 GMT

1) It is picking and choosing what days it wants to trade and not doing it every day at 00:00 GMT

2) Is not entering both a BUY and a SELL

Any of you programers out there - help would be appreciated!!!!

Here is the routine that works when it wants to (testing dates 1/2/06 through 1/31/06 with 15min data)

if (TimeHour(Time[0])==0+BrokerOffsetToGMT && TimeMinute(Time[0])==0)





------------------- HedgeHog.mq4 --- post #82


There is the EA. But backtesting doesn't seem to be profitable.

------------------- HedgeHog v1.1.mq4 --- post #88


There is original EA with implemented stoploss.

***Now this is the one that i found has the best performance, as it is purely the hedge trader with stoploss ***

------------------- HedgeHogUltra v1.1.mq4 --- post #95


There is EA for your ULTRA strategy. I used stop orders instead market. There are 2 opportunities to close opposite order when one is triggered. You can choose PO_mode:

0 - close when opposite is actived

1 - close at 23:55

There is no adjustment for different broker settings of time, so if you use it on the platform with another time than GMT, you have to change time settings.

***Based on Strategy found on post #87. This trader uses the Ultra Strategy, which doesn't do initial hedge, but rather bracket style trading (entry buy stop and sell stop). Good idea, but maybe as an option for the future. ***

------------------- HedgeHog_v1.3.mq4 --- post #104


Initiates market orders (not pending) at the time specified under the EA's properties.


It only initiates 1 trade at the specified time. It uses a 5M Parabolic SAR to determine the direction which to place the trade (BUY/SELL). This at least gives us a fighting chance of being right.

Trailing Stop: This not only helps on trades going our way, but can reduce the STOP LOSS we end up being stuck with.


StartHr=0; // Start hour to initiate trade

StartMin=30; // Start minute to initiate trade




DaysOfClose=2; // how many days before closing open orders

TS_Mode=1; // use trailing stop 0=NO 1=YES 2=TS Only



*** This one executes 1 trade based on PSar, so not a hedge system anymore. That is why i stuck with v1.1 ***


I hope that helps our cause. And lastly, as i was trolling the other thread for info, i found MoneyQuest's results on the Eur/Usd for Feb and March. Here are the stats, the trading log is enclosed under "Hedge Hog Trading Results.zip".

Original post is here: http://www.strategybuilderfx.com/forums/showpost.php?p=149755&postcount=234

Here is a summary of his results:

No of wins:22

No of losses:5

% win:81.5

Total profit:700 pips

Total losses:192 pips

Profit factor:3.65

Max No of consecutive win:8

Max No of consecutive losses:1

Maximum drawdown:90 pips

Maximum lots traded:6

His results do confirm the same results i have been getting as well. So i hope you guys enjoy the data

MP -- Martingale -- dont they put those on horses ?

There are a number of Martingale fans that do not agree with my opinion, and that is that ANY Martingale will eventually break your account. . . . . . . . . . . . . . . . look for a simple strategy that has a positive expectancy and add lots as your equity grows.


well said, as one must understand that martingale is a "gambling" strategy (with not so memorable results) and forex is NOT gambling, but rather a trend following, actively dependent on support and resistance form of trading that is FAR from random in its movements !

If you simply learn how forex moves its currencies, it becomes really hard to lose !

enjoy and trade well



Help on a Hedge Idea

Please if someone sould help - I just want a simple EA that will do a hedge trade (buy and sell) at makket close of any daily chart. Please Help!!

Please if someone sould help - I just want a simple EA that will do a hedge trade (buy and sell) at makket close of any daily chart. Please Help!!

This thread is one of many hedge EAs style. You could use the forum google search to find more and maybe the one that fits with your needs.


Hedge grid trend follow system (Hedgehog)


Here's a system I've been playing with and it seems to be working for me during market periods where martingale hedge grid systems arent. I've dubbed it Hedgehog.

I'm under no illusions that the idea is original, so if there are existing EA's to automate such a concept, please just point me in the right direction.

The basic notion is like this:

Lot sizes and grid sizes and TP, SL's must be user adjustable.

One example below.

Take a ranging commodity likely about to break out into a trend using a 15 pip grid trading system. e.g. EURUSD falling out of bed with its head and shoulder pattern.


Place a 0.5 lot market buy and a 0.5 lot market sell order simultaneously.

Place 0.5 lot buy stop 15 pips above and 0.5 lot sell stop 15 pips below the initial entry.

Place another 0.5 lot buy stop 30 pips above and 0.5 lot sell stop 30 pips below the initial entry.

Place another 0.5 lot buy stop 45 pips above and 0.5 lot sell stop 45 pips below the initial entry.

Continue adding on 0.5 lot positions every 15 pips in the direction of the trend.

Set a 2x grid size initial stop loss (i.e. 30 pips) on every position,

Adjust initial stops to (-15 pips) as soon as one is 15 stops in profit

Adjust all stops to breakeven as soon as one is 30 stops in profit.

Now run with the trend as long as it lasts.

Close all positions and delete all pending orders when the last opened position hits its -30 stop loss or maybe the 2nd last opened position closes out at breakeven (and the last has already hit its SL) to give market a little more breathing room.

To give you an idea of where I'm going with this. I'm looking at it from a grid trading perspective as a "scaling in" to the market trend concept. My usual way has been taking a certain lot size and entering the market only to get stopped out if I'm wrong. This way it can still happen but because my initial entry posn is smaller, the potential losses are less and the gains pretty good (but obviously not as good as if I'd opened the full lot size initially but then again the initial risk is less) if the trend continues and even if it only trends for a bit and then reverses then I have my profits locked into all the open positions except the last opened one which will end up getting stopped out if the market reverses more than 2x my grid size.

Unoriginal / harebrained / feasible?

Comments please ....