Old and defunct Holy Graily Bob

EA's inspired by nanningbob's work here, especially those based on his 240 Moving Average trend detection filter.
Locked
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Holy Graily Bob

Post by SteveHopwood »

theforexedge » Wed Dec 10, 2014 11:20 pm wrote:Steve

Thanks for the recent additions including the ATR :good:

I've just setup a few demo's to test the ATR Stoploss & TakeProfit and noticed what might be a cut & paste error...
Fantastic spot JP. Thanks. :clap: :clap: :clap: :clap: It could explain some of the errors noted in the dummies' thread. Possibly. Don't know. Whatever, you win an instant promotion here.

Anyhow guys, if you haven't been and do not intend using ATR for your tp/sl then it doesn't matter. Download the next update when it suits you. If your are using ATR, the V 1v is in post 1. If you enjoy making your own changes, then copy this over the existing double CalculateTakeProfit(int type, double price, string comment)

Code: Select all

double CalculateTakeProfit(int type, double price, string comment)
{
   //Returns the stop loss for use in LookForTradingOpps and InsertMissingStopLoss
   double take;

   RefreshRates();
            
   if (type == OP_BUY)
   {
      //Trend trades
      if (comment == TrendTradeComment)
      {
         //Atr take profit
         if (TrendAtrPeriod > 0)
         {
            TrendTakeProfit = (GetAtr(Symbol(), TrendAtrTimeFrame, TrendAtrPeriod, 0) * factor) * TrendAtrTpMultiplier;
         }//if (TrendAtrPeriod > 0)
         
         if (!CloseEnough(TrendTakeProfit, 0) )
         {
            take = price + (TrendTakeProfit / factor);
            HiddenTakeProfit = take;
         }//if (!CloseEnough(TrendTakeProfit, 0) )
      }//if (comment == TrendTradeComment)
      
      //Range trades
      if (comment == RangeTradeComment)
      {
         //Atr take profit
         if (RangeAtrPeriod > 0)
         {
            RangeTakeProfit = (GetAtr(Symbol(), RangeAtrTimeFrame, RangeAtrPeriod, 0) * factor) * RangeAtrTpMultiplier;
         }//if (RangeAtrPeriod > 0)
         
         if (!CloseEnough(RangeTakeProfit, 0) )
         {
            take = price + (RangeTakeProfit / factor);
            HiddenTakeProfit = take;
         }//if (!CloseEnough(RangeTakeProfit, 0) )
      }//if (comment == RangeTradeComment)
      
               
      //Rad trades
      if (comment == RadTradeComment)
      {
         //Atr take profit
         if (TrendAtrPeriod > 0)
         {
            RadTakeProfit = (GetAtr(Symbol(), TrendAtrTimeFrame, TrendAtrPeriod, 0) * factor) * TrendAtrTpMultiplier;
         }//if (TrendAtrPeriod > 0)
         
         if (!CloseEnough(RadTakeProfit, 0) )
         {
            take = price + (RadTakeProfit / factor);
            HiddenTakeProfit = take;
         }//if (!CloseEnough(RadTakeProfit, 0) )
      }//if (comment == RadTradeComment)
      
      //Wave trades
      if (comment == WaveTradeComment)
         if (!CloseEnough(WaveMultiTakeProfit, 0) )
         {
            take = price + (WaveMultiTakeProfit / factor);
            HiddenTakeProfit = take;
         }//if (!CloseEnough(WaveMultiTakeProfit, 0) )
               
      if (HiddenPips > 0 && take > 0) take = NormalizeDouble(take + (HiddenPips / factor), Digits);

   }//if (type == OP_BUY)
   
   if (type == OP_SELL)
   {
      
      //Trend trades
      if (comment == TrendTradeComment)
      {
         //Atr take profit
         if (TrendAtrPeriod > 0)
         {
            TrendTakeProfit = (GetAtr(Symbol(), TrendAtrTimeFrame, TrendAtrPeriod, 0) * factor) * TrendAtrTpMultiplier;
         }//if (TrendAtrPeriod > 0)
         
         if (!CloseEnough(TrendTakeProfit, 0) )
         {
            take = price - (TrendTakeProfit / factor);
            HiddenTakeProfit = take;         
         }//if (!CloseEnough(TrendTakeProfit, 0) )
      }//if (comment == TrendTradeComment)
         
      
      //Range trades
      if (comment == RangeTradeComment)
      {
         //Atr take profit
         if (RangeAtrPeriod > 0)
         {
            RangeTakeProfit = (GetAtr(Symbol(), RangeAtrTimeFrame, RangeAtrPeriod, 0) * factor) * RangeAtrTpMultiplier;
         }//if (RangeAtrPeriod > 0)
         
         if (!CloseEnough(RangeTakeProfit, 0) )
         {
            take = price - (RangeTakeProfit / factor);
            HiddenTakeProfit = take;         
         }//if (!CloseEnough(RangeTakeProfit, 0) )
      }//if (comment == RangeTradeComment)
         
      
      //Rad trades
      if (comment == RadTradeComment)
      {
         //Atr take profit
         if (RadAtrPeriod > 0)
         {
            RadTakeProfit = (GetAtr(Symbol(), RadAtrTimeFrame, RadAtrPeriod, 0) * factor) * RadAtrTpMultiplier;
         }//if (RadAtrPeriod > 0)
         
         if (!CloseEnough(RadTakeProfit, 0) )
         {
            take = price - (RadTakeProfit / factor);
            HiddenTakeProfit = take;         
         }//if (!CloseEnough(RadTakeProfit, 0) )
      }//if (comment == RadTradeComment)
      
      //Wave trades
      if (comment == WaveTradeComment)
         if (!CloseEnough(WaveMultiTakeProfit, 0) )
         {
            take = price - (WaveMultiTakeProfit / factor);
            HiddenTakeProfit = take;
         }//if (!CloseEnough(WaveMultiTakeProfit, 0) )

       
         
      
      if (HiddenPips > 0 && take > 0) take = NormalizeDouble(take - (HiddenPips / factor), Digits);

   }//if (type == OP_SELL)
   
   return(take);
   
}//End double CalculateTakeProfit(int type)

