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

Holy Graily Bob 'n Thomas multi-pair and dashboard EA
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=5395
Page 12 of 12
Author:  SteveHopwood [ Mon Jun 04, 2018 4:13 pm ]
Post subject:  Holy Graily Bob 'n Thomas multi-pair and dashboard EA

V 1i is in post 1, with the fix for the missing function call thingy.

To DIY: do a search for "void ShutDownForTheWeekend(" (clear the 'Match whole word only' box).
Delete the function and replace it with this:

Code: Select all

void ShutDownForTheWeekend()
{

   //Close/delete all trades to be flat for the weekend.
   
   int day = TimeDayOfWeek(TimeLocal() );
   int hour = TimeHour(TimeLocal() );
   bool CloseDelete = false;
   
   //Friday
   if (day == 5)
   {
      if (hour >= FridayCloseAllHour)
         if (TotalCashUpl > MaxAllowableCashLoss)//MaxAllowableCashLoss is a negative number
            CloseDelete = true;
   }//if (day == 5)
 
   //Saturday
   if (day == 6)
   {
      if (hour >= SaturdayCloseAllHour)
         if (TotalCashUpl > MaxAllowableCashLoss)//MaxAllowableCashLoss is a negative number
            CloseDelete = true;
   }//if (day == 6)
   
   if (CloseDelete)
   {
      CloseAllTrades(AllSymbols, AllTrades);
      if (ForceTradeClosure)
         CloseAllTrades(AllSymbols, AllTrades);
      if (ForceTradeClosure)
         CloseAllTrades(AllSymbols, AllTrades);
      if (!ForceTradeClosure)//Closure has succeeded
         TotalOpenTrades = 0;   
   }//if (CloseDelete)
      

}//End void ShutDownForTheWeekend()
Do a search for "//Have we finished trading for the week" and copy this over the top of the existing code:

Code: Select all

   //Have we finished trading for the week
   if (TotalOpenTrades > 0)
   {
      DoneForTheWeek = false;
      ShutDownForTheWeekend();
   }//if (TotalOpenTrades > 0)
   
:xm: :rocket:
All times are UTC Page 12 of 12