[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 402

 
yosuf:
Can you please tell me if the indicators H-L, H-O, H-C, O-C, O-L are available, preferably with lines of their mean values? Google sent me a link which I don't quite understand: http://www.metatrader4.com/ru/forum/8261/. I think they would be useful for assigning optimum TA and SL.
So, what's the problem? Replace Close in any indicator with a difference (High-Low) or any other of these. However, in some cases, you may have to draw the indicator in a separate window.
 
DmitriyN:
So, what's the problem? Replace Close in any indicator with a difference (High-Low) or any of the others listed. However, in some cases you may have to draw the indicator in a separate window.
In which indicator, exactly, is it better to change? Aren't they still available in a separate form?
 

Wrote the following script:

//+------------------------------------------------------------------------------------------+
//|                                                                         DeleteObject.mq4 |
//+------------------------------------------------------------------------------------------+
//+------------------------------------------------------------------------------------------+
//|                             script program start function                                |
//+------------------------------------------------------------------------------------------+
//---------------------------------------------------------------------------------------- 1 -
#include <Копия WinUser32.mqh>                                    //подключаемый файл, к-й неожходим для работы функции MessageBox: в этом файле в отличии от файла <WinUser32.mqh> в разделе MessageBox() Flags добавлена строка: #define MB_CANCELTRYCONTINUE      0x00000006  
//---------------------------------------------------------------------------------------- 2 -
int start()
  {
   double Timestart=GetTickCount();                               //переменная, с помощью которой вычисляется время (в милисекундах) начала выполнения эксперта 
   if(ObjectsTotal()==0)                                          //если объектов на графике нет
      {                                                           //начало if
       Alert("На графике нет графических объектов");              //то делаем сообщение на экран...
       return;                                                    //...и выходим
      }                                                           //конец if   
   Alert("На графике зафиксировано ",ObjectsTotal()," Объектов");
   Sleep(3000);
   int ret=MessageBox("Удалить ВСЕ графические объекты?","Удаление графических объектов",MB_YESNO|MB_ICONQUESTION);//функция MessageBox: вопрос на экран
   if(ret==6)                                                     //если ответ ДА,...
      {
       ObjectsDeleteAll();                                        //..., то удаляем ВСЕ объекты из ВСЕХ окон текущего графика
       if(!ObjectsDeleteAll())Alert("При удалениии объектов возникла ошибка ",GetLastError());//если удаление не удалось, то сообщение на экран
       Alert("ВСЕ графические объекты успешно удалены");          //сообщение на экран в случае успешного удаления сех объектов
       return;                                                    //и выход из start
      }                                                           //конец if   
//--------------------если ответ НЕТ? то перебираем объекты по списку---------------------- 3 -
   int obj_total=ObjectsTotal();                                  //получаем общее количество графических объектов
   string obj_name;                                               //объявляем переменную  "имя объекта"
   for(int i=obj_total-1;i>=0;i--)                                //цикл по удалению объекта
     {                                                            //начало for
      obj_name=ObjectName(i);                                     //имя текущего удаляемого объекта
      Alert("Удаляется объект: ",obj_name);                       //сообщение на экран     
      ret=MessageBox("Удалить графический объект?","Удаление графического объекта",MB_YESNO|MB_ICONQUESTION);//функция MessageBox: вопрос на экран
      if(ret==7)continue;                                         //если ответ НЕТ, то на следующую итерацию     
      ObjectDelete(obj_name);                                     //если ответ ДА, то удаляем текущий объект с именем obj_name     
      int error=GetLastError();                                   //вычисляем код возможной ошибки, к-я могла появиться при неудачном удалении Графического объекта номер i
      if(error!=0)Alert("При удалении объекта ",obj_name," возникла ошибка ",error);continue;//если функция ObjectDelete(obj_name) вернуа значение ЛОЖЬ (т.е. не удалила текущий объект), то сообщение об ошибке при удалении
      Alert("Объект ",obj_name," успешно удален");                //сообщение об успешном удалении
     }                                                            //конец for
   Comment("\nСкрипт выполнялся всего ",GetTickCount()-Timestart," миллисекунд, из них: ",MathFloor((GetTickCount()-Timestart)/1000)," секунд ",((GetTickCount()-Timestart)/1000-MathFloor((GetTickCount()-Timestart)/1000))*1000," миллисекунд");//печать сообщения вна экран
//---------------------------------------------------------------------------------------- 3 -
   return(0);
  }
//---------------------------------------------------------------------------------------- 4 -

In 2 words. The script is designed to delete graphical objects from the client terminal window. The script can be used in one of 2 ways: either all objects are deleted or the script goes through a series of objects and deletes only the ones selected by the user.

Question: why in the while loop after the next object is deleted the last Alert("Object ",obj_name," successfully deleted") function doesn't show the corresponding message on the screen and doesn't show up in any way (though the object is deleted in the while loop)

Note: the line with the include file #include < WinUser32.mqh> in the header of the script, which differs from the original include file #include <WinUser32.mqh>, supplied with the client terminal, so it is also given below

P.S. In order not to litter the forum, thank you in advance for your reply

Files:
 
yosuf:
Which indicator, exactly, is the best one to replace? Aren't they still available in a separate form?

The MA, for example, has it, but there are few options and the ones you mentioned are not there:

Therefore, you can take almost any indicator and make its versatility yourself.

 
7777877:

Question: why in the while loop, after the next object is deleted, the last function Alert("Object ",obj_name," successfully deleted") does not display a corresponding message on the screen and does not show itself in any way (although the corresponding object is deleted in the while loop)


int error=GetLastError();                                   //вычисляем код возможной ошибки, к-я могла появиться при неудачном удалении Графического объекта номер i
      if(error!=0)Alert("При удалении объекта ",obj_name," возникла ошибка ",error);continue;//если функция ObjectDelete(obj_name) вернуа значение ЛОЖЬ (т.е. не удалила текущий объект), то сообщение об ошибке при удалении
      Alert("Объект ",obj_name," успешно удален");                //сообщение об успешном удалении

This is because if(error != 0) will only affect an Alert, after which it will always continue and the next Alert will never be invoked
 
Hello! Please tell me how to make a loop counter (e.g. FOR) to search for orders within the current day!
 

What can I say I do not understand anything yet, I understand only one thing that it is all about making money, why do advisors if they are losing, you can go to the platform once a week and earn 1000 in a deposit of 3000

 
lowech:
Hello! Could you please tell me how to make the counter of the loop (for example, FOR) search for orders within the current day!

ExistInHistoryToDay().
 
kamolot: What are EAs for if they are losing money, you can log on to the platform once a week and earn 1000 on a 3000 deposit.
They just do not have the guts to stop by the platform even once a week and earn a grand. They are all too tired just to make money.
 
GaryKa:
It's just that these labyrinthine programmers don't have the heart to come in even once a week and earn their schtick. They're all too tired to make any money.

+100500 8-)
Reason: