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

Bob's Biggest Balls Ever
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=1375
Page 23 of 26
Author:  fmuir [ Fri Jan 25, 2013 5:14 pm ]
Post subject:  Re: Bob's Biggest Balls Ever

Wiggy1965 wrote:i had the GU one the other day, i posted abut it...;-)

did you have fun closing all those trades...;-)

Wiggy
@ Wiggy1965,

Here is a script that makes it a snap to close all open or pending trades.

-Frank
Author:  House Brick [ Fri Jan 25, 2013 5:52 pm ]
Post subject:  Re: Bob's Biggest Balls Ever

SteveHopwood wrote:Just had umpteen GU NY trend sell trades sent, so there is something wrong in the code that allows a new trade each day. I will look at this over the weekend.

:D

Code: Select all

int CountOpenTrendTrades()
{
   //Counts the number of open trend trades
   if (OrdersTotal() == 0) return(0);
   int OpenTrades;

   for (int cc = OrdersTotal() - 1; cc >= 0; cc--)
   {
      if (!OrderSelect(cc, SELECT_BY_POS) ) continue;
      if (OrderSymbol() != Symbol() ) continue;
      if (OrderMagicNumber() != TrendMagicNumber) continue;

      OpenTrades++;
      //We only want one trend trade a day
      if (TimeDayOfWeek(OrderOpenTime()) == TimeDayOfWeek(TimeLocal()) ) TrendTradingDoneForToday = true;
   }//for (int cc = OrdersTotal() - 1; cc >= 0; cc--)

   return(OpenTrades);

}//End int CountOpenTrendTrades()
[/size]

The variable OpenTrades isn't being initialised before being incremented. Not sure what Empty4 does, are ints defaulted to zero? If not, it could have random crap in like -12 so even when incremented

Code: Select all

if (CountOpenTrendTrades() <= MaxTrades)//3
[/size]
will always pass. Or it could sometimes have a bigger number e.g. 1012 which would stop some valid trades.

But

Code: Select all

//Look for a long 10.2A trend trade
. . .
if (!TrendTradingDoneForToday)//8
[/size]
Should block later on when OpenTrades is randomly negative unless

Code: Select all

if (TimeDayOfWeek(OrderOpenTime()) == TimeDayOfWeek(TimeLocal()) ) TrendTradingDoneForToday = true;
[/size]
Isn't doing what it should.

Is Order Open Time Local time or Criminal time? Seems to be Criminal time, (it looks like it is for my Oanda acct). Sometimes Criminal and Local time will overlap which would explain why this isn't happening all the time.

So we need:

Code: Select all

int OpenTrades = 0;
. . .
if (TimeDayOfWeek(OrderOpenTime()) == TimeDayOfWeek(TimeCurrent()) ) TrendTradingDoneForToday = true;
[/size]

However:

Code: Select all

//Look for a long 10.2A trend trade
. . .
            if (CountOpenTrendTrades() <= MaxTrades)//3
. . .
                                 if (!TrendTradingDoneForToday)//8
[/size]

Can you spot the problem, #3 allows up to MaxTrades but #8 TrendTradingDoneForToday blocks after 1 trade. I suggest removing the !TrendTradingDoneForToday check in the Trade allowed filters as being the easiest thing to do.

I'm just guessing though.

Ta,
HouseBrick
Author:  SteveHopwood [ Fri Jan 25, 2013 9:51 pm ]
Post subject:  Re: Bob's Biggest Balls Ever

House Brick wrote:Can you spot the problem, #3 allows up to MaxTrades but #8 TrendTradingDoneForToday blocks after 1 trade. I suggest removing the !TrendTradingDoneForToday check in the Trade allowed filters as being the easiest thing to do.

I'm just guessing though.

Ta,
HouseBrick
Thanks again.

I have learned/been taught not to trust Crapql4 documentation and normally explicitly initialise variables. I forgot to do this here with OpenTrades.

Re the #8

Code: Select all

if  (TimeDayOfWeek(OrderOpenTime()) == TimeDayOfWeek(TimeLocal()) ) TrendTradingDoneForToday = true;
check, this is essential. The code allows for scaling in of trend trades at the rate of one per day, so BBBE needs to know when this trade has been taken. Whether this check should be as is or should actually be

Code: Select all

if  (TimeDayOfWeek(OrderOpenTime()) == TimeDayOfWeek(TimeCurrent()) ) TrendTradingDoneForToday = true;
is another matter. I have coded what I coded because I decided to code it that way. It might be better coded differently - don't know.

So, the next update will have OpenTrades explicitly declared to zero. To be honest, I cannot see this making any difference, but accurate code is always better than my usual rubbish.

Do me a favour, please, and cast your eagle eye over the O_R_CheckForHistory code. This is industrial strength code provided by one of the best in the business and it is foolproof. Thing is, Matt's original code is for single pair EA's, so there is always the possibility that I have mucked up its translation for multi-pair use. I cannot see anything wrong, but that means not a lot.

:D
Author:  SteveHopwood [ Sun Jan 27, 2013 10:12 pm ]
Post subject:  Re: Bob's Biggest Balls Ever

V 1l is in post 1, with a fix for the implicit/explicit thingy that HB spotted.

Do I think this will make a scrap of difference? Nope, but we can hope. It will save a hell of a lot of bug-hunting if it does.

:D
Author:  McNish [ Mon Jan 28, 2013 7:49 am ]
Post subject:  Re: Bob's Biggest Balls Ever

CADCHF gone berserk for 10.2 short on V1l. Suspended EA for now, will resume an hour later with new H1 candle formation. Anyone else?
Author:  SteveHopwood [ Mon Jan 28, 2013 10:17 am ]
Post subject:  Re: Bob's Biggest Balls Ever

V 1m is in post 1. I found the cause of the repeated order sends as soon as I looked for it. It is the most gormless mistake imaginable. Hey ho.

Those of you who can, go to int CountOpenTrendTrades() and change it to int CountOpenTrendTrades(string symbol). Then change the reference to Symbol() to symbol.

Recompile and follow the links to the two errors this generates and change CountOpenTrendTrades() to CountOpenTrendTrades(symbol).

:D
Author:  McNish [ Mon Jan 28, 2013 10:45 am ]
Post subject:  Re: Bob's Biggest Balls Ever

Thanks Steve, Will edit and report back.
Author:  babalu4u [ Tue Jan 29, 2013 5:45 pm ]
Post subject:  Re: Bob's Biggest Balls Ever

Hi Steve,

the bot on my Cowboy IBFX au mini account have a problem to set tp....
Author:  ovisun [ Tue Jan 29, 2013 8:52 pm ]
Post subject:  Re: Bob's Biggest Balls Ever

case 130: Error Invalid stops
Check if broker is ecn or not
Author:  blinkxzero [ Tue Jan 29, 2013 9:19 pm ]
Post subject:  Re: Bob's Biggest Balls Ever

ovisun wrote:case 130: Error Invalid stops
Check if broker is ecn or not
Would the error imply that the broker is ECN but the setting is not changed to true? Or would it mean the broker isn't ECN and the setting is set to true?

If you set CrimIsECN to true and your Crim is not ECN, would this result in an error or just use 2 steps to put in your order but still function properly?

Thanks for the clarification!
All times are UTC Page 23 of 26