Questions from a "dummy" - page 250

 
stringo:

the interval you specify is: current time - current time (current bar time) plus some number of seconds (i.e. some future time)

What do you want to get in a given interval? How will the price develop? "If I knew the price, I'd live in Sochi".

Nah. It's simpler than that.

I have the start of bar D1.

D1 + 86400 day minutes.

In those minutes I look for max/min and specify the time.

But Bars doesn't work at all on the first try, and I strongly suspect it occasionally lies. I'm trying to write a ToR for now, to cross-check :)

In any case, the problems with Bars turned out to be bigger than with Copy. In this thread, the man also seems to have a problem with Bars.

 
stringo:
You don't need to take this question to servicedesk. What answer do you want to get?

OK, I won't.

PS To check that the function works.

 
tol64:
Check (log) the start (t[0]+b) and end (t[0]) times of the range. You will get it right away.
This is not enough. We must double-check the returned number of bars with another function.
 
Silent:

OK, I won't.

PS to check if the function works.

I am telling you straight away that you will get 0 bars either way! There's nothing to check. If you don't understand why you will get 0 bars anyway, then ask the question here.

Question: how many bars did you want to get?

 
Silent:
This is not enough. You should double-check the returned number of bars with another function.

I'm not saying it can't be enough. But you've got to start figuring things out somewhere. Otherwise, you'll be stuck in a bind every step of the way. )))

Check the values in the log or in the debugger and you will immediately know where to go next.

 
stringo:

I tell you straight away that you will get 0 bars either way! There is nothing to check. If you don't understand why you will get 0 bars anyway, then ask the question here.

Counter question: how many bars did you want to get?

And I don't consistently get 0.

1st try - 0.

2nd try - value, but at the same time.

   bm=Bars(_Symbol,PERIOD_M1,tm[0]+b,tm[0]);
   Print("bm = "+bm);
//--- возвращает bm = например 368
   bm=Bars(_Symbol,PERIOD_M1,tm[0]-b,tm[0]);
   Print("bm = "+bm);
//--- возвращает bm = а тут 1201

And it's on two adjacent bars, and the second value will consistently repeat, but the first will not.

And when running on minutes I got 6 in both cases, with b > 50000...

Anyway, okay. If all is well with the function, it's easier for me to discard it.

 
tol64:

I'm not saying it can't be enough. But you've got to start figuring things out somewhere. Otherwise, you'll be stuck in a rut every step of the way. )))

Check the values in the log or in the debugger and you'll immediately know where to go from here.

It's all clear, I already have each step printed, and the function is pulled into a separate script... Ok, I'll think about it at my leisure.
 
Silent:
This is not enough. You need to double-check the returned number of bars with another function.

If a function doesn't work, you should start looking for an error by checking the parameters passed to the function.

Stringo has already told you directly: "erroneous parameters are passed to the function", and you still can't understand it.

 
Silent:

And I don't get a steady 0.

1st try - 0.

2nd try - value, but at the same time.

And running it on minutes would get 6 in both cases, with b > 50000...

Anyway, ok. If all is well with the function, it's easier for me to discard it.

You don't have to give up the function.

When you request data in the range"current time - current time plus some number of seconds", it means that you are requesting data from the future. The data does not yet exist at the time of the request.

If you were requesting data in the range "current time - current time minus some number of seconds", then you are requesting potentially existing data.

Документация по MQL5: Дата и время / TimeCurrent
Документация по MQL5: Дата и время / TimeCurrent
  • www.mql5.com
Дата и время / TimeCurrent - Документация по MQL5
 
Contender:

If a function does not work, you should start looking for an error by checking the parameters passed to the function.

Stringo has already told you directly: "erroneous parameters are passed to the function", and you still can't understand it.

OK, OK.

Got it, I'll correct myself, I'm off to learn.

Reason: