Skip to content

Commit

Permalink
WIP. Fixing tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
nseam committed Nov 4, 2022
1 parent 545f320 commit 2c77ffe
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
exclude: '\.md$'
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down
2 changes: 1 addition & 1 deletion Indicators/Indi_Alligator.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class Indi_Alligator : public Indicator<IndiAlligatorParams> {
#ifdef __MQL4__
if (_mode == 0) {
// In MQL4 mode 0 should be treated as mode 1 as Alligator buffers starts from index 1.
return GetEntryValue((ENUM_ALLIGATOR_LINE)1, _ishift);
return GetEntryValue((ENUM_ALLIGATOR_LINE)1, ToRelShift(_abs_shift));
}
#endif
switch (Get<ENUM_IDATA_SOURCE_TYPE>(STRUCT_ENUM(IndicatorDataParams, IDATA_PARAM_IDSTYPE))) {
Expand Down
9 changes: 5 additions & 4 deletions Indicators/Indi_FractalAdaptiveMA.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ class Indi_FrAMA : public Indicator<IndiFrAIndiMAParams> {
* Built-in version of FrAMA.
*/
static double iFrAMA(string _symbol, ENUM_TIMEFRAMES _tf, int _ma_period, int _ma_shift, ENUM_APPLIED_PRICE _ap,
int _mode = 0, int _shift = 0, IndicatorData *_obj = NULL) {
int _mode = 0, int _rel_shift = 0, IndicatorData *_obj = NULL) {
#ifdef __MQL5__
INDICATOR_BUILTIN_CALL_AND_RETURN(::iFrAMA(_symbol, _tf, _ma_period, _ma_shift, _ap), _mode, _shift);
INDICATOR_BUILTIN_CALL_AND_RETURN(::iFrAMA(_symbol, _tf, _ma_period, _ma_shift, _ap), _mode,
_obj PTR_DEREF ToAbsShift(_rel_shift));
#else
if (_obj == nullptr) {
Print(
Expand All @@ -103,8 +104,8 @@ class Indi_FrAMA : public Indicator<IndiFrAIndiMAParams> {
return 0;
}
INDICATOR_CALCULATE_POPULATE_PARAMS_AND_CACHE_LONG(_obj, Util::MakeKey(_ma_period, _ma_shift, (int)_ap));
return iFrAMAOnArray(INDICATOR_CALCULATE_POPULATED_PARAMS_LONG, _ma_period,
_ma_indi PTR_DEREF ToAbsShift(rel_shift), _ap, _mode, _shift, _cache);
return iFrAMAOnArray(INDICATOR_CALCULATE_POPULATED_PARAMS_LONG, _ma_period, _ma_shift, _ap, _mode,
_obj PTR_DEREF ToAbsShift(_rel_shift), _cache);
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion Indicators/Indi_MFI.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Indi_MFI : public Indicator<IndiMFIParams> {
switch (Get<ENUM_IDATA_SOURCE_TYPE>(STRUCT_ENUM(IndicatorDataParams, IDATA_PARAM_IDSTYPE))) {
case IDATA_BUILTIN:
#ifdef __MQL4__
_value = Indi_MFI::iMFI(GetSymbol(), GetTf(), GetPeriod(), _ishift);
_value = Indi_MFI::iMFI(GetSymbol(), GetTf(), GetPeriod(), ToRelShift(_abs_shift));
#else // __MQL5__
_value =
Indi_MFI::iMFI(GetSymbol(), GetTf(), GetPeriod(), GetAppliedVolume(), ToRelShift(_abs_shift), THIS_PTR);
Expand Down
2 changes: 1 addition & 1 deletion Indicators/Indi_OBV.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class Indi_OBV : public Indicator<IndiOBVParams> {
switch (Get<ENUM_IDATA_SOURCE_TYPE>(STRUCT_ENUM(IndicatorDataParams, IDATA_PARAM_IDSTYPE))) {
case IDATA_BUILTIN:
#ifdef __MQL4__
_value = Indi_OBV::iOBV(GetSymbol(), GetTf(), GetAppliedPrice(), _ishift);
_value = Indi_OBV::iOBV(GetSymbol(), GetTf(), GetAppliedPrice(), ToRelShift(_abs_shift), THIS_PTR);
#else // __MQL5__
_value = Indi_OBV::iOBV(GetSymbol(), GetTf(), GetAppliedVolume(), ToRelShift(_abs_shift), THIS_PTR);
#endif
Expand Down
9 changes: 4 additions & 5 deletions Indicators/Price/Indi_Price.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,15 @@ class Indi_Price : public Indicator<PriceIndiParams> {
}

/**
* Checks whether indicator has a valid value for a given shift.
* Returns possible data source modes. It is a bit mask of ENUM_IDATA_SOURCE_TYPE.
*/
virtual bool HasValidEntry(int _shift = 0) { return GetBarTime(_shift) != 0; }
unsigned int GetPossibleDataModes() override { return IDATA_BUILTIN; }

/**
* Returns the indicator's value.
*/
virtual IndicatorDataEntryValue GetEntryValue(int _mode = 0, int _abs_shift = 0) {
return GetCandle() PTR_DEREF GetSpecificAppliedPriceValueStorage(iparams.GetAppliedPrice())
PTR_DEREF Fetch(ToRelShift(_abs_shift));
IndicatorDataEntryValue GetEntryValue(int _mode = 0, int _abs_shift = 0) override {
return GetCandle() PTR_DEREF GetPrice(iparams.GetAppliedPrice(), ToRelShift(_abs_shift));
}

/**
Expand Down

0 comments on commit 2c77ffe

Please sign in to comment.