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

 
Maxim Kuznetsov:

NO, CANNOT...

It's funny, but what the user has selected in the "Colours" tab is normally NOT available inside the indicator

Thanks for the reply.

I still have a dream that the developer in MT4 (for Windows) ADAPTIZED the redirections on my tablet....

I wrote to them, they wrote back, they said that all their efforts are focused on MT5...

 
kopeyka2:

Thank you for your reply.

I still have a dream that the developer in MT4 (for Windows) ADAPTED the redesign for the tablet....

I wrote to them, they replied, they said that all their efforts are concentrated on MT5...

In mt4 it is unlikely that there will be anything new.

 
kopeyka2:

Hi.

Question: In MT4, is it possible to match the colour of the EZ buffer with the chart, provided the colour of the indicator on the chart has changed?

In the code

#property indicators_color1 clrYellow

***

***

ObjectCreate(.......);

ObjectSetInteger(... indicators_color1);


Problem; when you change colour in the indicator, the buffer line colour changes, but in the chart it is the same as in #property. Needs matching.

So far solved through input color , BUT it's two entries in the code, two changes in the settings, and I would like one setting through the buffer.


Thanks for any feedback.

Diagrammed it from a smartphone.


We take the indicator where the graph is displayed and look:

//+------------------------------------------------------------------+
//| Описание                                                         |
//+------------------------------------------------------------------+
void Descriptions(void)
  {
   int x=4;
   int y=1;
   int arr_colors[]={indicator_color1,indicator_color2,indicator_color3,indicator_color4,indicator_color5};
   string arr_texts[]={"Up direction","Down direction","Crossing to up","Crossing to down","Neutral"};
   string arr_names[COUNT];
   for(int i=0; i<COUNT; i++)
     {
      arr_names[i]=prefix+"label"+(string)i;
      arr_colors[i]=PlotIndexGetInteger(i,PLOT_LINE_COLOR);
      int shift=(i*(i<2 ? 90 : i<COUNT-1 ? 96 : 100)-(i>0 ? x : 0));
      x+=shift;
      Label(arr_names[i],x,y,CharToString(167),16,arr_colors[i],"Wingdings");
      Label(arr_names[i]+"_txt",x+10,y+5,arr_texts[i],10,clrGray,"Calibri");
     }
  }
//+------------------------------------------------------------------+

An array of colours is declared and initialised with the colours specified by the user in the indicator settings.

Then the colour value from the array is passed to the text label output function.

Everything is standard in the text label output function:

//+------------------------------------------------------------------+
//| Выводит текстовую метку                                          |
//+------------------------------------------------------------------+
void Label(const string name,const int x,const int y,const string text,const int size,const color clr,const string font)
  {
   if(ObjectFind(0,name)!=wnd)
      ObjectCreate(0,name,OBJ_LABEL,wnd,0,0,0,0);
   ObjectSetInteger(0,name,OBJPROP_SELECTABLE,false);
   ObjectSetInteger(0,name,OBJPROP_HIDDEN,true);
   ObjectSetInteger(0,name,OBJPROP_XDISTANCE,x);
   ObjectSetInteger(0,name,OBJPROP_YDISTANCE,y);
   ObjectSetInteger(0,name,OBJPROP_CORNER,CORNER_LEFT_LOWER);
   ObjectSetInteger(0,name,OBJPROP_ANCHOR,ANCHOR_LEFT_LOWER);
   ObjectSetInteger(0,name,OBJPROP_FONTSIZE,size);
   ObjectSetInteger(0,name,OBJPROP_COLOR,clr);
//---
   ObjectSetString(0,name,OBJPROP_FONT,font);
   ObjectSetString(0,name,OBJPROP_TEXT,text);
   ObjectSetString(0,name,OBJPROP_TOOLTIP,"\n");
  }
//+------------------------------------------------------------------+

The colour passed to the function sets the colour of the text marker. And everything works...

 
Artyom Trishkin:

We take the indicator in which the graph is displayed and look at it:

An array of colours is declared and initialized with the colours specified by the user in the indicator settings.

Then the colour value from the array is passed to the text label output function.

Everything is standard in the function of text label output:

The colour passed to the function sets the colour of the text label. And everything works...

I have considered the array option... It is not clear HOW it is connected with the buffer...? The question was about ONE colour change motion...for the buffer and the label(line).

Or i don't get it ?)))

Thanks for the example)))


PS

thought, maybe somehow pull (compare) the colour from the buffer ... I think this is nonsense...

 

Greetings. Can you tell me how to write an indicator that would work only on ask price?

RSI = NormalizeDouble((iRSI(NULL,0,14,0,0)),Digits());

 
Anatolij Anufriev:

Greetings. Can you tell me how to write an indicator that would work only on ask price?

RSI = NormalizeDouble((iRSI(NULL,0,14,0,0)),Digits());

in MT4 bars - OHLC are built by Bid, in fact, Ask prices are not available in the history. as an option, collect Ask in ticks and use iRSIOnArray()

 

What is the best/comfortable solution for using databases with MQL4/5?

There are a lot of articles, it's hard to choose one

 
Igor Makanu:

in MT4 bars - OHLC are built by Bid, in fact Ask prices are not available in history, alternatively collect in Ask ticks and use iRSIOnArray()

Thank you

 
Sergey Likho:

What is the best/comfortable solution for using databases with MQL4/5?

There are a lot of articles, it is difficult to choose one.

If you don't have an article, search "Articles" on forum. You may find all information in "Forum" section. There are many things that were combined with MT4, SQL and applications like MathLab or R... Search what you like, search pretty good on this forum

https://www.mql5.com/ru/search#!keyword=sql&module=mql5_module_articles

Поиск - MQL5.community
Поиск - MQL5.community
  • www.mql5.com
Поиск выполняется с учетом морфологии и без учета регистра. Все буквы, независимо от того, как они введены, будут рассматриваться как строчные. По умолчанию наш поиск показывает страницы...
 

For some reason I can't catch a bar in the loop, which starts at 15 o'clock.

If I write if(i<24) as a condition, the log displays the time of each bar for the day, but the required condition is not met:


   Counted_bars=IndicatorCounted(); // Количество просчитанных баров 
   i=Bars-Counted_bars-1;           // Индекс первого непосчитанного
   while(i>=0)                      // Цикл по непосчитанным барам
     {
      
      if( TimeHour(iTime(NULL,PERIOD_H1,i)==15)  )
      //if(i<24)
      Print("TimeHour = ", TimeHour(iTime(NULL,PERIOD_H1,i)));
      
      CrossDown[i]=High[i]+250*Point;
   
      i--;                          // Расчёт индекса следующего бара
     }
Reason: