Simple HGI EA - help needed

Place your new trading idea here to see if someone can automate it.
JFonseca
Trader
Posts: 25
Joined: Thu Jul 26, 2012 9:50 am

Simple HGI EA - help needed

Post by JFonseca »

Hi,

I like to write my own EAs even though my coder skills are very basic. I never worked before with libraries and I'm having troubles to understand how to code my EA.

What I want to do is to get the signals from the HGI library and then define:
Buy conditions - Up trend arrow or blue wave under the bar
Stop Buy - Down trend arrow or blue wave above the bar

Sell conditions - Down trend arrow or blue wave above the bar
Stop sell - Up trend arrow or blue wave under the bar

Tighten Stop loss Buy - yellow wave above the bar
Tighten Stop loss Sell - yellow wave under the bar

I have attached my EA code if you want to see the rest of my strategy (MM, SL and TP)

So, the 1 million dollar question is: How can I get the signals out of the HGI library?

Thank you,
JFonseca
You do not have the required permissions to view the files attached to this post.
Image
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Simple HGI EA - help needed

Post by milanese »

just take a look to at exp. ----> http://www.stevehopwoodforex.com/phpBB3 ... =87&t=4009 v 1.04 uses the hgi_lib and gives you a coding exampel, to the HGI_matrix in the L versions uses the hgi-lib, so you find some coding exampels how to use the lib..

Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
JFonseca
Trader
Posts: 25
Joined: Thu Jul 26, 2012 9:50 am

Simple HGI EA - help needed

Post by JFonseca »

I think I got it:

Code: Select all

 TradeHGI_Signal = 0;
  TradeHGI_Slope  = 0;
    
  for(int i=1; (i <= 10) ;i++)
    {
    TradeHGI_Signal = getHGISignal(S,PERIOD_H4,i);
    TradeHGI_Slope  = getHGISlope (S,PERIOD_H4,i); 
    if (TradeHGI_Signal == 1 || TradeHGI_Signal  != 2) break;  
    if (TradeHGI_Slope == 3 || TradeHGI_Slope  != 4) break;                                       
    }
With this I get the most recent HGI signal for the last 10 bars. If it finds a trend arrow or a blue wave stops looking for older signals. Is this correct?

TradeHGI_Slope = 2 is a yellow wave under the bar and TradeHGI_Slope = 1 is a yellow wave above the bar. Is this correct?
Image
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Simple HGI EA - help needed

Post by milanese »

JFonseca » Thu Jan 15, 2015 11:37 pm wrote:I think I got it:

...

TradeHGI_Slope = 2 is a yellow wave under the bar and TradeHGI_Slope = 1 is a yellow wave above the bar. Is this correct?
yes as you see in the hgi_lib.mqh..

Code: Select all

//+------------------------------------------------------------------+
//|                                                      hgi_lib.mqh |
//|                                http://www.stevehopwoodforex.com/ |
//| This library was developed by milanese from the                  |
//|    http://www.stevehopwoodforex.com/ forum.                      |
//+------------------------------------------------------------------+
#property copyright "milanese"
#property link      "http://www.stevehopwoodforex.com/"
#property version   "1.00"
#property strict

#import "hgi_lib.ex4"

enum SIGNAL {
   NONE=0,
   TRENDUP=1,
   TRENDDN=2,
   RANGEUP=3,
   RANGEDN=4,
   RADUP=5,
   RADDN=6 };
   
enum SLOPE {
   UNDEFINED=0,
   RANGEABOVE=1,
   RANGEBELOW=2,
   TRENDABOVE=3,
   TRENDBELOW=4 };
   
SIGNAL getHGISignal( string symbol, int timeframe, int shift );

SLOPE getHGISlope( string symbol, int timeframe, int shift );
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
JFonseca
Trader
Posts: 25
Joined: Thu Jul 26, 2012 9:50 am

Simple HGI EA - help needed

Post by JFonseca »

Thank you for your help.

I will start forward testing in Demo next week :)

EA removed because has a bug!
Last edited by JFonseca on Tue Jan 20, 2015 9:54 pm, edited 1 time in total.
Image
JFonseca
Trader
Posts: 25
Joined: Thu Jul 26, 2012 9:50 am

Simple HGI EA - help needed

Post by JFonseca »

JFonseca » Fri Jan 16, 2015 1:06 am wrote:Thank you for your help.

I will start forward testing in Demo next week :)
Hi,

I found a minor issue Which could in some instances not send the TP.

Here is the fixed version.

EA removed because has a bug!

JFonseca
Last edited by JFonseca on Tue Jan 20, 2015 9:54 pm, edited 1 time in total.
Image
beorne
Trader
Posts: 31
Joined: Wed Jul 04, 2012 9:08 pm
Location: Portugal

Simple HGI EA - help needed

Post by beorne »

Thanks for sharing.

I'll try to set it up on a new demo today and publish a Myfxbook link.

Cheers,

b.
JFonseca
Trader
Posts: 25
Joined: Thu Jul 26, 2012 9:50 am

Simple HGI EA - help needed

Post by JFonseca »

To use this EA make sure that you have hgi_lib.mqh placed into the \Include folder of your Empty4 installation and hgi_lib.ex4 into \Libraries: These 2 files give the EA the HGI signals and were coded by Milanese.
You do not have the required permissions to view the files attached to this post.
Image
beorne
Trader
Posts: 31
Joined: Wed Jul 04, 2012 9:08 pm
Location: Portugal

Simple HGI EA - help needed

Post by beorne »

Yes, thanks, I figured I needed the libraries.

Here's the link to myfxbook:
http://www.myfxbook.com/members/beorn/shgi/1131085

Cheers,

b.
User avatar
woodlands
Trader
Posts: 226
Joined: Sun Mar 23, 2014 6:16 pm

Simple HGI EA - help needed

Post by woodlands »

I put on a demo on Sunday for opening and is now up 36% today.
The EA is only taking buy trades and placing buy stops (a lot of them).
I cannot see anything in the code comparing buy with sell why this should be so.
This is because I know less than nothing of code I expect but seems to be following the plan.
Thanks
Tony
Post Reply

Return to “Ideas for Possible Automation”