Thanks for all the help guys. I know I do a lot without you, but my life would me much harder without the bloop spotters here. :clap: :clap: :clap: :clap: :clap: :clap: :clap:

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
theforexedge
Trader
Posts: 220
Joined: Thu Apr 26, 2012 10:31 pm
Location: Torquay

Holy Graily Bob

Post by theforexedge »

Steve

Glad to be of some assistance...and glad to be here enjoying the HGB ride. Its a great example of many

great minds all conspiring together to make something truly remarkable... its the law of attraction

doing what it does best :clap:

Jason (JP)
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Holy Graily Bob

Post by SteveHopwood »

I see a duplicate gcad rad trade, so not all the bugs ironed out completely.

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
theforexedge
Trader
Posts: 220
Joined: Thu Apr 26, 2012 10:31 pm
Location: Torquay

Holy Graily Bob

Post by theforexedge »

Steve

OP_BUY Rad trades needed a few changes...I've posted the code if that helps, but best check it.. :lol:

Code: Select all

//Rad trades
      if (comment == RadTradeComment)
      {
         //Atr take profit
         if (TrendAtrPeriod > 0)
         {
            RadTakeProfit = (GetAtr(Symbol(), TrendAtrTimeFrame, TrendAtrPeriod, 0) * factor) * TrendAtrTpMultiplier;
         }//if (TrendAtrPeriod > 0)
         
         if (!CloseEnough(RadTakeProfit, 0) )
         {
            take = price + (RadTakeProfit / factor);
            HiddenTakeProfit = take;
         }//if (!CloseEnough(RadTakeProfit, 0) )
      }//if (comment == RadTradeComment)

Code: Select all

 //Rad trades
      if (comment == RadTradeComment)
      {
         //Atr take profit
         if (RadAtrPeriod > 0)
         {
            RadTakeProfit = (GetAtr(Symbol(), RadAtrTimeFrame, RadAtrPeriod, 0) * factor) * RadAtrTpMultiplier;
         }//if (RadAtrPeriod > 0)
         
         if (!CloseEnough(RadTakeProfit, 0) )
         {
            take = price + (RadTakeProfit / factor);
            HiddenTakeProfit = take;
         }//if (!CloseEnough(RadTakeProfit, 0) )
      }//if (comment == RadTradeComment)
JP
joancb

Holy Graily Bob

Post by joancb »

