Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev-indi-no-chart4' into v3.003-dev
Browse files Browse the repository at this point in the history
* origin/dev-indi-no-chart4-merge2:
  Merge remote-tracking branch 'origin/dev-indi-no-chart4' into v3.003-dev
  • Loading branch information
kenorb committed Aug 13, 2022
2 parents 1095289 + c9be418 commit e92f7d3
Show file tree
Hide file tree
Showing 19 changed files with 363 additions and 286 deletions.
1 change: 1 addition & 0 deletions Indicator.struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ struct IndicatorParams {
int shift; // Shift (relative to the current bar, 0 - default).
unsigned int max_params; // Max supported input params.
ENUM_INDICATOR_TYPE itype; // Indicator type (e.g. INDI_RSI).
color indi_color; // Indicator color.
ARRAY(DataParamEntry, input_params); // Indicator input params.
string custom_indi_name; // Name of the indicator passed to iCustom() method.
string symbol; // Symbol used by indicator.
Expand Down
13 changes: 9 additions & 4 deletions Indicators/Bitwise/Indi_Candle.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@ class Indi_Candle : public Indicator<CandleParams> {
/**
* Class constructor.
*/
Indi_Candle(CandleParams &_p, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_BUILTIN, IndicatorData *_indi_src = NULL, int _indi_src_mode = 0)
: Indicator(_p, IndicatorDataParams::GetInstance(1, TYPE_INT, _idstype, IDATA_RANGE_RANGE, _indi_src_mode), _indi_src){};
Indi_Candle(CandleParams &_p, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_BUILTIN, IndicatorData *_indi_src = NULL,
int _indi_src_mode = 0)
: Indicator(_p, IndicatorDataParams::GetInstance(1, TYPE_INT, _idstype, IDATA_RANGE_RANGE, _indi_src_mode),
_indi_src){};

Indi_Candle(int _shift = 0, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_BUILTIN, IndicatorData *_indi_src = NULL, int _indi_src_mode = 0)
: Indicator(CandleParams(), IndicatorDataParams::GetInstance(1, TYPE_INT, _idstype, IDATA_RANGE_RANGE, _indi_src_mode), _indi_src) {};
Indi_Candle(int _shift = 0, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_BUILTIN, IndicatorData *_indi_src = NULL,
int _indi_src_mode = 0)
: Indicator(CandleParams(),
IndicatorDataParams::GetInstance(1, TYPE_INT, _idstype, IDATA_RANGE_RANGE, _indi_src_mode),
_indi_src){};

/**
* Returns possible data source types. It is a bit mask of ENUM_INDI_SUITABLE_DS_TYPE.
Expand Down
11 changes: 9 additions & 2 deletions Indicators/Bitwise/Indi_Pattern.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,16 @@ class Indi_Pattern : public Indicator<IndiPatternParams> {
/**
* Class constructor.
*/
Indi_Pattern(IndiPatternParams &_p, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_BUILTIN, IndicatorData* _indi_src = NULL, int _indi_src_mode = 0) : Indicator(_p, IndicatorDataParams::GetInstance(5, TYPE_UINT, _idstype, IDATA_RANGE_BITWISE, _indi_src_mode), _indi_src) {}
Indi_Pattern(IndiPatternParams& _p, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_BUILTIN, IndicatorData* _indi_src = NULL,
int _indi_src_mode = 0)
: Indicator(_p, IndicatorDataParams::GetInstance(5, TYPE_UINT, _idstype, IDATA_RANGE_BITWISE, _indi_src_mode),
_indi_src) {}

Indi_Pattern(int _shift = 0, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_BUILTIN, IndicatorData* _indi_src = NULL, int _indi_src_mode = 0) : Indicator(IndiPatternParams(), IndicatorDataParams::GetInstance(5, TYPE_UINT, _idstype, IDATA_RANGE_BITWISE, _indi_src_mode), _indi_src) {}
Indi_Pattern(int _shift = 0, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_BUILTIN, IndicatorData* _indi_src = NULL,
int _indi_src_mode = 0)
: Indicator(IndiPatternParams(),
IndicatorDataParams::GetInstance(5, TYPE_UINT, _idstype, IDATA_RANGE_BITWISE, _indi_src_mode),
_indi_src) {}

/**
* Returns possible data source types. It is a bit mask of ENUM_INDI_SUITABLE_DS_TYPE.
Expand Down
8 changes: 6 additions & 2 deletions Indicators/Indi_ADX.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,18 @@ class Indi_ADX : public Indicator<IndiADXParams> {
: Indicator(_p,
IndicatorDataParams::GetInstance(FINAL_INDI_ADX_LINE_ENTRY, TYPE_DOUBLE, _idstype, IDATA_RANGE_RANGE,
_indi_src_mode),
_indi_src) {}
_indi_src) {
Init();
}

Indi_ADX(int _shift = 0, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_BUILTIN, IndicatorData *_indi_src = NULL,
int _indi_src_mode = 0)
: Indicator(IndiADXParams(),
IndicatorDataParams::GetInstance(FINAL_INDI_ADX_LINE_ENTRY, TYPE_DOUBLE, _idstype, IDATA_RANGE_RANGE,
_indi_src_mode),
_indi_src) {}
_indi_src) {
Init();
}
/**
* Returns possible data source types. It is a bit mask of ENUM_INDI_SUITABLE_DS_TYPE.
*/
Expand Down
2 changes: 1 addition & 1 deletion Indicators/Indi_BWZT.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Indi_BWZT : public Indicator<IndiBWZTParams> {
/**
* Initialize.
*/
void Init() { Set<int>(STRUCT_ENUM(IndicatorDataParams, IDATA_PARAM_MAX_MODES), FINAL_INDI_BWZT_MODE_ENTRY); }
void Init() {}

public:
/**
Expand Down
3 changes: 0 additions & 3 deletions Indicators/Indi_Drawer.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
*
*/

// Forward declaration.
struct IndicatorParams;

// Includes.
#include "../DictStruct.mqh"
#include "../Indicator.mqh"
Expand Down
1 change: 1 addition & 0 deletions Indicators/Indi_Drawer.struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

// Includes.
#include "../Indicator.struct.h"
#include "../SerializerNode.enum.h"

// Structs.

Expand Down
5 changes: 4 additions & 1 deletion Indicators/Indi_Pivot.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ class Indi_Pivot : public Indicator<IndiPivotParams> {
/**
* Initialize.
*/
void Init() { Set<int>(STRUCT_ENUM(IndicatorDataParams, IDATA_PARAM_MAX_MODES), 9); }
void Init() {}

protected:
/* Protected methods */

public:
/**
Expand Down
13 changes: 12 additions & 1 deletion Indicators/OHLC/Indi_OHLC.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,18 @@ class Indi_OHLC : public Indicator<IndiOHLCParams> {
/**
* Class constructor.
*/
Indi_OHLC(IndiOHLCParams &_p, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_BUILTIN, IndicatorData *_indi_src = NULL, int _indi_src_mode = 0) : Indicator(_p, IndicatorDataParams::GetInstance(FINAL_INDI_OHLC_MODE_ENTRY, TYPE_DOUBLE, _idstype, IDATA_RANGE_PRICE, _indi_src_mode), _indi_src){}; Indi_OHLC(int _shift = 0, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_BUILTIN, IndicatorData *_indi_src = NULL, int _indi_src_mode = 0) : Indicator(IndiOHLCParams(), IndicatorDataParams::GetInstance(FINAL_INDI_OHLC_MODE_ENTRY, TYPE_DOUBLE, _idstype, IDATA_RANGE_PRICE, _indi_src_mode), _indi_src) {};
Indi_OHLC(IndiOHLCParams &_p, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_BUILTIN, IndicatorData *_indi_src = NULL,
int _indi_src_mode = 0)
: Indicator(_p,
IndicatorDataParams::GetInstance(FINAL_INDI_OHLC_MODE_ENTRY, TYPE_DOUBLE, _idstype, IDATA_RANGE_PRICE,
_indi_src_mode),
_indi_src){};
Indi_OHLC(int _shift = 0, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_BUILTIN, IndicatorData *_indi_src = NULL,
int _indi_src_mode = 0)
: Indicator(IndiOHLCParams(),
IndicatorDataParams::GetInstance(FINAL_INDI_OHLC_MODE_ENTRY, TYPE_DOUBLE, _idstype, IDATA_RANGE_PRICE,
_indi_src_mode),
_indi_src){};
/**
* Returns possible data source types. It is a bit mask of ENUM_INDI_SUITABLE_DS_TYPE.
*/
Expand Down
10 changes: 9 additions & 1 deletion Indicators/Price/Indi_Price.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,15 @@ class Indi_Price : public Indicator<PriceIndiParams> {
/**
* Class constructor.
*/
Indi_Price(PriceIndiParams &_p, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_BUILTIN, IndicatorData *_indi_src = NULL, int _indi_src_mode = 0) : Indicator(_p, IndicatorDataParams::GetInstance(1, TYPE_DOUBLE, _idstype, IDATA_RANGE_PRICE, _indi_src_mode), _indi_src){}; Indi_Price(int _shift = 0, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_BUILTIN, IndicatorData *_indi_src = NULL, int _indi_src_mode = 0) : Indicator(PriceIndiParams(), IndicatorDataParams::GetInstance(1, TYPE_DOUBLE, _idstype, IDATA_RANGE_PRICE, _indi_src_mode), _indi_src) {};
Indi_Price(PriceIndiParams &_p, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_BUILTIN, IndicatorData *_indi_src = NULL,
int _indi_src_mode = 0)
: Indicator(_p, IndicatorDataParams::GetInstance(1, TYPE_DOUBLE, _idstype, IDATA_RANGE_PRICE, _indi_src_mode),
_indi_src){};
Indi_Price(int _shift = 0, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_BUILTIN, IndicatorData *_indi_src = NULL,
int _indi_src_mode = 0)
: Indicator(PriceIndiParams(),
IndicatorDataParams::GetInstance(1, TYPE_DOUBLE, _idstype, IDATA_RANGE_PRICE, _indi_src_mode),
_indi_src){};
/**
* Returns possible data source types. It is a bit mask of ENUM_INDI_SUITABLE_DS_TYPE.
*/
Expand Down
11 changes: 9 additions & 2 deletions Indicators/Special/Indi_Math.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,15 @@ class Indi_Math : public Indicator<IndiMathParams> {
/**
* Class constructor.
*/
Indi_Math(IndiMathParams &_p, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_INDICATOR, IndicatorData *_indi_src = NULL, int _indi_src_mode = 0) : Indicator(_p, IndicatorDataParams::GetInstance(1, TYPE_DOUBLE, _idstype, IDATA_RANGE_MIXED, _indi_src_mode), _indi_src){};
Indi_Math(int _shift = 0, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_INDICATOR, IndicatorData *_indi_src = NULL, int _indi_src_mode = 0) : Indicator(IndiMathParams(), IndicatorDataParams::GetInstance(1, TYPE_DOUBLE, _idstype, IDATA_RANGE_MIXED, _indi_src_mode), _indi_src) {};
Indi_Math(IndiMathParams &_p, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_INDICATOR, IndicatorData *_indi_src = NULL,
int _indi_src_mode = 0)
: Indicator(_p, IndicatorDataParams::GetInstance(1, TYPE_DOUBLE, _idstype, IDATA_RANGE_MIXED, _indi_src_mode),
_indi_src){};
Indi_Math(int _shift = 0, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_INDICATOR, IndicatorData *_indi_src = NULL,
int _indi_src_mode = 0)
: Indicator(IndiMathParams(),
IndicatorDataParams::GetInstance(1, TYPE_DOUBLE, _idstype, IDATA_RANGE_MIXED, _indi_src_mode),
_indi_src){};
/**
* Returns possible data source types. It is a bit mask of ENUM_INDI_SUITABLE_DS_TYPE.
*/
Expand Down
6 changes: 6 additions & 0 deletions Instances.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
#pragma once
#endif

// Prevents processing this includes file multiple times.
#ifndef INSTANCES_H
#define INSTANCES_H

#include "Dict.mqh"
#include "Util.h"

Expand All @@ -49,3 +53,5 @@ class Instances {

template<typename T>
T* Instances::instances[];

#endif // INSTANCES_MQH
2 changes: 1 addition & 1 deletion Storage/ValueStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,4 +314,4 @@ int iPeak(ValueStorage<double> &_price, int _count, int _start, ENUM_IPEAK _type
return _price_size - _peak_idx - 1;
}

#endif // STRATEGY_MQH
#endif // VALUE_STORAGE_H
15 changes: 11 additions & 4 deletions Strategy.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ class Strategy : public Taskable<DataParamEntry> {
if (METHOD(_method, 6))
_result &= !trade REF_DEREF Check(
TRADE_COND_ACCOUNT, _method > 0 ? ACCOUNT_COND_EQUITY_01PC_LOW : ACCOUNT_COND_EQUITY_01PC_HIGH); // 64
*/
*/
// if (METHOD(_method, 5)) _result &= Trade().IsRoundNumber(_cmd);
// if (METHOD(_method, 6)) _result &= Trade().IsHedging(_cmd);
_method = _method > 0 ? _method : !_method;
Expand Down Expand Up @@ -996,7 +996,7 @@ class Strategy : public Taskable<DataParamEntry> {
_result |=
_result || trade REF_DEREF Check(TRADE_COND_ACCOUNT, _method > 0 ? ACCOUNT_COND_EQUITY_01PC_HIGH
: ACCOUNT_COND_EQUITY_01PC_LOW); // 64
*/
*/
// if (METHOD(_method, 7)) _result |= _result || Trade().IsRoundNumber(_cmd);
// if (METHOD(_method, 8)) _result |= _result || Trade().IsHedging(_cmd);
_method = _method > 0 ? _method : !_method;
Expand Down Expand Up @@ -1090,12 +1090,19 @@ class Strategy : public Taskable<DataParamEntry> {
bool AddTask(TaskEntry &_tentry) {
bool _is_valid = _tentry.IsValid();
if (_is_valid) {
TaskObject<Strategy, Strategy> _taskobj(_tentry, THIS_PTR, THIS_PTR);
tasks.Add(&_taskobj);
tasks.Add(new TaskObject<Strategy, Strategy>(_tentry, THIS_PTR, THIS_PTR));
}
return _is_valid;
}

/**
* Add task object.
*/
template <typename TA, typename TC>
bool AddTaskObject(TaskObject<TA, TC> *_tobj) {
return tasks.Add<TA, TC>(_tobj);
}

/**
* Process tasks.
*/
Expand Down
Loading

0 comments on commit e92f7d3

Please sign in to comment.