expert advisor - miscellaneous questions - page 14

 

Some food for thought:

if(ObjectFind(chart_ID, name) < 0) // check the object does not exist
{
   if( !ObjectCreate( chart_ID, name, OBJ_LABEL, sub_window, 0, 0 ) )
   {
       Print( __FUNCTION__, ": failed to create text label! Error code = ", GetLastError() );
       return(false);
   }
}
 
honest_knave:

Some food for thought:

if(ObjectFind(chart_ID, name) < 0) // check the object does not exist
{
   if( !ObjectCreate( chart_ID, name, OBJ_LABEL, sub_window, 0, 0 ) )
   {
       Print( __FUNCTION__, ": failed to create text label! Error code = ", GetLastError() );
       return(false);
   }
}

You mean above code better than below code? But I liked below code which is it gives me descriptions of errors.

if( errorcode !=0 ) printf( "Error %i: %s", errorcode, ErrorDescription( errorcode ) );

// --- second times edited.

I tested, yeah it prevent any warnings, and errors. I need your advice which is good, please? 

Thanks man. 

 

Sorry, I just pasted a bit from one of your snippets earlier on. Any error handling print statement will do, just don't ignore errors.

 

#SpreadSheet - Closed

#SpreadSheet Errors - Closed

Maybe, I little confused. So I just use below method.

if(ObjectFind(chart_ID, name) < 0) // check the object does not exist
{
   if( !ObjectCreate( chart_ID, name, OBJ_LABEL, sub_window, 0, 0 ) )
   {
       if( errorcode !=0 ) printf( "Error %i: %s", errorcode, ErrorDescription( errorcode ) );
   }
}

I hope it will be good decision for me.

Thanks for your help! 

Special thanks to @honest_knave and @Marco vd Heijden
 

#Close By - Open

My broker does not shows me close by order function. So but I can 'Close By' with script.
So, in this case, is there any illegal things?

Thanks in advance. 

 
I'm sorry, I don't understand. Please can you explain in more detail?
 
honest_knave:
I'm sorry, I don't understand. Please can you explain in more detail?

Oh! This is just my misunderstood.
Close by works Opposite Positions.

Thanks for your attention.

#Close By - Closed

 

#continue; - Open

Is 'continue;' operator calls next functions?
Also 'continue;' is doing skip?

Even I read about 'continue;' from MQL4 book. And it was not clearly for me.
Can someone explain it to me, please?

Thanks in advance. 

 

continue operator

Passes control to the beginning of the nearest external loop operator while, do-while or for

 
Marco vd Heijden:

continue operator

Passes control to the beginning of the nearest external loop operator while, do-while or for

I understand. But I need practices for it...
I will try something for it.

Thanks man.

Reason: