Mt4 End of support. - page 16

 
Artyom Trishkin:

Now make it return the fact of opening a new bar on M5. Then make it return the fact of opening on H1, and then return the fact of opening on D1

Why?

My TS does not imply trading on the "new bar". I took it out of the closet at your request.

And if you have a moose growing, it will continue to grow on a new bar. And on the next one after the new one. And (yes, yes, do not be surprised) at the beginning of the next day it won't go anywhere.


So what? Create a new top like this with a description?

I like it much easier to give an estimate of where a tool will go than to write a bot for it.


As for the question

For 5 minutes, the algorithm will be about this:

If 300 seconds have passed since the last value, then this bar is new, respectively, 3600 for an hour.

 
Mickey Moose:

Why?

My TS does not involve trading on a "new bar" at all I took it out of the closet at your request.

And if your moose is growing, it will continue to grow on the new bar. And on the next one after the new one. And (yes, don't be surprised) at the beginning of the next day it won't go anywhere.


So what? Create a new top with the same description?

A description of what? What kind of new topic?

You were simply asked to make a hypothetical task - to find a new bar. On at least three timeframes in one EA.

 
If Rehtag Konow would like to participate, please do so.
 
Alexey Viktorov:
If Reteg Konow wishes to participate, please be my guest.

No, not like this. It's like this:

If @Reteg Konow wants to participate, you're welcome.

 
Alexander Puzanov:

The other side is those who don't need OOP, because there are no OOP-specific tasks. But they use it. Because they like it, it is progressive, professional programmers use it and it will come in handy.

But from the viewpoint of result it does not matter much whether it has OOP or not

It is not.

I have already said more than once what the advantage of the OOP approach is.

Encapsulation allows me not to worry that I could "get in the wrong place" and disturb the work of ready to use module.

Inheritance and polymorphism - allows to easily change behavior of similar objects, in case of MT - that is orders (open MT4, pending and historical MT4-5) and MT5-positions. In addition - the protocols of interaction with the trade server.

Also, my internal architecture of the Expert Advisor - there is a queue of requests for trade actions, all the TC in the Expert Advisor send their requests to this queue and then the trade processor executes these requests. So the requests themselves are very effectively described within OOP-approach.

All these things would be no less easy to write in procedural approach, and most importantly - then it is very difficult to modify, if necessary.

 
Alexey Viktorov:
If Rehtag Konow wants to participate, you're welcome to do so.

Participate in what?

I'm sorry, I don't understand.

 
Artyom Trishkin:

No, not like this. It's like this:

If @Reteg Konow wishes to participate, you're welcome.

That didn't work for me. And not everyone has push notifications enabled. I certainly do not and never will.

 
Реter Konow:

Participate in what?

Sorry, I do not understand.

The beginning is here.

Forum on trading, automated trading systems and trading strategy testing

Mt4 End Support.

Alexey Viktorov, 2017.09.10 16:47

If you are willing, let's do it this way:

Do you have a function to define a new bar? If you have it, post its code.

And describe the sequence of calls to this function when we need to know the new bar on M5, H1 and D1.

Then we will continue.


 
It's a continuation

Forum on trading, automated trading systems and trading strategy testing

Mt4 End of support.

Mickey Moose, 2017.09.10 17:40

I really don't know why you need it. This is a skeleton for the current TF.
bool isNewBar() //true  если бар новый
  {
   static datetime last_time=0;
   datetime lastbar_time=SeriesInfoInteger(Symbol(),Period(),SERIES_LASTBAR_DATE);
   if(last_time==0)
     {
      last_time=lastbar_time;
      return(false);
     }
   if(last_time!=lastbar_time)
     {
      last_time=lastbar_time;
      return(true);
     }
   return(false);
  }

Forum on trading, automated trading systems and trading strategy testing

Mt4 End of support.

Alexey Viktorov, 2017.09.10 17:45

I have been working on this for a long time and I am confident that it will work. What if on any timeframe it is necessary to identify the onset of a new day? I.e. a new bar on D1. How do you do in this case?

It's a sequence of a self-taught person explaining the benefits of OOP to an equally self-taught person. Not to the full extent, but only the rudiments of OOP.



 
Alexey Viktorov:
This is a continuation.

So you need a function that determines the start of a new bar on any timeframes?