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

Holy Graily Bob 'n Dotty 'n Super Slope 'n Flying Buddha
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=5101
Page 1 of 33
Author:  SteveHopwood [ Fri Mar 03, 2017 11:53 am ]
Post subject:  Holy Graily Bob 'n Dotty 'n Super Slope 'n Flying Buddha

SERIOUS WARNING
  • Most Forex traders lose all their money.
  • Using the robot posted here in trading Forex does not guarantee success.
  • Trading this robot could lead to serious financial loss.
  • Trading this robot without understanding its underlying trading strategies guarantees traders will lose their money.
  • This is not a set-and-forget ea; there is no such thing and anyone who tries to claim there is, is either stupid or lying. This ea requires frequent manual intervention.
  • At best, a trading robot is only 90% as good as the manual strategy it trades. At best. At worst, it can be much less effective. If the strategy is rubbish, so is the robot.
  • To trade this robot, you have to understand:
MAKE SURE YOU READ THIS POST http://www.stevehopwoodforex.com/phpBB3 ... 41#p111241 There was a Forex bloodbath on Jan 15th 2015 that you need to know about.

I refer to SUPER CSS-2.0 here and in the inputs as SuperSlope - abbreviated to SS here.

HGBnDnSSnFB is an extension of Holy Graily Bob 'n Dotty. The trade trigger here is a Flying Budda, as described by TraderJoeForex in his thread at http://www.stevehopwoodforex.com/phpBB3 ... 101&t=5098. Download his template to make your SS colours the same as those shown in TJF's pictures and in the bot's chart feedback.

I have adapted HGBnDnSS to create this EA so users have all the options. The defaults tell the bot to trade as TJF describes, so:
  • buy when there is a blue Flying Buddha and Super Slope is blue.
  • sell when there is a red Flying Buddha and Super Slope is red.
You need to download two libraries because the bot will not run without them: The Super Slope indi code was added to the EA's code by Thomas so you do not need it for running the EA. Download it from http://www.stevehopwoodforex.com/phpBB3 ... 101&t=4888

A quick note to noobs. Those of us who have been in on DottyBot's development from the start understand what is going on here, so I am not going to clutter up this thread with information already posted elsewhere. User Guide describes the panoply of gridding/hedging/offsetting. Holy Graily Bob 'n Dotty is posted at http://www.stevehopwoodforex.com/phpBB3 ... 40#p145240. Post 2 describes the full hedge trade that inspired the addition of the full hedging feature. The User Guide describes the panoply of gridding/hedging/offsetting.

Remember to download hgi_lib.ex4 from Bob's post as well, and save it in either your Experts or Libraries folder. HGBnDnSS will not run without it. You do not need HGI on your charts for anything other than reference; this EA uses Thomas' calls to hgi_lib.ex4 instead.

There is an inputs section for the Flying Buddha-related thingies. The "Indi inputs" are those that you enter into the Flying Buddha indicator posted in TJF's thread. The rest are all to do with how the bot enters and closes trades. Here are the inputs, their defaults and the comment that describes their functions
  • "-- Trading inputs --";
  • TradeEverySignal=true; //Take every trade signal
  • MaxSignalsToFollow=10; //up to this maximum
  • MinimumDistanceBetweenSignalsPips=10; //with this distance between signals.
  • UsePercentageOfAtrForDistance=true; //Use atr to calculate the minimum distance
  • FbAtrPeriod=24; //over this period
  • FbPercentageOfAtrToUse=100; //at this percentage.
  • "-- Trade closure inputs --";
  • CloseOnOppositeFB=true; //Close buys following a down arrow and sells at an up arrow
  • OnlyCloseWhenSuperSlopeAgrees=true; //but only when SS is the same direction as the arrow.
FB will not act when SS is ranging as this happens so rarely. I can add the relevant code in five minutes should it turn out to be advantageous in TJF's thread.

I have been demoing 0.1 lots on the 5 biggies + GJ - no grids etc but taking fresh FB signals. Trading time frame is H1 and SS D1. Demo started with $10,000.


It is possible to disable this EA in the lead up to a news release - this applies to all of the Dotty family and pretty much everything I have coded for about 3 years. Go to Rene's http://www.stevehopwoodforex.com/phpBB3 ... =97&t=5039 and download the EA. It goes on a single chart on your Empty4 platform and set up the inputs to do whatever it is you want it to do. Rene's EA will talk to all of mine and stop them doing anything in the run up to a news release.

