Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1139

 
ascerdfg:
Where do I right-click?

Ctrl T to bring up the menu at the bottom, Trading, Assets, ..... , lastly Log. Click the logbook and right-click on one of the entries to view

 
Alexey Viktorov:

It is possible that the price and time for the object coordinates are equal to zero. Check it this way: Press Ctrl+B, press "All" button in the appeared dialog and see the list of existing objects. If there is one, open properties and see coordinates.

debugged, all is ok when creating all objects

 
ascerdfg:
Where should you right-click?

specially, rzewski: a mouse to poke in the right place

 
Maxim Kuznetsov:

Especially for Rzewski: a mouse to click in the right place

To be honest, the method of groping to find where the log is called, and liked the word view, pressed. and there's the log))))) And by the way is there no way to call the log via counterclause or what?

 

Good afternoon.

Is it possible to set an object to always be above the others, including newly placed objects. So that when objects overlap, the desired object never overlaps the top?

I initially thought that the OBJPROP_ZORDER property could help, if the required object was always set to the highest value. But as it turned out in practice, it's only a priority for click catching. Visually, the object doesn't get higher than all of them.

Also in practice, I found out that if an object is drawn last, it will definitely be visually higher than the others. So I have to either create some property I don't know about, or redraw the object, which should not overlap the top every time the number of objects on the chart changes. But when redrawing, I ran into a problem - flickering of an object that was removed and drawn again. Is there any way to redraw the object nicely, without flickering, or to make it non-overlapping from above?


 
Oleg Remizov:

Good afternoon.

Is it possible to set an object to always be above the others, including newly placed objects. So that when objects overlap, the desired object never overlaps the top?

I initially thought that the OBJPROP_ZORDER property could help, if the required object was always set to the highest value. But as it turned out in practice, it's only a priority for click catching. Visually, the object doesn't get higher than all of them.

Also in practice, I found out that if an object is drawn last, it will definitely be visually higher than the others. So I have to either create some property I don't know about, or redraw the object, which should not overlap the top every time the number of objects on the chart changes. But when redrawing, I ran into a problem - flickering of an object that was removed and drawn again. Is there any way to redraw the object nicely, without flickering, or make it non-overlapping from above?


OBJPROP_TIMEFRAMES:

OBJ_NO_PERIODS - invisible on all periods,

OBJ_ALL_PERIODS - visible on all periods

Документация по MQL5: Константы, перечисления и структуры / Константы объектов / Видимость объектов
Документация по MQL5: Константы, перечисления и структуры / Константы объектов / Видимость объектов
  • www.mql5.com
Комбинация флагов видимости объекта определяет таймфреймы графика, на которых объект отображаем. Для установки/получения значения свойства OBJPROP_TIMEFRAMES можно использовать функции ObjectSetInteger()/ObjectGetInteger...
 
Oleg Remizov:

Good afternoon.

Is it possible to set an object to always be above the others, including newly placed objects. So that when objects overlap, the desired object never overlaps the top?

I initially thought that the OBJPROP_ZORDER property could help, if the required object was always set to the highest value. But as it turned out in practice, it's only a priority for click catching. Visually, the object doesn't get higher than all of them.

Also in practice, I found out that if an object is drawn last, it will definitely be visually higher than the others. So I have to either create some property I don't know about, or redraw the object, which should not overlap the top every time the number of objects on the chart changes. But when redrawing, I ran into a problem - flickering of an object that was removed and drawn again. Is there a way to redraw the object nicely, without flickering, or make it non-overlapping from above?


The objects are displayed according to the index:

string  ObjectName( 
   int    object_index   // номер в списке объектов
   );

It follows that visually, the object with the highest index will be in the foreground.

I get out of this situation in the following way:

string pref="own"; //префикс в именах своих объектов
bool CheckOtherObj(string &arrObjOther[]){
   CheckOtherObjDelete(&arrObjOther);
   for(int i=ObjectsTotal(0,-1,-1)-1; i>=0; i--){
      string name=ObjectName(0,i,-1,-1);
      if(StringFind(name,pref)>=0)continue;
      bool add=true;
      for(int k=ArraySize(arrObjOther)-1; k>=0; k--){
         if(arrObjOther[k]==name){
            add=false;
            break;
         }
      }
      if(add){
         AddToArr(name,arrObjOther);
         return(true);
      }
   }
   return(false);
}
void CheckOtherObjDelete(string &arrObjOther[]){
   string arrdel[];
   ArrayFree(arrdel);
   for(int k=0; k<ArraySize(arrObjOther); k++){
      bool add=true;
      for(int i=0; i<ObjectsTotal(0,-1,-1); i++){
         string n=ObjectName(0,i,-1,-1);
         if(StringFind(n,pref)>=0)continue;
         if(n==arrObjOther[k]){
            add=false;
            break;  
         }
      }
      if(add) AddToArr(arrObjOther[k],arrdel);
   }
   if(ArraySize(arrdel)>0){
      string temp[];
      ArrayCopy(temp,arrObjOther);
      ArrayFree(arrObjOther);
      for(int i=0; i<ArraySize(temp); i++){
         bool add=true;
         for(int k=0; k<ArraySize(arrdel); k++){
            if(arrdel[k]==temp[i]){
               add=false;
               break;
            }
         }
         if(add)AddToArr(temp[i],arrObjOther);
      }
   }
}
void AddToArr(string value, string &arr[]){
   int s=ArraySize(arr);
   ArrayResize(arr,s+1);
   arr[s]=value;
}


in this case, I have an array of object names in my code that were not created by the program (others). As soon as a new other object appears, I delete all objects created by the program (my own) and create them anew. In this case, own objects will always have the highest index in the list of objects, and hence visually be in the foreground. But it is also necessary to always clear the array of other objects, in case of their removal from the chart, so that the array does not grow uncontrollably.

If you want to control your objects, it's easier. You just need to control the object indices.

 
Maksym Mudrakov:
The objects are displayed according to the index:

it follows that visually the object with the highest index will be in the foreground.

This is how I get out of this situation:


In this case, my code has an array of names of objects not created in the program (others). As soon as new other object appears, I delete all objects created by program (my own) and create them again. In this case, own objects will always have the highest index in the list of objects, and hence visually be in the foreground. But it is also necessary to always clear the array of other objects, in case they are deleted from the chart, so that the array does not grow uncontrollably.

If you want to control your objects, it is easier. You just need to control the object indices.

I have shown above what to do. Why go to such lengths when there is a developer-recommended method?

 
Hello.

I want to transfer the ATP indicator to the price chart. But I do not know how to do it. I want it to show the maximal movement in volatility from the midline of the same period. If anyone has the code, thank you for sharing.
 
Hello! I don't know where to start, as after a month of searching to no avail, my head was in a terrible mess. I decided to write a message in this thread. If I'm going to the wrong place here, I'm sorry. Maybe someone will tell which branch this topic is better to raise? The heart of my question is: What is the best and easiest way to get data in MT4 from a third-party site for further display of this information on a symbol chart using Expert Advisor, indicator or a script? At the moment I am using my own script which opens the file Book1.csv at the address "MT4 Data Directory"\MQL4\Files. Before running the script I have to launch Chrome browser, go to the resource page, select a symbol on this page, then select the type of displayed data for this symbol (the page address doesn't change), after displaying the data for this symbol as a table with the parameter values at limited range of price levels I use Table Capture extension for Chrome browser, copy data from table on the resource page to clipboard, then open Excel and paste data from clipboard into Exel sheet. Then I convert numeric data in Exel (replace commas in numbers with dots) and save the file in csv format to terminal data directory. And already after performing this set of actions I run the script. Obviously, WebRequest function isn't suitable for this task, because there's no data at the page address at the beginning (it appears after selecting a tool and data type). I would be grateful to anyone who can tell me the right direction (obviously, there may be several directions).
Reason: