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

Peaky on Steroids
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=5204
Page 16 of 97
Author:  SteveHopwood [ Sun Jul 16, 2017 8:03 pm ]
Post subject:  Peaky on Steroids

trader689 » Sun Jul 16, 2017 5:11 pm wrote:hey Steve

do you have any open DD for those m1 PoS trades?

thanks, trader
Yes.

:xm:
Author:  SteveHopwood [ Tue Jul 18, 2017 9:11 am ]
Post subject:  Peaky on Steroids

There is a fault in the code that closes ALL trades on the platform regardless of their origin. This fault exists in both versions. Copy this over the top of void NuclearOption():

Code: Select all

void NuclearOption()
{

   ForceTradeClosure= false;
   
   if (OrdersTotal() == 0) return;
   
   //Put all the order tickets into an array for our friends in the US
   int Tickets[];
   int as = 0;
   for (int cc = OrdersTotal() - 1; cc >= 0; cc--)
   {
      if (!BetterOrderSelect(cc, SELECT_BY_POS, MODE_TRADES))
         continue;
         
      ArrayRange(Tickets, as + 1);
      Tickets[as] = OrderTicket();
      as++;
   }//for (int cc = OrdersTotal() - 1; cc >= 0; cc--)
   if (as == 0)
      return;//Just in case
      
   ArraySort(Tickets, WHOLE_ARRAY, 0, MODE_DESCEND);   
   
   bool result = false;
   for (int pass = 0; pass <= 1; pass++)
   {
      if (OrdersTotal() == 0 || OpenTrades == 0)
         break;

      for (int cc = ArraySize(Tickets) - 1; cc >= 0; cc--)
      {
         if (!BetterOrderSelect(Tickets[cc], SELECT_BY_TICKET, MODE_TRADES) ) continue;
            
         
         while(IsTradeContextBusy()) Sleep(100);
         if (OrderType() < 2)
         {
            result = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 1000, CLR_NONE);
            if (result) 
            {
               Tickets[cc] = -1;
               OpenTrades--;
            }//(result) 
            
            if (!result) ForceTradeClosure= true;
         }//if (OrderType() < 2)
         
         if (pass == 1)
            if (OrderType() > 1) 
            {
               result = OrderDelete(OrderTicket(), clrNONE);
               if (result) 
               {
                  Tickets[cc] = -1;
                  OpenTrades--;
               }//(result) 
               if (!result) ForceTradeClosure= true;
            }//if (OrderType() > 1) 
            
      }//for (int cc = ArraySize(Tickets) - 1; cc >= 0; cc--)
   }//for (int pass = 0; pass <= 1; pass++)

}//End void NuclearOption
:xm:
Author:  Gertje [ Tue Jul 18, 2017 2:12 pm ]
Post subject:  Peaky on Steroids

I started PoS last week on the 4 timeframes that were in the OOTB settings.
Just before the weekend, I saw the M5 and M15 gaining a lot, but also building huge DD so I decided to go forward with only the H1 and H4 timeframes.

Attached is the beaty of PoS showing, a week ago a trade on the H1 opened, and 2 recovery trades opened since.

Today the 3 trades closed with a healthy profit, and PoS opened the same trade again, let's see if price will act like it is supposed to.
GBPJPY H1.png
Author:  SteveHopwood [ Tue Jul 18, 2017 5:41 pm ]
Post subject:  Peaky on Steroids

The nuclear option code is still wrong and needs replacing with this:

Code: Select all

void NuclearOption()
{

   ForceTradeClosure= false;
   
   if (OrdersTotal() == 0) return;
   
   //Put all the order tickets into an array for our friends in the US
   int Tickets[];
   int as = 0;
   for (int cc = OrdersTotal() - 1; cc >= 0; cc--)
   {
      if (!BetterOrderSelect(cc, SELECT_BY_POS, MODE_TRADES))
         continue;
         
      ArrayResize(Tickets, as + 1);
      Tickets[as] = OrderTicket();
      as++;
   }//for (int cc = OrdersTotal() - 1; cc >= 0; cc--)
   if (as == 0)
      return;//Just in case
   ArraySort(Tickets, WHOLE_ARRAY, 0, MODE_DESCEND);   
   
   for (int cc = ArraySize(Tickets) - 1; cc >= 0; cc--)
   {
      if (!BetterOrderSelect(Tickets[cc], SELECT_BY_TICKET, MODE_TRADES) ) continue;
         
      while(IsTradeContextBusy()) Sleep(100);
      bool result = false;

      if (OrderType() < 2)
      {
         result = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 1000, CLR_NONE);
         if (result) 
         {
            Tickets[cc] = -1;
            OpenTrades--;
         }//(result) 
         
         if (!result) ForceTradeClosure= true;
      }//if (OrderType() < 2)
      
      if (OrderType() > 1) 
      {
         result = OrderDelete(OrderTicket(), clrNONE);
         if (result) 
         {
            Tickets[cc] = -1;
            OpenTrades--;
         }//(result) 
         if (!result) ForceTradeClosure= true;
      }//if (OrderType() > 1) 
      
   }//for (int cc = ArraySize(Tickets) - 1; cc >= 0; cc--)

}//End void NuclearOption
:xm:
Author:  SteveHopwood [ Tue Jul 18, 2017 8:26 pm ]
Post subject:  Peaky on Steroids

The power of a combo of patience and filling in the gaps when the market is being uncooperative:
AUDCADH1.png

:xm:
Author:  acostafulano [ Wed Jul 19, 2017 6:10 am ]
Post subject:  Peaky on Steroids

Hi Steve, just made the switch from v1j to v1j (Untested functions) and got a zero divide error.

I hope this doesn't get me grilled, But where should I look for this error? Looked around all the peaky subforums and didn't find any mention to this

Diego
Author:  Vokin [ Wed Jul 19, 2017 7:45 am ]
Post subject:  Peaky on Steroids

SteveHopwood » Tue Jul 18, 2017 6:41 pm wrote:The nuclear option code is still wrong and needs replacing with this:
:xm:
Ooops - still close ALL... :shock:
Author:  SteveHopwood [ Wed Jul 19, 2017 9:18 am ]
Post subject:  Peaky on Steroids

acostafulano » Wed Jul 19, 2017 6:10 am wrote:Hi Steve, just made the switch from v1j to v1j (Untested functions) and got a zero divide error.

I hope this doesn't get me grilled, But where should I look for this error? Looked around all the peaky subforums and didn't find any mention to this

Diego
This happens when one of the two variables in a division has a zero value. For example:
x = 10
y = 0
x / y will throw up the zero divide error.

Look in your platform's Experts tab. EA errors are clearly marked with a red circle and white dash in the middle - a 'No Entry' road sign here in the UK. This gives the line and character number of the error and will help me track it down. It has not happened on my platform, so I do not know where to look.

:xm:
Author:  acostafulano [ Wed Jul 19, 2017 5:59 pm ]
Post subject:  Peaky on Steroids

Hello Steve,

This is the error I got, and the setfile I got it with.
456 OOTB-SwapOFF-M1-M5-M15-H1-TPSixth-SL300.set
As noted before, this was running perfectly under v1j right before getting this error, and the setfile was the same settings just updated to the new parameters available in the untested version.

PoS Unt.PNG
Author:  SteveHopwood [ Wed Jul 19, 2017 7:27 pm ]
Post subject:  Peaky on Steroids

acostafulano » Wed Jul 19, 2017 5:59 pm wrote:Hello Steve,

This is the error I got, and the setfile I got it with.


As noted before, this was running perfectly under v1j right before getting this error, and the setfile was the same settings just updated to the new parameters available in the untested version.

Whom is your broker?

:xm:
All times are UTC Page 16 of 97