This commit is contained in:
2025-12-25 16:57:18 +03:30
parent 3fe79f0f52
commit f8dcb89644
2 changed files with 716 additions and 28 deletions
+8 -28
View File
@@ -7126,36 +7126,21 @@ double GetTrueRange(
_barIndex = NormalizeInt(_barIndex, 0);
//
XOHCL bar;
XOHCL pBar;
double _low = iLow(_symbol, _period, _barIndex);
double _high = iHigh(_symbol, _period, _barIndex);
double _pLow = iLow(_symbol, _period, _barIndex + 1);
double _pHigh = iHigh(_symbol, _period, _barIndex + 1);
double _pClose = iClose(_symbol, _period, _barIndex + 1);
//
bool has =
bar.Init(
_symbol,
_period,
_barIndex //
);
if (!ignorePC)
{
//
has = has &&
bar.GetPreviousBar(pBar);
}
if (!has)
{
return result;
}
//
double hlDiff = bar.high - bar.low;
double hlDiff = _high - _low;
//
if (!ignorePC)
{
//
double hpcDiff = MathAbs(bar.high - pBar.close);
double lpcDiff = MathAbs(bar.high - pBar.close);
double hpcDiff = MathAbs(_high - _pClose);
double lpcDiff = MathAbs(_high - _pClose);
//
result = MathMax(hlDiff, hpcDiff);
@@ -7166,11 +7151,6 @@ double GetTrueRange(
result = hlDiff;
}
//
// Cleanup ...
bar.Clean();
pBar.Clean();
//
return result;
}