expert advisor - miscellaneous questions - page 15

 

Maybe a simple example will help:

for(ENUM_DAY_OF_WEEK i=0; i<7; i++)
  {
   if(i==WEDNESDAY) continue;
   Print(EnumToString(i));
  }

It is a loop to run through the 7 days of the week, printing the name of each day.

However, before the Print statement is an 'if' statement that tells the loop to move straight on to the next iteration if it is Wednesday (missing the print statement).

The result: (see how Wednesday was not printed?)

 

 
#continue; - Closed
honest_knave:
for(ENUM_DAY_OF_WEEK i=0; i<7; i++)
  {
   if(i==WEDNESDAY) continue;
   Print(EnumToString(i));
  }

However, before the Print statement is an 'if' statement that tells the loop to move straight on to the next iteration if it is Wednesday (missing the print statement).

just Wow - that is it! Wonderful ( much more / absolutely clear ) explanation.

Huge thanks, all the best to you man.

 

#Order Close - Open

Please note: I have already code for Close Orders - Pending, Loss, Profit, All Orders. But I need to rewrite them again. ( I just try to forget them. )
First of all: I am just trying to find Optimal methods for them, please give me advice and share some good links ( and something else ) for them.

So, I was found this thread from @Simon GniadkowskiLoops and Closing or Deleting Orders ( thanks Simon - which is I was bookmarked it ). I did not read whole of that thread.
Just who already read this thread, please let me know and would it be better for me for Close and Delete Orders, please?
( and I am still researching for that type of threads or codes which one it'd be good for me )

I will start to write codes for them, after good advice and comments. 

Thanks in advance.

 

#Order Close - Closed

I already rewrite my EA's Close Orders functions after I carefully read @Simon 2 great comments.

 

#Account Info's & Profit of Sell, Buy, All Orders - Open

I am just trying to write code for " Account Info's, Sell Profit, Buy Profit, All this chart symbols, All Opening Orders Profits ".
First I start to write code for Account Info. This code does not update in real time, this code delaying. I already tried WindowRedraw(), RefreshRates(), does not help me.

I need help, please.

ObjectSetString ( chart_ID, name, OBJPROP_TEXT, DoubleToString( AccountProfit(), 2 ) ); 

Thanks in advance.

( I am still researching for them. ) 

 
please put it in OnMillisecondTimer(250);
 
Marco vd Heijden:
please put it in OnMillisecondTimer(250);

You mean below code?

EventSetMillisecondTimer( 250 );

Cause I get below error.

'OnMillisecondTimer' - function not defined

Thanks man.

 

#BuyProfit

I try to get 'Buy Profit' with below code, it does work with separately. But I need to calculate all of them then it will show me one value.
I need help.

// Buy Profit
void testbuyprofit()
{
    for ( int i = OrdersTotal() - 1; i >= 0; i-- )
    {
        if ( ! OrderSelect( i, SELECT_BY_POS, MODE_TRADES) ) continue;
        if( OrderType() == OP_BUY )
        {
            profit = OrderProfit();
            Print( "Profit Buy:", profit );
        }
    }
    //---
    return;
}

Thanks in advance.

 
void testbuyprofit()
{
    double profit_buy=0;
    for ( int i = OrdersTotal() - 1; i >= 0; i-- )
    {
        if ( ! OrderSelect( i, SELECT_BY_POS, MODE_TRADES) ) continue;
        if( OrderType() == OP_BUY )
        {
            profit_buy += OrderProfit();
        }
    }
    Print( "Profit Buy:", profit_buy );
}
 
honest_knave:
void testbuyprofit()
{
    ...
    Print( "Profit Buy:", profit_buy );
}
You clearly understand me. Thanks man.
Reason: