[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 333

 
Can you tell me how to implement it in the code - there is a parameter it should be added to a file with a periodicity of n minutes?...

21
LLIAMAH 11.11.2011 21:03
I mean, there is one parameter and it changes weekly. And I want to create an auxiliary adviser, which will save this parameter to a file in text format or better yet in excel. The periodicity of information in the file, I think I can write myself, the main thing code or function that creates a file and writes there information when you access it. Can you help?

We can help :) As someone once helped us, we will help you :).

Kim has a wonderful function that adds data to the end of the text document. With it in hand, all you have to do is keep track of those very annn minutes. Once they've passed, take our changed parameter, stick it into Kim's function and you get an updated text document. (Except I VERY much wish you would have understood HOW this function works). Here it is:

//+------------------------- WritingLineInFile() ----------------------------
//| Дописывание строки в конец файла
//+---------------------------------
void WritingLineInFile(string FlName, string Text){
  int file_handle=FileOpen(FlName, FILE_CSV|FILE_READ|FILE_WRITE, " ");
        if (file_handle>0){
                FileSeek(file_handle,0,SEEK_END);
                FileWrite(file_handle,Text);
                FileClose(file_handle);
        }
        else{
          Print("Ошибка ",GetLastError()," - Не удалось открыть файл ",FlName);
   }
}
//---------------------------------------------------------------------------

How to use it?

I have attached my indicator to this post. The only thing it does is write the price of each new tick into a text document. Have a look at the code - it's simple. I think that having a simple working indicator in your hands, you'll figure it out faster than if I tried to describe it in words.

Files:
 

Hi all, could you please advise a newbie, using one indicator buffer, I can draw such a thing on a chart:

I want to make a horizontal chart layout with one indicator buffer, but I don't understand how it works.

 
drknn:

We can help you :) As someone helped us back in the day, we can help you too :).

Kim has a great feature that adds data to the end of a text document. With it in hand, all you have to do is keep track of the very end of the minutes. Once they've passed, take our changed parameter, stick it into Kim's function and you've got an updated text document. (Except I VERY much wish you would have understood HOW this function works). Here it is:

How to use it?

I have attached my indicator to this post. The only thing it does is write the price of each new tick into a text document. Have a look at the code - it's simple. I think that having a simple working indicator in your hands, you will understand it faster than if I tried to describe it in words.

Thank you, Vladimir, it worked :) I have copied the code line by line in 15 minutes, no problems appeared, I have replaced DoubleToStr(Bid,Digits) value with my DoubleToStr(Profit_Loss,Digits) value without any problems :)

I decided to track the same minutes using the new bar function:

//+------------------------------------------------------------------+
// Определение появления нового бара!                                
//+------------------------------------------------------------------+
bool NewBar()
{
   static datetime lastbar = 0;
   datetime curbar = Time[0];
   if(lastbar!=curbar)
   {
      lastbar=curbar;
      return (true);
   } 
   else return(false);
}
//+------------------------------------------------------------------+

Thus, the information in the file is written either every minute, 5 minutes, 15, 30, hour, 4 or a day, depending on the timeframe, on which the auxiliary EA was attached :)

Thanks so much again! :) Helpful :)

 

Good afternoon!

Please advise how to organize the space in MetaEditor correctly.

I want to have indicators not just in a big list, but for each TS in a separate folder.

I tried the following: Computer - P.F- MetaTrader 4-experts - indicators and create a folder there, but apparently this is not correct,

Because data of this folder is not displayed in Navigator and is not available for work through the terminal.

Thank you. Regards, Olga

 

Probably the easiest thing to do is to rename the indicators so that each group starts with a different symbol/digit/letter/set of them.

But the unnecessary ones should be stored in a separate folder - they will not be visible, and it will be easy to get them when you need them (no matter how big or small).

The list will shrink and be ordered (alphabetically).

 
drknn:

We can help you :) As someone helped us in the past, we can help you :).

Kim has a great feature that adds data to the end of a text document. With it in hand, all you have to do is keep track of the very end of the minutes. Once they've passed, take our changed parameter, stick it in Kim's function and you've got an updated text document. (Except I VERY much wish you would have understood HOW this function works). Here it is:

How to use it?

I have attached my indicator to this post. The only thing it does is write the price of each new tick into a text document. Have a look at the code - it's simple. I think that having a simple working indicator in your hands, you will figure it out faster than if I tried to describe it in words.

One more question: I decided to do csv instead of txt format and replaced the filename line with:

FileName=Symbol()+"_"+DoubleToStr(Day(),0)+"_"+DoubleToStr(Month(),0)+"_"+DoubleToStr(Year(),0)+".csv";

Now it saves my parameter value to my excel document like this:

Can you tell me how I can divide the values into rows, so that in column A1 I enter the date value, in column B2 the time and in C2 the value of my parameter?

P.S. don't pay any attention to the values, because I checked it on the tester, now the market is closed... :(

 
google: excel separator site:mql4.com
 
Google:
google: excel separator site:mql4.com

Thanks, got it :)

 
How do I calculate the maximum allowable lot size with leverage etc.?
Thank you
 
What is the difference between POINT and TICKSIZE ? When queried through MarketInfo() they are the same, but should they be different if they have different names?
Reason: