Secret Bob's Basket

EA's inspired by nanningbob's work here, especially those based on his 240 Moving Average trend detection filter.
Post Reply
Radar
Trader
Posts: 437
Joined: Fri Mar 23, 2012 5:39 pm
Location: Round the bend ;)

Secret Bob's Basket

Post by Radar »

Hey Steve,

Just had a look at the GV's, and noticed that date/time and highest don't have the magic number appended, which will be a problem if we try using SBB on multiple timeframes in the same instance of Empty4.

The obvious work-around for now is to have an instance of Empty4 for each timeframe ;)

The average spread GV's don't need a unique identifier, as the spread should be the same across all timeframes, unless some bucketboy decides to play with it to grab more of our balance. Hmmm, I might just add the magic to them and see.

Take care,

&

Have fun!

Radar =8^)
Check out my new, (well, old now), manual trade & automatic scale-in manager,
StackManV2
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

Secret Bob's Basket

Post by renexxxx »

Hi Radar,

The code in SBB was written --I believe-- with the assumption that no other EA's would be running in the same Empty4 terminal. For instance, Steve uses AccountProfit() to work out the total basket profit. If you were running other EA's or other instances of the same EA, AccountProfit() would give you the total UPL for the account and not for the basket.
Radar
Trader
Posts: 437
Joined: Fri Mar 23, 2012 5:39 pm
Location: Round the bend ;)

Secret Bob's Basket

Post by Radar »

Hey Renexxxx,
renexxxx » Sun Oct 26, 2014 11:00 am wrote:Hi Radar,

The code in SBB was written --I believe-- with the assumption that no other EA's would be running in the same Empty4 terminal. For instance, Steve uses AccountProfit() to work out the total basket profit. If you were running other EA's or other instances of the same EA, AccountProfit() would give you the total UPL for the account and not for the basket.
Thanks for the heads-up :)

Whenever I mod EA's or indicators, I always assume that they'll be part of a portfolio of systems... With basket EA's, I check/set a GV with the starting date/time of a basket, and tally the profit/loss of both open and closed trades (filtered by magicnumber) back to that date to determine when to close on GEC, and delete the GV when closing the basket. That way, I don't need to know the balance or equity at the start of a new basket.

It takes a bit more code and processing time, but gives me the flexibility to test variations on settings or timeframes on the same account.

Have fun!

Radar =8^)
Check out my new, (well, old now), manual trade & automatic scale-in manager,
StackManV2
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.

Secret Bob's Basket

Post by SteveHopwood »

You need to run one instance per platform if using SBB as a basket trader. The bot is complicated enough without adding extra layers of lunacy.

: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
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Secret Bob's Basket

Post by SteveHopwood »

I forgot to add that I will include adding the magic number to the GV in time for the markets opening later on so people can run multiple baskets if they want to.

: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
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Secret Bob's Basket

Post by SteveHopwood »

I have added the magic number to the global variable. Also added the usual minimum margin checks.

That is it for now. I am sick of coding and will be teaching later, so it is safe to assume the version in post 1 is the version that will go onto our demos later on.

: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.
Radar
Trader
Posts: 437
Joined: Fri Mar 23, 2012 5:39 pm
Location: Round the bend ;)

Secret Bob's Basket

Post by Radar »

Hey Steve,

Thanks for the MN on the GV's :)

As for the extra layers of lunacy... Join us! Joooiiin uuuuussss! ;)

Take care,

&

Have fun!

Radar =8^)
Check out my new, (well, old now), manual trade & automatic scale-in manager,
StackManV2
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.

Secret Bob's Basket

Post by SteveHopwood »

I forgot to add the magic to the date global. Insert
GvNameDate="Date/time " + IntegerToString(MagicNumber);

at line 317.

: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
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Secret Bob's Basket

Post by SteveHopwood »

renexxxx has just pointed out the need for another mod, in a pm a few minutes ago.

Line 3002 needs modifying from:
BasketCashUpl = AccountProfit();

to

BasketCashUpl = BasketCashUpl;

Cheers Rene

: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
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

Secret Bob's Basket

Post by renexxxx »

Not sure if I am following this ... Shouldn't it be something like:

Code: Select all

BasketCashUpl = basketProfit( MagicNumber );
with:

Code: Select all

//+------------------------------------------------------------------+
//| basketProfit()                                                   |
//|    -- returns total profit (or loss) for basket                  |
//+------------------------------------------------------------------+
double basketProfit( int magic = -1 ) {

   double myProfit = 0.0;
   int allOrders = OrdersTotal();
   
   for (int i = 0; i < allOrders; i++) {
      if (OrderSelect(i, SELECT_BY_POS)) {
         if ( ( (magic == -1) || ( OrderMagicNumber() == magic ) ) && ( (OrderType() == OP_BUY) || (OrderType() == OP_SELL) ) ) {
            myProfit += OrderProfit() + OrderCommission() + OrderSwap();
         }
      }
   } // for
   return(myProfit);
}
?
Post Reply

Return to “Thingy Bob EA's”