pacinvest » Wed Dec 10, 2014 10:22 pm wrote:Along with the H4 trials I am doing (going well), I have also got a M5 trial going trading trend arrows only to next opposing arrow. There are some very promising results from this but I am getting some trade openings without signals and a few closures I can not figure out. I have checked and rechecked settings and have not found anything. Reset demo with v1u and just got another un-signaled trade. I am using every tick mode = false, to reduce 'interim signals'. I can post screen shots if needed.

is anyone else having similar problems? Is there any reason that HGB will not handle M5?
I had the same issue while tetsing the same settings as you on 1M, trades were closed at any opposite signal, not only at the opposite trend signal.
art
Trader
Posts: 588
Joined: Fri Mar 02, 2012 3:51 pm

Holy Graily Bob

Post by art »

yep I have the same duplicate gbp cad trade steve
Maximilian
Trader
Posts: 150
Joined: Sat Sep 06, 2014 2:43 pm

Holy Graily Bob

Post by Maximilian »

One reason for doubled pending orders, here at least, is,that after sending the first order the price retraces, comes back a few candles later and retraces again, HGB is sending its next orders at the same (rounded?) pricelevel and so on. If there is a way for HGB to check it there a pending order allready in place, these could be avoided. Then I also get these doubled orders every ten minutes, which are based probably on a different reason. :?:
User avatar
Mike
Trader
Posts: 272
Joined: Sun Dec 11, 2011 12:30 pm
Location: Italy

Holy Graily Bob

Post by Mike »

BobbyT » Wed Dec 10, 2014 1:14 pm wrote: [1.] ...there are 2 buffers for the waves. One marks entering weakness [Buffer 7] from up/down trend and the other marks exiting weakness [Buffer 8] from up/down trend. ..Load up the indicator [HGI_Dark/Light. V14.05], change colours of these two buffers so you can see which is which and look for a buffer 8 wave in conjunction with a trend arrow...
[2.] As for the basket management, I was thinking ... something like %/0.01 lots/$1000 dollars. This way differing lot sizes and account sizes will be accounted for in any basket closures.
Great summary and basket management suggestion:

ad 1. how do you rename "Value 7" (showing Buffer 7) and "Value 8" (showing Buffer 8) within Empty4's Data Window to something like
7="Trend End/Range In"
8="Trend Start/Range Out"?
(which are 6 & 7 in base = for EA)
In the same line Value 2 to 6 could be renamed.

ad 2. Basket Management, independent of account size and lot size. How would you adapt to number of pairs? Something like
%/(0.01 lots)/1000$x(Nr of Pairs)
What %/0.01 lots/1000$ per pair would be in line with the results we get by now?

As to Basket closure
- I have two templates with HGB, one set to "Allow live trading"=ticked, one set to "Allow live trading"=off.
The template with the ea active on all trading pairs is set. HGB shows a profit (see above):
- I load the passive ea-Template on any chart
- I copy this passive ea-Template with the "copy template to all charts script" to all charts
- I close all trades and pendings with the appropriate script
- I reactivate trading by setting my active-ea Template at the next session start to all charts.
looking forward to some easier way
Mike
Image
Image
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Holy Graily Bob

Post by SteveHopwood »

theforexedge » Thu Dec 11, 2014 12:46 am wrote:Steve

OP_BUY Rad trades needed a few changes...I've posted the code if that helps, but best check it.. :lol:


JP
Nice spot. Thanks. :clap:

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
Gertje
Trader
Posts: 1936
Joined: Mon Dec 12, 2011 1:17 pm
Location: Middle of the Netherlands

Holy Graily Bob

Post by Gertje »

Mike » Thu Dec 11, 2014 8:55 am wrote:As to Basket closure
- I have two templates with HGB, one set to "Allow live trading"=ticked, one set to "Allow live trading"=off.
The template with the ea active on all trading pairs is set. HGB shows a profit (see above):
- I load the passive ea-Template on any chart
- I copy this passive ea-Template with the "copy template to all charts script" to all charts
- I close all trades and pendings with the appropriate script
- I reactivate trading by setting my active-ea Template at the next session start to all charts.
looking forward to some easier way
Mike
You could save each set of charts with EA's as different profiles
- Trading
- Sleeping

When desired profit is reached, change profiles and the EA goes to sleep.
At to the 'sleeping profile' one chart with MPBM with a cash TP of $0,01 and it will close all trades as long as the float is positive.

When you want to commence trading, change profiles again.
Locked

Return to “Thingy Bob EA's”