Errors, bugs, questions - page 851

 

moved to this thread, no answer in the Dummies)

I have not found anything on how to work with files, can someone kindly suggest how to organize a loop using CFileTxt, figuring out the number of lines in the file and get the value of each string in a text variable?

It seems to be simple, but no articles or manuals on this subject, or I've searched badly (

i have a good example of working with lines in MT4, it would be good if somebody wrote an article for MT5

#include <Files\FileTxt.mqh>

 
........
CFileTxt Txt;
........

int reshandle=Txt.Open(test.csv",FILE_READ|FILE_CSV);
int j=количество строк в текстовом файле;
for (int i=1;i<=j;i++) 
   {
     string line=значение текущей строки i;
   }
 
Olegts:
I have not found anything about working with files, can someone kindly tell me how to organize a loop using CFileTxt, figuring out the number of lines in the file and get the value of each string in a text variable?

It seems to be simple, but there are no articles or manuals on this subject, or I've searched badly again(



This is usually how I read txt:

 if(filehandle!=INVALID_HANDLE)
     {

 while(StringFind(Stroka,"Конец файла",0)<0 && !IsStopped())
        {

         Stroka=FileReadString(filehandle);

.........

          }

     }

 
Fia:

That's usually how I read txt:

 if(filehandle!=INVALID_HANDLE)
     {

 while(StringFind(Stroka,"Конец файла",0)<0 && !IsStopped())
        {

         Stroka=FileReadString(filehandle);

.........

          }

     }


Thank you, I will look at your version

I triedCArrayString, it would be prettier than working with a text file, and the array can be saved in the file and there is sorting with substitutions.

 
please tell me how to make it multi-currency, I tried but failed, please tell me where the mistake is and advice on how to make it better
Files:
lucky.mq5  4 kb
 

Afternoon!

In MetaTrader5 it is possible to create an indicator which draws bars (#property indicator_type DRAW_BARS)

I have done it.

Now my question is: Can I automatically overlay other indicators on these bars?

1) simpler - for example a standard moving average, on HL/2 (yes, there is an option "use data from previous indicator", but there is no choice what kind)

2) more complicated - to apply to these bars an indicator that uses high, low, open, close?

Or for each indicator I have to manually add it through iCustom?

 
ilunga: In MetaTrader5 it is possible to create an indicator which draws bars (#property indicator_type DRAW_BARS) It worked for me.

Now a question: is it possible to automatically overlay other indicators on these bars:

1) simpler - for example a standard moving average, on HL/2 (yes, there is an option "use data from previous indicator", but there is no choice what kind)

2) more complicated - to apply to these bars an indicator that uses high, low, open, close?

Have you tried to enter additional arrays for new indicator buffers and using these new indicator buffers to draw the required lines? The calculation part for these lines should be written by yourself.
 
Yedelkin:
Have you tried to enter additional arrays for new indicator buffers, and use these new indicator buffers to draw the needed lines? Do you want to write the calculation part for these lines yourself?

That's exactly what I would like to avoid) That's why I asked here

I do not want to add fractals, moving averages and a couple more indicators just to see how they look

 
ilunga: I would like to avoid it) That's why I asked here ... I don't want to "append" ... for each indicator. I don't want to "add" ... ... I don't want to add ... a couple more indicators just to see how they look

Then let's define the terms. In MQL5, an indicator is a separate program that reflects certain graphical constructions on the chart. When you talk about "indicator overlay", what exactly are we talking about? In particular, what are we talking about in the question "...Or, for each indicator you should manually add it through iCustom?

 
Yedelkin:

Then let's define the terms. In MQL5, an indicator is a separate program that reflects certain graphical constructions on the chart. When you talk about "indicator overlay", what exactly are we talking about? In particular, what exactly are we talking about in the question "...Or, you have to add each indicator manually through iCustom?

What I mean is the following:

Here I opened EURUSD H1 chart. I can put several moving averages on it. One by Close prices, one by Open prices, one by High prices and one by Low prices.

I can also throw a moving average on the previous moving average (which is the fourth one, on Low prices).


Now, let's continue.

I take an indicator from the website ( https://www.mql5.com/ru/code/337 ) that draws bars.

May I also use moving averages, which I used earlier? If so, how.

DRAW_BARS
DRAW_BARS
  • votes: 5
  • 2011.04.08
  • MetaQuotes Software Corp.
  • www.mql5.com
Стиль DRAW_BARS рисует бары по значениям четырех индикаторных буферов, в которых содержатся цены Open, High, Low и Close.
 
ilunga: I opened EURUSD H1 chart. I can use several moving averages on it. One by Close prices, one by Open prices, one by High prices and one by Low prices.

I can also throw a moving average over the previous moving average (which is fourth, at Low prices).

Now continuing. I take the indicator from the website ( https://www.mql5.com/ru/code/337 ), which draws bars. May I also use moving averages, which I used earlier? If so, how.

In other words, do you want moving averages to be calculated based on technical/user indicator bars instead of EURUSD H1 chart data?
Документация по MQL5: Технические индикаторы
Документация по MQL5: Технические индикаторы
  • www.mql5.com
Технические индикаторы - Документация по MQL5