Bob and Shelley Again

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

Re: Bob and Shelley Again

Post by SteveHopwood »

V 1j in post 1.I have changed the MA stacking filter in light of Andy's advice. There is an individual inputs section for MA stacking.

:D
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.
MrLong

Re: Bob and Shelley Again

Post by MrLong »

SteveHopwood wrote:V 1j in post 1.I have changed the MA stacking filter in light of Andy's advice. There is an individual inputs section for MA stacking.

:D
Hi Steve,

I use the PRICE_CLOSE, the EA would have just missed the NZDUSD trade with PRICE_OPEN.

if (useMaStack && (!detectMaStack(CurrentPair, PERIOD_H4, 21, 55, 0, MODE_EMA, PRICE_CLOSE, OP_BUY, 0)))

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

Re: Bob and Shelley Again

Post by SteveHopwood »

MrLong wrote:
SteveHopwood wrote:V 1j in post 1.I have changed the MA stacking filter in light of Andy's advice. There is an individual inputs section for MA stacking.

:D
Hi Steve,

I use the PRICE_CLOSE, the EA would have just missed the NZDUSD trade with PRICE_OPEN.

if (useMaStack && (!detectMaStack(CurrentPair, PERIOD_H4, 21, 55, 0, MODE_EMA, PRICE_CLOSE, OP_BUY, 0)))

Andy
Cheers Andy.

I have made the change folks and uploaded to post 1 - have not changed the version no.

Those of you who know how; find the two lines of code that begin:

Code: Select all

if (detectMaStack(Symbol(), PERIOD_H4, FastStackMaPeriod
and change PRiCE_OPEN to PRICE_CLOSE and recompile.

:D
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
fxdaytrader
Trader
Posts: 190
Joined: Sun Jun 10, 2012 7:03 am
Location: Poon-Town (germany, se-asia, se-europe) ...

Re: Bob and Shelley Again

Post by fxdaytrader »

MrLong wrote:
SteveHopwood wrote:Andy, why do you use the 21 EMA and 55 EMA for MA stack confirmation?
Fibonacci numbers, I've always used them, drop a 55 or 21 on a chart and most pairs respect them.
It is also that e.g. on

H4:
The EMA 55 value is ~equal to the ema 200 on H1
The EMA 21 value is ~equal to the ema 200 on M30

H1:
The EMA 55 value is ~equal to the ema 200 on M15
The EMA 21 value is ~equal to the ema 200 on M5

:)
User avatar
fxdaytrader
Trader
Posts: 190
Joined: Sun Jun 10, 2012 7:03 am
Location: Poon-Town (germany, se-asia, se-europe) ...

Re: Bob and Shelley Again

Post by fxdaytrader »

Could be a bloop?

Code: Select all

         //MA stacking check. Thanks to Andy (Mr Long) for this code
         if (SendShort)
         {
            if (useMaStack && (!detectMaStack(Symbol(), PERIOD_H4, FastMaTdPeriod, SlowMaTdPeriod, 0, MODE_LWMA, PRICE_OPEN, OP_SELL, 0))) return;
         }//if (SendShort)
and

Code: Select all

//MA stacking check. Thanks to Andy (Mr Long) for this code
      if (SendLong)
      {
         if (useMaStack && (!detectMaStack(Symbol(), PERIOD_H4, FastMaTdPeriod, SlowMaTdPeriod, 0, MODE_LWMA, PRICE_OPEN, OP_BUY, 0))) return;
      }//if (SendLong)
Instead of FastMaTdPeriod, SlowMaTdPeriod it should be
FastStackMaPeriod, SlowStackMaPeriod or not? :)
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.

Re: Bob and Shelley Again

Post by SteveHopwood »

fxdaytrader wrote:Could be a bloop?

Instead of FastMaTdPeriod, SlowMaTdPeriod it should be
FastStackMaPeriod, SlowStackMaPeriod or not? :)
Fabulous spot. Thanks. This is a last gasp just-in-case check, so the bloop completely negated MA stacking.

Fixed in V 1k in post 1.

Guys, discovering that I had negated MA stacking sent me to my demo to study the open trades. Correctly coded MA stacking would have kept me out of most of the losers. Not all of them, but most so this looks like an invaluable filter.

Then I noticed stack trades that should have been taken but were not, so I found a couple of bloops in the troublesome trade stacking code that were stopping the trades.

So, if you want to use MA stacking and demo trade stacking, then the download is essential.

:D
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.
ffxbettor
Trader
Posts: 12
Joined: Thu Feb 02, 2012 12:08 pm
Location: France

Re: Bob and Shelley Again

Post by ffxbettor »

Potential bloop :

At the end of the function detectMaStack(), dont forget to add this instruction : return (false);

Before :

Code: Select all

bool detectMaStack(string symbol, int timeframe, int period, int period1, int mashift, int method, int applied, int type, int shift)
{
   if (type == OP_BUY)
   {
    .... blabla
    return(true);
   }

   if (type == OP_SELL)
   {
    .... blabla
    return(true);
   }
   
}//End detectMaStack
After :

Code: Select all

bool detectMaStack(string symbol, int timeframe, int period, int period1, int mashift, int method, int applied, int type, int shift)
{
   if (type == OP_BUY)
   {
    .... blabla
    return(true);
   }

   if (type == OP_SELL)
   {
    .... blabla
    return(true);
   }

   return (false); // <---

}//End detectMaStack

Not sure if it's required, but better to add this small line of code, just to be sure !

Cheers,
Didier
MrLong

Re: Bob and Shelley Again

Post by MrLong »

ffxbettor wrote:Potential bloop :

At the end of the function detectMaStack(), dont forget to add this instruction : return (false);

Before :

Code: Select all

bool detectMaStack(string symbol, int timeframe, int period, int period1, int mashift, int method, int applied, int type, int shift)
{
   if (type == OP_BUY)
   {
    .... blabla
    return(true);
   }

   if (type == OP_SELL)
   {
    .... blabla
    return(true);
   }
   
}//End detectMaStack
After :

Code: Select all

bool detectMaStack(string symbol, int timeframe, int period, int period1, int mashift, int method, int applied, int type, int shift)
{
   if (type == OP_BUY)
   {
    .... blabla
    return(true);
   }

   if (type == OP_SELL)
   {
    .... blabla
    return(true);
   }

   return (false); // <---

}//End detectMaStack

Not sure if it's required, but better to add this small line of code, just to be sure !

Cheers,
Didier
default is false.
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.

Re: Bob and Shelley Again

Post by SteveHopwood »

ffxbettor wrote: Not sure if it's required, but better to add this small line of code, just to be sure !

Cheers,
Didier
Theoretically, it does not matter because a CrapQl4 Boolean function will return(false) if not explicitly coded told to return(true). All of us coders know who unreliable implicit values are in CrapQl4 and everything should be done explicitly.

So, I have added the line of code to the function. I have not issued another update yet; I shall do that over the weekend when I have added the ATR stop loss function that Shelley wants.

Also, the 50% stop loss is back - 50 instead of 100 pips. I made an incorrect change to the calculation function (wrong conditional), so those of you who can, copy this over the top of the existing function and recompile:

Code: Select all

double CalculateStopLoss(int type, double price)
{
   //Returns the stop loss for use in LookForTradingOpps and InsertMissingStopLoss
   double stop;

   RefreshRates();
   
   if (type == OP_BUY)
   {
      if (!CloseEnough(StopLoss, 0) ) 
      {
         if (OpenTrades == 0) stop = price - (StopLoss / factor);
         else 
         {
            stop = price - ((StopLoss / 2) / factor);
         }//else 
         
         HiddenStopLoss = stop;
      }//if (!CloseEnough(StopLoss, 0) ) 

      if (HiddenPips > 0 && stop > 0) stop = NormalizeDouble(stop - (HiddenPips / factor), Digits);
   }//if (type == OP_BUY)
   
   if (type == OP_SELL)
   {
      if (!CloseEnough(StopLoss, 0) ) 
      {
         if (OpenTrades == 0) stop = price + (StopLoss / factor);
         else 
         {
            stop = price + ((StopLoss / 2) / factor);
         }//else 
         
         HiddenStopLoss = stop;         
      }//if (!CloseEnough(StopLoss, 0) ) 
      
      if (HiddenPips > 0 && stop > 0) stop = NormalizeDouble(stop + (HiddenPips / factor), Digits);

   }//if (type == OP_SELL)
   
   return(stop);
   
}//End double CalculateStopLoss(int type)
:D
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
fxozgirl
Trader
Posts: 1176
Joined: Wed Nov 16, 2011 9:16 am
Location: Melbourne, Australia

Re: Bob and Shelley Again

Post by fxozgirl »

Stacking trades is working...3 stack trades were taken on Friday
basawithstacking_130809.png
You do not have the required permissions to view the files attached to this post.
Locked

Return to “Automated trading systems”