Hi. I don't know what exactly happens. I am comparing two integers that have the same value (with the > operator) and However the control statement "if" returns true ...
Does anyone know why this happens and how to fix it?
I attach a image of the console output...
And this is the code:
NOTE:
start, end and maxPeriods are integers too... in fact, (end = rates_total) (start = 0 or start = maxPeriods or start=rates_total-1)
if(usedData > rates_total - maxPeriods)
Unless maxPeriods is zero, usedData will always be bigger.
You are subtracting maxPeriods from rates_total.
Unless maxPeriods is zero, usedData will always be bigger.
Look at the attach image of the console output. It is printing the same value. So the sentence is true. But it can't be if the numbers are equal because I am compared to the (greater than) operator...
This is my other part of the code ... but everything indicates that the problem must be the "if" control statement
//+------------------------------------------------------------------+ bool CalculateLimits(const int rates_total, const int prev_calculated) { start = 0; end = rates_total; if(!isFirstCalculation && prev_calculated==0) { start = maxPeriods; isFirstCalculation = true; return true; } else if(rates_total==prev_calculated+1) start=rates_total-1; else if(rates_total<=prev_calculated) start=rates_total-1; return false; }
You are subtracting maxPeriods from rates_total.
Unless maxPeriods is zero, usedData will always be bigger.
I'm sorry ... You were right ... I think I've been programming too many hours ... getting a little sleep would do me good XD ...
Thanks for your help!!
I'm sorry ... You were right ... I think I've been programming too many hours ... getting a little sleep would do me good XD ...
Thanks for your help!!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi. I don't know what exactly happens. I am comparing two integers that have the same value (with the > operator) and However the control statement "if" returns true ...
Does anyone know why this happens and how to fix it?
I attach a image of the console output...
And this is the code:
NOTE:
start, end and maxPeriods are integers too... in fact, (end = rates_total) (start = 0 or start = maxPeriods or start=rates_total-1)