Skip to content

Commit

Permalink
Moves Indicator related files into Indicator/
Browse files Browse the repository at this point in the history
  • Loading branch information
kenorb committed Aug 19, 2022
1 parent e92f7d3 commit 0ecb54d
Show file tree
Hide file tree
Showing 132 changed files with 397 additions and 383 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test-indicator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ jobs:
strategy:
matrix:
test:
- Indicator.test
- IndicatorBase.test
- IndicatorCandle.test
- IndicatorData.test
- IndicatorTf.test
- IndicatorTick.test
steps:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ jobs:
- DatabaseTest
- DrawIndicatorTest
- EATest
- IndicatorTest
- IndicatorsTest
- MailTest
- MarketTest
Expand Down
2 changes: 1 addition & 1 deletion 3D/Chart3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/

#include "../Bar.struct.h"
#include "../IndicatorData.mqh"
#include "../Indicator/IndicatorData.h"
#include "../Indicators/Indi_MA.mqh"
#include "../Instances.h"
#include "../Refs.mqh"
Expand Down
3 changes: 1 addition & 2 deletions Account/AccountMt.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ class AccountMt;
// Includes.
#include "../Array.mqh"
#include "../BufferStruct.mqh"
#include "../Chart.mqh"
#include "../Convert.mqh"
#include "../Data.struct.h"
#include "../Indicator.struct.h"
#include "../Indicator/Indicator.struct.h"
#include "../Order.struct.h"
#include "../Orders.mqh"
#include "../Serializer.mqh"
Expand Down
3 changes: 1 addition & 2 deletions BufferFXT.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@

// Includes.
#include "Account/AccountMt.h"
#include "Chart.mqh"
#include "DictStruct.mqh"
#include "IndicatorBase.h"
#include "Indicator/IndicatorData.h"
#include "Object.mqh"

// Defines.
Expand Down
8 changes: 4 additions & 4 deletions Chart.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
* - https://www.mql5.com/en/docs/series
*/

// Class dependencies.
class Chart;
class Market;

// Prevents processing this includes file for the second time.
#ifndef CHART_MQH
#define CHART_MQH
Expand All @@ -47,6 +43,10 @@ class Market;
#include "Serializer.mqh"
#include "Task/TaskCondition.enum.h"

// Forward class declaration.
class Chart;
class Market;

#ifndef __MQL4__
// Defines structs (for MQL4 backward compatibility).
// Struct arrays that contains given values of each bar of the current chart.
Expand Down
2 changes: 2 additions & 0 deletions Chart.struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

// Forward class declaration.
class Class;
struct ChartTf;

// Includes.
#include "Array.mqh"
Expand All @@ -41,6 +42,7 @@ class Class;
#include "Chart.struct.static.h"
#include "Chart.struct.tf.h"
#include "Serializer.mqh"
#include "SerializerNode.enum.h"
#include "Terminal.define.h"

