- Don't just post snippets of what you think you are doing. Post the real code.
- See How to do your lookbacks correctly.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello everyone,
Im making my first indicator and I dont understand why its not refreshing/calculating the first bar.
The indicator works with no errors apparently. As soon as I drag the indicator to a chart, the whole buffer is ok, but the first bar is 0. And the next bars that will eventually feed the array come as 0 as well.. and will remain like that until I switch back and forth timeframes, for example M1 to M5. This re-initiates the indicator and the whole buffer gets recalculated.
So if i leave the chart running for 10 mins on the M1 timeframe, i end up with the 10 newest bars flat at 0 on the indicator. How can I solve this?
Im calling ArraySetAsSeries() as false, if I understand well, index[0] on the buffer would be the oldest bar on the chart (far left) and the current bar being the last (far right).
I assume the logic would be the same in reverse if I change ArraySetAsSeries() to true. I would have to reverse my loop to step -1, so to speak, but I assume that is not the problem (?)
The main code is under a function, type void, that gets called from OnCalculate().
I have failed trying the following:
OnCalculate(), returning(rates_total -1)
void Functionlogic(), the for loop ( i=limit ; i < (rates_total - 1) ; i++ )
I still have the same effect..
Any lights on the matter would be great!
Thanks
M