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

 

Good afternoon, please advise how to write a correct algorithm for writing each five-minute bar to a file without repeats in the form: Time;Open;High;Low;Close; ?

 

I'm sorry, I wanted to send my EA for real, but it doesn't do anything, it turns out I don't like stops, error 130.

I tried to put them here, but they are right where I want them. For a pending sell higher and a pending buy lower. Even if by 3000 pips.

 
Dimka-novitsek:

I'm sorry, I wanted to send my EA for real, but it doesn't do anything, it turns out I don't like stops, error 130.

I tried to put them here, but they are right where I want them. For a pending sell higher and a pending buy lower. Even if by 3000 pips.

I have everything written in my Expert Advisor correctly but errors still occur... But everything is correct! Prices are normalized, stops below BUY, above SELL, takeprofit levels above BUY, below SELL, RefreshRates() in every line, all variables are double... Can you help me? :(


first_may:

Hello, Could you please advise how to write correctly an algorithm for writing in a file each 5-minute bar without repeats in the form: Time;Open;High;Low;Close; ?

And which algorithm have you settled on?
 
I'm sorry, I thought maybe I'm being stupid after all. I think the EA has been tested recently, with stops...
 
Dimka-novitsek:
I'm sorry, I thought maybe I was dumb after all. I think the Expert Advisor has been tested recently, with stops...

You are now trying to make a task work that is clearly beyond your capabilities...

Start with an easier one and gradually increase the complexity of the task you have set.

But until the current task works correctly, don't move on to the next one!

 
MaxZ:

I've got everything right in my EA too, but I still get errors... But everything is right there! Prices are normalized, stops lower BUY, higher SELL, takeprofits higher BUY, lower SELL, RefreshRates() in every line, all variables double... Can you help me? :(


And what algorithm did you use?

I learnt how to work with halves from the article https://book.mql4.com/ru/functions/files, but I can't figure out how to determine if there is a new bar, i.e. five minutes have passed and I have to make a record in the file.

 

well, there you go.

 

well, there you go.

Files:
 
first_may:

I learned how to work with halves from the article https://book.mql4.com/ru/functions/files, but I can't figure out how to determine if a new bar has appeared, i.e. five minutes have passed and I need to make a record to the file.

I have been using the following construction for more than half a year:

datetime TimeLastBar;
...

int start()
{
   ...
   
   if (TimeLastBar != Time[0])
   {
      TimeLastBar = Time[0];
      ...
   }
}

The appearance of a new bar can also be checked via the Bars predefined variable. But I got bored with the method described above. Maybe it's faster with Bars! :D

 
MaxZ:

I've got everything right in my EA too, but I still get errors... But everything is right there! Prices are normalized, stops lower BUY, higher SELL, takeprofits higher BUY, lower SELL, RefreshRates() in every line, all variables double... Can you help me? :(

Did you do a search?
Reason: