- Array question about High[],Low[],Close[],Open[] etc.
- Can't find bug, please help
- TP and SL ten times higher
Bars
Returns the number of bars count in the history for a specified symbol and period.
So this has got nothing to do with the number of bars on the chart and so it will not be affected by you changing the chart dimensions.
Maybe you are referring to:
VisibleBars
Gets total number of visible chart bars.
In any case if you are running an EA that uses for example a Moving Average of 100, then in order to calculate the value of this moving average, at least 100 bars have to be present, or the function will give a false reading.
If there are less then 100 bars in history, the correct value can not be calculated and if you are not using this filter it can result in unwanted or false entries.
samusmus1: why do people use this protection in their EA?
| They are following what some moron did 15 years ago and don't know any better. They aren't a complete idiot, some parts are missing. |
In case of a symbol change, timeframe change, account change or terminal (re-) start it could be that the EA, indicator or script starts working while the quotes and other stuff (e.g. tickvalue) hasn't been available yet. OnInit() has already been passed and some of your values could have been set incorrectly!
I don't see how what you wrote is related to the topic ?
The question was: "Why..."
Bars>100 is a protection against this kind of problem I described.
I check as well MarketInfo(Symbol(),MODE_TICKVALUE)) in start() or OnTick() or OnCalculate() ..
It is the reason and the answer of "Why ..."
The question was: "Why..."
Bars>100 is a protection against this kind of problem I described.
I check as well MarketInfo(Symbol(),MODE_TICKVALUE)) in start() or OnTick() or OnCalculate() ..
It is the reason and the answer of "Why ..."
Sure, I know it's your answer ;-)
But what I don't see is how "Bars < 100" is a protection against "the quotes and other stuff (e.g. tickvalue) hasn't been available yet" ? I mean, if it's one, it's not a good one in my opinion.
Anyway, probably not important.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use