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

HGI for beginners.
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3985
Page 70 of 76
Author:  Cribey [ Tue Jun 13, 2017 1:04 am ]
Post subject:  HGI for beginners.

Here is an HGI template file (attached) I found by 'scalping' the forums, as it was NOT on the HGI post #1 as indicated several times.

May be outdated but has the fundamentals in place.

Also, the EA (HGB) available that I've found, which is supposed to automate, to an extent, the trading using the HGI indi, only works with v16.xx, and not with 17.xx, so..... :arrrg:
Or not that I've found anyway. If anyone has an updated EA that works with v17.xx of HGI, please let me know.

The missing pieces of the puzzle that I have found are within the HGB user PDF manual.

Cheers, hope it helps. :good:
Author:  Andresgc67 [ Tue Jun 13, 2017 11:53 am ]
Post subject:  HGI for beginners.

Hi
Is there a way to disbale the alerts?
Thanks
EDIT: Nevermind, I found it.
Author:  Andresgc67 [ Wed Jun 14, 2017 1:42 am ]
Post subject:  HGI for beginners.

Guys, I haven´t find it on the pdf, so I need to ask a really noob question: Difference between blue wavy and yellow wavy??

Thanks
Author:  milanese [ Wed Jun 14, 2017 4:32 am ]
Post subject:  HGI for beginners.

Andresgc67 » Wed Jun 14, 2017 1:42 am wrote:Guys, I haven´t find it on the pdf, so I need to ask a really noob question: Difference between blue wavy and yellow wavy??

Thanks
All you questions are more times in the thread answered you have to read it!
Author:  milanese [ Thu Aug 03, 2017 8:48 pm ]
Post subject:  HGI for beginners.

eurobear » Thu Aug 03, 2017 8:35 pm wrote:Hello everyone!

Can someone please give a short explanation what the following settings mean and what happens when I set it to true:
- "ignoreFuture" (in HGI 17.00)
- isiCustom

Many thanks!
read the thread and the main thread and your question will be more times answered!
Author:  c1borg [ Fri Aug 04, 2017 2:51 pm ]
Post subject:  HGI for beginners.

c1borg » Fri Aug 04, 2017 2:46 pm wrote:Hi guy's first post so be kind :roll: where might I find the manual which is mentioned in the posts?
Actually think I found it HGI DEC 2014 V.14.01.pdf :clap:
Author:  gunaydines [ Sat Aug 12, 2017 4:29 pm ]
Post subject:  HGI for beginners.

Hi All,

I am using the HGI 16.09 for a couple of weeks. Reading every related topic in order to benefit from this wonderful community and learn more about this indicator.

I have a question about Range Buy/Sell signals (small green and red arrows). Do these appear just between the wavy lines (blue or yellow) or can be seen anywhere according the math of the HGI?

Thanks for your support.

Cheers,

Emre
Author:  smallkai [ Wed Dec 06, 2017 11:51 am ]
Post subject:  HGI for beginners.

Hi guys, iam trying to write a simple EA that would place orders when HGI signals treadbuy/sell etc. However using the icustom commend i've came up with the blow scripts.

Code: Select all

extern double LotSize=0.01;
extern double Stoploss=30.0;
extern double TakeProfit=10.0;
extern int Slippage=5;
extern int MagicNumber=123;
extern bool UpdateSecondsDelay=true;
extern bool TrendSize=true;
extern bool RangeSize=true;
extern bool RadSize=true;
extern bool WavySize=true;

int BuyOrder;
int SellOrder;

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
return(0);
}

//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
double Y1, Y2, Y3, Y4, Y5, Y6, Y7, Y8;
double SL, TP;
SL=Bid-(Stoploss)*Point;
TP=Bid+(TakeProfit)*Point;
{
Y1 = iCustom(NULL,0,"HGI_v17.00", UpdateSecondsDelay, TrendSize, RangeSize, RadSize, WavySize,0,0);
Y2 = iCustom(NULL,0,"HGI_v17.00", UpdateSecondsDelay, TrendSize, RangeSize, RadSize, WavySize,1,0);
Y3 = iCustom(NULL,0,"HGI_v17.00", UpdateSecondsDelay, TrendSize, RangeSize, RadSize, WavySize,2,0);
Y4 = iCustom(NULL,0,"HGI_v17.00", UpdateSecondsDelay, TrendSize, RangeSize, RadSize, WavySize,3,0);
Y5 = iCustom(NULL,0,"HGI_v17.00", UpdateSecondsDelay, TrendSize, RangeSize, RadSize, WavySize,4,0);
Y6 = iCustom(NULL,0,"HGI_v17.00", UpdateSecondsDelay, TrendSize, RangeSize, RadSize, WavySize,5,0);
Y7 = iCustom(NULL,0,"HGI_v17.00", UpdateSecondsDelay, TrendSize, RangeSize, RadSize, WavySize,6,0);
Y8 = iCustom(NULL,0,"HGI_v17.00", UpdateSecondsDelay, TrendSize, RangeSize, RadSize, WavySize,7,0);
}

if (Y1 > 0.0001)
{BuyOrder=OrderSend(Symbol(), OP_BUY, LotSize,Ask,5,SL,TP,"Buy Order",MagicNumber, 0,Blue);}
if (Y2 > 0.0001)
{SellOrder=OrderSend(Symbol(), OP_SELL, LotSize,Bid,5,SL,TP,"Sell Order",MagicNumber, 0,Red);}
if (Y3 > 0.0001)
{BuyOrder=OrderSend(Symbol(), OP_BUY, LotSize,Ask,5,SL,TP,"Buy Order",MagicNumber, 0,Blue);}
if (Y4 > 0.0001)
{SellOrder=OrderSend(Symbol(), OP_SELL, LotSize,Bid,5,SL,TP,"Sell Order",MagicNumber, 0,Red);}
if (Y5 > 0.0001)
{BuyOrder=OrderSend(Symbol(), OP_BUY, LotSize,Ask,5,SL,TP,"Buy Order",MagicNumber, 0,Blue);}
if (Y6 > 0.0001)
{SellOrder=OrderSend(Symbol(), OP_SELL, LotSize,Bid,5,SL,TP,"Sell Order",MagicNumber, 0,Red);}
if (Y7 > 0.0001)
{BuyOrder=OrderSend(Symbol(), OP_BUY, LotSize,Ask,5,SL,TP,"Buy Order",MagicNumber, 0,Blue);}
if (Y8 > 0.0001)
{SellOrder=OrderSend(Symbol(), OP_SELL, LotSize,Bid,5,SL,TP,"Sell Order",MagicNumber, 0,Red);}
return(0);
}
The problem iam getting right now is that i don't think this script is following the HGI signals at all, since iam pretty much guessing the buffer 0-7 as ctrl -d shows the data in order. Also i've noticed a isicustom in HGI inputs, what does this have to do in relation to my EA?

I know i still have a long way to go with this, and any help would be much appreciated. Thank you.
Author:  SteveHopwood [ Wed Dec 06, 2017 11:22 pm ]
Post subject:  HGI for beginners.

I cannot make all this easy for you, but there is an easier way once you get your head around it.

Instead of battling with iCustom, use the HGI library. It is much quicker and easier once you know what you are doing, and your code will be everlastingly reusable.

What follows is from my Holy Graily Bob's Candle Power EA.

First download hgi_lib.ex4 from Bob's HGI thread and store it in your libraries folder.

Then put this somewhere close to the top of your code:

Code: Select all

//Using hgi_lib
//The HGI library functionality was added by tomele. Many thanks Thomas.
#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);
#import

//HGI constants
#define  hginoarrow " No relevant signal"
#define  hgiuparrowtradable " Tradable up arrow"
#define  hgidownarrowtradable " Tradable down arrow"
#define  hgiuparrowuntradable " Untradable up arrow"
#define  hgidownarrowuntradable " Untradable down arrow"
#define  hgiupradarrowtradable " Tradable Rad up arrow"
#define  hgidownradarrowtradable " Tradable Rad down arrow"
#define  hgiupradarrowuntradable " Untradable Rad up arrow"
#define  hgidownradarrowuntradable " Untradable Rad down arrow"
#define  hgibluewavylong " Blue wavy long"
#define  hgibluewavyshort " Blue wavy short"
#define  hgiyellowrangewavey " Yellow range wavey"
Then set up some externs and associated variables - you can leave out the 'extern' if you are coding this purely for your own use:

Code: Select all

extern bool    UseHgiTrendFilter=true;
extern ENUM_TIMEFRAMES HgiTradeFilterTimeFrame=PERIOD_H4;
extern bool    TradeTrendArrows=true;
extern bool    TradeBlueWavyLines=true;
extern bool    HgiCloseOnOppositeSignal=true;
extern bool    HgiCloseOnYellowWavy=false;
////////////////////////////////////////////////////////////////////////////////////////
string         TradeHgiStatus;//Constants defined at top of file//Amended HGI code
string         TradeHgiTimeFrameDisplay="";
////////////////////////////////////////////////////////////////////////////////////////
Then set up code that reads the HGI library:

Code: Select all

      if (UseHgiTrendFilter)
      {
         //Using hgi_lib
         //The HGI library functionality was added by tomele. Many thanks Thomas.
         SIGNAL signal = 0;
         SLOPE slope  = 0;
         

         //Read HGI at the open of each new HgiTimeFrame candle, iterating back in time to
         //find the most recent signal.
         static datetime OldTradeHgiReadTime = 0;
         if (OldTradeHgiReadTime != iTime(Symbol(), HgiTradeFilterTimeFrame, 0) )
         {
            OldTradeHgiReadTime = iTime(Symbol(), HgiTradeFilterTimeFrame, 0);
      
            TradeHgiStatus = hginoarrow;
            
            cc = 1;   
            while(TradeHgiStatus == hginoarrow)
            {
               signal = getHGISignal(Symbol(), HgiTradeFilterTimeFrame, cc);//This library function looks for arrows.
               slope  = getHGISlope (Symbol(), HgiTradeFilterTimeFrame, cc);//This library function looks for wavy lines.
            
               if (signal==TRENDUP)
               {
                  if (TradeTrendArrows)
                  TradeHgiStatus = hgiuparrowtradable;
               }
               else 
               if (signal==TRENDDN)
               {
                  if (TradeTrendArrows)
                     TradeHgiStatus = hgidownarrowtradable;
               }
               else 
               if (slope==TRENDBELOW)
               {
                  if (TradeBlueWavyLines)
                     TradeHgiStatus = hgibluewavylong;
               }
               else 
               if (slope==TRENDABOVE)
               {
                  if (TradeBlueWavyLines)
                     TradeHgiStatus = hgibluewavyshort;
               }
               else
               if (HgiCloseOnYellowWavy)
               {
                  if (slope==RANGEABOVE || slope == RANGEBELOW)
                  {
                     //No need to discriminate between the market and the yellow lines - a range
                     //is a range and we are closing all trades on a range.
                     TradeHgiStatus = hgiyellowrangewavey;
                  }//if (slope==RANGEABOVE || slope == RANGEBELOW)
                  
               }//if (HgiCloseOnYellowWavy)
               
               /*else
               if (signal==RADUP)
               {
                  if (RadTradingAllowed)
                  TradeHgiStatus = hgiuparrowtradable;
               }
               else 
               if (signal==RADDN)
               {
                  if (RadTradingAllowed)
                     TradeHgiStatus = hgiuparrowtradable;
               */
               
               cc++;
            }//while(TradeHgiStatus == hginoarrow)
            
         }//if (OldTradeHgiReadTime != iTime(Symbol(), HgiTimeFrame, 0))
              
      }//if (UseHgiTrendFilter)
The above will cycle back through the candles and find the most recent HGI signal. Adapt it to find the signal now by removing the loop back etc. I leave you to work out the rest for yourself.

You can see some of the code commented out. That is because it is unused in the EA but I am not in a hurry to lose it. Note my appreciation of Thomas' contribution? The code is his, not mine, so include similar appreciation if you use it in your work.

So now you have code that loops back through the candles and spots the first relevant (to you) HGI signal. Now you can send a buy trade following an HGI buy signal and close an open sell trade and vice versa.

Take this construct as an example:

Code: Select all

   if (TradeHgiStatus == hgiuparrowtradable)
   {
      CloseAnySellTrades();//Fictional function that performs this action
      SendBuyTrade();//Fictional function that performs this action
   }//if (TradeHgiStatus = hgiuparrowtradable)
 

I have taken a long long long time to learn this stuff. A lot of it has been provided by coders far far far better than me. I have provided you with a masterclass in coding reading HGI. Use it without asking any stupid questions. There have been a glut of them tonight asked by (now formerly) members and I am not in the best of all possible moods.

:xm:
Author:  smallkai [ Thu Dec 07, 2017 12:20 pm ]
Post subject:  HGI for beginners.

wow thank you so much Steve, i'll look in to using hgi lib and refer to HGI CP for coding reference. And of course thanks to Thomas and other fantastic coders that make this possible! Much appreciated,
All times are UTC Page 70 of 76