or use for(;;) loop for ObjectsTotal() to ObjectFind() a specific ObjectName()
//delete Objects int vObjCount = ObjectsTotal(); for ( int h=0; h<vObjCount; h++ ) { string vObjName = ObjectName(h); if( vObjName != "" ) { if( StringSubstr(vObjName ,0, 17) == "MarketProfileDraw" ) { ObjectDelete(vObjName) ; } } } vObjCount = ObjectsTotal(); Print("ObjectsTotal = " + vObjCount); for ( h=0; h<vObjCount; h++ ) Print("ObjectName = " + StringSubstr(ObjectName(h) ,0, 17));
log:
13:46:16 Defcon___Indicator___MP___Simple___0.1 GBPJPY,M5: ObjectsTotal = 93
13:46:16 Defcon___Indicator___MP___Simple___0.1 GBPJPY,M5: ObjectName = MarketProfileDraw
13:46:16 Defcon___Indicator___MP___Simple___0.1 GBPJPY,M5: ObjectName = MarketProfileDraw
13:46:16 Defcon___Indicator___MP___Simple___0.1 GBPJPY,M5: ObjectName = MarketProfileDraw
13:46:16 Defcon___Indicator___MP___Simple___0.1 GBPJPY,M5: ObjectName = MarketProfileDraw
13:46:16 Defcon___Indicator___MP___Simple___0.1 GBPJPY,M5: ObjectName = MarketProfileDraw
13:46:16 Defcon___Indicator___MP___Simple___0.1 GBPJPY,M5: ObjectName = MarketProfileDraw
13:46:16 Defcon___Indicator___MP___Simple___0.1 GBPJPY,M5: ObjectName = MarketProfileDraw
13:46:16 Defcon___Indicator___MP___Simple___0.1 GBPJPY,M5: ObjectName = MarketProfileDraw
etc...
it don't delete objects, what's wrong?
this is the drawing function
void fDrawProfile() { if(dbg_ShowRunInfo) fRunInfo("fDrawProfile()...", "", "") ; if ( Period() <= 30 && Period() >= 5) { int vBarsToCount = Bars - IndicatorCounted()-1 ; int vObjCount; if(vBarsToCount >= 1 ) fDeleteObjects(); for ( int h=0; h<100; h++ ) { // break long loop if ( h>= 1000000 ) { Alert(cProgram_Name + " Cycle too long" ) ; break ; } // draw market profile for(double vPrice=NormalizeDouble(Low[h], Digits-1); vPrice<=NormalizeDouble(High[h],Digits-1); vPrice+=(Point*10) ) { fDrawMarketProfile(vPrice, h); } } } if(dbg_ShowRunInfo) fRunInfo("fDrawProfile()...DONE", "", "") ; }
it don't delete objects, what's wrong?
this is the drawing function
It reassign the object index :-) nice
thanks for fast reply
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
is there a way to delete several objects without deleting every single object step by step?
Example:
I use:
ObjectDelete("LR_Line_extension"); ObjectDelete("Res_Line_extension"); ObjectDelete("Sup_Line_extension");
And I need something like:
ObjectDelete("LR_Line_extension","Res_Line_extension","Sup_Line_extension");
Thanks in advance!