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

Holy Graily Bob 'n Grid
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=4525
Page 19 of 99
Author:  cyberevil [ Sun Jan 31, 2016 10:00 pm ]
Post subject:  Holy Graily Bob 'n Grid

Here is my current working set file. It's running on some very basic settings for the time being. Once I get the basic logic up and running and my heart is satisfied then i'll start playing with all the bells and whistles Steve has added ;)

PS. my set file keeps changing so :?
PSS don't use it on live account.
Author:  SteveHopwood [ Sun Jan 31, 2016 10:51 pm ]
Post subject:  Holy Graily Bob 'n Grid

Anybody using 1u to fill in a missing grid will have come across the same problems I did. I have fixed them in V 1v in post 1.

To make the changes yourselves, go to line 900 and copy this over the top of the code snippet:

Code: Select all

   //Force a pending grid order send
   if (SendGrid)
   {
      int type = PendingOrderType + 2;//enum starts at 0, so we need to add 2 to make the order a stop or limit
      int retno = MessageBox("Please confirm that you want to send a pending trade grid", "Confirm grid sending", MB_YESNOCANCEL);
            
      if (retno == IDYES)
      {
         double price = NormalizeDouble(Bid + (DistanceBetweenTrades / factor), Digits);//Defaults to buy stop/sell limit
         if (type == 2 || type == 5)//Buy limit sell stop
            price = NormalizeDouble(Bid - (DistanceBetweenTrades / factor), Digits);
         if (!CloseEnough(GridStartPrice, 0))
            price = GridStartPrice;
         if (type == 2 || type == 4)
            SendBuyGrid(Symbol(), type, price, Lot);
         else
            SendSellGrid(Symbol(), type, price, Lot);
         RemoveExpert = true;
         Alert(Symbol() + ": I have removed myself from the chart.");
         ExpertRemove();
         return(0);               
      }//if (retno == IDYES) 
   }//if (SendGrid)
:xm:
Author:  Peepaws [ Sun Jan 31, 2016 11:09 pm ]
Post subject:  Holy Graily Bob 'n Grid

SteveHopwood » Sun Jan 31, 2016 3:00 pm wrote:V 1u is in post 1.

It occurred to me that there might be times when we want to add a fresh grid - I do at the mo on that GJ chart I posted. I have added this functionality.

Loving this new feature Steve! Thank you I think the Ea is perfect now!

:clap: :clap: :clap: :clap: :clap:
Author:  tonyharmony [ Sun Jan 31, 2016 11:54 pm ]
Post subject:  Holy Graily Bob 'n Grid

SteveHopwood » Mon Feb 01, 2016 8:51 am wrote:Anybody using 1u to fill in a missing grid will have come across the same problems I did. I have fixed them in V 1v in post 1.

To make the changes yourselves, go to line 900 and copy this over the top of the code snippet:

Code: Select all

   //Force a pending grid order send
   if (SendGrid)
   {
      int type = PendingOrderType + 2;//enum starts at 0, so we need to add 2 to make the order a stop or limit
      int retno = MessageBox("Please confirm that you want to send a pending trade grid", "Confirm grid sending", MB_YESNOCANCEL);
            
      if (retno == IDYES)
      {
         double price = NormalizeDouble(Bid + (DistanceBetweenTrades / factor), Digits);//Defaults to buy stop/sell limit
         if (type == 2 || type == 5)//Buy limit sell stop
            price = NormalizeDouble(Bid - (DistanceBetweenTrades / factor), Digits);
         if (!CloseEnough(GridStartPrice, 0))
            price = GridStartPrice;
         if (type == 2 || type == 4)
            SendBuyGrid(Symbol(), type, price, Lot);
         else
            SendSellGrid(Symbol(), type, price, Lot);
         RemoveExpert = true;
         Alert(Symbol() + ": I have removed myself from the chart.");
         ExpertRemove();
         return(0);               
      }//if (retno == IDYES) 
   }//if (SendGrid)
:xm:
Thanks for the update Steve!

Decided to have a go at updating myself, rather than just downloading...
Once I figured out to remove the numbers, as it copies them as well, I compiled and had great success! :yahoo:

I think I'll keep doing this when the time arises as it is a new trick I am learning.
Who says they can't teach an old dog new tricks! :lol:

Cheers
Author:  cozybooks [ Mon Feb 01, 2016 2:28 pm ]
Post subject:  Holy Graily Bob 'n Grid

Hey Steve,

I'm not convinced I'm encountering a real problem but thought I'd post it in case anyone else sees the same thing. I've had the same issue with rev U and V.

I initially had the problem on a one hour timeframe, so I tried setting up tests with a 5 minute timeframe, but both had the same problem.

I'm doing Stop_Orders_Only with a grid size of 5.

I'm using the ATR setting for TP, SL and grid. The grid size works fine, and the TP on the pending buy and sell stop orders is correct, but the SL on the pendings orders (both long and short) is zero.

I was using an oddball setting for SL ( .72 of a 4 Hour ATR with 20 periods), so I tried using a straight 1.0 instead of the .72, but had the same issue. I then tried putting in a SL at the top of the EA, thinking maybe if there was an initial stop loss, then it would change it. Same problem, except on my 5 minute timeframe test (just to get a signal more quickly), it got as far as the first four sell stop orders (all with a SL of zero instead of the ATR setting), then hit an error trying to send the 5th pending sell order for an invalid stop.

The journal shows sl: 0.00000 on the pending orders sent.

I was getting this problem on an ECN broker account, so I tried setting it up on my non-ecn broker, but that's the setup where I got the invalid stop error trying to generate the 5th pending.

Sorry in advance if I'm missing something obvious. It's still early Monday here in the U.S. and my brain isn't very functional even at its peak!!
Author:  SteveHopwood [ Mon Feb 01, 2016 3:09 pm ]
Post subject:  Holy Graily Bob 'n Grid

cozybooks » Mon Feb 01, 2016 2:28 pm wrote:Hey Steve,

I'm not convinced I'm encountering a real problem but thought I'd post it in case anyone else sees the same thing. I've had the same issue with rev U and V.

I initially had the problem on a one hour timeframe, so I tried setting up tests with a 5 minute timeframe, but both had the same problem.

I'm doing Stop_Orders_Only with a grid size of 5.

I'm using the ATR setting for TP, SL and grid. The grid size works fine, and the TP on the pending buy and sell stop orders is correct, but the SL on the pendings orders (both long and short) is zero.

I was using an oddball setting for SL ( .72 of a 4 Hour ATR with 20 periods), so I tried using a straight 1.0 instead of the .72, but had the same issue. I then tried putting in a SL at the top of the EA, thinking maybe if there was an initial stop loss, then it would change it. Same problem, except on my 5 minute timeframe test (just to get a signal more quickly), it got as far as the first four sell stop orders (all with a SL of zero instead of the ATR setting), then hit an error trying to send the 5th pending sell order for an invalid stop.

The journal shows sl: 0.00000 on the pending orders sent.

I was getting this problem on an ECN broker account, so I tried setting it up on my non-ecn broker, but that's the setup where I got the invalid stop error trying to generate the 5th pending.

Sorry in advance if I'm missing something obvious. It's still early Monday here in the U.S. and my brain isn't very functional even at its peak!!
Read the user guide. It is there to stop me having to read damn fool questions.
Author:  tonyharmony [ Tue Feb 02, 2016 12:35 am ]
Post subject:  Holy Graily Bob 'n Grid

cyberevil » Mon Feb 01, 2016 8:00 am wrote:Here is my current working set file. It's running on some very basic settings for the time being. Once I get the basic logic up and running and my heart is satisfied then i'll start playing with all the bells and whistles Steve has added ;)

PS. my set file keeps changing so :?
PSS don't use it on live account.
Hey Cyber, how are you going mate? Thanks for the use of your setfile... :D

Just a quick question if you don't mind me asking? Have you adjusted your set file to suit Version 1v?

Just a little curious to know what you would use in your 'Grid Inputs', under Grid Type as your setfile suggests '0'!

Which would you use 'Stop_And_Limit_Orders', or just the 'Stop_Orders_Only' to replace the '0' in your style of trading?

I am a bit like you you, as some days I like to watch the market, get in and out, and that's my trading done for the day....

Interested to know your thoughts, thanks... :D

Cheers
Tony
Author:  FXCoder [ Tue Feb 02, 2016 1:12 am ]
Post subject:  Holy Graily Bob 'n Grid

Hi Tony,
A value of 0 in GridType represents "Stop Orders Only". A value of 1 represents "Stop and Limit Orders".

Cheers,

Bob
Just a little curious to know what you would use in your 'Grid Inputs', under Grid Type as your setfile suggests '0'!

Which would you use 'Stop_And_Limit_Orders', or just the 'Stop_Orders_Only' to replace the '0' in your style of trading?
Author:  tonyharmony [ Tue Feb 02, 2016 1:32 am ]
Post subject:  Holy Graily Bob 'n Grid

FXCoder » Tue Feb 02, 2016 11:12 am wrote:Hi Tony,
A value of 0 in GridType represents "Stop Orders Only". A value of 1 represents "Stop and Limit Orders".

Cheers,

Bob
Just a little curious to know what you would use in your 'Grid Inputs', under Grid Type as your setfile suggests '0'!

Which would you use 'Stop_And_Limit_Orders', or just the 'Stop_Orders_Only' to replace the '0' in your style of trading?
Thanks Bob, I appreciate the clarification...

I thought that may have been the case as it is the default option in HGB'nG V 1v...

Cheers :D
Tony
Author:  SteveHopwood [ Tue Feb 02, 2016 9:58 am ]
Post subject:  Holy Graily Bob 'n Grid

GridType is an enumeration, ENUM in the code. These are array constants that allow coders to show users a list of relevant inputs only. They are represented in set files by their integer equivalents, so Stop_Orders_Only is represented by 0, whilst Stop_And_Limit_Orders is represented by 1.

Fledgling coders, I only came across enumerations a few weeks ago; they are really useful. There are a number of inbuilt enumeration constants accessed through the ENUM command, as in:
extern ENUM_TIMEFRAMES TradingTimeFrame=PERIOD_M15;
This would be represented by 15 in the set file.

Rene showed me how to define my own:

Code: Select all

enum GridStrategyType
{
   Stop_Orders_Only,
   Stop_And_Limit_Orders
};

Then FXCoder showed me how to present them as a user input:
input GridStrategyType GridType=Stop_Orders_Only;

Useful thingies.

:xm:
All times are UTC Page 19 of 99