/* Defines struct to store bar entries. */
Expand Down
2 changes: 1 addition & 1 deletion Chart.struct.serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ SerializerNodeType ChartEntry::Serialize(Serializer& _s) {
SerializerNodeType ChartParams::Serialize(Serializer& s) {
s.Pass(THIS_REF, "id", id);
s.Pass(THIS_REF, "symbol", symbol);
s.PassStruct(THIS_REF, "tf", tf);
// s.PassStruct(THIS_REF, "tf", tf); // @fixme
return SerializerNodeObject;
}
7 changes: 6 additions & 1 deletion Chart.struct.tf.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@
#pragma once
#endif

// Forward declarations.
class Serializer;

// Includes.
#include "Chart.enum.h"
#include "Serializer.mqh"
#include "SerializerNode.enum.h"
#include "Terminal.define.h"

/* Defines struct for chart timeframe. */
Expand Down Expand Up @@ -348,6 +351,8 @@ struct ChartTf {
SerializerNodeType Serialize(Serializer& s);
};

#include "Serializer.mqh"

/* Method to serialize ChartTf structure. */
SerializerNodeType ChartTf::Serialize(Serializer& s) {
s.PassEnum(THIS_REF, "tf", tf);
Expand Down
1 change: 1 addition & 0 deletions ChartMt.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#endif

// Includes.
#include "Chart.struct.static.h"
#include "Chart.symboltf.h"
#include "Terminal.define.h"

Expand Down
1 change: 0 additions & 1 deletion DictBase.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "Dict.enum.h"
#include "DictIteratorBase.mqh"
#include "DictSlot.mqh"
#include "Serializer.mqh"

/**
* Dictionary overflow listener. arguments are:
Expand Down
7 changes: 4 additions & 3 deletions DictIteratorBase.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@
#pragma once
#endif

// Forward class declaration.
template <typename K, typename V>
class DictBase;

#include "DictBase.mqh"
#include "DictSlotsRef.h"
#include "SerializerConversions.h"

template <typename K, typename V>
class DictBase;

template <typename K, typename V>
class DictIteratorBase {
protected:
Expand Down
2 changes: 1 addition & 1 deletion DictSlot.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ class DictSlot {
void RemoveFlags(unsigned char flags) { _flags &= (unsigned char)~flags; }
};

#endif
#endif // DICT_SLOT_MQH
1 change: 1 addition & 0 deletions DictSlotsRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "Std.h"
#include "Util.h"

// Forward class declaration.
template <typename K, typename V>
class DictSlot;

Expand Down
4 changes: 0 additions & 4 deletions DictStruct.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
#ifndef DICT_STRUCT_MQH
#define DICT_STRUCT_MQH

// Forward declarations.
class Dynamic;
class Log;

#include "DictBase.mqh"
#include "DictIteratorBase.mqh"
#include "Serializer.mqh"
Expand Down
2 changes: 1 addition & 1 deletion Draw.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void SetIndexStyle(int _index, int _type, int _style = EMPTY, int _width = EMPTY
/**
* Class to provide drawing methods working with graphic objects.
*/
class Draw : public Chart {
class Draw : public Object {
protected:
// Variables.
long chart_id;
Expand Down
3 changes: 2 additions & 1 deletion File.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@
// Includes.
#include "File.define.h"
#include "File.extern.h"
#include "Std.h"
#include "Terminal.define.h"
#include "Terminal.extern.h"
#include "Terminal.enum.h"
#include "Terminal.extern.h"

#ifndef __MQL__
enum ENUM_FILE_PROPERTY_INTEGER {
Expand Down
3 changes: 0 additions & 3 deletions Indicator.define.h → Indicator/Indicator.define.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@
#define LOWER_LINE 1 // Bottom line.
#endif

// Forward declarations.
class DrawIndicator;

#ifndef __MQL__
//
// Empty value in an indicator buffer.
Expand Down
52 changes: 0 additions & 52 deletions Indicator.enum.h → Indicator/Indicator.enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,6 @@ enum ENUM_INDI_ADX_LINE {
FINAL_INDI_ADX_LINE_ENTRY,
};

/* Define indicator index. */
enum ENUM_INDICATOR_INDEX {
CURR = 0,
PREV = 1,
PPREV = 2,
FINAL_ENUM_INDICATOR_INDEX = 3 // Should be the last one. Used to calculate the number of enum items.
};

/* Indicator line identifiers used in Envelopes and Fractals */
enum ENUM_LO_UP_LINE {
#ifdef __MQL4__
Expand Down Expand Up @@ -197,49 +189,6 @@ enum ENUM_SIGNAL_LINE {
enum ENUM_APPLIED_VOLUME { VOLUME_TICK = 0, VOLUME_REAL = 1 };
#endif

/* Indicator entry flags. */
enum INDICATOR_ENTRY_FLAGS {
INDI_ENTRY_FLAG_NONE = 0 << 0,
INDI_ENTRY_FLAG_IS_BITWISE = 1 << 0,
INDI_ENTRY_FLAG_IS_DOUBLED = 1 << 1, // Type is doubled in size (e.g. double or long).
INDI_ENTRY_FLAG_IS_EXPIRED = 1 << 2,
INDI_ENTRY_FLAG_IS_REAL = 1 << 3, // Type is real (float or double).
INDI_ENTRY_FLAG_IS_PRICE = 1 << 4,
INDI_ENTRY_FLAG_IS_UNSIGNED = 1 << 5, // Type is unsigned (unsigned int or unsigned long).
INDI_ENTRY_FLAG_IS_VALID = 1 << 6,
INDI_ENTRY_FLAG_INSUFFICIENT_DATA = 1 << 7, // Entry has missing value for that shift and probably won't ever have.
};

// Storage type for IndicatorBase::GetSpecificValueStorage().
enum ENUM_INDI_VS_TYPE {
INDI_VS_TYPE_NONE, // Not set.
INDI_VS_TYPE_TIME, // Candle.
INDI_VS_TYPE_TICK_VOLUME, // Candle.
INDI_VS_TYPE_VOLUME, // Candle.
INDI_VS_TYPE_SPREAD, // Candle.
INDI_VS_TYPE_PRICE_OPEN, // Candle.
INDI_VS_TYPE_PRICE_HIGH, // Candle.
INDI_VS_TYPE_PRICE_LOW, // Candle.
INDI_VS_TYPE_PRICE_CLOSE, // Candle.
INDI_VS_TYPE_PRICE_MEDIAN, // Candle.
INDI_VS_TYPE_PRICE_TYPICAL, // Candle.
INDI_VS_TYPE_PRICE_WEIGHTED, // Candle.
INDI_VS_TYPE_PRICE_BID, // Tick.
INDI_VS_TYPE_PRICE_ASK, // Tick.
// Indexed value storages, available if indicator have buffer at this index:
INDI_VS_TYPE_INDEX_0,
INDI_VS_TYPE_INDEX_1,
INDI_VS_TYPE_INDEX_2,
INDI_VS_TYPE_INDEX_4,
INDI_VS_TYPE_INDEX_5,
INDI_VS_TYPE_INDEX_6,
INDI_VS_TYPE_INDEX_7,
INDI_VS_TYPE_INDEX_8,
INDI_VS_TYPE_INDEX_9,
INDI_VS_TYPE_INDEX_FIRST = INDI_VS_TYPE_INDEX_0,
INDI_VS_TYPE_INDEX_LAST = INDI_VS_TYPE_INDEX_9
};

// Indicator flags.
enum ENUM_INDI_FLAGS {
INDI_FLAG_INDEXABLE_BY_SHIFT, // Indicator supports indexation by shift.
Expand Down Expand Up @@ -269,4 +218,3 @@ enum ENUM_INDI_DS_MODE_KIND {
INDI_DS_MODE_KIND_AP, // Mode is a value from ENUM_APPLIED_PRICE enumeration. It is used to retrieve value storage
// based on ENUM_INDI_VS_TYPE enumeration, e.g., PRICE_OPEN becomes ENUM_INDI_VS_PRICE_OPEN.
};
//+------------------------------------------------------------------+
43 changes: 23 additions & 20 deletions Indicator.mqh → Indicator/Indicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,30 @@
#ifndef INDICATOR_MQH
#define INDICATOR_MQH

// Includes.
#include "Array.mqh"
#include "BufferStruct.mqh"
#include "DateTime.mqh"
#include "DrawIndicator.mqh"
#include "Flags.h"
// Forward class declaration.
struct IndicatorParams;

#include "Indicator.define.h"
#include "Indicator.enum.h"
#include "Indicator.struct.cache.h"
#include "Indicator.struct.h"
#include "Indicator.struct.serialize.h"
#include "IndicatorData.mqh"
#include "Math.h"
#include "Object.mqh"
#include "Refs.mqh"
#include "Serializer.mqh"
#include "SerializerCsv.mqh"
#include "SerializerJson.mqh"
#include "Storage/ValueStorage.h"
#include "Storage/ValueStorage.indicator.h"
#include "Storage/ValueStorage.native.h"
#include "IndicatorData.h"

// Includes.
#include "../Array.mqh"
#include "../BufferStruct.mqh"
#include "../DateTime.mqh"
#include "../DrawIndicator.mqh"
#include "../Flags.h"
#include "../Math.h"
#include "../Object.mqh"
#include "../Refs.mqh"
#include "../Serializer.mqh"
#include "../SerializerCsv.mqh"
#include "../SerializerJson.mqh"
#include "../Storage/ValueStorage.h"
#include "../Storage/ValueStorage.indicator.h"
#include "../Storage/ValueStorage.native.h"

#ifndef __MQL4__
// Defines global functions (for MQL4 backward compatibility).
Expand Down Expand Up @@ -608,10 +611,10 @@ class Indicator : public IndicatorData {
_entry.Resize(_max_modes);
_entry.timestamp = GetBarTime(_ishift);
#ifndef __MQL4__
if (IndicatorBase::Get<bool>(STRUCT_ENUM(IndicatorState, INDICATOR_STATE_PROP_IS_CHANGED))) {
if (IndicatorData::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);
IndicatorData::Set<int>(STRUCT_ENUM(IndicatorState, INDICATOR_STATE_PROP_HANDLE), INVALID_HANDLE);
IndicatorData::Set<int>(STRUCT_ENUM(IndicatorState, INDICATOR_STATE_PROP_IS_CHANGED), false);
}
#endif
for (int _mode = 0; _mode < _max_modes; _mode++) {
Expand Down
Loading

0 comments on commit 0ecb54d

Please sign in to comment.