help ObjectsDeleteAll

 
datetime itime[ 2 ];
itime[ 0 ]= iTime ( _Symbol , PERIOD_M15 , 0 );
itime[ 1 ]= TimeCurrent ();

 string name= "open" ;
 double iprice;
iprice= iOpen ( _Symbol , PERIOD_M15 , 0 );
 ObjectCreate ( _Symbol ,name, OBJ_TREND , 0 ,itime[ 0 ],iprice,itime[ 1 ],iprice);

name= "high" ;
iprice= iHigh ( _Symbol , PERIOD_M15 , 0 );
 ObjectCreate ( _Symbol ,name, OBJ_TREND , 0 ,itime[ 0 ],iprice,itime[ 1 ],iprice);

name= "low" ;
iprice= iLow ( _Symbol , PERIOD_M15 , 1 );
 ObjectCreate ( _Symbol ,name, OBJ_TREND , 0 ,itime[ 0 ],iprice,itime[ 1 ],iprice);

Assuming I have created a lot of objects on the chart...

so I decided to delete all objects,

how do i use the ObjectsDeleteAll function??


I'm learning to program, if anyone can give me a tip, I'll be very happy...thanks

 
Gedday Silva:

Assuming I have created a lot of objects on the chart...

so I decided to delete all objects,

how do i use the ObjectsDeleteAll function??


I'm learning to program, if anyone can give me a tip, I'll be very happy...thanks

Before asking you could search here for "delete all objects" - I get ~1340 results and most of them will answer your question.

 
int    
ObjectsDeleteAll 
 ( 
long 
   chart_id,            
int 
    sub_window = - 
1 
 ,       
int 
    type = - 
1              
    ); 

Carl Schreiber :

in case you didn't understand my question was how to use this function in my code

since I still don't know exactly how it works

 
Gedday Silva:

Assuming I have created a lot of objects on the chart...

so I decided to delete all objects,

how do i use the ObjectsDeleteAll function??


I'm learning to program, if anyone can give me a tip, I'll be very happy...thanks

int OnInit()
  {
//---
ObjectsDeleteAll(0,-1,-1);

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---

    datetime itime[ 2 ];
itime[ 0 ]= iTime ( _Symbol , PERIOD_M15 , 0 );
itime[ 1 ]= TimeCurrent ();

 string name= "open"+string(TimeCurrent ()) ;
 double iprice;
iprice= iOpen ( _Symbol , PERIOD_M15 , 0 );
if(ObjectFind(0,name)<0)
 ObjectCreate ( _Symbol ,name, OBJ_TREND , 0 ,itime[ 0 ],iprice,itime[ 1 ],iprice);

name= "high"+string(TimeCurrent ()) ;
iprice= iHigh ( _Symbol , PERIOD_M15 , 0 );
if(ObjectFind(0,name)<0)  ObjectCreate ( _Symbol ,name, OBJ_TREND , 0 ,itime[ 0 ],iprice,itime[ 1 ],iprice);

name= "low"+string(TimeCurrent ()) ;
iprice= iLow ( _Symbol , PERIOD_M15 , 1 );
 if(ObjectFind(0,name)<0)  ObjectCreate ( _Symbol ,name, OBJ_TREND , 0 ,itime[ 0 ],iprice,itime[ 1 ],iprice);
   }
 
Gedday Silva:

in case you didn't understand my question was how to use this function in my code

since I still don't know exactly how it works

So you need to learn how to read a Language Documentation.

It is pretty clear: DELETE ALL OBJECTS.

And you optionally may choose which type of objects would you like to delete. It's that it! Plain and simple.

https://www.mql5.com/en/docs/objects/objectdeleteall

Documentation on MQL5: Object Functions / ObjectsDeleteAll
Documentation on MQL5: Object Functions / ObjectsDeleteAll
  • www.mql5.com
ObjectsDeleteAll - Object Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Flavio Javier Jarabeck #:

So you need to learn how to read a Language Documentation.

It is pretty clear: DELETE ALL OBJECTS.

And you optionally may choose which type of objects would you like to delete. It's that it! Plain and simple.

https://www.mql5.com/en/docs/objects/objectdeleteall

usual non answer from this forum. 

 
stuartmiles #:

usual non answer from this forum. 

Is that so?

What is it, you are actually trying to achieve?

ObjectsDeleteAll will delete all drawing objects on a chart.

It is actually not easy to answer your question, because you have not said what your goal is. So how do you expect someone to answer? Or, better, what type of answer do you expect?
 
stuartmiles #:

usual non answer from this forum. 

how is that a non answer, given that it provides a direct link to the documentation for the function requested?

Reason: