HGI Hurst Trader

EA's inspired by nanningbob's work here, especially those based on his 240 Moving Average trend detection filter.
Post Reply
User avatar
SpiderX
Trader
Posts: 554
Joined: Thu Aug 22, 2013 4:50 pm

HGI Hurst Trader

Post by SpiderX »

SERIOUS WARNING
Most Forex traders lose all their money.
Using the robot posted here in trading Forex does not guarantee success.
Trading this robot could lead to serious financial loss.
Trading this robot without understanding its underlying trading strategies guarantees traders will lose their money.
This is not a set-and-forget ea; there is no such thing and anyone who tries to claim there is, is either stupid or lying. This ea requires frequent manual intervention.
At best, a trading robot is only 90% as good as the manual strategy it trades. At best. At worst, it can be much less effective. If the strategy is rubbish, so is the robot.
To trade this robot, you have to understand:
How to use EA's.
Bob's Holy Grail Indicator at http://www.stevehopwoodforex.com/phpBB3 ... 44#p105044
HGI used with Hurst Charts at http://www.stevehopwoodforex.com/phpBB3 ... =88&t=3993

This EA is an attempt to automate the methods mentioned in http://www.stevehopwoodforex.com/phpBB3 ... =88&t=3993
In an effort to keep things simple, there would be less options in my EA compared to Steve's.
At present, we keep trading to one trade per pair at any one time, and looking at how strict the Hurst filter is, we also should not expect to have multiple trades on the same pair going on at the same time too.
However, if there is demand for more trades and features in the future, these would be added accordingly to the EA.

Trade Entry Conditions:
Buy Trades:
Hurst (5)MA below Hurst (11)MA
HGI Buy Trend/RAD/Wave Signal (Selectable)

Sell Trades:
Hurst (5)MA above Hurst (11)MA
HGI Sell Trend/RAD/Wave Signal (Selectable)

Trade Exit Conditions:
Buy Trades:
Either one of the following
1. Hurst(5) MA above Hurst(11) MA AND Any HGI Signal
2. Wave signalling Trend Weakness
3. Any Bearish HGI Signal (Bearish Wave/Trend/RAD/Range)

*Condition 3 is added only as a safety precaution, usually either condition 1 or 2 will trigger the exit.

Sell Trades:
Either one of the following
1. Hurst(5) MA below Hurst(11) MA AND Any HGI Signal
2. Wave signalling Trend Weakness
3. Any Bullish HGI Signal (Bearish Wave/Trend/RAD/Range)

Others:
-Exit Half when the Hurst MA Cross (Optional)

Please let me know if any of the rules are missing

EA options:( Please adjust the following before running the EA)


Basic Trade Setup

Code: Select all

extern int     TradingTimeFrame  =PERIOD_H4;//Base Time frame for indicators 
extern int     MinTradeTimeMinutes =30; 
Please adjust the above to set the timeframe for trading.
It does not really matter which timeframe of chart you set this on, as the EA follows the above input.


HGI Entry Options

Code: Select all

extern bool    EntryOnTrend	      = true;
extern bool    EntryOnRAD      	   = true;
extern bool    EntryOnWave		      = true;
extern bool    EntryOnWaveAndTrend	= false; 
These options are for the selection of the HGI entry signal.
Note that if EntryOnWaveAndTrend is selected, then the EA will automatically set EntryOnWave and EntryOnTrend to false.

HGI Exit Options

Code: Select all

extern bool    ExitOnHurst          = true;
extern bool    ExitOnTrend          = true;
extern bool    ExitOnRAD            = true;
extern bool    ExitOnTrendWeakness  = true;
extern bool    ExitOnTrendStart     = true;
ExitOnHurst - Exit trade when there is a HGI signal, while the Hurst bands indicate a buy condition (for sell trade), sell condition for buy trade
ExitOnTrend- Exit trade on an opposite Trend Signal, i.e Trend Sell for Buy Trade
ExitOnRAD - Exit trade on an opposite RAD Signal, i.e RAD Sell for Buy Trade
ExitOnTrendWeakness - Exit trade on a wave signal, which shows ranging has begun
ExitOnTrendStart - Exit trade on a wave signal, which shows that range has end, and new trend has potentially start.

Partial Exit

Code: Select all

extern bool    PartialExitOnCross   = false;
extern double  CrossExitPercent     = 50.0;
This option is to set a partial exit on the Hurst MA Cross as mentioned by Pedro.

Pending Orders

Code: Select all

extern bool   SendPendingTrades    = true;
extern int    PendingExpiryMinutes = 60;
extern double PendingGapPips       = 5;
This is a personal preference to enter via Pending instead of direct entry.
i.e: We allow the trade to move a little bit in favor of the direction before we enter to prevent getting caught in a bad trade from the start.
Disable if you prefer direct entry.

Other Notes:
I try to keep my EA as simple as possible, so this EA reads and processes every minute, instead of every tick, since it does not seem to be necessary.
This could be an issue if you try to use it one an M1 chart.

22 Dec 14: v1.01
-Corrected bug in CloseTheTrade. Mistake from copy/paste of code.
-Line 570 should be if(bBearishHGISignal) instead of if(bBullishHGISignal)

23 Dec 14:v1.02
-Added more options for TradeExits

Code: Select all

extern string   gen1b="====Trade Exit Options====";
extern bool    ExitOnHurst          = true;
extern bool    ExitOnTrend          = true;
extern bool    ExitOnRAD            = true;
extern bool    ExitOnTrendWeakness  = true;
extern bool    ExitOnTrendStart     = true;
ExitOnHurst - Exit trade when there is a HGI signal, while the Hurst bands indicate a buy condition (for sell trade), sell condition for buy trade
ExitOnTrend- Exit trade on an opposite Trend Signal, i.e Trend Sell for Buy Trade
ExitOnRAD - Exit trade on an opposite RAD Signal, i.e RAD Sell for Buy Trade
ExitOnTrendWeakness - Exit trade on a wave signal, which shows ranging has begun
ExitOnTrendStart - Exit trade on a wave signal, which shows that range has end, and new trend has potentially start.

Those who find that the ExitOnHurst option exits the trade too fast, may use the other options to hang on to the trade a little longer.

29 Dec 14:v1.03
-Added more control for Start/Stop on Monday/Friday:

Code: Select all

extern bool    useMondayStartHour    = false;
extern bool    useFridayStopHour     = false;
Due to some complaints of MondayStartHour and FridayStopHour, these variables are added so the user can enable the Start/Stop Hours.
Defaults to false.
In addition, the EA gives a warning and screen feedback if the start/stop hour is activated.

-Added variable

Code: Select all

extern int     MinTimeBetweenTrades=60;
This controls the minimum time between the trades and effectively allows the EA to multitrade.
Use in conjunction with variable MaxAllowedTrades for multi trades, though that would be rare at this point in time.

-Added option for Range Trade

Code: Select all

extern bool    EntryOnRange		   = true;
Defaults to true, please adjust if you wish to disable

-Added variables for MA shift

Code: Select all

extern int      FastMA_Shift  = 0;
extern int      SlowMA_Shift  = 0;
29 Dec 14:v1.03b
-Fixed bug in LookForTrading

30 Dec 14:v1.03c
-Further bug fixes in LookForTrading
-CloseTheTrade only prints the CloseTrade status when the closing criteria is met. Previously it prints before that and could result in multiple prints.

30 Dec 14:v1.03d
-Further bug fixes in LookForTrading

30 Dec 14:v1.03e
-Further code improvements in LookForTrading and ManageStopLoss

11 Jan 15:v1.04
-Updated EA to use HGI Lib. Please dl the .ex and .mqh files and place in the appropriate folders

-Added option to exit on Range

Code: Select all

extern bool    ExitOnRange          = true;
e.g if in a Buy trade, if this option is enabled, the EA will exit on a sell range signal.

-Added 60 and 240 MA Check.
Enable CheckTrend to use.

Code: Select all

extern bool     CheckTrend = false;
-Added option to part close on breakeven.

Code: Select all

extern bool    PartCloseOnBreakEven    =false;
extern double  BEPartClosePercent      = 50.0; 
-Added options to lookback on past HGI signals

Code: Select all

extern bool     useHGILookBack     = false;
extern int      MaxHGILookBackCandles = 5;
extern bool     CheckPriceMoveOnLookBack = true;
extern bool     usePreviousHiLoAsRef     = false;
extern double   MaxPipsInTradeDir        = 20;
extern double   MaxPipsAgainstTradeDir   = 10;
useHGILookBack - set true to enable HGI Lookback. This option is only available when UseHurst is set as true.
It does not make sense to use this without Hurst.

MaxHGILookBackCandles - Maximum candles to look back.
Only check the latest HGI signal. Once a HGI signal is found, the EA does not look further back.
i.e If there is a RAD signal 2 candles ago, any signals before that would not be considered.

CheckPriceMoveOnLookBack
This applies when trading on a lookback signal.
The default reference is the Close of the signal candle, otherwise if usePreviousHiLoAsRef is set true, then the Low of that candle is used for sells, while the High is used for buys.
The current price must be between MaxPipsInTradeDir and MaxPipsAgainstTradeDir for the trade to be taken.
The rationale is that if a Sell Trend signal was 3 candles ago, and if the price is now 50 pips below the Close of that candle, it implies the move has happened and might not be a good idea to enter.
Or if the price is now 40 pips above the Close of that candle, then most likely the signal was not a good one and might be good to avoid.

11 Jan 15:v1.04b

Fixed bug in trading time function.
Due to enabling of #property strict in the EA, the bug surfaced and caused the EA to exit.
Previously this bug was not uncovered without #property strict

20 Jan 15:v1.05

-Added Htf HGI/ Hurst Check option

Code: Select all

extern bool    CheckHtfTradeEntry   = false;
extern int     HtfTradingTimeFrame  = PERIOD_D1;
extern int     HtfLookBackCandles   = 8;
extern bool    HtfTradeTrend	      = true;
extern bool    HtfTradeRAD      	   = true;
extern bool    HtfTradeRange		   = true;
extern bool    HtfTradeWave		   = true;
extern bool    HtfTradeWaveAndTrend	= false;
extern bool    HtfUseHurst          = false;   
extern int     HtfFastMA_Period     = 5;
extern int     HtfFastMA_Shift      = 0;
extern int     HtfSlowMA_Period     = 11;
extern int     HtfSlowMA_Shift      = 0;
To enable set CheckHtfTradeEntry to true.
The code will check the current and previous HtfLookBackCandles for the last Signal.
Use the HtfTradeTrend/RAD/Range/Wave/WaveAndTrend options to determine which Htf signal to follow.
Set HtfUseHurst to enable Hurst check on the higher time frame

-Added Trade Balance filters

Code: Select all

extern bool     UseZeljkoBalancedCcyTrade =false; //Allow only one buy and sell of Currency at one time
extern bool     LimitTradesPerCurrency    =false; //Limit the maximum trades per currency to MaxTradesPerCurrency
extern int		 MaxTradesPerCurrency	  = 2;
UseZeljkoBalancedCcyTrade - allows only one buy and one sell of a currency at one time
LimitTradesPerCurrency - limits the maximum trades of each currency subject to MaxTradesPerCurrency

20 Jan 15:v1.05b

Corrected some small bugs which causing the HGI candle lookback shift to display wrongly and spelling errors

Cheers
You do not have the required permissions to view the files attached to this post.
"Love is patient, love is kind. It does not envy, it does not boast, it is not proud. It does not dishonor others, it is not self-seeking, it is not easily angered, it keeps no record of wrongs.Love does not delight in evil but rejoices with the truth. It always protects, always trusts, always hopes, always perseveres."
-Corinthians 13:4-8
Radar
Trader
Posts: 437
Joined: Fri Mar 23, 2012 5:39 pm
Location: Round the bend ;)

HGI Hurst Trader

Post by Radar »

Hey SpiderX,

Thanks for this one :) Will give it a run and see how I go.

Have fun!

Radar =8^)
Check out my new, (well, old now), manual trade & automatic scale-in manager,
StackManV2
hannele
Trader
Posts: 137
Joined: Wed Sep 19, 2012 2:31 am

HGI Hurst Trader

Post by hannele »

Thank you SpiderX, I will give it a whirl this week.
cheers
hannele
SWG123
Trader
Posts: 565
Joined: Wed Nov 16, 2011 3:02 pm
Location: Cape Town

HGI Hurst Trader

Post by SWG123 »

Thanks SpiderX - much appreciated :clap:
dudest
Trader
Posts: 1847
Joined: Tue May 08, 2012 2:37 pm

HGI Hurst Trader

Post by dudest »

:clap: :clap: :clap: :clap: :good: :hi:
Neno0102
Trader
Posts: 30
Joined: Wed Jan 04, 2012 4:25 pm

HGI Hurst Trader

Post by Neno0102 »

Thanks Spider. Nice gift for Christmas. :hi: :good:
User avatar
traderduke
Trader
Posts: 306
Joined: Mon Nov 28, 2011 7:30 pm
Location: East Coast USA

HGI Hurst Trader

Post by traderduke »

SpiderX
Have great Holiday & thanks a million, I hope. Now I'll be visiting relatives and wanting to get home to play with my new toy.

Was it you who said Retirement can be exciting, Your right!!

Regards

ray
Jollyroger
Trader
Posts: 91
Joined: Wed Nov 16, 2011 4:13 am

HGI Hurst Trader

Post by Jollyroger »

Thanks Spider:
I'm going to give this a run.

I traded Hurst manually with HGI when it was first posted by Pedro but found myself using Hurst as the dominant indicator rather than HGI. It kept me out of a few bad trades but also colored my judgment to the point that I was missing some very good trades so I quit using it. Hopefully the EA will solve this problem since it will make the decisions according to its programed rules.
Roger

MERRY CHRISTMAS :xm:
Dewey McG
Trader
Posts: 435
Joined: Sat Nov 26, 2011 4:20 pm
Location: Tampa FL

HGI Hurst Trader

Post by Dewey McG »

Hello Spyder.

Thanks for working on this EA.

I had been playing around with a trade simulator before your EA and was looking at EURCAD because it has been ranging this month and I thought that would be a good test. In ran the EA for the 1st week of December because I had already done that with a simulator. There seems to be some bugs. As you can see from the PIC there were signals confirmed by Hurst which were not taken, one trade taken well after the signal and two taken that didn't seem to have a signal.

Can I also suggest allowing separate TP targets for range trades? I suspect going for smaller TP targets may work better on these, while shooting for larger targets for the big arrows.
You do not have the required permissions to view the files attached to this post.
nicolkoekoek
Trader
Posts: 72
Joined: Tue Mar 11, 2014 4:27 pm
Location: De Bilt

HGI Hurst Trader

Post by nicolkoekoek »

Thanks Spider for your very nice work! I can't believe how many X-mas presents I got this year.. :smile: :clap: :clap: :clap: :clap:
Post Reply

Return to “Thingy Bob EA's”