fix xca indicator to calculate all bars if necessary ...

This commit is contained in:
2025-04-29 09:19:52 +03:30
parent 7060ed012a
commit f7e8e1c5bf
3 changed files with 48 additions and 21 deletions
+25 -2
View File
@@ -529,6 +529,9 @@ double resBuffer[];
// this counts Available Bars ...
int limit;
//
int firstBarIndex;
//
int maxLength;
@@ -1404,10 +1407,16 @@ void CalculateBuffers(
int barsLimit = startCalculationForLastBars > 0
? startCalculationForLastBars
: 0;
if (barsLimit == 0)
{
//
barsLimit = ratesTotal;
firstBarIndex = barsLimit - 1;
}
//
// bool canCalculate = true;
bool canCalculate =
barsLimit == 0 ||
bar_index <= barsLimit;
if (canCalculate)
{
@@ -1778,7 +1787,7 @@ void CalculateValues(
bool isFirstBar =
startCalculationForLastBars > 0
? bar_index == startCalculationForLastBars
: bar_index == ratesTotal;
: bar_index == firstBarIndex;
XOHCL iBar;
bool isInited = iBar.Init(
@@ -2167,6 +2176,13 @@ bool IsSwingLow(
//
bool result = false;
//
result = index + 1 + length <= firstBarIndex;
if (!result)
{
return result;
}
//
for (int i = index + 1; i <= index + length; i++)
{
@@ -2193,6 +2209,13 @@ bool IsSwingHigh(
//
bool result = false;
//
result = index + 1 + length <= firstBarIndex;
if (!result)
{
return result;
}
//
for (int i = index + 1; i <= index + length; i++)
{