last ...
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user