Suspend Trading within the EA for the rest of the day after 3 stop losses hit in a row

 

Hi,

I'm running 6-8 scalper EAs at once. Today there was a massacre when I went out to eat and by the time I got back the 3.2% daily gain was replaced by 1.5% loss in a 30 minute window with 6 different scalping attempts that were called to dance and hit the stop out.

This is what I am hoping to get done - after I manage to collect enough information on this topic

 

Run cycle on CLOSED ORDERS that were made on THIS DAY

 

counter = 0; 

i = OrdersHistoryTotal();

 while (i>=0 && counter<3                  -    and the day part of the OrderCloseTime says it is from today)

       if (OrderSelect(i, SELECT_BY_POS))

   if (OrderType() == ORDER_TYPE_BUY || OrderType() == ORDER_TYPE_SELL )

     if (OrderClosePrice( ) ==  OrderStopLoss())

                              counter = counter +1;

                         else  counter = 0;

   i--;

 

later if i==3 then all the rest of the routine is excluded via an else branch;

 

the trades opened and deleted and the ones opened and closed at other prices than the stop loss do not matter

order buy and order sell are trades that got already triggered                       

Files:
 
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. if (OrderClosePrice( ) ==  OrderStopLoss())
    This is unlikely to ever be true. A stop becomes a market order and is filled at market price with slippage. Also there is The == operand. - MQL4 forum
  3. macdulio_: Run cycle on CLOSED ORDERS that were made on THIS DAY
    Where are you checking the time?
 
WHRoeder:

  1. Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. This is unlikely to ever be true. A stop becomes a market order and is filled at market price with slippage. Also there is The == operand. - MQL4 forum
  3. macdulio_: Run cycle on CLOSED ORDERS that were made on THIS DAY
    Where are you checking the time?

2. This is not an everyday broker, they are not market makers and the spread is 0.2 pips plus variable on EURUSD.

 The image shows the stop losses highlighted as well as the closing prices, that are equal.

 

3. I currently have no clue about how to get the day out of the CloseOrderPrice();

 

 Snap

Reason: