stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Simple HGI EA - help needed
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=4055
Page 1 of 3
Author:  JFonseca [ Thu Jan 15, 2015 9:39 pm ]
Post subject:  Simple HGI EA - help needed

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
Author:  milanese [ Thu Jan 15, 2015 9:56 pm ]
Post subject:  Simple HGI EA - help needed

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
Author:  JFonseca [ Thu Jan 15, 2015 11:37 pm ]
Post subject:  Simple HGI EA - help needed

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?
Author:  milanese [ Thu Jan 15, 2015 11:56 pm ]
Post subject:  Simple HGI EA - help needed

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 );
Author:  JFonseca [ Fri Jan 16, 2015 1:06 am ]
Post subject:  Simple HGI EA - help needed

Thank you for your help.

I will start forward testing in Demo next week :)

EA removed because has a bug!
Author:  JFonseca [ Sun Jan 18, 2015 3:49 pm ]
Post subject:  Simple HGI EA - help needed

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
Author:  beorne [ Sun Jan 18, 2015 3:55 pm ]
Post subject:  Simple HGI EA - help needed

Thanks for sharing.

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

Cheers,

b.
Author:  JFonseca [ Sun Jan 18, 2015 4:26 pm ]
Post subject:  Simple HGI EA - help needed

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.
Author:  beorne [ Mon Jan 19, 2015 1:31 am ]
Post subject:  Simple HGI EA - help needed

Yes, thanks, I figured I needed the libraries.

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

Cheers,

b.
Author:  woodlands [ Tue Jan 20, 2015 2:59 pm ]
Post subject:  Simple HGI EA - help needed

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
All times are UTC Page 1 of 3