We have to deal with this situation:
EURUSDH1.png
The bot took the trade in the usual way. Then came the concatenation of the terms, "Possible impeachment" and "US President" within the same sentence and the USD tanked. The trade is currently at just over -300

This sort of event will occur on all tf's. Just because we know where the market is going eventually does not mean we know when 'eventually' will be. At least, I don't.

Here is what I have coded to help us out: when the market moves determinedly against us and we have an open market trade, then leave a stop order behind the market to take advantage of the retrace that will come eventually. The inputs that control this behaviour are:
  • FollowAdverseMarketWithStopOrders: tells Peaky to place the stops as the market moves against our market trade.
  • MarketDistancePips: tells Peaky how far the market must move before sending a stop order. The order will be a half way between the most recent order open price (market or stop makes no difference) and the current price.
  • MaxTradesAllowed: this input is a part of all of my EA's, although it is hidden when the bot will definitely trade only once at a time. It is important here. Peaky will not send any more stop orders once the total of stop and market orders (i.e. OpenTrades for the coders) reaches this figure.
  • TradesToConstituteBasket: imagine this scenario: the market reaches the peak high and fills the limit sell order then retraces and fills the sell stop order; we are in a healthy profit position and can allow the market to proceed to our take profit. Now imagine instead that the market continues to rise: Peaky obediently leaves sell stop orders behind him - let's say 5; the market finally gets its bloody act together, does what it is damn well supposed to do and reverses; we are in a basic Recovery situation and trading the position as a basket. This input tells us how many trades we need to have open to be in Recovery and so treating the position as a basket. We simply want out and as soon as possible.
  • BasketCashProfitTarget: no need to suffer the pain of Recovery without some reward, so this input tells Peaky how much cash profit to lock in before closing the basket of trades.
----
Note to noobs: before asking about basket trading and Recovery, break the habit of a lifetime and read "To trade this robot, you have to understand:" at the top of this post. I will eviscerate you if ask about them here.
----


Have fun.

:xm:

Matters of general interest
Go here to download and run the script that will fill your platform's missing chart history: http://www.stevehopwoodforex.com/phpBB3 ... f=15&t=254
Read this post:
http://www.stevehopwoodforex.com/phpBB3 ... p?f=6&t=78 Newbie traders, read this for inspiration and warning. Those of you who have suffered losses, read it for inspiration.

Masterly summary of hedging: http://www.forexfactory.com/showthread. ... ost4977179

EA coding
I receive may requests to code EA's. Traders, if I code your EA for free, then I will share it here. If you want me to code your EA without sharing, then my fee is $100 payable into my paypal account. I explain why at http://www.stevehopwoodforex.com/phpBB3 ... ?f=15&t=79, at the bottom of the post.

Useful utilities/EA's/scripts -

-
Author:  rapple [ Fri Mar 03, 2017 9:39 pm ]
Post subject:  Holy Graily Bob 'n Dotty 'n Super Slope 'n Flying Buddha

Thanks TJF, Thomas and Steve

Will give it a go :clap: :clap: :clap:
Author:  ronald111 [ Sat Mar 04, 2017 8:36 pm ]
Post subject:  Holy Graily Bob 'n Dotty 'n Super Slope 'n Flying Buddha

Hello,
Line 3300 FbStatus==fbuparrowtradable
Should be down for sell signal. Thanks for the ea.
Author:  SteveHopwood [ Sat Mar 04, 2017 8:47 pm ]
Post subject:  Holy Graily Bob 'n Dotty 'n Super Slope 'n Flying Buddha

ronald111 » Sat Mar 04, 2017 8:36 pm wrote:Hello,
Line 3300 FbStatus==fbuparrowtradable
Should be down for sell signal. Thanks for the ea.
Fantastic spot. Thanks very much. :clap: :clap: :clap: :clap: :clap: :clap:

Fix in post 1. DIYers, you know what to do.

:xm:
Author:  ronald111 [ Sat Mar 04, 2017 10:08 pm ]
Post subject:  Holy Graily Bob 'n Dotty 'n Super Slope 'n Flying Buddha

