Questions from Beginners MQL4 MT4 MetaTrader 4 - page 101

 
MikeZv:

Thank you Nikolay...
I took from both lines.
Then I merged them into one (left one buffer). Same result.


here is the script which shows that everything works correctly.

printout result 2017.11.04 01:15:45.359 check EURUSD,H1: 1.163966063602423 2147483647.0


The indicator has draw_begin=500 variable, i.e. the number of candles from the end (from the freshest candle) on which the chart is drawn.
And when we extract the indicator value using the iCustom() method, this 500 is counted from which candlestick ?
Why it's important - draw_begin is used not only for drawing, but also participates in calculation of indicator ...

it is counted from the 0 bar of the current chart. i.e. if the value is 500, count 600 bar, there will be no result

Files:
check.mq4  2 kb
 
Nikolay Ivanov:

here is the script which shows that everything works correctly.

printout result 2017.11.04 01:15:45.359 check EURUSD,H1: 1.163966063602423 2147483647.0



Thanks for your reply, Nicholas!
When I apply the script to the EURUSD D1 chart, it outputs

2017.11.04 12:54:37.009 check EURUSD,Daily: 2147483647.0 1.103082155651458

----------------------------------------------------------------------------------
And if I read iCustom() from the EA in testing, while no chart is open, from which candle will the indicator be read (to the question about draw_begin)?
And if I am testing for 2010, then this indicator cannot be used ?

 
MikeZv:


And if in testing, we read iCustom() from the Expert Advisor without opening any chart, from which candlestick will the indicator be calculated (drawing_begin question)?
And if I am testing for 2010, then this indicator cannot be used ?


It will be OK, 0 bar in the tester or in real life, with or without a graph. It will be used to calculate this value.

 
Nikolay Ivanov:

It will be OK, 0 bar in the tester or in real life, with or without a graph. It will be counted from it.


So zero bar is the last bar downloaded (contained in the archive) ?

 
MikeZv: So the zero bar is the last one uploaded (contained in the archive) ?

The tester looks at the history within a given range. The last bar viewed will be the null bar at this point. The next bars are as if there are no bars yet. Then the next history bar is taken, which becomes zero. This continues until the end of the pre-set testing range. Full simulation of real trading

 
STARIJ:

The tester looks through the history in a given range. The last bar viewed and will be zero at the moment. The next bars are sort of missing for the time being. Then the next history bar is taken, which becomes zero. This continues until the end of the pre-set testing range. Full simulation of real trading


STARIJ, thanks for the reply.
So the zero bar in the tester, is the one that counts at the moment and it keeps shifting to the last one in the archive.
I.e. if a period of 500 D1 candles is set, it is in any case ( in the tester) - two years before each candle in question.
Did I get it right?

 
MikeZv:

STARIJ, thanks for the reply.
So the zero bar in the tester, is the one that counts at the moment and it keeps shifting to the last one in the archive.

The zero bar is the last one available at the moment. And it moves towards the end of the archive BEFORE the END of the specified testing interval


I.e. if a period of 500 D1 candles is set, it is in any case ( in the tester) - two years before each candle in question.
Did I get it right ?

And this part is hard to understand.

What does 2 years have to do with it? Zero bar is the one under consideration at the moment, it is the LAST one you see. After that, the bars are sort of non-existent. But a period passes (actually it's much faster as the next bar is ready now, we just need to finish the required calculations) and the next bar is introduced. Now it's the last one, now it's zero. But a period passes and the next bar is entered. Now it is the last one, now it is zero. And so on to the end of the entire testing range.

 
STARIJ:

What does this have to do with 2 years? The zero bar is the one in question at the moment, it is the LAST one in question. After that, the bars are sort of non-existent. But a period passes (actually it's much faster as the next bar is ready, we'll get it now, just need to finish the required calculations) and the next bar is introduced. Now it's the last one, now it's zero. But a period passes and the next bar is entered. Now it is the last one, now it is zero. And so on to the end of the entire testing range.

Probably easier to phrase as "Where the current price of Bid and Ask is the zero bar".

 
Vitaly Muzichenko:

Probably easier to say "Where the current price is Bid and Ask is the zero bar".

The price on the chart is on the vertical axis from bottom to top, while the time and bar numbering is on the horizontal axis to the right

The zero bar is the last bar currently available. The following bars exist in the history, but are not yet available to the tester. Later, when this bar is counted, the tester will go to the next bar, which will become zero for him.

 
STARIJ:

Price on the chart on the vertical axis from bottom to top, and time and bar numbering on the horizontal axis to the right

Zero bar is the last bar currently available. The following bars exist in the history, but are not yet available to the tester. Later, when this bar is counted, the tester will go to the next bar, which will become zero for him.

Well, what did I write?

Reason: