Update JMA_chart indicator to use Indicator base class and add painting logic

This commit is contained in:
Miha Kralj
2023-04-12 13:47:25 -07:00
parent b99d451ea8
commit b655c05d72
8 changed files with 117 additions and 105 deletions
+2 -3
View File
@@ -26,7 +26,7 @@ public class CMO_Series : Single_TSeries_Indicator {
public override void Add((DateTime t, double v) TValue, bool update) {
if (this.Count == 0) { _plast_value = _last_value = TValue.v; }
if (update) _last_value = _plast_value; else _plast_value = _last_value;
if (update) {_last_value = _plast_value;} else {_plast_value = _last_value;}
Add_Replace_Trim(_buff_up, (TValue.v > _last_value) ? TValue.v-_last_value : 0, _p, update);
Add_Replace_Trim(_buff_dn, (TValue.v < _last_value) ? _last_value-TValue.v : 0, _p, update);
@@ -40,8 +40,7 @@ public class CMO_Series : Single_TSeries_Indicator {
}
double _cmo = 100 * (_cmo_up - _cmo_dn) / (_cmo_up + _cmo_dn);
if (_cmo_up + _cmo_dn == 0)
_cmo = 0;
if (_cmo_up + _cmo_dn == 0) {_cmo = 0;}
base.Add((TValue.t, _cmo), update, _NaN);
}
}