Hello, hi
Might be nothing.
TradingTimeFrame 1HR
UseSsTradingTimeFrameControl = true
Line3133 GetSuperSlope(TradingTimeFrame
TJF setting for superslope is D1. Just wondering how it ties up? I'm not a coder just learning
Author:  TraderJoeForex [ Sat Mar 04, 2017 10:40 pm ]
Post subject:  Holy Graily Bob 'n Dotty 'n Super Slope 'n Flying Buddha

ronald111 » Sat Mar 04, 2017 10:08 pm wrote:Hello, hi
Might be nothing.
TradingTimeFrame 1HR
UseSsTradingTimeFrameControl = true
Line3133 GetSuperSlope(TradingTimeFrame
TJF setting for superslope is D1. Just wondering how it ties up? I'm not a coder just learning

Hi Ronald111,

You can choose D1 as the higher timeframe and turn the rest off (or W1 if trading H4 etc). Or play around to find some magic combination which is what the choices are there for.

... Now that we have this gift of an EA it wil be a lot easier to forward test different combinations of settings and that is the whole point.

What I have suggested in my manual thread is just a basic starting point :)
Author:  SteveHopwood [ Mon Mar 06, 2017 3:16 pm ]
Post subject:  Holy Graily Bob 'n Dotty 'n Super Slope 'n Flying Buddha

V 1a is in post 1, in response to a pm this morning from TJF.

There are two new inputs in the higher and medium time frame Slope inputs section - SsCloseTradesOnHtfColourChange and SsCloseTradesOnMtfColourChange. These allow you to prevent the bot from closing a trade merely because the higher and medium colours are wrong for the trade.

I noticed that the trade closure code could be more sophisticated, and have rewritten bool LookForTradeClosure(int ticket). I have a fuzzy brain this afternoon, so I would appreciate you codeslingers passing your peepers over it to see if you can spot holes in the logic.

DIYers, easy changes to make.
Insert this at line 284
extern bool SsCloseTradesOnMtfColourChange=false;

Insert this at line 273:
extern bool SsCloseTradesOnHtfColourChange=false;

Then copy this over the top of bool LookForTradeClosure(int ticket):

Code: Select all

bool LookForTradeClosure(int ticket)
{
   //Close the trade if the close conditions are met.
   //Called from within CountOpenTrades(). Returns true if a close is needed and succeeds, so that COT can increment cc,
   //else returns false
   
   if (!BetterOrderSelect(ticket, SELECT_BY_TICKET) ) return(true);
   if (BetterOrderSelect(ticket, SELECT_BY_TICKET) && OrderCloseTime() > 0) return(true);
   
   bool CloseThisTrade = false;
   
   string LineName = TpPrefix + DoubleToStr(ticket, 0);
   //Work with the lines on the chart that represent the hidden tp/sl
   double take = ObjectGet(LineName, OBJPROP_PRICE1);
   if (CloseEnough(take, 0) ) take = OrderTakeProfit();
   LineName = SlPrefix + DoubleToStr(ticket, 0);
   double stop = ObjectGet(LineName, OBJPROP_PRICE1);
   if (CloseEnough(stop, 0) ) stop = OrderStopLoss();
   
   
   ///////////////////////////////////////////////////////////////////////////////////////////////////////////
   if (OrderType() == OP_BUY || OrderType() == OP_BUYSTOP || OrderType() == OP_BUYLIMIT)
   {
      //TP
      if (Bid >= take && !CloseEnough(take, 0) && !CloseEnough(take, OrderTakeProfit()) ) CloseThisTrade = true;
      //SL
      if (Bid <= stop && !CloseEnough(stop, 0)  && !CloseEnough(stop, OrderStopLoss())) CloseThisTrade = true;

      
      //Close trade on opposite direction signal
      if (BuyCloseSignal)
         CloseThisTrade = true;

      
      //Delete pendings on a new signal.
      //You may need to make changes here.
      if (!CloseThisTrade)
        if (SellSignal)
            if (DeletePendingsOnNewSignal)
               if (MarketTradesTotal == 0)
                  CloseThisTrade = true;
   
      
     //Change of SS colour and/or opposite direction FB
     //Higher time frame
     if (!CloseThisTrade)
        if (UseSsHigherTimeFrameControl)
        {
            if (SsCloseTradesOnHtfColourChange)
               if(SsHtfColour != blue)
                  CloseThisTrade = true;              
        
            //Opposite FB signal
            if (!CloseThisTrade)
               if (SsCloseTradesOnHtfColourChange)
                  if (!OnlyCloseWhenSuperSlopeAgrees || SsHtfColour == red)
                     if (FbStatus == fbdownarrowtradable || FbStatus == fbdownarrowuntradable)
                        CloseThisTrade = true;
        }//if (UseSsHigherTimeFrameControl)
       
     //Medium time frame
     if (!CloseThisTrade)
        if (UseSsMediumTimeFrameControl)
        {
            if (SsCloseTradesOnMtfColourChange)
               if(SsMtfColour != blue)
                  CloseThisTrade = true;              
        
            //Opposite FB signal
            if (!CloseThisTrade)
               if (SsCloseTradesOnMtfColourChange)
                  if (!OnlyCloseWhenSuperSlopeAgrees || SsMtfColour == red)
                     if (FbStatus == fbdownarrowtradable || FbStatus == fbdownarrowuntradable)
                        CloseThisTrade = true;
        }//if (UseSsMediumTimeFrameControl)
       
     //Trading time frame
     if (!CloseThisTrade)
        if (UseSsTradingTimeFrameControl)
        {
            if (SsCloseTradesOnColourChange)
               if(SsColour != blue)
                  CloseThisTrade = true;              
        
            //Opposite FB signal
            if (!CloseThisTrade)
               if (SsCloseTradesOnColourChange)
                  if (!OnlyCloseWhenSuperSlopeAgrees || SsColour == red)
                     if (FbStatus == fbdownarrowtradable || FbStatus == fbdownarrowuntradable)
                        CloseThisTrade = true;
        }//if (UseSsTradingTimeFrameControl)
       
             
   //Opposite FB with no slope
   if (!CloseThisTrade)
      if (CloseOnOppositeFB)
      {
         if ((!UseSsHigherTimeFrameControl && !SsCloseTradesOnHtfColourChange) || SsHtfColour == red)
            if ((!UseSsMediumTimeFrameControl && !SsCloseTradesOnMtfColourChange) || SsMtfColour == red)
               if ((!UseSsTradingTimeFrameControl && !SsCloseTradesOnColourChange) || SsColour == red)
                  if (FbStatus == fbdownarrowtradable || FbStatus == fbdownarrowuntradable)
                     CloseThisTrade = true;
      }//if (CloseOnOppositeFB)
      
   }//if (OrderType() == OP_BUY)
   
   
   ///////////////////////////////////////////////////////////////////////////////////////////////////////////
   if (OrderType() == OP_SELL || OrderType() == OP_SELLSTOP || OrderType() == OP_SELLLIMIT)
   {
      //TP
      if (Bid <= take && !CloseEnough(take, 0) && !CloseEnough(take, OrderTakeProfit()) ) CloseThisTrade = true;
      //SL
      if (Bid >= stop && !CloseEnough(stop, 0)  && !CloseEnough(stop, OrderStopLoss())) CloseThisTrade = true;



      
      //Close trade on opposite direction signal
      if (SellCloseSignal)
         CloseThisTrade = true;

     //Change of SS colour and/or opposite direction FB
     //Higher time frame
     if (!CloseThisTrade)
        if (UseSsHigherTimeFrameControl)
        {
            if (SsCloseTradesOnHtfColourChange)
               if(SsHtfColour != blue)
                  CloseThisTrade = true;              
        
            //Opposite FB signal
            if (!CloseThisTrade)
               if (SsCloseTradesOnHtfColourChange)
                  if (!OnlyCloseWhenSuperSlopeAgrees || SsHtfColour == blue)
                     if (FbStatus == fbuparrowtradable || FbStatus == fbuparrowuntradable)
                        CloseThisTrade = true;
        }//if (UseSsHigherTimeFrameControl)
       
     //Medium time frame
     if (!CloseThisTrade)
        if (UseSsMediumTimeFrameControl)
        {
            if (SsCloseTradesOnMtfColourChange)
               if(SsMtfColour != blue)
                  CloseThisTrade = true;              
        
            //Opposite FB signal
            if (!CloseThisTrade)
               if (SsCloseTradesOnMtfColourChange)
                  if (!OnlyCloseWhenSuperSlopeAgrees || SsMtfColour == blue)
                     if (FbStatus == fbuparrowtradable || FbStatus == fbuparrowuntradable)
                        CloseThisTrade = true;
        }//if (UseSsMediumTimeFrameControl)
       
     //Trading time frame
     if (!CloseThisTrade)
        if (UseSsTradingTimeFrameControl)
        {
            if (SsCloseTradesOnColourChange)
               if(SsColour != blue)
                  CloseThisTrade = true;              
        
            //Opposite FB signal
            if (!CloseThisTrade)
               if (SsCloseTradesOnColourChange)
                  if (!OnlyCloseWhenSuperSlopeAgrees || SsColour == blue)
                     if (FbStatus == fbuparrowtradable || FbStatus == fbuparrowuntradable)
                        CloseThisTrade = true;
        }//if (UseSsTradingTimeFrameControl)


   //Opposite FB with no slope
   if (!CloseThisTrade)
      if (CloseOnOppositeFB)
      {
         if ((!UseSsHigherTimeFrameControl && !SsCloseTradesOnHtfColourChange) || SsHtfColour == blue)
            if ((!UseSsMediumTimeFrameControl && !SsCloseTradesOnMtfColourChange) || SsMtfColour == blue)
               if ((!UseSsTradingTimeFrameControl && !SsCloseTradesOnColourChange) || SsColour == blue)
                  if (FbStatus == fbdownarrowtradable || FbStatus == fbdownarrowuntradable)
                     CloseThisTrade = true;
      }//if (CloseOnOppositeFB)
       
   }//if (OrderType() == OP_SELL)

   ///////////////////////////////////////////////////////////////////////////////////////////////////////////
   if (CloseThisTrade)
   {
      bool result = false;
      
      if (OrderType() < 2)//Market orders
         result = CloseOrder(ticket);
      else
         result = OrderDelete(ticket, clrNONE);
            
      //Actions when trade close succeeds
      if (result)
      {
         DeletePendingPriceLines();
         TicketNo = -1;//TicketNo is the most recently trade opened, so this might need editing in a multi-trade EA
         OpenTrades--;//Rather than OpenTrades = 0 to cater for multi-trade EA's
         return(true);//Makes CountOpenTrades increment cc to avoid missing out ccounting a trade
      }//if (result)
   
      //Actions when trade close fails
      if (!result)
      {
         return(false);//Do not increment cc
      }//if (!result)
   }//if (CloseThisTrade)
   
   //Got this far, so no trade closure
   return(false);//Do not increment cc
   
}//End bool LookForTradeClosure()



:xm:
Author:  traderduke [ Tue Mar 07, 2017 4:10 pm ]
Post subject:  Holy Graily Bob 'n Dotty 'n Super Slope 'n Flying Buddha

Steve & fellow traders
It has been 2 days and no trades, has anybody got his EA to trade. The attached chart shows several opportunities. The top shows before re-boot, the bottom after re-boot. Could this be the EA problem??

Now that that I deleted all the line number and spaced most of the code, there must be an easy way to insert the new code without all the line numbers and spaces which need deleting. This was the largest change so therefore I never cared enough to ask.

My little coding project produced an error:
There seems to be a missing input “line 293 needed a Ss added to it.
Line 293“extern bool SsCloseTradesOnColourChange = true;

Some where I read that the Ea was set up for the Buddha but that appears to be my fantasy
So I believe that the following are the needed inputs for TJF buddha to work, if I’m wrong I’m sure I’ll hear about it!
Line 193, extern ENUM_TIMEFRAMES TradingTimeFrame=PERIOD_H1; //Chart TF
Line 275, extern bool UseSsMediumTimeFrameControl=true;
Line 276, extern ENUM_TIMEFRAMES SsMediumTimeFrame=PERIOD_D1; // Ss TF
Line 286, extern bool UseSsTradingTimeFrameControl=false;

Thanks for all the coding, I’m looking forward to trying to understand the new Shell’s coding.
Ray

Check out AUDUSD's re-boot!
3-7-2017 10-43-31 AM-buddah.png
3-7-2017 10-43-31 AM-buddah-reboot.png
Author:  SteveHopwood [ Tue Mar 07, 2017 6:59 pm ]
Post subject:  Holy Graily Bob 'n Dotty 'n Super Slope 'n Flying Buddha

I inadvertently issued 1a with ImmediateMarketOrders turned off and all of Slope disabled. I have put a setfile into post 1 to get you guys started.

:xm:
Author:  SteveHopwood [ Tue Mar 07, 2017 7:15 pm ]
Post subject:  Holy Graily Bob 'n Dotty 'n Super Slope 'n Flying Buddha

I just noticed that the default SS inputs are not the same as those in TJF's template, so I have redone the setfile.

Nobody else appears to have noticed this yet there have been over 100 downloads of this bot.

You have got to check your own inputs folks. Don't expect me to do your thinking for you - it ain't going to happen.

:xm:
All times are UTC Page 1 of 33