REFRESH EA-OBJECTS after ORDERCLOSE after 20 SECONDS

 

REFRESH EA-OBJECTS after ORDERCLOSE after 20 SECONDS

ONLY ONE CHART,

I want that all objects of that chart/currency-pair become refreshed/renewed,

ONCE after all orders are closed, at  2 different TIMES of OP-BUYS and OP-SELLS,

after the last/second ORDERCLOSE of OP-BUYS or OP-SELLS, about 20 seconds later.


//===========================================================================================================================================

void OBJECTSREFRESHER()
{
int i;
int hstTotal = OrdersHistoryTotal();  
for(i=0; i < hstTotal; i++)
{               
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==true)
{
int e;
int oj_total1=OrdersHistoryTotal();
for(e=oj_total1-1; e>=0; e--)
{
return;
}
int SECONDS10  = 10*TimeSeconds(TimeCurrent());  
datetime CLOSETIME=OrderCloseTime();
int REFRESHER1=CLOSETIME+SECONDS10;
if(REFRESHER1>0)
{
if(ObjectName(e)>=0)
{
ObjectsDeleteAll();
WindowRedraw();
Print("Close time for the order REFRESHER1 ", REFRESHER1);
break;
//===========================================================================================================================================
}
}
}
}
return;
}
//===========================================================================================================================================

Files:
 
DERIKO02:

REFRESH EA-OBJECTS after ORDERCLOSE after 20 SECONDS

ONLY ONE CHART,

I want that all objects of that chart/currency-pair become refreshed/renewed,

ONCE after all orders are closed, at  2 different TIMES of OP-BUYS and OP-SELLS,

after the last/second ORDERCLOSE of OP-BUYS or OP-SELLS, about 20 seconds later.


//===========================================================================================================================================

void OBJECTSREFRESHER()
{
int i;
int hstTotal = OrdersHistoryTotal();  
for(i=0; i < hstTotal; i++)
{               
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==true)
{
int e;
int oj_total1=OrdersHistoryTotal();
for(e=oj_total1-1; e>=0; e--)
{
return;
}
int SECONDS10  = 10*TimeSeconds(TimeCurrent());  
datetime CLOSETIME=OrderCloseTime();
int REFRESHER1=CLOSETIME+SECONDS10;
if(REFRESHER1>0)
{
if(ObjectName(e)>=0)
{
ObjectsDeleteAll();
WindowRedraw();
Print("Close time for the order REFRESHER1 ", REFRESHER1);
break;
//===========================================================================================================================================
}
}
}
}
return;
}
//===========================================================================================================================================

Some words of wisdom.

When you're publishing an extract of code, Alt+S is your friend. 

All the best :) 

 
  1. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
              Messages Editor

    1. Do not assume history has only closed orders.
                OrderType() == 6, 7 in the history pool? - MQL4 programming forum (2017)

    2. Do not assume history is ordered by date, it's not.
                Could EA Really Live By Order_History Alone? (ubzen) - MQL4 programming forum (2012)
                Taking the last profit and storing it in a variable | MQL4 - MQL4 programming forum #3 (2020)

    3. Total Profit is OrderProfit() + OrderSwap() + OrderCommission(). Some brokers don't use the Commission/Swap fields. Instead, they add balance entries. (Maybe related to Government required accounting/tax laws.)
                "balance" orders in account history - Day Trading Techniques - MQL4 programming forum (2017)

      Broker History
      FXCM
      Commission - <TICKET>
      Rollover - <TICKET>

      >R/O - 1,000 EUR/USD @0.52

      #<ticket>  N/A
      OANDA
      Balance update
      Financing (Swap: One entry for all open orders.)

  2. int SECONDS10  = 10*TimeSeconds(TimeCurrent());  

    Do not post code that will not even compile. There is no such function as TimeSeconds.

  3. int REFRESHER1=CLOSETIME+SECONDS10;
    if(REFRESHER1>0) 
    Non-zero is true. Your if condition is always true.
  4. if(ObjectName(e)>=0)

    A string does not compare to a number. Makes no sense.  Is “Apple” greater than zero?

  5. for(e=oj_total1-1; e>=0; e--)
    {
    return;
    }

    What do you think happens there and below?

Reason: