Everything works correctly.
It was:
It became:
Code:
//+------------------------------------------------------------------+ //| Test_en.mq5 | //| Copyright © 2019-2022, Vladimir Karputov | //| https://www.mql5.com/en/users/barabashkakvn | //+------------------------------------------------------------------+ #property copyright "Copyright © 2019-2022, Vladimir Karputov" #property link "https://www.mql5.com/en/users/barabashkakvn" #property script_show_inputs //--- input input string InpName = "MyObj"; //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { DeleteObjects(InpName); } //+------------------------------------------------------------------+ //| Delete Objects | //+------------------------------------------------------------------+ void DeleteObjects(const string name) { /* int ObjectsTotal( long chart_id, // chart identifier int sub_window=-1, // window index int type=-1 // object type ); */ /* string ObjectName( long chart_id, // chart identifier int pos, // number in the list of objects int sub_window=-1, // window index int type=-1 // object type ); */ /* bool ObjectDelete( long chart_id, // chart identifier string name // object name ); */ /* string StringSubstr( string string_value, // string int start_pos, // position to start with int length=-1 // length of extracted string ); */ int shift=ObjectsTotal(0,-1,-1)-1,strLen=StringLen(name); while(shift>=0) { string objName=ObjectName(0,shift,-1,-1); if(StringSubstr(objName,0,strLen)!=name) { shift--; continue; } ObjectDelete(0,objName); shift--; } } //+------------------------------------------------------------------+
Files:
Test_en.mq5
5 kb
@Cipud Sableng Could you test your code on Windows? What OS runs wine?
thanks for reply..
i use debian bookworm..
tested on windows..
it seem wine bug on my debian..
but i solved this with function
ObjectsDeleteAll(0,qObjName,-1,-1);
and it will delete all objects i've created..
thank you so much you all...
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
hello..
i've use this code to delete objects i've created..
it work on mql4 but not in mql5..
could you please help me to fix it
thanks in advance..