The topic is closed, I don't know how or if I can delete it?
Please test the following script to remove trend lines (code presented in 2 variants):
void OnStart()
{ bool ticket;string name;int obj_total=ObjectsTotal(0,0,OBJ_TREND);
for(int i=0;i<obj_total;i++){
name = ObjectName(0,i,0,OBJ_TREND);
ticket=ObjectDelete(0,name);
if(!ticket){Alert("Delete TrendLine error #",GetLastError());return;}
}/for(int i=0;i<ObjectsTotal(0,0,OBJ_TREND);i++)
}
and another variant:
void OnStart()
{ bool ticket;string name;int obj_total=ObjectsTotal(0,0,OBJ_TREND);int i=0;
while(obj_total>0){
name = ObjectName(0,i,0,OBJ_TREND);
ticket=ObjectDelete(0,name);
if(!ticket){Alert("Delete TrendLine error #",GetLastError());return;}
obj_total=ObjectsTotal(0,0,OBJ_TREND);i++;
}//while
}
For some reason, for example out of ten lines, it deletes several and hangs. In MT4 everything works - all are deleted and instantly.
- www.mql5.com
In general, both are wrong. It is advisable to organise the traversal of objects in any list from the end. I don't write the word "always", because there may be cases when it is not so.
A wish: make the code correctly, use the Ctrl+ key combination in MetaEditor 5 for code formatting (simultaneous pressing of Ctrl and comma), then it will be better readable. Try this option:
void OnTick()
{
//---
void OnStart()
{
bool ticket;
string name;
int obj_total=ObjectsTotal(0,0,OBJ_TREND);
for(int i=obj_total-1;i>=0;i--)
{
name=ObjectName(0,i,0,OBJ_TREND);
ticket=ObjectDelete(0,name);
if(!ticket)
{
Alert("Delete TrendLine error #",GetLastError());
return;
}
}
//---
}
- 2010.02.23
- MetaQuotes Software Corp.
- www.mql5.com
In general, both are wrong. It is desirable to traverse the objects in any list from the end. I don't write the word "always", because there may be cases when it is not so.
A wish: make the code correctly, use the Ctrl+ key combination in MetaEditor 5 for code formatting (simultaneous pressing of Ctrl and comma), then it will be better readable. Try this option:
Thank you. It works. As for the layout - I indent the code as well. In this particular post, I inserted the code as plain text, so it's not indented.
- 2010.02.23
- MetaQuotes Software Corp.
- www.mql5.com
And perhaps this akazija:
//+------------------------------------------------------------------+
//||
//+------------------------------------------------------------------+
replace with:
/*------------------------------------------------------------------+
//+----------------------------------------------------------------*/
As they are inserted automatically, it is very inconvenient to edit them later (add new lines)
- www.mql5.com
And perhaps this akazija:
//+------------------------------------------------------------------+
//||
//+------------------------------------------------------------------+
replace with:
/*------------------------------------------------------------------+
//+----------------------------------------------------------------*/
As they are inserted automatically, it is very inconvenient to edit them afterwards (add new lines)
You can edit the template right in the unitor, for example:
...\mt5\MQL5\Templates\Expert.mqt
(do not prevent to save a copy, for example under Russian name Expert.mqt)
SZS: By the way, a question to the developers.
In addition to #header#, is it possible to add #filename#?
so it would be easier and more flexible to shape the header to your needs...
You can change the template to suit your needs, for example:
...\mt5\MQL5\Templates\Expert.mqt
(do not prevent to save a copy, for example, under the Russian name Expert.mqt)
I haven't found such directories and files, or do I have to create them myself?
You can change the template to suit your needs, for example:
...\mt5\MQL5\Templates\Expert.mqt
(do not prevent to save a copy, for example, under the Russian name Expert.mqt)
I have not found such directories and files, or do you have to create them yourself?
They are there!
You have to put a tick in the context menu "Show All Files".
Learn the basics. ;)
They are there!
You must put a tick in the context menu "Show All Files".
Learn the math... ;)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I suggest that those who would like to try and learn FIVE together.
Unfortunately, in the main branch, where beta testing is going on, there is little help in learning a new language.
There is really testing for bugs and the branch is intended for PROFISERS.
For the other 90% of programmers I suggest to discuss more "understandable" topics.
I will begin by saying that I have started to rewrite one very handy indicator for A, but I have faced many problems that required brainstorming.
The first problem is that now it is impossible to implement the approach used in the 4 indicators in 5.
I have to implement everything through Expert Advisor. I am attaching it for reviewing and accepting suggestions (not for criticism :-). The description of what has been implemented and what will happen, a bit later.
So far I have managed to implement in it 15% of what was in Quartet.
Briefly, what I am trying to implement:
1) Struggle with the 3/5 mark. For those who trade on "adult" fifth sign is like a fifth leg for a dog. Personally, it gets in my way. I optimize displaying of information and management of positions and orders as if there were 4 of them
2) To display all possible information on instruments, orders, etc. directly on the chart. Very convenient and clear, especially for F11.
3) Graphical display of positions and trades of the current instrument on the chart, as well as information on all positions in the lower left corner