| / | Forum |
|
yarns90401
2008.04.18 19:25
Does the system value Bars include Bar[0] in the count? Thanks, Y |
|
Interview with Leonid Velichkovski (LeoV) There is an opinion that all types of neural networks can work in financial markets. But actually it is far from true. |
|
ukt
2008.04.18 20:52
If you look at editor help, it specfically states: "Number of bars in the current chart." So, if you had 10 bars then each bar open time would be: Time[9]..Time[0], where [0] is the current developing bar When one loops to process all bars (where Bars=10) in a chart one does
hth please note that the editor help for: MQL4 Reference - Predefined variables - Bars has an example. This example could be better simply because many learning to program see this code and believe is best practice... Why they gave an example that uses [i-1] is a mistery because is massive waste to do "-1" each iteration when all have to do is: (int i=0; i<Bars; i++) to achieve same thing. Sure I hear one say - "only example", but you can be sure 'they' would never code in anger using such practices... imagine StrategyTester with such redundant coding, where iterations are the basics of the beast once it gets going! (just my little rant about sometimes crazy docs - imho of course! :o)) int counter=1;
for(int i=1; i<=Bars; i++)
{
Print(Close[i-1]);
}
|