Slopey Peaky Bob

Post Reply
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

Slopey Peaky Bob

Post by renexxxx »

With the fear that this thread is losing its original intention, I just want to add the following to this discussion:

If you store a long as a GlobalVariable() and retrieve it back again by casting the double to a long, the returned value is different:

Code: Select all

void OnStart() {
   //---
   long thisChartID = ChartID();
   long newChartID;
   
   GlobalVariableSet("myChartID", thisChartID);
   
   newChartID = (long)GlobalVariableGet("myChartID");
   
   if ( thisChartID != newChartID ) {
      PrintFormat("thisChartID = %I64d, newChartID = %I64d", thisChartID, newChartID);
   }
}
There is a workaround for this: you need to store the lower 32-bits and and higher 32-bits of the long as two GlobalVariables, retrieve them back and reconstruct them as one long, like this:

Code: Select all

void OnStart() {
   //---
   long thisChartID = ChartID();

   // Split the long into two ints -- the low 32-bit and the high 32-bit   
   int l32 = (int)(thisChartID & UINT_MAX);
   int h32 = (int)(thisChartID >> 32);

   GlobalVariableSet("myChartID_l32", (int)l32);
   GlobalVariableSet("myChartID_h32", (int)h32);
   
   int newl32 = (int)GlobalVariableGet("myChartID_l32");
   int newh32 = (int)GlobalVariableGet("myChartID_h32");

   long newChartID = (long)newh32;
   newChartID = newChartID << 32;
   newChartID = newChartID | newl32;
   
   PrintFormat("thisChartID = %I64d, newChartID = %I64d", thisChartID, newChartID);
}
Anyway ... back to SPB.
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.

Slopey Peaky Bob

Post by SteveHopwood »

renexxxx » Sun Jun 24, 2018 9:49 am wrote:With the fear that this thread is losing its original intention
I guess that a lot of members are building up some knowledge of CrapQl4 through DIY activities - which is why I usually leave instructions when I update the bot. Your insights are invaluable to them and to me. :clap: :clap: :clap:

Thomas, thanks for your help. The info you passed on earlier is really useful. :clap: :clap: :clap:

:xm: :rocket:
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.

Slopey Peaky Bob

Post by SteveHopwood »

Live account progress so far is excellent. Last week saw $338 added across the three accounts.

"My" account is +$189. That is two closed baskets and a great example of slippage working in my favour as I describe in the UG.

Gareth's is +$59 - two closed baskets and an example of slippage working mildly against us. The balance on the account is now $667, a superb recovery from its low point of c. $226.

The account I am running to finance PJ's trip to Cambodia is +$90. That is three baskets closing last week. Accrued profits are $397 in just over a month, so we are making a good hole in the amount he needs around about this time next year.

All this means that SPB has added $1464 to the three accounts overall. :party:

:xm: :rocket:
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.
trader689
Trader
Posts: 674
Joined: Thu Nov 17, 2011 12:53 am

Slopey Peaky Bob

Post by trader689 »

thanks for the update Steve, absolutely assuring/great to know that this promising looking bot has such chops in 'real life' trading

thanks to you and all involved in this :) :cheer:
Lifesys
Trader
Posts: 126
Joined: Wed Apr 25, 2012 2:05 am
Location: Echuca Victoria. Australia

Slopey Peaky Bob

Post by Lifesys »

Hi Steve
Have not really gone anywhere ;) - always have a serious review of all SHF ideas.
Congratulations to all on SPB, after 2 months best EA I have tested/used. Currently on demo & live for 2 brokers, a solid >14%/mth is brilliant when compounded.

On version Q, a minor correction.
As the original proponent of 'PipFactor' I use an external mqh file with 'pipfactors' for trading some indexes as well as Forex. Means all indicators/scripts/EAs read & compile the same mqh.
Thomas and Rene have brilliantly provided a replacement pipfactor function - except for one thing.
It MUST BE a 'double' function, NOT 'int' and all references as ''double', given some indexes eg HSI, NK225 have a pipfactor of 0.1 which is not an integer.
When changed to below. the function worked almost perfectly for all 135 symbols (most useless) of another Aust. broker I trust, as well as GP.
Well done guys.

Paul B. (lifesys)

Code: Select all

double GetPipFactor(string symbolName)
{
....
....
   // Now we can calculate the pip factor for the symbol
   double symbolDigits=SymbolInfoInteger(symbolName,SYMBOL_DIGITS);
   double symbolFactor=MathPow(10,symbolDigits-brokerDigits);
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.

Slopey Peaky Bob

Post by SteveHopwood »

Lifesys » Sun Jun 24, 2018 12:16 pm wrote:Hi Steve
Have not really gone anywhere ;) - always have a serious review of all SHF ideas.
Congratulations to all on SPB, after 2 months best EA I have tested/used. Currently on demo & live for 2 brokers, a solid >14%/mth is brilliant when compounded.

On version Q, a minor correction.
As the original proponent of 'PipFactor' I use an external mqh file with 'pipfactors' for trading some indexes as well as Forex. Means all indicators/scripts/EAs read & compile the same mqh.
Thomas and Rene have brilliantly provided a replacement pipfactor function - except for one thing.
It MUST BE a 'double' function, NOT 'int' and all references as ''double', given some indexes eg HSI, NK225 have a pipfactor of 0.1 which is not an integer.
When changed to below. the function worked almost perfectly for all 135 symbols (most useless) of another Aust. broker I trust, as well as GP.
Well done guys.

Paul B. (lifesys)

Code: Select all

double GetPipFactor(string symbolName)
{
....
....
   // Now we can calculate the pip factor for the symbol
   double symbolDigits=SymbolInfoInteger(symbolName,SYMBOL_DIGITS);
   double symbolFactor=MathPow(10,symbolDigits-brokerDigits);
Nice one Paul. Thanks.

I have updated 1q. I suggest there is no rush to re-download if you already have it. Most of you will be using the OOTB pairs and so do not need the fix.

The easiest way to DIY is to copy this over the top of the existing function:

Code: Select all

//Thomas and Rene provided this pip factor function. Thanks guys.
//There is also a contribution by lifesys, who gave us the first ever
//incarnation of this.
double GetPipFactor(string symbolName)
{
   static bool brokerDigitsKnown=false;
   static int  brokerDigits=0;
 
   // We want the additional pip digits of the broker (only once)
   if(!brokerDigitsKnown)
   {  
      // Try to get the broker digits for plain EURUSD
      brokerDigits=(int)SymbolInfoInteger("EURUSD",SYMBOL_DIGITS)-4;
      
      // If plain EURUSD was found, we take that
      if(brokerDigits>=0)
         brokerDigitsKnown=true;
         
      // If plain EURUSD not found, we take the most precise of all symbols containing EURUSD 
      else
      {
         brokerDigits=0;
         
         // Cycle through all symbols
         for(int i=0; i<SymbolsTotal(false); i++) 
         {
            string symName=SymbolName(i,false);
            if(StringFind(symName,"EURUSD")>=0)
               brokerDigits=MathMax(brokerDigits,(int)SymbolInfoInteger(symName,SYMBOL_DIGITS)-4);
         }
         
         brokerDigitsKnown=true;
      }
   }

   // Now we can calculate the pip factor for the symbol
   double symbolDigits = (int) SymbolInfoInteger(symbolName,SYMBOL_DIGITS);
   double symbolFactor=MathPow(10,symbolDigits-brokerDigits);
   
   return(symbolFactor);
}//End int getPipFactor(string symbolName)
:xm: :rocket:
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.

Slopey Peaky Bob

Post by SteveHopwood »

V 1r is in post 1. DC send me a code block last night to show your basket pips TP - I forgot to add that. Thanks David. :clap: :clap: :clap:

Easy DIY. Do a search for "if (TreatAllPairsAsBasket)
sizingInfo += " , Basket cash take profit = " + AccountCurrency() + " " + DoubleToStr(BasketTargetCash, 2) ;"

Replace the code with this:

Code: Select all

   //This came from DigitalCrypto. Thanks David.
   if (TreatAllPairsAsBasket)
   {
      if (BasketTargetCash > 0)
         sizingInfo +=  " , Basket cash take profit = " + AccountCurrency() + " " + DoubleToStr(BasketTargetCash, 2) ;
   
      if (BasketTargetPips > 0)
         sizingInfo +=  " , Basket take profit pips = " + IntegerToString(BasketTargetPips);
     
   }
   SM(sizingInfo + NL);
:xm: :rocket:
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
MurphyMan
Trader
Posts: 345
Joined: Tue Nov 15, 2011 2:35 pm
Location: Southern Illinois, USA

Slopey Peaky Bob

Post by MurphyMan »

From the user's guide:
▪ Basket Trailing Stop: this feature was added by SHF member 1of3. Once
the cash value of our basket reaches a point of our choosing, a cash trailing
stop kicks in. The idea is to catch more of the moves that are in our favour
than is possible with our standard basket take profit. We can use this to lock
in profit whilst hoping to reach a much larger basket TP. There are both cash
and pips trails available.
• Inputs for the cash TS are:
◦ UseBasketTrailingStopCash: turns this feature on/off. Note that it is
disabled by default.
◦ BasketTrailingStopStartValueCash: the basket profit at which the
TS kicks in. The default is based on a 0.01 lot size on a Global Prime
account.
◦ BasketTrailingStopGapValueCash: the distance between the stop
loss and the basket profit. The default is based on a 0.01 lot size on a
Global Prime account.
If using using BasketTrailingStopCash , and a value for BasketTrailingStopStartValueCash is inputted, I take it that BasketTargetCash should remain at 0.0?

Sam
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.

Slopey Peaky Bob

Post by SteveHopwood »

MurphyMan » Mon Jun 25, 2018 8:18 pm wrote:From the user's guide:
▪ Basket Trailing Stop: this feature was added by SHF member 1of3. Once
the cash value of our basket reaches a point of our choosing, a cash trailing
stop kicks in. The idea is to catch more of the moves that are in our favour
than is possible with our standard basket take profit. We can use this to lock
in profit whilst hoping to reach a much larger basket TP. There are both cash
and pips trails available.
• Inputs for the cash TS are:
◦ UseBasketTrailingStopCash: turns this feature on/off. Note that it is
disabled by default.
◦ BasketTrailingStopStartValueCash: the basket profit at which the
TS kicks in. The default is based on a 0.01 lot size on a Global Prime
account.
◦ BasketTrailingStopGapValueCash: the distance between the stop
loss and the basket profit. The default is based on a 0.01 lot size on a
Global Prime account.
If using using BasketTrailingStopCash , and a value for BasketTrailingStopStartValueCash is inputted, I take it that BasketTargetCash should remain at 0.0?

Sam
Nope Sam. You can have both and lock in profits on your way to a massive basket target.

:xm: :rocket:
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
MurphyMan
Trader
Posts: 345
Joined: Tue Nov 15, 2011 2:35 pm
Location: Southern Illinois, USA

Slopey Peaky Bob

Post by MurphyMan »

SteveHopwood » Mon Jun 25, 2018 2:34 pm wrote:
MurphyMan » Mon Jun 25, 2018 8:18 pm wrote:From the user's guide:
▪ Basket Trailing Stop: this feature was added by SHF member 1of3. Once
~snip~
If using using BasketTrailingStopCash , and a value for BasketTrailingStopStartValueCash is inputted, I take it that BasketTargetCash should remain at 0.0?

Sam
Nope Sam. You can have both and lock in profits on your way to a massive basket target.

:xm: :rocket:
Thanks Steve, and I'm well on my way. Two months into a live account, as of today I'm up 35%!

:yahoo:
Post Reply

Return to “Super Slope EA's”