I've been working with some code that does simple things to get a hang of the language and make sure I understand the basic concepts.
For instance, I use the following to iterate over the entire bar history to the most current bar for calculations (see code below).
My question is how to handle going over an entire history of bars, for a given sample period for an indicator doing some calculations along the way -- so I'd need to use a rolling "window" of some kind to do this. I'm not too clear on how to manipulate/use prev_calculated, though I think that is part of the solution.
If anyone could please show me how to construct a simple loop that iterates for say, every 15 bars and does a calculation to display on the indicator plot in a separate window, I'd be very grateful. I think this is the only major stumbling block I have, and it is driving me nuts trying to work with array indexes and getting it all wrong.
Thank you, but I'm asking for annotated answers.
You are correct that there are indicators in the codebase - but none of them seem to have the granular annotations for me to understand it deeply.
I'm sorry I'm not as smart or clever as most of you, I need just a little bit of clarification.
I clearly stated - please show me a basic loop where it iterates over bar history for 'n' defined periods to calculate a custom indicator.
If that is too much, then I guess I'll just stumble through it while you laugh at my lack of knowledge.
You are misinterpreting what I wrote.
I am just saying I have no idea how to help you, some hopefully someone will able to do it. It's not about your lack of knowledge, it's about my lack of "teaching" skills.
An open entreaty then, to those that have mastered this topic to visit upon me a singular simple example of iterating over a given bar history for 'n' periods - I beseech you, out of frustration from having combed through the docs, looked at other indicators (with nearly no programmer comments), and have finally come to these rocky shores to seek redemption.
I feel that I'm on the cusp of understanding, I just need an example that isn't cluttered with trying to calculate an EMA/SMA/FIB/Bollinger/SAR/RSI ... just something dead-simple doing a plain task like calculating ranges, as I've pasted in my original comment.
Thanks in advance....
Greetings, I am working with MQL5 hence my query in this forum.
Just a polite reminder that I still exist, and my problem still festers.
Hope is a precious commodity that I must cling to.
Thanks in advance.
In the ".\MQL5\Indicators\Examples" folder, you will find several examples of Indicators provided by MetaQuotes themselves.
Choose one (or more) of the indicators that best fits your needs and study how it works, while always referring to the documentation.
Trying to explain it to you is going to be difficult. It will be easier for you to just "do it" by using one of those Indicators as a "skeleton" or starting point and then you can alter it according to your needs.
After that, you can re-post here with more specific queries about what you did not understand after trying it out yourself.
The following Article may also be of assistance: How to Write an Indicator on the Basis of Another Indicator