Function that return true when the last 3 closed orders are loss continuously in a same day

 

Hi, 

I'm trying to figure out function that return true when the last 3 closed orders are loss continuously in a same day. Can anyone help me with this?

bool Check3Loss
{
        //if last 3 closed orders are loss continuously in a same day.
	{
		return(true);
	}


	return(false);
}

void OpenPos(string Trade, double Lots)
{
        if(Check3Loss() == false){
                //open new order
        }
}


example:

Before function filter

Closed Order:

03/12/2019 8am - profit

03/12/2019 10am - loss

03/12/2019 12pm - loss

03/12/2019 2pm - profit

04/12/2019 8am - loss

04/12/2019 10am - loss

04/12/2019 12pm - loss //no new order after this closed order for a day

04/12/2019 2pm - loss

04/12/2019 4pm - loss

04/12/2019 2pm - loss

05/12/2019 8am - profit



after function filter

Closed Order:

03/12/2019 8am - profit

03/12/2019 10am - loss

03/12/2019 12pm - loss

03/12/2019 2pm - profit

04/12/2019 8am - loss

04/12/2019 10am - loss

04/12/2019 12pm - loss

05/12/2019 8am - profit

 
I'll send Martingale function as described by Andrew Young in his book Expert Advisor programming for MT4. 
Look at code and write the Checkloss () function

double martingale()
   {
    int WinCount, LossCount;
    for (int Count = OrdersHistroyTotal()-1;;count--)
       {
        if(OrderSelect(Count, Select_By_Pos, MODE_HISTORY))
          if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)
            { 
             if (OrderProfit()>0 && LossCount == 0)
               WinCount++;
             
             else if (OrderProfit()<0 && WinCount ==0)
             LossCount++;
            }
            else break;
       }
       if (MartingaleType==0)
          int ConsecutiveCount = LossCount;
       else if (MartingaleType == 1) 
          ConsecutiveCount = WinCount;
       
       if(ConsecutiveCount>MaxMartingale)
          ConsecutiveCount=Max;
       
       double LotSize = BaseLotSize * MathPow(LotMultiplier,ConsecutiveCount);
       return (LotSize);
   }
//+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+