Best Bob

Post your 10.7 EA's here
Post Reply
phil_trade

Best Bob

Post by phil_trade »

Steve

"Most people go ootb and the magics are different by default" -> Between Trade and CT trade but are equal for each SYMBOL !

More, the last bug I found in BOB EA in Close Procedure was a bad Ticket Number / Symbol association that was corrected by adding an OrderSelect().
phil_trade

Best Bob

Post by phil_trade »

Hi Steve

In LookForTradeClosure routine the test if (CloseEnough(DailyStochMain, 0)) in the same for SELL and BUY trades ?

is this abug as for sell it should be if (CloseEnough(DailyStochMain, 100)) ?

Code: Select all

   if (OrderType() == OP_SELL)
   {
   
      if (UseDailyStochForExit==true)
      {
          
         //Reset FirstFlipTime if the yellow is the corrrect value
         if (!CloseEnough(DailyStochMain, 0))
            FirstFlipTime = 0;
            
         //Take the time the line flips
         if (CloseEnough(DailyStochMain, 0))
            if (FirstFlipTime == 0)
               FirstFlipTime = TimeCurrent();
   
         //Is it time to close the trade?
         if (CloseEnough(DailyStochMain, 0))
            if (FirstFlipTime > 0)
               if (TimeCurrent() - FirstFlipTime >= (MinutesToConfirmYellowFlip) )
               {
                  CloseThisTrade = true;
                  reason = StringConcatenate(Symbol() + " Yellow flip. Closing ticket no " + OrderTicket() + " Blue = " + DoubleToStr(dStochMain[0], 2) + " Yellow = " 
                           + DoubleToStr(DailyStochMain, 0) + " Red = " + DoubleToStr(WeeklyStochMain, 0));
               }//if (TimeCurrent() - FirstFlipTime >= (MinutesToConfirmYellowFlip ) )
            

        
          /*if (NewBar(PERIOD_M5))
phil_trade

Best Bob

Post by phil_trade »

With BreakEven allowed I have bug alert : Invalid Stop Loss cause GBPJPY wants to Move SL of EUCAD trade ....

just stop this with :

but it seems there's a mess in Symbol and/or Trade management :

Code: Select all

void BreakEvenStopLoss() // Move stop loss to breakeven
{

if (OrderSymbol() != Symbol()) return;
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.

Best Bob

Post by SteveHopwood »

phil_trade » Thu May 08, 2014 8:53 am wrote:Hi Steve

In LookForTradeClosure routine the test if (CloseEnough(DailyStochMain, 0)) in the same for SELL and BUY trades ?

is this abug as for sell it should be if (CloseEnough(DailyStochMain, 100)) ?

Code: Select all

   if (OrderType() == OP_SELL)
   {
   
      if (UseDailyStochForExit==true)
      {
          
         //Reset FirstFlipTime if the yellow is the corrrect value
         if (!CloseEnough(DailyStochMain, 0))
            FirstFlipTime = 0;
            
         //Take the time the line flips
         if (CloseEnough(DailyStochMain, 0))
            if (FirstFlipTime == 0)
               FirstFlipTime = TimeCurrent();
   
         //Is it time to close the trade?
         if (CloseEnough(DailyStochMain, 0))
            if (FirstFlipTime > 0)
               if (TimeCurrent() - FirstFlipTime >= (MinutesToConfirmYellowFlip) )
               {
                  CloseThisTrade = true;
                  reason = StringConcatenate(Symbol() + " Yellow flip. Closing ticket no " + OrderTicket() + " Blue = " + DoubleToStr(dStochMain[0], 2) + " Yellow = " 
                           + DoubleToStr(DailyStochMain, 0) + " Red = " + DoubleToStr(WeeklyStochMain, 0));
               }//if (TimeCurrent() - FirstFlipTime >= (MinutesToConfirmYellowFlip ) )
            

        
          /*if (NewBar(PERIOD_M5))
You are dead right here :clap: and it explains both why rapple's picture was showing the wrong yellow line values and why I could not find the fault. The code in post 1 here is not the code I was reading, which does have the correct value of 100.

Not even a hint of a clue how that happened folks, but somehow I managed to upload a faulty version. V 1b is in post 1 with the fix. CT trading turned back on by default, so let's see if the trades open and close properly now.

: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.
phil_trade

Best Bob

Post by phil_trade »

phil_trade » Today, 11:47 wrote:With BreakEven allowed I have bug alert : Invalid Stop Loss cause GBPJPY wants to Move SL of EUCAD trade ....

just stop this with :

but it seems there's a mess in Symbol and/or Trade management :

Code: Select all

void BreakEvenStopLoss() // Move stop loss to breakeven
{

if (OrderSymbol() != Symbol()) return;
Steve

I think I have found the problem with this example above. The problem occur when a new GBPJPY trade was generated. the Chart GBPJPY try to modify an EURCAD trade and calculate a wrong SL value.
I guess that the problem come that BOB EA is a single Symbol EA and we run it on multiple charts. When one chart is in CountOpenTrades() module, and another chart add or close a trade, then the loop

Code: Select all

for (int cc = OrdersTotal() - 1; cc >= 0; cc--)
is disturbed
and this problem could occur for all loops like this one !
User avatar
SpiderX
Trader
Posts: 554
Joined: Thu Aug 22, 2013 4:50 pm

Best Bob

Post by SpiderX »

phil_trade » Thu May 08, 2014 7:54 pm wrote:
Steve

I think I have found the problem with this example above. The problem occur when a new GBPJPY trade was generated. the Chart GBPJPY try to modify an EURCAD trade and calculate a wrong SL value.
I guess that the problem come that BOB EA is a single Symbol EA and we run it on multiple charts. When one chart is in CountOpenTrades() module, and another chart add or close a trade, then the loop

Code: Select all

for (int cc = OrdersTotal() - 1; cc >= 0; cc--)
is disturbed
and this problem could occur for all loops like this one !
Hi phil,

Wow...cant believe you caught this.
Wonder what are the chances for this to happen.

Cheers
"Love is patient, love is kind. It does not envy, it does not boast, it is not proud. It does not dishonor others, it is not self-seeking, it is not easily angered, it keeps no record of wrongs.Love does not delight in evil but rejoices with the truth. It always protects, always trusts, always hopes, always perseveres."
-Corinthians 13:4-8
phil_trade

Best Bob

Post by phil_trade »

SpiderX » 8 minutes ago wrote:
phil_trade » Thu May 08, 2014 7:54 pm wrote:
Steve

I think I have found the problem with this example above. The problem occur when a new GBPJPY trade was generated. the Chart GBPJPY try to modify an EURCAD trade and calculate a wrong SL value.
I guess that the problem come that BOB EA is a single Symbol EA and we run it on multiple charts. When one chart is in CountOpenTrades() module, and another chart add or close a trade, then the loop

Code: Select all

for (int cc = OrdersTotal() - 1; cc >= 0; cc--)
is disturbed
and this problem could occur for all loops like this one !
Hi phil,

Wow...cant believe you caught this.
Wonder what are the chances for this to happen.

Cheers
it's happen to me this afternoon... error message just fire after the second a new trade on GBPJPY... there are 25 charts running... so a lot of possibilities to crunch.

Need to code to filter better Symbol().

I have to add this

Code: Select all

if (OrderSymbol() != Symbol()) return;
at the beginning of a lot of module to stop bugs
User avatar
SpiderX
Trader
Posts: 554
Joined: Thu Aug 22, 2013 4:50 pm

Best Bob

Post by SpiderX »

The below can be a possible fix, though i can already imagine how it might fail...if you got multiple orders opening and closing at the same time.
Not perfect, but guess....it could work ?

Cheers

Code: Select all

int InitialOrdersTotal = OrdersTotal();
for (int cc = InitialOrdersTotal - 1; cc >= 0; cc--)
{
     if(OrdersTotal()!= InitialOrdersTotal)
     {
         InitialOrdersTotal = OrdersTotal();
         cc= InitialOrdersTotal -1;
         continue;
     }

     ..............
}
"Love is patient, love is kind. It does not envy, it does not boast, it is not proud. It does not dishonor others, it is not self-seeking, it is not easily angered, it keeps no record of wrongs.Love does not delight in evil but rejoices with the truth. It always protects, always trusts, always hopes, always perseveres."
-Corinthians 13:4-8
phil_trade

Best Bob

Post by phil_trade »

SpiderX » 1 minute ago wrote:The below can be a possible fix, though i can already imagine how it might fail...if you got multiple orders opening and closing at the same time.
Not perfect, but guess....it could work ?

Cheers

Code: Select all

int InitialOrdersTotal = OrdersTotal();
for (int cc = InitialOrdersTotal - 1; cc >= 0; cc--)
{
     if(OrdersTotal()!= InitialOrdersTotal)
     {
         InitialOrdersTotal = OrdersTotal();
         cc= InitialOrdersTotal -1;
         continue;
     }

     ..............
}
I will test that. for now I have to add this

Code: Select all

if (OrderSymbol() != Symbol()) return;
at the beginning of a lot of module to stop bugs
phil_trade

Best Bob

Post by phil_trade »

phil_trade » 15 minutes ago wrote:
SpiderX » 1 minute ago wrote:The below can be a possible fix, though i can already imagine how it might fail...if you got multiple orders opening and closing at the same time.
Not perfect, but guess....it could work ?

Cheers

Code: Select all

int InitialOrdersTotal = OrdersTotal();
for (int cc = InitialOrdersTotal - 1; cc >= 0; cc--)
{
     if(OrdersTotal()!= InitialOrdersTotal)
     {
         InitialOrdersTotal = OrdersTotal();
         cc= InitialOrdersTotal -1;
         continue;
     }

     ..............
}
May be it will be safer to EXIT the loop if if(OrdersTotal()!= InitialOrdersTotal) and wait next tick ? this should avoid all add/close trade interference ?
Post Reply

Return to “10.7 Auto Traders Forum”