mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-25 22:08:05 +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)
|
if (isNew)
|
||||||
{
|
{
|
||||||
_p_state = _state;
|
_p_state = _state;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_state = _p_state;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isNew)
|
|
||||||
{
|
|
||||||
_index++;
|
_index++;
|
||||||
if (_count < _period)
|
if (_count < _period)
|
||||||
{
|
{
|
||||||
_count++;
|
_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_state = _p_state;
|
||||||
|
}
|
||||||
|
|
||||||
int bufIdx = (int)(_index % _period);
|
int bufIdx = (int)(_index % _period);
|
||||||
var (high, low) = GetValid(input.High, input.Low);
|
var (high, low) = GetValid(input.High, input.Low);
|
||||||
|
|||||||
@@ -221,20 +221,16 @@ public sealed class Fcb : ITValuePublisher
|
|||||||
if (isNew)
|
if (isNew)
|
||||||
{
|
{
|
||||||
_p_state = _state;
|
_p_state = _state;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_state = _p_state;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isNew)
|
|
||||||
{
|
|
||||||
_index++;
|
_index++;
|
||||||
if (_count < _period)
|
if (_count < _period)
|
||||||
{
|
{
|
||||||
_count++;
|
_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_state = _p_state;
|
||||||
|
}
|
||||||
|
|
||||||
var (high, low) = GetValid(input.High, input.Low);
|
var (high, low) = GetValid(input.High, input.Low);
|
||||||
|
|
||||||
|
|||||||
@@ -101,20 +101,16 @@ public sealed class Mmchannel : ITValuePublisher
|
|||||||
if (isNew)
|
if (isNew)
|
||||||
{
|
{
|
||||||
_p_state = _state;
|
_p_state = _state;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_state = _p_state;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isNew)
|
|
||||||
{
|
|
||||||
_index++;
|
_index++;
|
||||||
if (_count < _period)
|
if (_count < _period)
|
||||||
{
|
{
|
||||||
_count++;
|
_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_state = _p_state;
|
||||||
|
}
|
||||||
|
|
||||||
int bufIdx = (int)(_index % _period);
|
int bufIdx = (int)(_index % _period);
|
||||||
var (high, low) = GetValid(input.High, input.Low);
|
var (high, low) = GetValid(input.High, input.Low);
|
||||||
|
|||||||
@@ -197,20 +197,16 @@ public sealed class Pchannel : ITValuePublisher
|
|||||||
if (isNew)
|
if (isNew)
|
||||||
{
|
{
|
||||||
_p_state = _state;
|
_p_state = _state;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_state = _p_state;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isNew)
|
|
||||||
{
|
|
||||||
_index++;
|
_index++;
|
||||||
if (_count < _period)
|
if (_count < _period)
|
||||||
{
|
{
|
||||||
_count++;
|
_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_state = _p_state;
|
||||||
|
}
|
||||||
|
|
||||||
int bufIdx = (int)(_index % _period);
|
int bufIdx = (int)(_index % _period);
|
||||||
var (high, low) = GetValid(input.High, input.Low);
|
var (high, low) = GetValid(input.High, input.Low);
|
||||||
|
|||||||
@@ -66,17 +66,13 @@ public sealed class Mgdi : AbstractBase
|
|||||||
if (isNew)
|
if (isNew)
|
||||||
{
|
{
|
||||||
_p_state = _state;
|
_p_state = _state;
|
||||||
|
_state.Count++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_state = _p_state;
|
_state = _p_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNew)
|
|
||||||
{
|
|
||||||
_state.Count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
double price = input.Value;
|
double price = input.Value;
|
||||||
if (!double.IsFinite(price))
|
if (!double.IsFinite(price))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user