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

Nanningbob 10.2 auto-trading EA
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=552
Page 21 of 54
Author:  quanttraderjoe [ Wed May 23, 2012 3:02 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

hello Steve,

i've tried version 1n, its great cos the stoploss works well..i put 75 in the stoploss field n it works very well..but there's a problem, i had a short eur/usd trade that went to 100pips profit cos it hit the tp of the weekly support...after that...no more short eur/usd trades even though the conditions were met.. so missed out on the continued downward moves.

do i have to set "every tick mode" to true?

also for version 1t, i put the stoploss of 75 pips..but the ea uses a 7.5pip stop...i tried using 750pips..n same thing..the ea still uses a 7.5pip stop. very weird.

appreciate your help as always. thanks.
Author:  phil_trade [ Wed May 23, 2012 6:04 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

Steve

The last version has always the bug I mentionned in this post :


I just saw you took the wrong code just before I edit my post for StopLevel SL/TP calculation

it's Bid-take <= Stoplevel*Point) and NOT Bid-take <= Stoplevel/Point)

4 times in calculate SL BUY/SELL and Calculate TP Buy/Sell.


Philippe
Author:  spotdespot [ Wed May 23, 2012 8:15 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

There seems to be an issue with the partial close function somewhere (I am pretty sure this wasn't there prior to version 1s).

My orders are for 0.03 lots, close_lots 0.01, preserve_lots 0.01. It seems to close 2 parts of the order very quickly and even at a loss, then can't adjust the SL and continually modifies it between 2 values - see below.

I will take a look at the code in the morning (UK time) and hopefully work out what is going on! :?
partial close.JPG
order modify.JPG
EDIT - it may be that Philippe has just posted the answer above whilst I was writing this - looking at the timing I just didn't refresh. :oops:
Author:  phil_trade [ Wed May 23, 2012 8:20 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

spotdespot wrote:There seems to be an issue with the partial close function somewhere (I am pretty sure this wasn't there prior to version 1s).

My orders are for 0.03 lots, close_lots 0.01, preserve_lots 0.01. It seems to close 2 parts of the order very quickly and even at a loss, then can't adjust the SL and continually modifies it between 2 values - see below.

I will take a look at the code in the morning (UK time) and hopefully work out what is going on! :?
partial close.JPG
order modify.JPG
EDIT - it may be that Philippe has just posted the answer above whilst I was writing this!!
No it's due to prior Steve's modification on JumpingStopLoss()

Steve I have to restore line code for BUY -> if (sl < OrderOpenPrice() ) return;//Not at breakeven yet
and for SELL -> if (sl > OrderOpenPrice() ) return;//Not at breakeven yet

and this line is quite enigmatic for me - Always return 0 no ?

Code: Select all

if (sl == 0) sl = MathMin(sl, OrderOpenPrice());//No hidden stop loss line
Author:  jjasper7 [ Wed May 23, 2012 8:30 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

can anyone suggest what to look at for a solution to the problem that my platform has only opened 'WPC range trades'? (no trend trades for 5 days running on several charts.)
Author:  spotdespot [ Wed May 23, 2012 8:33 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

Thanks Philippe.
Author:  John [ Wed May 23, 2012 9:29 pm ]
Post subject:  Re: 10.2; the auto-trading EA is born.

FYI, I exerienced the same issue with the partial close... I only noticed because I saw a "half trade" floating in the negative which is impossible if I understand the partial close feature correctly... i.e., you would only ever have your full position size floating in the negative, not a partial one...
Author:  phil_trade [ Thu May 24, 2012 7:36 am ]
Post subject:  Re: 10.2; the auto-trading EA is born.

jjasper7 wrote:can anyone suggest what to look at for a solution to the problem that my platform has only opened 'WPC range trades'? (no trend trades for 5 days running on several charts.)
Hi

It's a bug in the latest version : Steve I think the code should be this

Code: Select all

bool LookForLongTrend(int tf)
{
   /*
   Returns true if Slope and Woh trend are up, else returns false
   - Slope must be >= 0.4
   - Woh must be green   
   */
   
   if (tf == PERIOD_D1)
   {
      if (D1SlopeVal < 0.4) return(false);
      if (D1WohVal <= 0) return(false);
      if (WeeklyDirection != up) return(false);
   }//if (tf = PERIOD_D1)

   if (tf == LowerTimeFrame)
   {
      if (LtfSlopeVal < 0.4) return(false);
      if (LtfWohVal <= 0) return(false);
      if (WeeklyDirection != up) return(false);
   }//if (tf = LowerTimeFrame)
   
   
   //Got this far without returning false, so must be in trend
   return(true);

}//End bool LookForLongTrend(int tf)


bool LookForShortTrend(int tf)
{
   /*
   Returns true if D1 Slope and Woh trend are down, else returns false
   - Slope must be <= -0.4
   - Woh must be red   
   */
   
   if (tf == PERIOD_D1)
   {
      if (D1SlopeVal > -0.4) return(false);
      if (D1WohVal >= 0) return(false);
      if (WeeklyDirection != down) return(false);
   }//if (tf = PERIOD_D1)
   
   if (tf == LowerTimeFrame)
   {
      if (LtfSlopeVal > -0.4) return(false);
      if (LtfWohVal >= 0) return(false);
      if (WeeklyDirection != down) return(false);
   }//if (tf == LowerTimeFrame)
   
   
   //Got this far without returning false, so must be in trend
   return(true);

}//End bool LookForShortTrend(int tf)

instead of this

Code: Select all

bool LookForLongTrend(int tf)
{
   /*
   Returns true if Slope and Woh trend are up, else returns false
   - Slope must be >= 0.4
   - Woh must be green   
   */
   
   if (tf == PERIOD_D1)
   {
      if (D1SlopeVal < 0.4) return(false);
      if (D1WohVal <= 0) return(false);
      if (WeeklyDirection <= up) return(false);
   }//if (tf = PERIOD_D1)

   if (tf == LowerTimeFrame)
   {
      if (LtfSlopeVal < 0.4) return(false);
      if (LtfWohVal <= 0) return(false);
      if (WeeklyDirection <= up) return(false);
   }//if (tf = LowerTimeFrame)
   
   
   //Got this far without returning false, so must be in trend
   return(true);

}//End bool LookForLongTrend(int tf)


bool LookForShortTrend(int tf)
{
   /*
   Returns true if D1 Slope and Woh trend are down, else returns false
   - Slope must be <= -0.4
   - Woh must be red   
   */
   
   if (tf == PERIOD_D1)
   {
      if (D1SlopeVal > -0.4) return(false);
      if (D1WohVal >= 0) return(false);
      if (WeeklyDirection <= down) return(false);
   }//if (tf = PERIOD_D1)
   
   if (tf == LowerTimeFrame)
   {
      if (LtfSlopeVal > -0.4) return(false);
      if (LtfWohVal >= 0) return(false);
      if (WeeklyDirection <= down) return(false);
   }//if (tf == LowerTimeFrame)
   
   
   //Got this far without returning false, so must be in trend
   return(true);

}//End bool LookForShortTrend(int tf)
It's OK now for me.
Author:  mackaozy [ Thu May 24, 2012 8:12 am ]
Post subject:  Re: 10.2; the auto-trading EA is born.

phil_trade wrote:
jjasper7 wrote:can anyone suggest what to look at for a solution to the problem that my platform has only opened 'WPC range trades'? (no trend trades for 5 days running on several charts.)
Hi

It's a bug in the latest version : Steve I think the code should be this

Code: Select all

bool LookForLongTrend(int tf)
{
   /*
   Returns true if Slope and Woh trend are up, else returns false
   - Slope must be >= 0.4
   - Woh must be green   
   */
   
   if (tf == PERIOD_D1)
   {
      if (D1SlopeVal < 0.4) return(false);
      if (D1WohVal <= 0) return(false);
      if (WeeklyDirection != up) return(false);
   }//if (tf = PERIOD_D1)

   if (tf == LowerTimeFrame)
   {
      if (LtfSlopeVal < 0.4) return(false);
      if (LtfWohVal <= 0) return(false);
      if (WeeklyDirection != up) return(false);
   }//if (tf = LowerTimeFrame)
   
   
   //Got this far without returning false, so must be in trend
   return(true);

}//End bool LookForLongTrend(int tf)


bool LookForShortTrend(int tf)
{
   /*
   Returns true if D1 Slope and Woh trend are down, else returns false
   - Slope must be <= -0.4
   - Woh must be red   
   */
   
   if (tf == PERIOD_D1)
   {
      if (D1SlopeVal > -0.4) return(false);
      if (D1WohVal >= 0) return(false);
      if (WeeklyDirection != down) return(false);
   }//if (tf = PERIOD_D1)
   
   if (tf == LowerTimeFrame)
   {
      if (LtfSlopeVal > -0.4) return(false);
      if (LtfWohVal >= 0) return(false);
      if (WeeklyDirection != down) return(false);
   }//if (tf == LowerTimeFrame)
   
   
   //Got this far without returning false, so must be in trend
   return(true);

}//End bool LookForShortTrend(int tf)

instead of this

Code: Select all

bool LookForLongTrend(int tf)
{
   /*
   Returns true if Slope and Woh trend are up, else returns false
   - Slope must be >= 0.4
   - Woh must be green   
   */
   
   if (tf == PERIOD_D1)
   {
      if (D1SlopeVal < 0.4) return(false);
      if (D1WohVal <= 0) return(false);
      if (WeeklyDirection <= up) return(false);
   }//if (tf = PERIOD_D1)

   if (tf == LowerTimeFrame)
   {
      if (LtfSlopeVal < 0.4) return(false);
      if (LtfWohVal <= 0) return(false);
      if (WeeklyDirection <= up) return(false);
   }//if (tf = LowerTimeFrame)
   
   
   //Got this far without returning false, so must be in trend
   return(true);

}//End bool LookForLongTrend(int tf)


bool LookForShortTrend(int tf)
{
   /*
   Returns true if D1 Slope and Woh trend are down, else returns false
   - Slope must be <= -0.4
   - Woh must be red   
   */
   
   if (tf == PERIOD_D1)
   {
      if (D1SlopeVal > -0.4) return(false);
      if (D1WohVal >= 0) return(false);
      if (WeeklyDirection <= down) return(false);
   }//if (tf = PERIOD_D1)
   
   if (tf == LowerTimeFrame)
   {
      if (LtfSlopeVal > -0.4) return(false);
      if (LtfWohVal >= 0) return(false);
      if (WeeklyDirection <= down) return(false);
   }//if (tf == LowerTimeFrame)
   
   
   //Got this far without returning false, so must be in trend
   return(true);

}//End bool LookForShortTrend(int tf)
It's OK now for me.
Hi Phil

Any chance you could please post with the fix?

Cheers

Steve :)
Author:  phil_trade [ Thu May 24, 2012 8:20 am ]
Post subject:  Re: 10.2; the auto-trading EA is born.

mackaozy wrote:
phil_trade wrote:
jjasper7 wrote:can anyone suggest what to look at for a solution to the problem that my platform has only opened 'WPC range trades'? (no trend trades for 5 days running on several charts.)
Hi

It's a bug in the latest version : Steve I think the code should be this

Code: Select all

bool LookForLongTrend(int tf)
{
   /*
   Returns true if Slope and Woh trend are up, else returns false
   - Slope must be >= 0.4
   - Woh must be green   
   */
   
   if (tf == PERIOD_D1)
   {
      if (D1SlopeVal < 0.4) return(false);
      if (D1WohVal <= 0) return(false);
      if (WeeklyDirection != up) return(false);
   }//if (tf = PERIOD_D1)

   if (tf == LowerTimeFrame)
   {
      if (LtfSlopeVal < 0.4) return(false);
      if (LtfWohVal <= 0) return(false);
      if (WeeklyDirection != up) return(false);
   }//if (tf = LowerTimeFrame)
   
   
   //Got this far without returning false, so must be in trend
   return(true);

}//End bool LookForLongTrend(int tf)


bool LookForShortTrend(int tf)
{
   /*
   Returns true if D1 Slope and Woh trend are down, else returns false
   - Slope must be <= -0.4
   - Woh must be red   
   */
   
   if (tf == PERIOD_D1)
   {
      if (D1SlopeVal > -0.4) return(false);
      if (D1WohVal >= 0) return(false);
      if (WeeklyDirection != down) return(false);
   }//if (tf = PERIOD_D1)
   
   if (tf == LowerTimeFrame)
   {
      if (LtfSlopeVal > -0.4) return(false);
      if (LtfWohVal >= 0) return(false);
      if (WeeklyDirection != down) return(false);
   }//if (tf == LowerTimeFrame)
   
   
   //Got this far without returning false, so must be in trend
   return(true);

}//End bool LookForShortTrend(int tf)

instead of this

Code: Select all

bool LookForLongTrend(int tf)
{
   /*
   Returns true if Slope and Woh trend are up, else returns false
   - Slope must be >= 0.4
   - Woh must be green   
   */
   
   if (tf == PERIOD_D1)
   {
      if (D1SlopeVal < 0.4) return(false);
      if (D1WohVal <= 0) return(false);
      if (WeeklyDirection <= up) return(false);
   }//if (tf = PERIOD_D1)

   if (tf == LowerTimeFrame)
   {
      if (LtfSlopeVal < 0.4) return(false);
      if (LtfWohVal <= 0) return(false);
      if (WeeklyDirection <= up) return(false);
   }//if (tf = LowerTimeFrame)
   
   
   //Got this far without returning false, so must be in trend
   return(true);

}//End bool LookForLongTrend(int tf)


bool LookForShortTrend(int tf)
{
   /*
   Returns true if D1 Slope and Woh trend are down, else returns false
   - Slope must be <= -0.4
   - Woh must be red   
   */
   
   if (tf == PERIOD_D1)
   {
      if (D1SlopeVal > -0.4) return(false);
      if (D1WohVal >= 0) return(false);
      if (WeeklyDirection <= down) return(false);
   }//if (tf = PERIOD_D1)
   
   if (tf == LowerTimeFrame)
   {
      if (LtfSlopeVal > -0.4) return(false);
      if (LtfWohVal >= 0) return(false);
      if (WeeklyDirection <= down) return(false);
   }//if (tf == LowerTimeFrame)
   
   
   //Got this far without returning false, so must be in trend
   return(true);

}//End bool LookForShortTrend(int tf)
It's OK now for me.
Hi Phil

Any chance you could please post with the fix?

Cheers

Steve :)
Hmmm...It's up to steve to do that ! It's his home here :D

but you can Cut and paste the code and compile it !
All times are UTC Page 21 of 54