Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 590

 
artmedia70:

No miracles.

File --> Open Data Folder --> In the window that opens --> MQL4 --> and that's where the folders you are used to are located. The link to this article on the main page of the forum. I am just too lazy to do it.



Thank you, to be honest I thought I was doing something wrong. It all makes sense now.
 
When running the script, you need to put an icon (marker) when the condition is triggered. How can this be done?
 
Forexman77:
When running the script, you need to put an icon (marker) when the condition is triggered. How do I do this?
As soon as the condition is triggered - put a mark. Definitely.
 
Forexman77:
When running the script, you need to set the icon (label) when the condition is triggered. How can I do it?
artmedia70:
As soon as the condition is triggered - put a mark. Unambiguously.

Artyom meant by "... condition triggered - put a mark.", what he meant by setting a mark in the script's code when the condition is triggered.

There are very good examples of badge creation scripts in the MQL4 language guide. For example, this script that creates and moves "Buy" icons on the chart.
 
DiPach:

Artyom meant by "... condition triggered - put a mark.", what he meant was to write in the script code to set the icon (marker) when the condition is triggered.

The MQL4 Reference has very good examples of scripts for creating icons. For example, this script that creates and moves "Buy" icons on the chart.

Good script, pull the required function from there,

and there you have it.

//+------------------------------------------------------------------+
void OnStart()
  {
 
  if(Signal == Buy_)   //условия
     ArrowBuyCreate(0,"ArrowBuy_"+(string)Time[0],0,Time[0],Ask);

  if(Signal == Sell_)  //условия
     ArrowSellCreate(0,"ArrowSell_"+(string)Time[0],0,Time[0],Bid);
   
  }
//+------------------------------------------------------------------+
//====================================================================
//+------------------------------------------------------------------+
//| Создает знак "Buy"                                               |
//+------------------------------------------------------------------+
bool ArrowBuyCreate(const long            chart_ID=0,        // ID графика
                    const string          name="ArrowBuy",   // имя знака
                    const int             sub_window=0,      // номер подокна
                    datetime              time=0,            // время точки привязки
                    double                price=0,           // цена точки привязки
                    const color           clr=C'3,95,172',   // цвет знака
                    const ENUM_LINE_STYLE style=STYLE_SOLID, // стиль линии (при выделении)
                    const int             width=1,           // размер линии (при выделении)
                    const bool            back=false,        // на заднем плане
                    const bool            selection=false,   // выделить для перемещений
                    const bool            hidden=true,       // скрыт в списке объектов
                    const long            z_order=0)         // приоритет на нажатие мышью
  {
//--- установим координаты точки привязки, если они не заданы
//   ChangeArrowEmptyPoint(time,price);
//--- сбросим значение ошибки
   ResetLastError();
//--- создадим знак
   if(!ObjectCreate(chart_ID,name,OBJ_ARROW_BUY,sub_window,time,price))
     {
      Print(__FUNCTION__,
            ": не удалось создать знак \"Buy\"! Код ошибки = ",GetLastError());
      return(false);
     }
//--- установим цвет знака
   ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- установим стиль линии (при выделении)
   ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style);
//--- установим размер линии (при выделении)
   ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width);
//--- отобразим на переднем (false) или заднем (true) плане
   ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- включим (true) или отключим (false) режим перемещения знака мышью
   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
//--- скроем (true) или отобразим (false) имя графического объекта в списке объектов
   ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- установи приоритет на получение события нажатия мыши на графике
   ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- успешное выполнение
   return(true);
  }
//+------------------------------------------------------------------+
//| Создает знак "Sell"                                              |
//+------------------------------------------------------------------+
bool ArrowSellCreate(const long            chart_ID=0,        // ID графика
                     const string          name="ArrowSell",  // имя знака
                     const int             sub_window=0,      // номер подокна
                     datetime              time=0,            // время точки привязки
                     double                price=0,           // цена точки привязки
                     const color           clr=C'225,68,29',  // цвет знака
                     const ENUM_LINE_STYLE style=STYLE_SOLID, // стиль линии (при выделении)
                     const int             width=1,           // размер линии (при выделении)
                     const bool            back=false,        // на заднем плане
                     const bool            selection=false,   // выделить для перемещений
                     const bool            hidden=true,       // скрыт в списке объектов
                     const long            z_order=0)         // приоритет на нажатие мышью
  {
//--- установим координаты точки привязки, если они не заданы
//   ChangeArrowEmptyPoint(time,price);
//--- сбросим значение ошибки
   ResetLastError();
//--- создадим знак
   if(!ObjectCreate(chart_ID,name,OBJ_ARROW_SELL,sub_window,time,price))
     {
      Print(__FUNCTION__,
            ": не удалось создать знак \"Sell\"! Код ошибки = ",GetLastError());
      return(false);
     }
//--- установим цвет знака
   ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- установим стиль линии (при выделении)
   ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style);
//--- установим размер линии (при выделении)
   ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width);
//--- отобразим на переднем (false) или заднем (true) плане
   ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- включим (true) или отключим (false) режим перемещения знака мышью
   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
//--- скроем (true) или отобразим (false) имя графического объекта в списке объектов
   ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- установим приоритет на получение события нажатия мыши на графике
   ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- успешное выполнение
   return(true);
  }
 

Can you advise why there may be an error when trying to open a *.txt file in test mode?

This option works flawlessly:

Handle=FileOpen(File_Name,FILE_CSV|FILE_READ,";"); 

But this one doesn't work:

Handle2=FileOpen(File_Name2,FILE_TXT|FILE_READ);

It gives error 5004, function FileIsExist(File_Name2) returns false for some reason (wtf???)

Both files (csv and txt) are located in folder tester\files (terminal on drive D) and their names correspond to variables File_Name and File_Name2 - I checked them many times.

 
DiPach:

Artyom meant by "... condition triggered - put a mark.", that to prescribe in the script code to set a badge (marker) when the condition triggered.

The MQL4 reference book contains very good examples of scripts for creating icons. For example, this script that creates and moves "Buy" icons on the chart.

No, Dina, I meant exactly what I said ;)

I hinted at "a specific question and a specific answer". I'm being mean today :)

 
artmedia70:

I'm being mean today :)

I'll be quiet then, :) so I don't get in hot hand today. :)

 
DiPach:

I won't say a word then :) lest I accidentally get in the hot hand today. :)

Nah... I always like girls.
 
artmedia70:
Nah... I always like girls.

Uh... (exhales softly) : )

That's great! :)

I promise not to abuse this knowledge. :)

Lan. Night-night! I'm going to sleep now.

Reason: