mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-07-27 17:27:43 +00:00
refactor: consolidate duplicate if (isNew) checks (S2589)
This commit is contained in:
@@ -102,20 +102,16 @@ public sealed class Dchannel : ITValuePublisher
|
||||
if (isNew)
|
||||
{
|
||||
_p_state = _state;
|
||||
}
|
||||
else
|
||||
{
|
||||
_state = _p_state;
|
||||
}
|
||||
|
||||
if (isNew)
|
||||
{
|
||||
_index++;
|
||||
if (_count < _period)
|
||||
{
|
||||
_count++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_state = _p_state;
|
||||
}
|
||||
|
||||
int bufIdx = (int)(_index % _period);
|
||||
var (high, low) = GetValid(input.High, input.Low);
|
||||
|
||||
@@ -221,20 +221,16 @@ public sealed class Fcb : ITValuePublisher
|
||||
if (isNew)
|
||||
{
|
||||
_p_state = _state;
|
||||
}
|
||||
else
|
||||
{
|
||||
_state = _p_state;
|
||||
}
|
||||
|
||||
if (isNew)
|
||||
{
|
||||
_index++;
|
||||
if (_count < _period)
|
||||
{
|
||||
_count++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_state = _p_state;
|
||||
}
|
||||
|
||||
var (high, low) = GetValid(input.High, input.Low);
|
||||
|
||||
|
||||
@@ -101,20 +101,16 @@ public sealed class Mmchannel : ITValuePublisher
|
||||
if (isNew)
|
||||
{
|
||||
_p_state = _state;
|
||||
}
|
||||
else
|
||||
{
|
||||
_state = _p_state;
|
||||
}
|
||||
|
||||
if (isNew)
|
||||
{
|
||||
_index++;
|
||||
if (_count < _period)
|
||||
{
|
||||
_count++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_state = _p_state;
|
||||
}
|
||||
|
||||
int bufIdx = (int)(_index % _period);
|
||||
var (high, low) = GetValid(input.High, input.Low);
|
||||
|
||||
@@ -197,20 +197,16 @@ public sealed class Pchannel : ITValuePublisher
|
||||
if (isNew)
|
||||
{
|
||||
_p_state = _state;
|
||||
}
|
||||
else
|
||||
{
|
||||
_state = _p_state;
|
||||
}
|
||||
|
||||
if (isNew)
|
||||
{
|
||||
_index++;
|
||||
if (_count < _period)
|
||||
{
|
||||
_count++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_state = _p_state;
|
||||
}
|
||||
|
||||
int bufIdx = (int)(_index % _period);
|
||||
var (high, low) = GetValid(input.High, input.Low);
|
||||
|
||||
@@ -66,17 +66,13 @@ public sealed class Mgdi : AbstractBase
|
||||
if (isNew)
|
||||
{
|
||||
_p_state = _state;
|
||||
_state.Count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
_state = _p_state;
|
||||
}
|
||||
|
||||
if (isNew)
|
||||
{
|
||||
_state.Count++;
|
||||
}
|
||||
|
||||
double price = input.Value;
|
||||
if (!double.IsFinite(price))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user