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

Old and defunct Holy Graily Bob
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3966
Page 37 of 129
Author:  SteveHopwood [ Wed Dec 10, 2014 11:39 pm ]
Post subject:  Holy Graily Bob

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:
Author:  theforexedge [ Wed Dec 10, 2014 11:49 pm ]
Post subject:  Holy Graily Bob

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)
Author:  SteveHopwood [ Thu Dec 11, 2014 12:10 am ]
Post subject:  Holy Graily Bob

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

:xm:
Author:  theforexedge [ Thu Dec 11, 2014 12:46 am ]
Post subject:  Holy Graily Bob

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
Author:  joancb [ Thu Dec 11, 2014 7:40 am ]
Post subject:  Holy Graily Bob

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.
Author:  art [ Thu Dec 11, 2014 8:27 am ]
Post subject:  Holy Graily Bob

yep I have the same duplicate gbp cad trade steve
Author:  Maximilian [ Thu Dec 11, 2014 8:48 am ]
Post subject:  Holy Graily Bob

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. :?:
Author:  Mike [ Thu Dec 11, 2014 8:55 am ]
Post subject:  Holy Graily Bob

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
Author:  SteveHopwood [ Thu Dec 11, 2014 9:38 am ]
Post subject:  Holy Graily Bob

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:
Author:  Gertje [ Thu Dec 11, 2014 9:54 am ]
Post subject:  Holy Graily Bob

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.
All times are UTC Page 37 of 129