Skip to content

Commit

Permalink
Merge tag 'v3.000' into dev-indi-no-chart4
Browse files Browse the repository at this point in the history
  • Loading branch information
kenorb committed Aug 5, 2022
1 parent a7669c8 commit a33519b
Show file tree
Hide file tree
Showing 55 changed files with 171 additions and 169 deletions.
45 changes: 1 addition & 44 deletions Account/AccountMt.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,49 +317,6 @@ class AccountMt {
*/
static string GetType() { return AccountMt::GetServerName() != "" ? (IsDemo() ? "Demo" : "Live") : "Off-line"; }

/* Setters */

/*
@TODO Still used?
double UpdateStats(ENUM_ACC_STAT_VALUE _type, double _value) {
static datetime _last_check = TimeCurrent();
bool _stats_rotate = false;
for (unsigned int _pindex = 0; _pindex < FINAL_ENUM_ACC_STAT_PERIOD; _pindex++) {
acc_stats[_type][_pindex][ACC_VALUE_MIN][ACC_VALUE_CURR] =
fmin(acc_stats[_type][_pindex][ACC_VALUE_MIN][ACC_VALUE_CURR], _value);
acc_stats[_type][_pindex][ACC_VALUE_MAX][ACC_VALUE_CURR] =
fmin(acc_stats[_type][_pindex][ACC_VALUE_MAX][ACC_VALUE_CURR], _value);
acc_stats[_type][_pindex][ACC_VALUE_AVG][ACC_VALUE_CURR] =
(acc_stats[_type][_pindex][ACC_VALUE_AVG][ACC_VALUE_CURR] + _value) / 2;
switch (_pindex) {
case ACC_DAILY:
_stats_rotate = _last_check < ChartStatic::iTime(_Symbol, PERIOD_D1);
break;
case ACC_WEEKLY:
_stats_rotate = _last_check < ChartStatic::iTime(_Symbol, PERIOD_W1);
break;
case ACC_MONTHLY:
_stats_rotate = _last_check < ChartStatic::iTime(_Symbol, PERIOD_MN1);
break;
}
if (_stats_rotate) {
acc_stats[_type][_pindex][ACC_VALUE_MIN][ACC_VALUE_PREV] =
acc_stats[_type][_pindex][ACC_VALUE_MIN][ACC_VALUE_CURR];
acc_stats[_type][_pindex][ACC_VALUE_MAX][ACC_VALUE_PREV] =
acc_stats[_type][_pindex][ACC_VALUE_MAX][ACC_VALUE_CURR];
acc_stats[_type][_pindex][ACC_VALUE_AVG][ACC_VALUE_PREV] =
acc_stats[_type][_pindex][ACC_VALUE_AVG][ACC_VALUE_CURR];
acc_stats[_type][_pindex][ACC_VALUE_MIN][ACC_VALUE_CURR] = _value;
acc_stats[_type][_pindex][ACC_VALUE_MAX][ACC_VALUE_CURR] = _value;
acc_stats[_type][_pindex][ACC_VALUE_AVG][ACC_VALUE_CURR] = _value;
_last_check = TimeCurrent();
}
}
return _value;
}
*/

/* Class getters */

/**
Expand Down Expand Up @@ -500,7 +457,7 @@ class AccountMt {
double GetStatValue(ENUM_ACC_STAT_VALUE _value_type, ENUM_ACC_STAT_PERIOD _period, ENUM_ACC_STAT_TYPE _stat_type,
ENUM_ACC_STAT_INDEX _shift = ACC_VALUE_CURR) {
// @fixme
return acc_stats[_value_type][_period][_stat_type][_shift];
return acc_stats[(int)_value_type][(int)_period][(int)_stat_type][(int)_shift];
}

/* State checkers */
Expand Down
13 changes: 13 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ For example, to format file inplace, run:

clang-format -i File.mqh

### Syntax

To improve code compatibility, please use the following syntax:

| MQL | C++ | Syntax to use |
|:------------------|:------------------------|:---------------------------|
| `T name[]` | `_cpp_array<T> name` | `ARRAY(T, name)` |
| `T<A, B> N[]` | `_cpp_array<T<A, B>> N` | `ARRAY(T<A, B>, N)` |
| `obj.Method()` | `obj->Method()` | `obj PTR_DEREF Method()` |
| `obj.a1.a2` | `obj->a1->a2` | `PTR_ATTRIB2(obj, a1, a2)` |
| `obj.attr` | `obj->attr` | `PTR_ATTRIB(obj, attr)` |
| `str == NULL` | `str == NULL` | `IsNull(str)` |

## Proposing changes

To propose a code change on GitHub,
Expand Down
2 changes: 2 additions & 0 deletions Chart.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ class Chart : public Market {
/* Conditions */

/* Printer methods */

void SerializeStub(int _n1 = 1, int _n2 = 1, int _n3 = 1, int _n4 = 1, int _n5 = 1) {}
};

#endif
36 changes: 23 additions & 13 deletions EA.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -776,19 +776,29 @@ class EA : public Taskable<DataParamEntry> {
Strategy *_strat = strats.GetByKey(_order.Get<unsigned long>(ORDER_MAGIC)).Ptr();
Strategy *_strat_sl = _strat.GetStratSl();
Strategy *_strat_tp = _strat.GetStratTp();
if (_strat_sl != NULL) {
float _psl = _strat_sl.Get<float>(STRAT_PARAM_PSL);
int _psm = _strat_sl.Get<int>(STRAT_PARAM_PSM);
_sl_new = _trade.NormalizeSL(_strat_sl.PriceStop(_otype, ORDER_TYPE_SL, _psm, _psl), _otype);
_sl_valid = _trade.IsValidOrderSL(_sl_new, _otype, _order.Get<double>(ORDER_SL), _psm > 0);
_sl_new = _sl_valid ? _sl_new : _order.Get<double>(ORDER_SL);
}
if (_strat_tp != NULL) {
float _ppl = _strat_tp.Get<float>(STRAT_PARAM_PPL);
int _ppm = _strat_tp.Get<int>(STRAT_PARAM_PPM);
_tp_new = _trade.NormalizeTP(_strat_tp.PriceStop(_otype, ORDER_TYPE_TP, _ppm, _ppl), _otype);
_tp_valid = _trade.IsValidOrderTP(_tp_new, _otype, _order.Get<double>(ORDER_TP), _ppm > 0);
_tp_new = _tp_valid ? _tp_new : _order.Get<double>(ORDER_TP);
if (_strat_sl != NULL || _strat_tp != NULL) {
float _olots = _order.Get<float>(ORDER_VOLUME_CURRENT);
float _trisk = _trade.Get<float>(TRADE_PARAM_RISK_MARGIN);
if (_strat_sl != NULL) {
float _psl = _strat_sl.Get<float>(STRAT_PARAM_PSL);
float _sl_max = _trade.GetMaxSLTP(_otype, _olots, ORDER_TYPE_SL, _trisk);
int _psm = _strat_sl.Get<int>(STRAT_PARAM_PSM);
_sl_new = _strat_sl.PriceStop(_otype, ORDER_TYPE_SL, _psm, _psl);
_sl_new = _trade.GetSaferSLTP(_sl_new, _sl_max, _otype, ORDER_TYPE_SL);
_sl_new = _trade.NormalizeSL(_sl_new, _otype);
_sl_valid = _trade.IsValidOrderSL(_sl_new, _otype, _order.Get<double>(ORDER_SL), _psm > 0);
_sl_new = _sl_valid ? _sl_new : _order.Get<double>(ORDER_SL);
}
if (_strat_tp != NULL) {
float _ppl = _strat_tp.Get<float>(STRAT_PARAM_PPL);
float _tp_max = _trade.GetMaxSLTP(_otype, _olots, ORDER_TYPE_TP, _trisk);
int _ppm = _strat_tp.Get<int>(STRAT_PARAM_PPM);
_tp_new = _strat_tp.PriceStop(_otype, ORDER_TYPE_TP, _ppm, _ppl);
_tp_new = _trade.GetSaferSLTP(_tp_new, _tp_max, _otype, ORDER_TYPE_TP);
_tp_new = _trade.NormalizeTP(_tp_new, _otype);
_tp_valid = _trade.IsValidOrderTP(_tp_new, _otype, _order.Get<double>(ORDER_TP), _ppm > 0);
_tp_new = _tp_valid ? _tp_new : _order.Get<double>(ORDER_TP);
}
}
if (_sl_valid || _tp_valid) {
_result &= _order.OrderModify(_sl_new, _tp_new);
Expand Down
7 changes: 7 additions & 0 deletions Indicator.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,13 @@ class Indicator : public IndicatorBase {
if (_bar_time > 0 && !_entry.IsValid() && !_entry.CheckFlag(INDI_ENTRY_FLAG_INSUFFICIENT_DATA)) {
_entry.Resize(iparams.GetMaxModes());
_entry.timestamp = GetBarTime(_ishift);
#ifndef __MQL4__
if (IndicatorBase::Get<bool>(STRUCT_ENUM(IndicatorState, INDICATOR_STATE_PROP_IS_CHANGED))) {
// Resets the handle on any parameter changes.
IndicatorBase::Set<int>(STRUCT_ENUM(IndicatorState, INDICATOR_STATE_PROP_HANDLE), INVALID_HANDLE);
IndicatorBase::Set<int>(STRUCT_ENUM(IndicatorState, INDICATOR_STATE_PROP_IS_CHANGED), false);
}
#endif
for (int _mode = 0; _mode < (int)iparams.GetMaxModes(); _mode++) {
switch (iparams.GetDataValueType()) {
case TYPE_BOOL:
Expand Down
18 changes: 18 additions & 0 deletions Indicator.struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,24 @@ struct IndicatorState {
SetUserError(ERR_INVALID_PARAMETER);
return (T)WRONG_VALUE;
}
// Setters.
template <typename T>
void Set(STRUCT_ENUM(IndicatorState, ENUM_INDICATOR_STATE_PROP) _prop, T _value) {
switch (_prop) {
case INDICATOR_STATE_PROP_HANDLE:
handle = (T)_value;
break;
case INDICATOR_STATE_PROP_IS_CHANGED:
is_changed = (T)_value;
break;
case INDICATOR_STATE_PROP_IS_READY:
is_ready = (T)_value;
break;
default:
SetUserError(ERR_INVALID_PARAMETER);
break;
};
}
// State checkers.
bool IsChanged() { return is_changed; }
bool IsReady() { return is_ready; }
Expand Down
8 changes: 8 additions & 0 deletions IndicatorBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,14 @@ class IndicatorBase : public Object {
Util::ArrayRemoveFirst(listeners, _ref);
}

/**
* Sets an indicator's state property value.
*/
template <typename T>
void Set(STRUCT_ENUM(IndicatorState, ENUM_INDICATOR_STATE_PROP) _prop, T _value) {
istate.Set<T>(_prop, _value);
}

/**
* Sets indicator data source.
*/
Expand Down
1 change: 0 additions & 1 deletion Indicators/Indi_AC.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ class Indi_AC : public Indicator<IndiACParams> {
int _ishift = _shift >= 0 ? _shift : iparams.GetShift();
switch (iparams.idstype) {
case IDATA_BUILTIN:
istate.handle = istate.is_changed ? INVALID_HANDLE : istate.handle;
_value = Indi_AC::iAC(GetSymbol(), GetTf(), _ishift, THIS_PTR);
break;
case IDATA_ICUSTOM:
Expand Down
1 change: 0 additions & 1 deletion Indicators/Indi_AD.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ class Indi_AD : public Indicator<IndiADParams> {
int _ishift = _shift >= 0 ? _shift : iparams.GetShift();
switch (iparams.idstype) {
case IDATA_BUILTIN:
istate.handle = istate.is_changed ? INVALID_HANDLE : istate.handle;
_value = Indi_AD::iAD(GetSymbol(), GetTf(), _ishift, THIS_PTR);
break;
case IDATA_ICUSTOM:
Expand Down
1 change: 0 additions & 1 deletion Indicators/Indi_ADX.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ class Indi_ADX : public Indicator<IndiADXParams> {
int _ishift = _shift >= 0 ? _shift : iparams.GetShift();
switch (iparams.idstype) {
case IDATA_BUILTIN:
istate.handle = istate.is_changed ? INVALID_HANDLE : istate.handle;
_value = Indi_ADX::iADX(GetSymbol(), GetTf(), GetPeriod(), GetAppliedPrice(), _mode, _ishift, THIS_PTR);
break;
case IDATA_ICUSTOM:
Expand Down
1 change: 0 additions & 1 deletion Indicators/Indi_ADXW.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ class Indi_ADXW : public Indicator<IndiADXWParams> {
int _ishift = _shift >= 0 ? _shift : iparams.GetShift();
switch (iparams.idstype) {
case IDATA_BUILTIN:
istate.handle = istate.is_changed ? INVALID_HANDLE : istate.handle;
_value = iADXWilder(GetSymbol(), GetTf(), GetPeriod(), _mode, _ishift, THIS_PTR);
break;
case IDATA_ONCALCULATE:
Expand Down
6 changes: 3 additions & 3 deletions Indicators/Indi_AMA.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Indi_AMA : public Indicator<IndiAMAParams> {
* Returns possible data source modes. It is a bit mask of ENUM_IDATA_SOURCE_TYPE.
*/
unsigned int GetPossibleDataModes() override {
#ifdef __MQL4__
#ifdef __MQL5__
return IDATA_BUILTIN | IDATA_ONCALCULATE | IDATA_ICUSTOM | IDATA_INDICATOR;
#else
return IDATA_ONCALCULATE | IDATA_ICUSTOM | IDATA_INDICATOR;
Expand Down Expand Up @@ -239,11 +239,11 @@ class Indi_AMA : public Indicator<IndiAMAParams> {

break;
case IDATA_ONCALCULATE:
_value = Indi_AMA::iAMAOnIndicator(GetDataSource(), /*[*/ GetPeriod(), GetFastPeriod(), GetSlowPeriod(),
_value = Indi_AMA::iAMAOnIndicator(THIS_PTR, /*[*/ GetPeriod(), GetFastPeriod(), GetSlowPeriod(),
GetAMAShift(), GetAppliedPrice() /*]*/, _mode, _ishift);
break;
case IDATA_INDICATOR:
_value = Indi_AMA::iAMAOnIndicator(GetDataSource(), /*[*/ GetPeriod(), GetFastPeriod(), GetSlowPeriod(),
_value = Indi_AMA::iAMAOnIndicator(THIS_PTR, /*[*/ GetPeriod(), GetFastPeriod(), GetSlowPeriod(),
GetAMAShift(), GetAppliedPrice() /*]*/, _mode, _ishift);
break;
default:
Expand Down
1 change: 0 additions & 1 deletion Indicators/Indi_AO.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ class Indi_AO : public Indicator<IndiAOParams> {
int _ishift = _shift >= 0 ? _shift : iparams.GetShift();
switch (iparams.idstype) {
case IDATA_BUILTIN:
istate.handle = istate.is_changed ? INVALID_HANDLE : istate.handle;
_value = Indi_AO::iAO(GetSymbol(), GetTf(), _ishift, _mode, THIS_PTR);
break;
case IDATA_ICUSTOM:
Expand Down
1 change: 0 additions & 1 deletion Indicators/Indi_ATR.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ class Indi_ATR : public Indicator<IndiATRParams> {
int _ishift = _shift >= 0 ? _shift : iparams.GetShift();
switch (iparams.idstype) {
case IDATA_BUILTIN:
istate.handle = istate.is_changed ? INVALID_HANDLE : istate.handle;
_value = Indi_ATR::iATR(GetSymbol(), GetTf(), GetPeriod(), _ishift, THIS_PTR);
break;
case IDATA_ICUSTOM:
Expand Down
1 change: 0 additions & 1 deletion Indicators/Indi_Alligator.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ class Indi_Alligator : public Indicator<IndiAlligatorParams> {
#endif
switch (iparams.idstype) {
case IDATA_BUILTIN:
istate.handle = istate.is_changed ? INVALID_HANDLE : istate.handle;
_value = Indi_Alligator::iAlligator(GetSymbol(), GetTf(), GetJawPeriod(), GetJawShift(), GetTeethPeriod(),
GetTeethShift(), GetLipsPeriod(), GetLipsShift(), GetMAMethod(),
GetAppliedPrice(), (ENUM_ALLIGATOR_LINE)_mode, _ishift, THIS_PTR);
Expand Down
1 change: 0 additions & 1 deletion Indicators/Indi_BWMFI.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ class Indi_BWMFI : public Indicator<IndiBWIndiMFIParams> {

switch (iparams.idstype) {
case IDATA_BUILTIN:
istate.handle = istate.is_changed ? INVALID_HANDLE : istate.handle;
_value = Indi_BWMFI::iBWMFI(GetSymbol(), GetTf(), _ishift, (ENUM_BWMFI_BUFFER)_mode, THIS_PTR);
break;
case IDATA_ICUSTOM:
Expand Down
2 changes: 1 addition & 1 deletion Indicators/Indi_Bands.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ class Indi_Bands : public Indicator<IndiBandsParams> {
*/
virtual bool IsValidEntry(IndicatorDataEntry &_entry) {
return !_entry.HasValue((double)NULL) && !_entry.HasValue(EMPTY_VALUE) && _entry.IsGt<double>(0) &&
_entry.values[BAND_LOWER].GetDbl() < _entry.values[BAND_UPPER].GetDbl();
_entry.values[(int)BAND_LOWER].GetDbl() < _entry.values[(int)BAND_UPPER].GetDbl();
}

/**
Expand Down
1 change: 0 additions & 1 deletion Indicators/Indi_BearsPower.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ class Indi_BearsPower : public Indicator<IndiBearsPowerParams> {
int _ishift = _shift >= 0 ? _shift : iparams.GetShift();
switch (iparams.idstype) {
case IDATA_BUILTIN:
istate.handle = istate.is_changed ? INVALID_HANDLE : istate.handle;
_value = _value = iBearsPower(GetSymbol(), GetTf(), GetPeriod(), GetAppliedPrice(), _ishift, THIS_PTR);
break;
case IDATA_ICUSTOM:
Expand Down
1 change: 0 additions & 1 deletion Indicators/Indi_BullsPower.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ class Indi_BullsPower : public Indicator<IndiBullsPowerParams> {
int _ishift = _shift >= 0 ? _shift : iparams.GetShift();
switch (iparams.idstype) {
case IDATA_BUILTIN:
istate.handle = istate.is_changed ? INVALID_HANDLE : istate.handle;
_value = iBullsPower(GetSymbol(), GetTf(), GetPeriod(), GetAppliedPrice(), _ishift, THIS_PTR);
break;
case IDATA_ICUSTOM:
Expand Down
1 change: 0 additions & 1 deletion Indicators/Indi_CCI.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ class Indi_CCI : public Indicator<IndiCCIParams> {
double _value = EMPTY_VALUE;
switch (iparams.idstype) {
case IDATA_BUILTIN:
istate.handle = istate.is_changed ? INVALID_HANDLE : istate.handle;
// @fixit Somehow shift isn't used neither in MT4 nor MT5.
_value = Indi_CCI::iCCI(GetSymbol(), GetTf(), GetPeriod(), GetAppliedPrice(), _ishift /* + iparams.shift*/,
THIS_PTR);
Expand Down
2 changes: 0 additions & 2 deletions Indicators/Indi_DEMA.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ class Indi_DEMA : public Indicator<IndiDEMAParams> {
case IDATA_BUILTIN:
// We're getting DEMA from Price indicator.

istate.handle = istate.is_changed ? INVALID_HANDLE : istate.handle;
_value = Indi_DEMA::iDEMA(GetSymbol(), GetTf(), /*[*/ GetPeriod(), GetMAShift(), GetAppliedPrice() /*]*/,
_ishift, _mode, THIS_PTR);
break;
Expand All @@ -208,7 +207,6 @@ class Indi_DEMA : public Indicator<IndiDEMAParams> {
_mode, _ishift);
break;
case IDATA_ICUSTOM:
istate.handle = istate.is_changed ? INVALID_HANDLE : istate.handle;
_value = iCustom(istate.handle, GetSymbol(), GetTf(), iparams.custom_indi_name, /*[*/ GetPeriod(), GetMAShift(),
GetAppliedPrice() /*]*/, _mode, _ishift);
break;
Expand Down
1 change: 0 additions & 1 deletion Indicators/Indi_DeMarker.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ class Indi_DeMarker : public Indicator<IndiDeMarkerParams> {
int _ishift = _shift >= 0 ? _shift : iparams.GetShift();
switch (iparams.idstype) {
case IDATA_BUILTIN:
istate.handle = istate.is_changed ? INVALID_HANDLE : istate.handle;
_value = _value = Indi_DeMarker::iDeMarker(GetSymbol(), GetTf(), GetPeriod(), _ishift, THIS_PTR);
break;
case IDATA_ICUSTOM:
Expand Down
1 change: 0 additions & 1 deletion Indicators/Indi_Drawer.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ class Indi_Drawer : public Indicator<IndiDrawerParams> {
int _ishift = _shift >= 0 ? _shift : iparams.GetShift();
switch (iparams.idstype) {
case IDATA_BUILTIN:
istate.handle = istate.is_changed ? INVALID_HANDLE : istate.handle;
_value = Indi_Drawer::iDrawer(GetSymbol(), GetTf(), _ishift, THIS_PTR);
break;
case IDATA_INDICATOR:
Expand Down
1 change: 0 additions & 1 deletion Indicators/Indi_Envelopes.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ class Indi_Envelopes : public Indicator<IndiEnvelopesParams> {
int _ishift = _shift >= 0 ? _shift : iparams.GetShift();
switch (iparams.idstype) {
case IDATA_BUILTIN:
istate.handle = istate.is_changed ? INVALID_HANDLE : istate.handle;
_value = Indi_Envelopes::iEnvelopes(GetSymbol(), GetTf(), GetMAPeriod(), GetMAMethod(), GetMAShift(),
GetAppliedPrice(), GetDeviation(), _mode, _ishift, THIS_PTR);
break;
Expand Down
1 change: 0 additions & 1 deletion Indicators/Indi_Force.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ class Indi_Force : public Indicator<IndiForceParams> {
int _ishift = _shift >= 0 ? _shift : iparams.GetShift();
switch (iparams.idstype) {
case IDATA_BUILTIN:
istate.handle = istate.is_changed ? INVALID_HANDLE : istate.handle;
_value =
Indi_Force::iForce(GetSymbol(), GetTf(), GetPeriod(), GetMAMethod(), GetAppliedPrice(), _ishift, THIS_PTR);
break;
Expand Down
1 change: 0 additions & 1 deletion Indicators/Indi_Fractals.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ class Indi_Fractals : public Indicator<IndiFractalsParams> {
int _ishift = _shift >= 0 ? _shift : iparams.GetShift();
switch (iparams.idstype) {
case IDATA_BUILTIN:
istate.handle = istate.is_changed ? INVALID_HANDLE : istate.handle;
_value = _value = Indi_Fractals::iFractals(GetSymbol(), GetTf(), (ENUM_LO_UP_LINE)_mode, _ishift, THIS_PTR);
break;
case IDATA_ICUSTOM:
Expand Down
5 changes: 2 additions & 3 deletions Indicators/Indi_Gator.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ class Indi_Gator : public Indicator<IndiGatorParams> {
int _ishift = _shift >= 0 ? _shift : iparams.GetShift();
switch (iparams.idstype) {
case IDATA_BUILTIN:
istate.handle = istate.is_changed ? INVALID_HANDLE : istate.handle;
_value = Indi_Gator::iGator(GetSymbol(), GetTf(), GetJawPeriod(), GetJawShift(), GetTeethPeriod(),
GetTeethShift(), GetLipsPeriod(), GetLipsShift(), GetMAMethod(), GetAppliedPrice(),
(ENUM_GATOR_HISTOGRAM)_mode, _ishift, THIS_PTR);
Expand Down Expand Up @@ -218,8 +217,8 @@ class Indi_Gator : public Indicator<IndiGatorParams> {
* Checks if indicator entry values are valid.
*/
virtual bool IsValidEntry(IndicatorDataEntry &_entry) {
return !_entry.HasValue(EMPTY_VALUE) &&
(_entry.values[LINE_UPPER_HISTOGRAM].GetDbl() != 0 || _entry.values[LINE_LOWER_HISTOGRAM].GetDbl() != 0);
return !_entry.HasValue(EMPTY_VALUE) && (_entry.values[(int)LINE_UPPER_HISTOGRAM].GetDbl() != 0 ||
_entry.values[(int)LINE_LOWER_HISTOGRAM].GetDbl() != 0);
}

/* Getters */
Expand Down
3 changes: 1 addition & 2 deletions Indicators/Indi_HeikenAshi.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ class Indi_HeikenAshi : public Indicator<IndiHeikenAshiParams> {
_value = iCustom(istate.handle, GetSymbol(), GetTf(), iparams.GetCustomIndicatorName(), _mode, _ishift);
break;
case IDATA_ICUSTOM_LEGACY:
istate.handle = istate.is_changed ? INVALID_HANDLE : istate.handle;
_value =
iCustomLegacyHeikenAshi(GetSymbol(), GetTf(), iparams.GetCustomIndicatorName(), _mode, _ishift, THIS_PTR);
break;
Expand All @@ -264,6 +263,6 @@ class Indi_HeikenAshi : public Indicator<IndiHeikenAshiParams> {
*/
virtual bool IsValidEntry(IndicatorDataEntry &_entry) {
return !_entry.HasValue<double>(NULL) && !_entry.HasValue<double>(EMPTY_VALUE) && _entry.IsGt<double>(0) &&
_entry.values[HA_LOW].GetDbl() < _entry.values[HA_HIGH].GetDbl();
_entry.values[(int)HA_LOW].GetDbl() < _entry.values[(int)HA_HIGH].GetDbl();
}
};
Loading

0 comments on commit a33519b

Please sign in to comment.