diff --git a/Dict.mqh b/Dict.mqh index 56f894fdc..923e63575 100644 --- a/Dict.mqh +++ b/Dict.mqh @@ -26,6 +26,7 @@ #include "Convert.basic.h" #include "DictBase.mqh" +#include "DictIteratorBase.mqh" #include "Matrix.mqh" #include "Serializer/Serializer.h" #include "Serializer/SerializerNodeIterator.h" @@ -41,12 +42,12 @@ class DictIterator : public DictIteratorBase { /** * Constructor. */ - DictIterator(DictBase& dict, unsigned int slotIdx) : DictIteratorBase(dict, slotIdx) {} + DictIterator(DictBase& dict, unsigned int slotIdx) : DictIteratorBase(dict, slotIdx) {} /** * Copy constructor. */ - DictIterator(const DictIterator& right) : DictIteratorBase(right) {} + DictIterator(const DictIterator& right) : DictIteratorBase(right) {} }; /** @@ -70,37 +71,37 @@ class Dict : public DictBase { Clear(); Resize(right.GetSlotCount()); for (unsigned int i = 0; i < (unsigned int)ArraySize(right._DictSlots_ref.DictSlots); ++i) { - _DictSlots_ref.DictSlots[i] = right._DictSlots_ref.DictSlots[i]; + THIS_ATTR _DictSlots_ref.DictSlots[i] = right._DictSlots_ref.DictSlots[i]; } - _DictSlots_ref._num_used = right._DictSlots_ref._num_used; - _current_id = right._current_id; - _mode = right._mode; + THIS_ATTR _DictSlots_ref._num_used = right._DictSlots_ref._num_used; + THIS_ATTR _current_id = right._current_id; + THIS_ATTR _mode = right._mode; } void operator=(const Dict& right) { Clear(); Resize(right.GetSlotCount()); for (unsigned int i = 0; i < (unsigned int)ArraySize(right._DictSlots_ref.DictSlots); ++i) { - _DictSlots_ref.DictSlots[i] = right._DictSlots_ref.DictSlots[i]; + THIS_ATTR _DictSlots_ref.DictSlots[i] = right._DictSlots_ref.DictSlots[i]; } - _DictSlots_ref._num_used = right._DictSlots_ref._num_used; - _current_id = right._current_id; - _mode = right._mode; + THIS_ATTR _DictSlots_ref._num_used = right._DictSlots_ref._num_used; + THIS_ATTR _current_id = right._current_id; + THIS_ATTR _mode = right._mode; } void Clear() { - for (unsigned int i = 0; i < (unsigned int)ArraySize(_DictSlots_ref.DictSlots); ++i) { - if (_DictSlots_ref.DictSlots[i].IsUsed()) _DictSlots_ref.DictSlots[i].SetFlags(0); + for (unsigned int i = 0; i < (unsigned int)ArraySize(THIS_ATTR _DictSlots_ref.DictSlots); ++i) { + if (THIS_ATTR _DictSlots_ref.DictSlots[i].IsUsed()) THIS_ATTR _DictSlots_ref.DictSlots[i].SetFlags(0); } - _DictSlots_ref._num_used = 0; + THIS_ATTR _DictSlots_ref._num_used = 0; } /** * Inserts value using hashless key. */ bool Push(V value) { - if (!InsertInto(_DictSlots_ref, value)) return false; + if (!InsertInto(THIS_ATTR _DictSlots_ref, value)) return false; return true; } @@ -113,15 +114,15 @@ class Dict : public DictBase { * Inserts or replaces value for a given key. */ bool Set(K key, V value) { - if (!InsertInto(_DictSlots_ref, key, value, true)) return false; + if (!InsertInto(THIS_ATTR _DictSlots_ref, key, value, true)) return false; return true; } V operator[](K key) { - if (_mode == DictModeList) return GetSlot((unsigned int)key).value; + if (THIS_ATTR _mode == DictModeList) return THIS_ATTR GetSlot((unsigned int)key).value; int position; - DictSlot* slot = GetSlotByKey(_DictSlots_ref, key, position); + DictSlot* slot = GetSlotByKey(THIS_ATTR _DictSlots_ref, key, position); if (!slot) return (V)NULL; @@ -136,7 +137,7 @@ class Dict : public DictBase { */ V GetByKey(const K _key, V _default = NULL) { unsigned int position; - DictSlot* slot = GetSlotByKey(_DictSlots_ref, _key, position); + DictSlot* slot = GetSlotByKey(THIS_ATTR _DictSlots_ref, _key, position); if (!slot) { return _default; @@ -149,7 +150,7 @@ class Dict : public DictBase { * Returns value for a given position. */ V GetByPos(unsigned int _position) { - DictSlot* slot = GetSlotByPos(_DictSlots_ref, _position); + DictSlot* slot = GetSlotByPos(THIS_ATTR _DictSlots_ref, _position); if (!slot) { Alert("Invalid DictStruct position \"", _position, "\" (called by GetByPos()). Returning empty structure."); @@ -164,10 +165,12 @@ class Dict : public DictBase { /** * Checks whether dictionary contains given key => value pair. */ +#ifdef __MQL__ template <> +#endif bool Contains(const K key, const V value) { unsigned int position; - DictSlot* slot = GetSlotByKey(_DictSlots_ref, key, position); + DictSlot* slot = GetSlotByKey(THIS_ATTR _DictSlots_ref, key, position); if (!slot) return false; @@ -177,9 +180,11 @@ class Dict : public DictBase { /** * Returns index of dictionary's value or -1 if value doesn't exist. */ +#ifdef __MQL__ template <> +#endif int IndexOf(V& value) { - for (DictIteratorBase i(Begin()); i.IsValid(); ++i) { + for (DictIteratorBase i(THIS_ATTR Begin()); i.IsValid(); ++i) { if (i.Value() == value) { return (int)i.Index(); } @@ -192,7 +197,7 @@ class Dict : public DictBase { * Checks whether dictionary contains given value. */ bool Contains(const V value) { - for (DictIterator i = Begin(); i.IsValid(); ++i) { + for (DictIterator i = THIS_ATTR Begin(); i.IsValid(); ++i) { if (i.Value() == value) { return true; } @@ -232,7 +237,7 @@ class Dict : public DictBase { if ((_is_full || !_is_performant) && allow_resize) { // We have to resize the dict as it is either full or have perfomance problems due to massive number of conflicts // when inserting new values. - if (overflow_listener == NULL) { + if (THIS_ATTR overflow_listener == NULL) { // There is no overflow listener so we can freely grow up the dict. if (!GrowUp()) { // Can't resize the dict. Error happened. @@ -240,8 +245,9 @@ class Dict : public DictBase { } } else { // Overflow listener will decide if we can grow up the dict. - if (overflow_listener(_is_full ? DICT_LISTENER_FULL_CAN_RESIZE : DICT_LISTENER_NOT_PERFORMANT_CAN_RESIZE, - dictSlotsRef._num_used, 0)) { + if (THIS_ATTR overflow_listener( + _is_full ? DICT_LISTENER_FULL_CAN_RESIZE : DICT_LISTENER_NOT_PERFORMANT_CAN_RESIZE, + dictSlotsRef._num_used, 0)) { // We can freely grow up the dict. if (!GrowUp()) { // Can't resize the dict. Error happened. @@ -268,11 +274,12 @@ class Dict : public DictBase { (!dictSlotsRef.DictSlots[position].HasKey() || dictSlotsRef.DictSlots[position].key != key)) { ++_num_conflicts; - if (overflow_listener != NULL) { + if (THIS_ATTR overflow_listener != NULL) { // We had to skip slot as it is already occupied. Now we are checking if // there is too many conflicts/skips and thus we can overwrite slot in // the starting position. - if (overflow_listener(DICT_LISTENER_CONFLICTS_CAN_OVERWRITE, dictSlotsRef._num_used, _num_conflicts)) { + if (THIS_ATTR overflow_listener(DICT_LISTENER_CONFLICTS_CAN_OVERWRITE, dictSlotsRef._num_used, + _num_conflicts)) { // Looks like dict is working as buffer and we can overwrite slot in the starting position. position = _starting_position; break; @@ -309,9 +316,9 @@ class Dict : public DictBase { * Inserts hashless value into given array of DictSlots. */ bool InsertInto(DictSlotsRef& dictSlotsRef, V value) { - if (_mode == DictModeUnknown) - _mode = DictModeList; - else if (_mode != DictModeList) { + if (THIS_ATTR _mode == DictModeUnknown) + THIS_ATTR _mode = DictModeList; + else if (THIS_ATTR _mode != DictModeList) { Alert("Warning: Dict already operates as a dictionary, not a list!"); DebugBreak(); return false; @@ -322,7 +329,7 @@ class Dict : public DictBase { if (!GrowUp()) return false; } - unsigned int position = Hash((unsigned int)dictSlotsRef._list_index) % ArraySize(dictSlotsRef.DictSlots); + unsigned int position = THIS_ATTR Hash((unsigned int)dictSlotsRef._list_index) % ArraySize(dictSlotsRef.DictSlots); // Searching for empty DictSlot. while (dictSlotsRef.DictSlots[position].IsUsed()) { @@ -342,14 +349,15 @@ class Dict : public DictBase { * Expands array of DictSlots by given percentage value. */ bool GrowUp(int percent = DICT_GROW_UP_PERCENT_DEFAULT) { - return Resize(MathMax(10, (int)((float)ArraySize(_DictSlots_ref.DictSlots) * ((float)(percent + 100) / 100.0f)))); + return Resize( + MathMax(10, (int)((float)ArraySize(THIS_ATTR _DictSlots_ref.DictSlots) * ((float)(percent + 100) / 100.0f)))); } /** * Shrinks or expands array of DictSlots. */ bool Resize(int new_size) { - if (new_size <= MathMin(_DictSlots_ref._num_used, ArraySize(_DictSlots_ref.DictSlots))) { + if (new_size <= MathMin(THIS_ATTR _DictSlots_ref._num_used, ArraySize(THIS_ATTR _DictSlots_ref.DictSlots))) { // We already use minimum number of slots possible. return true; } @@ -367,36 +375,37 @@ class Dict : public DictBase { new_DictSlots._num_used = 0; // Copies entire array of DictSlots into new array of DictSlots. Hashes will be rehashed. - for (i = 0; i < ArraySize(_DictSlots_ref.DictSlots); ++i) { - if (!_DictSlots_ref.DictSlots[i].IsUsed()) continue; + for (i = 0; i < ArraySize(THIS_ATTR _DictSlots_ref.DictSlots); ++i) { + if (!THIS_ATTR _DictSlots_ref.DictSlots[i].IsUsed()) continue; - if (_DictSlots_ref.DictSlots[i].HasKey()) { - if (!InsertInto(new_DictSlots, _DictSlots_ref.DictSlots[i].key, _DictSlots_ref.DictSlots[i].value, false)) + if (THIS_ATTR _DictSlots_ref.DictSlots[i].HasKey()) { + if (!InsertInto(new_DictSlots, THIS_ATTR _DictSlots_ref.DictSlots[i].key, + THIS_ATTR _DictSlots_ref.DictSlots[i].value, false)) return false; } else { - if (!InsertInto(new_DictSlots, _DictSlots_ref.DictSlots[i].value)) return false; + if (!InsertInto(new_DictSlots, THIS_ATTR _DictSlots_ref.DictSlots[i].value)) return false; } } // Freeing old DictSlots array. - ArrayFree(_DictSlots_ref.DictSlots); + ArrayFree(THIS_ATTR _DictSlots_ref.DictSlots); - _DictSlots_ref = new_DictSlots; + THIS_ATTR _DictSlots_ref = new_DictSlots; return true; } public: -#ifdef __cplusplus +#ifdef __MQL__ template <> #endif SerializerNodeType Serialize(Serializer& s) { if (s.IsWriting()) { - for (DictIteratorBase i(Begin()); i.IsValid(); ++i) { + for (DictIteratorBase i(THIS_ATTR Begin()); i.IsValid(); ++i) { V value = i.Value(); - s.Pass(THIS_REF, GetMode() == DictModeDict ? i.KeyAsString() : "", value); + s.Pass(THIS_REF, THIS_ATTR GetMode() == DictModeDict ? i.KeyAsString() : "", value); } - return (GetMode() == DictModeDict) ? SerializerNodeObject : SerializerNodeArray; + return (THIS_ATTR GetMode() == DictModeDict) ? SerializerNodeObject : SerializerNodeArray; } else { SerializerIterator i; @@ -432,9 +441,9 @@ class Dict : public DictBase { */ template Matrix* ToMatrix() { - Matrix* result = new Matrix(Size()); + Matrix* result = new Matrix(THIS_ATTR Size()); - for (DictIterator i = Begin(); i.IsValid(); ++i) result[i.Index()] = (X)i.Value(); + for (DictIterator i = THIS_ATTR Begin(); i.IsValid(); ++i) result[i.Index()] = (X)i.Value(); return result; } diff --git a/Draw.mqh b/Draw.mqh index 5c2fcca9e..3fb403904 100644 --- a/Draw.mqh +++ b/Draw.mqh @@ -30,8 +30,10 @@ class Chart; class Draw; // Includes. -#include "Chart.mqh" #include "Data.define.h" +#include "Object.extern.h" +#include "Platform.h" +#include "Terminal.define.h" #ifndef __MQL4__ // Defines macros (for MQL4 backward compatibility). @@ -41,21 +43,6 @@ class Draw; #define SetIndexShift(_index, _value) (PlotIndexSetInteger(_index, PLOT_SHIFT, _value)) #endif -#ifndef __MQL4__ -// Defines global functions (for MQL4 backward compatibility). -bool ObjectCreate(string _name, ENUM_OBJECT _otype, int _swindow, datetime _t1, double _p1) { - return Draw::ObjectCreate(0, _name, _otype, _swindow, _t1, _p1); -} -bool ObjectDelete(string _name) { return Draw::ObjectDelete(_name); } -bool ObjectSet(string _name, int _prop_id, double _value) { return Draw::ObjectSet(_name, _prop_id, _value); } -int ObjectsTotal(int _type = EMPTY) { return Draw::ObjectsTotal(); } -string ObjectName(int _index) { return Draw::ObjectName(_index); } -void SetIndexLabel(int _index, string _text) { Draw::SetIndexLabel(_index, _text); } -void SetIndexStyle(int _index, int _type, int _style = EMPTY, int _width = EMPTY, color _clr = CLR_NONE) { - Draw::SetIndexStyle(_index, _type, _style, _width, _clr); -} -#endif - #define WINDOW_MAIN 0 #ifdef __MQL5__ @@ -85,7 +72,7 @@ class Draw : public Object { /** * Class constructor. */ - Draw(long _chart_id = 0) : chart_id(_chart_id != 0 ? _chart_id : ChartID()) {} + Draw(long _chart_id = 0) : chart_id(_chart_id != 0 ? _chart_id : Platform::ChartID()) {} /* Graphic object related methods */ @@ -335,3 +322,18 @@ class Draw : public Object { return true; } }; + +#ifndef __MQL4__ +// Defines global functions (for MQL4 backward compatibility). +bool ObjectCreate(string _name, ENUM_OBJECT _otype, int _swindow, datetime _t1, double _p1) { + return Draw::ObjectCreate(0, _name, _otype, _swindow, _t1, _p1); +} +bool ObjectDelete(string _name) { return Draw::ObjectDelete(_name); } +bool ObjectSet(string _name, int _prop_id, double _value) { return Draw::ObjectSet(_name, _prop_id, _value); } +int ObjectsTotal(int _type = EMPTY) { return Draw::ObjectsTotal(); } +string ObjectName(int _index) { return Draw::ObjectName(_index); } +void SetIndexLabel(int _index, string _text) { Draw::SetIndexLabel(_index, _text); } +void SetIndexStyle(int _index, int _type, int _style = EMPTY, int _width = EMPTY, color _clr = CLR_NONE) { + Draw::SetIndexStyle(_index, _type, _style, _width, _clr); +} +#endif diff --git a/File.extern.h b/File.extern.h index de79731bf..ca4e965b5 100644 --- a/File.extern.h +++ b/File.extern.h @@ -28,6 +28,7 @@ // Define external global functions. #ifndef __MQL__ +#pragma once MemoryFileSystem _memfs; diff --git a/File.mqh b/File.mqh index 7c98322de..fc840d1a7 100644 --- a/File.mqh +++ b/File.mqh @@ -29,6 +29,11 @@ * - Files with which file operations are conducted means cannot be outside the file sandbox. */ +#ifndef __MQL__ +// Allows the preprocessor to include a header file when it is needed. +#pragma once +#endif + // Includes. #include "File.define.h" #include "File.extern.h" diff --git a/Indicator/Indicator.define.h b/Indicator/Indicator.define.h index 3d1a65c24..d0e2900df 100644 --- a/Indicator/Indicator.define.h +++ b/Indicator/Indicator.define.h @@ -35,8 +35,8 @@ #define DUMMY #define ICUSTOM_DEF(SET_HANDLE, PARAMS) \ - double _res[]; \ - if (_handle == NULL || _handle == INVALID_HANDLE) { \ + ARRAY(double, _res); \ + if (_handle == 0 || _handle == INVALID_HANDLE) { \ if ((_handle = ::iCustom(_symbol, _tf, _name PARAMS)) == INVALID_HANDLE) { \ SetUserError(ERR_USER_INVALID_HANDLE); \ return EMPTY_VALUE; \ diff --git a/Indicator/IndicatorBase.h b/Indicator/IndicatorBase.h index ff1327cb2..3dede1258 100644 --- a/Indicator/IndicatorBase.h +++ b/Indicator/IndicatorBase.h @@ -34,11 +34,10 @@ #include "../Array.mqh" #include "../BufferStruct.mqh" #include "../Chart.struct.tf.h" -//#include "../ChartBase.h" -#include "../ChartMt.h" #include "../DateTime.mqh" #include "../Log.mqh" #include "../Object.mqh" +#include "../Platform.extern.h" #include "../Refs.mqh" #include "../Serializer/Serializer.h" #include "../Serializer/SerializerCsv.h" @@ -192,7 +191,7 @@ class IndicatorBase : public Object { /** * Get name of the indicator. */ - virtual string GetName() = NULL; + virtual string GetName() = 0; /** * Get full name of the indicator (with "over ..." part). diff --git a/Indicator/IndicatorData.h b/Indicator/IndicatorData.h index 58776bff9..78b5bb1f1 100644 --- a/Indicator/IndicatorData.h +++ b/Indicator/IndicatorData.h @@ -31,15 +31,13 @@ // Forward class declaration. class IndicatorBase; +class IndicatorDraw; // Includes. #include "../Bar.struct.h" -#include "../DrawIndicator.mqh" #include "../Flags.h" +#include "../Storage/IValueStorage.h" #include "../Storage/ItemsHistory.h" -#include "../Storage/ValueStorage.h" -#include "../Storage/ValueStorage.indicator.h" -#include "../Storage/ValueStorage.native.h" #include "../SymbolInfo.struct.h" #include "Indicator.enum.h" #include "IndicatorBase.h" diff --git a/Indicators/Tick/Indi_TickRandom.mqh b/Indicators/Tick/Indi_TickRandom.mqh index c3b3a6253..56e8148c5 100644 --- a/Indicators/Tick/Indi_TickRandom.mqh +++ b/Indicators/Tick/Indi_TickRandom.mqh @@ -31,7 +31,6 @@ #endif // Includes. -#include "../../Chart.struct.static.h" #include "../../Indicator/IndicatorTick.h" #include "../../Indicator/IndicatorTick.provider.h" diff --git a/Math.extern.h b/Math.extern.h index a19b60b13..7965fd1f3 100644 --- a/Math.extern.h +++ b/Math.extern.h @@ -75,4 +75,6 @@ template T log10(T value) { return std::log10(value); } +int MathRand() { return std::rand() % 32768; } +int rand() { return std::rand() % 32768; } #endif diff --git a/Matrix.mqh b/Matrix.mqh index 59f3eef39..de0f7177c 100644 --- a/Matrix.mqh +++ b/Matrix.mqh @@ -282,7 +282,7 @@ class MatrixDimension { /** * Sets physical position of the dimension in the matrix. */ - void SetPosition(int& _position[], int _level) { + void SetPosition(ARRAY_REF(int, _position), int _level) { for (int i = 0; i < ArraySize(_position); ++i) { position[i] = i < _level ? _position[i] : -1; } @@ -472,8 +472,8 @@ class MatrixDimension { * * @todo Allow of resizing containers instead of freeing them firstly. */ - static MatrixDimension* SetDimensions(MatrixDimension* _ptr_parent_dimension, int& _dimensions[], int index, - int& _current_position[]) { + static MatrixDimension* SetDimensions(MatrixDimension* _ptr_parent_dimension, ARRAY_REF(int, _dimensions), + int index, ARRAY_REF(int, _current_position)) { if (_ptr_parent_dimension == NULL) _ptr_parent_dimension = new MatrixDimension(); if (index == 0 && _dimensions[0] == 0) { @@ -634,7 +634,7 @@ class MatrixDimension { /** * Extracts dimensions's values to the given array. Used internally. */ - void FillArray(X& array[], int& offset) { + void FillArray(ARRAY_REF(X, array), int& offset) { int i; if (type == MATRIX_DIMENSION_TYPE_CONTAINERS) { for (i = 0; i < ArraySize(containers); ++i) { @@ -647,7 +647,7 @@ class MatrixDimension { } } - void FromArray(X& _array[], int& offset) { + void FromArray(ARRAY_REF(X, _array), int& offset) { int i; switch (type) { case MATRIX_DIMENSION_TYPE_CONTAINERS: @@ -1378,7 +1378,7 @@ class Matrix { /** * Fills array with all values from the matrix. */ - void GetRawArray(X& array[]) { + void GetRawArray(ARRAY_REF(X, array)) { ArrayResize(array, GetSize()); int offset = 0; ptr_first_dimension.FillArray(array, offset); @@ -1425,7 +1425,7 @@ class Matrix { } #endif - void FillFromArray(X& _array[]) { + void FillFromArray(ARRAY_REF(X, _array)) { if (ArraySize(_array) != GetSize()) { Print("Matrix::FillFromArray(): input array (", ArraySize(_array), " elements) must be the same size as matrix (", GetSize(), " elements)!"); @@ -1908,10 +1908,10 @@ class Matrix { return GetDimensionsTotal(_dimensions); } - static int GetDimensionsTotal(int& dimensions[]) { + static int GetDimensionsTotal(FIXED_ARRAY_REF(int, dimensions, MATRIX_DIMENSIONS)) { int size = 0; - for (int i = 0; i < ArraySize(dimensions); ++i) { + for (int i = 0; i < MATRIX_DIMENSIONS; ++i) { if (dimensions[i] != 0) { if (size == 0) { size = 1; diff --git a/MiniMatrix.h b/MiniMatrix.h index 3ceaaa5ab..14560235f 100644 --- a/MiniMatrix.h +++ b/MiniMatrix.h @@ -27,7 +27,7 @@ template class MiniMatrix2d { public: - T data[]; + ARRAY(T, data); int size_x; int size_y; diff --git a/Object.extern.h b/Object.extern.h index 0b4bd3e35..8490e9499 100644 --- a/Object.extern.h +++ b/Object.extern.h @@ -25,6 +25,9 @@ * Includes external declarations related to objects. */ #ifndef __MQL__ + +#pragma once + template X* GetPointer(X& value) { return &value; @@ -33,4 +36,61 @@ template X* GetPointer(X* ptr) { return ptr; } + +template +ENUM_POINTER_TYPE CheckPointer(X& value) { + return (&value) != nullptr ? POINTER_DYNAMIC : POINTER_INVALID; +} +template +ENUM_POINTER_TYPE CheckPointer(X* ptr) { + return ptr != nullptr ? POINTER_DYNAMIC : POINTER_INVALID; +} + +enum ENUM_OBJECT { + OBJ_VLINE = 0, // Vertical Line + OBJ_HLINE = 1, // Horizontal Line + OBJ_TREND = 2, // Trend Line + OBJ_TRENDBYANGLE = 3, // Trend Line By Angle + OBJ_CYCLES = 4, // Cycle Lines + OBJ_ARROWED_LINE = 108, // Arrowed Line + OBJ_CHANNEL = 5, // Equidistant Channel + OBJ_STDDEVCHANNEL = 6, // Standard Deviation Channel + OBJ_REGRESSION = 7, // Linear Regression Channel + OBJ_PITCHFORK = 8, // AndrewsÂ’ Pitchfork + OBJ_GANNLINE = 9, // Gann Line + OBJ_GANNFAN = 10, // Gann Fan + OBJ_GANNGRID = 11, // Gann Grid + OBJ_FIBO = 12, // Fibonacci Retracement + OBJ_FIBOTIMES = 13, // Fibonacci Time Zones + OBJ_FIBOFAN = 14, // Fibonacci Fan + OBJ_FIBOARC = 15, // Fibonacci Arcs + OBJ_FIBOCHANNEL = 16, // Fibonacci Channel + OBJ_EXPANSION = 17, // Fibonacci Expansion + OBJ_ELLIOTWAVE5 = 18, // Elliott Motive Wave + OBJ_ELLIOTWAVE3 = 19, // Elliott Correction Wave + OBJ_RECTANGLE = 20, // Rectangle + OBJ_TRIANGLE = 21, // Triangle + OBJ_ELLIPSE = 22, // Ellipse + OBJ_ARROW_THUMB_UP = 23, // Thumbs Up + OBJ_ARROW_THUMB_DOWN = 24, // Thumbs Down + OBJ_ARROW_UP = 25, // Arrow Up + OBJ_ARROW_DOWN = 26, // Arrow Down + OBJ_ARROW_STOP = 27, // Stop Sign + OBJ_ARROW_CHECK = 28, // Check Sign + OBJ_ARROW_LEFT_PRICE = 29, // Left Price Label + OBJ_ARROW_RIGHT_PRICE = 30, // Right Price Label + OBJ_ARROW_BUY = 31, // Buy Sign + OBJ_ARROW_SELL = 32, // Sell Sign + OBJ_ARROW = 100, // Arrow + OBJ_TEXT = 101, // Text + OBJ_LABEL = 102, // Label + OBJ_BUTTON = 103, // Button + OBJ_CHART = 104, // Chart + OBJ_BITMAP = 105, // Bitmap + OBJ_BITMAP_LABEL = 106, // Bitmap Label + OBJ_EDIT = 107, // Edit + OBJ_EVENT = 109, // The "Event" object corresponding to an event in the economic calendar + OBJ_RECTANGLE_LABEL = 110 // The "Rectangle label" object for creating and designing the custom graphical interface. +}; + #endif diff --git a/Orders.mqh b/Orders.mqh index 2b5ca4057..906f018a6 100644 --- a/Orders.mqh +++ b/Orders.mqh @@ -25,7 +25,6 @@ class Orders; // Includes. #include "Account/Account.h" -#include "Chart.mqh" #include "Log.mqh" #include "Math.h" #include "Order.mqh" diff --git a/Platform.h b/Platform.h index ccbada32f..f0da9db31 100644 --- a/Platform.h +++ b/Platform.h @@ -25,6 +25,19 @@ #pragma once #endif +#ifndef __MQL__ + +/** + * Extern declarations for C++. + */ + +/** + * Returns number of candles for a given symbol and time-frame. + */ +extern int Bars(CONST_REF_TO(string) _symbol, ENUM_TIMEFRAMES _tf); + +#endif + // Includes. /** @@ -193,6 +206,11 @@ class Platform { return 0; } + /** + * Returns id of the current chart. + */ + static int ChartID() { Print("Not yet implemented: ", __FUNCTION__, " returns 0."); } + /** * Binds Candle and/or Tick indicator as a source of prices or data for given indicator. * diff --git a/Serializer/SerializerCsv.h b/Serializer/SerializerCsv.h index 85992b779..aea45d535 100644 --- a/Serializer/SerializerCsv.h +++ b/Serializer/SerializerCsv.h @@ -55,12 +55,12 @@ class SerializerCsv { SerializerConverter* _stub = (SerializerConverter*)serializer_aux_arg; if (CheckPointer(_root) == POINTER_INVALID) { - Alert("SerializerCsv: Invalid root node poiner!"); + Alert("SerializerCsv: Invalid root node pointer!"); DebugBreak(); return NULL; } - if (_stub == NULL || _stub.Node() == NULL) { + if (_stub == NULL || _stub PTR_DEREF Node() == NULL) { Alert("SerializerCsv: Cannot convert to CSV without stub object!"); DebugBreak(); return NULL; @@ -72,12 +72,13 @@ class SerializerCsv { unsigned int _num_columns, _num_rows; int x, y; - if (_stub.Node().IsArray()) { - _num_columns = _stub.Node().MaximumNumChildrenInDeepEnd(); - _num_rows = _root.NumChildren(); + if (_stub PTR_DEREF Node() PTR_DEREF IsArray()) { + _num_columns = _stub PTR_DEREF Node() PTR_DEREF MaximumNumChildrenInDeepEnd(); + _num_rows = _root PTR_DEREF NumChildren(); } else { - _num_columns = MathMax(_stub.Node().MaximumNumChildrenInDeepEnd(), _root.MaximumNumChildrenInDeepEnd()); - _num_rows = _root.NumChildren() > 0 ? 1 : 0; + _num_columns = MathMax(_stub PTR_DEREF Node() PTR_DEREF MaximumNumChildrenInDeepEnd(), + _root PTR_DEREF MaximumNumChildrenInDeepEnd()); + _num_rows = _root PTR_DEREF NumChildren() > 0 ? 1 : 0; } if (_include_titles) { @@ -100,61 +101,61 @@ class SerializerCsv { _column_types_out = &_column_types; } - _matrix_out.Resize(_num_columns, _num_rows); - _column_types_out.Resize(_num_columns, 1); + _matrix_out PTR_DEREF Resize(_num_columns, _num_rows); + _column_types_out PTR_DEREF Resize(_num_columns, 1); if (_include_titles) { _column_titles.Resize(_num_columns, 1); int _titles_current_column = 0; - SerializerCsv::ExtractColumns(_stub.Node(), &_column_titles, _column_types_out, serializer_flags, + SerializerCsv::ExtractColumns(_stub PTR_DEREF Node(), &_column_titles, _column_types_out, serializer_flags, _titles_current_column); - for (x = 0; x < _matrix_out.SizeX(); ++x) { - _matrix_out.Set(x, 0, EscapeString(_column_titles.Get(x, 0))); + for (x = 0; x < _matrix_out PTR_DEREF SizeX(); ++x) { + _matrix_out PTR_DEREF Set(x, 0, EscapeString(_column_titles.Get(x, 0))); } } #ifdef __debug__ - Print("Stub: ", _stub.Node().ToString()); - Print("Data: ", _root.ToString()); + Print("Stub: ", _stub PTR_DEREF Node() PTR_DEREF ToString()); + Print("Data: ", _root PTR_DEREF ToString()); Print("Size: ", _num_columns, " x ", _num_rows); #endif - if (!SerializerCsv::FlattenNode(_root, _stub.Node(), _matrix_out, _column_types_out, _include_key ? 1 : 0, - _include_titles ? 1 : 0, serializer_flags)) { + if (!SerializerCsv::FlattenNode(_root, _stub PTR_DEREF Node(), PTR_TO_REF(_matrix_out), _column_types_out, + _include_key ? 1 : 0, _include_titles ? 1 : 0, serializer_flags)) { Alert("SerializerCsv: Error occured during flattening!"); } string _result; - for (y = 0; y < _matrix_out.SizeY(); ++y) { - for (x = 0; x < _matrix_out.SizeX(); ++x) { - _result += _matrix_out.Get(x, y); + for (y = 0; y < _matrix_out PTR_DEREF SizeY(); ++y) { + for (x = 0; x < _matrix_out PTR_DEREF SizeX(); ++x) { + _result += _matrix_out PTR_DEREF Get(x, y); - if (x != _matrix_out.SizeX() - 1) { + if (x != _matrix_out PTR_DEREF SizeX() - 1) { _result += ","; } } - if (y != _matrix_out.SizeY() - 1) _result += "\n"; + if (y != _matrix_out PTR_DEREF SizeY() - 1) _result += "\n"; } if ((serializer_flags & SERIALIZER_FLAG_REUSE_STUB) == 0) { - _stub.Clean(); + _stub PTR_DEREF Clean(); } return _result; } static string ParamToString(SerializerNodeParam* param) { - switch (param.GetType()) { + switch (param PTR_DEREF GetType()) { case SerializerNodeParamBool: case SerializerNodeParamLong: case SerializerNodeParamDouble: - return param.AsString(false, false, false, param.GetFloatingPointPrecision()); + return param PTR_DEREF AsString(false, false, false, param PTR_DEREF GetFloatingPointPrecision()); case SerializerNodeParamString: - return EscapeString(param.AsString(false, false, false, param.GetFloatingPointPrecision())); + return EscapeString(param PTR_DEREF AsString(false, false, false, param PTR_DEREF GetFloatingPointPrecision())); default: - Print("Error: Wrong param type ", EnumToString(param.GetType()), "!"); + Print("Error: Wrong param type ", EnumToString(param PTR_DEREF GetType()), "!"); DebugBreak(); } @@ -173,12 +174,12 @@ class SerializerCsv { */ static void ExtractColumns(SerializerNode* _stub, MiniMatrix2d* _titles, MiniMatrix2d* _column_types, int _flags, int& _column) { - for (unsigned int _stub_entry_idx = 0; _stub_entry_idx < _stub.NumChildren(); ++_stub_entry_idx) { - SerializerNode* _child = _stub.GetChild(_stub_entry_idx); - if (_child.IsContainer()) { + for (unsigned int _stub_entry_idx = 0; _stub_entry_idx < _stub PTR_DEREF NumChildren(); ++_stub_entry_idx) { + SerializerNode* _child = _stub PTR_DEREF GetChild(_stub_entry_idx); + if (_child PTR_DEREF IsContainer()) { ExtractColumns(_child, _titles, _column_types, _flags, _column); - } else if (_child.HasKey()) { - _titles.Set(_column++, 0, _child.Key()); + } else if (_child PTR_DEREF HasKey()) { + _titles PTR_DEREF Set(_column++, 0, _child PTR_DEREF Key()); } } } @@ -192,31 +193,31 @@ class SerializerCsv { bool _include_key = bool(_flags & SERIALIZER_CSV_INCLUDE_KEY); - if (_stub.IsArray()) { - for (_data_entry_idx = 0; _data_entry_idx < _data.NumChildren(); ++_data_entry_idx) { + if (_stub PTR_DEREF IsArray()) { + for (_data_entry_idx = 0; _data_entry_idx < _data PTR_DEREF NumChildren(); ++_data_entry_idx) { if (_include_key) { // Adding object's key in the first row. - SerializerNode* _child = _data.GetChild(_data_entry_idx); - string key = _child.HasKey() ? _child.Key() : ""; + SerializerNode* _child = _data PTR_DEREF GetChild(_data_entry_idx); + string key = _child PTR_DEREF HasKey() ? _child PTR_DEREF Key() : ""; _cells.Set(0, _row + _data_entry_idx, key); } - if (!SerializerCsv::FillRow(_data.GetChild(_data_entry_idx), _stub.GetChild(0), _cells, _column_types, _column, - _row + _data_entry_idx, 0, 0, _flags)) { + if (!SerializerCsv::FillRow(_data PTR_DEREF GetChild(_data_entry_idx), _stub PTR_DEREF GetChild(0), _cells, + _column_types, _column, _row + _data_entry_idx, 0, 0, _flags)) { return false; } } - } else if (_stub.IsObject()) { + } else if (_stub PTR_DEREF IsObject()) { // Object means that there is only one row. - if (_data.IsArray()) { + if (_data PTR_DEREF IsArray()) { // Stub is an object, but data is an array (should be?). - for (_data_entry_idx = 0; _data_entry_idx < _data.NumChildren(); ++_data_entry_idx) { - if (!SerializerCsv::FillRow(_data.GetChild(_data_entry_idx), _stub, _cells, _column_types, _column, _row, 0, - 0, _flags)) { + for (_data_entry_idx = 0; _data_entry_idx < _data PTR_DEREF NumChildren(); ++_data_entry_idx) { + if (!SerializerCsv::FillRow(_data PTR_DEREF GetChild(_data_entry_idx), _stub, _cells, _column_types, _column, + _row, 0, 0, _flags)) { return false; } - _column += (int)_stub.GetChild(_data_entry_idx).MaximumNumChildrenInDeepEnd(); + _column += (int)_stub PTR_DEREF GetChild(_data_entry_idx) PTR_DEREF MaximumNumChildrenInDeepEnd(); } } else { // Stub and object are both arrays. @@ -237,34 +238,34 @@ class SerializerCsv { int _level, int _flags) { unsigned int _data_entry_idx, _entry_size; - if (_stub.IsObject()) { - for (_data_entry_idx = 0; _data_entry_idx < _data.NumChildren(); ++_data_entry_idx) { - if (_stub.NumChildren() == 0) { - Print("Stub is empty for object representation of: ", _data.ToString(false, 2)); + if (_stub PTR_DEREF IsObject()) { + for (_data_entry_idx = 0; _data_entry_idx < _data PTR_DEREF NumChildren(); ++_data_entry_idx) { + if (_stub PTR_DEREF NumChildren() == 0) { + Print("Stub is empty for object representation of: ", _data PTR_DEREF ToString(false, 2)); Print( "Note that if you're serializing a dictionary, your stub must contain a single, dummy key and maximum " "possible object representation."); - Print("Missing key \"", _data.Key(), "\" in stub."); + Print("Missing key \"", _data PTR_DEREF Key(), "\" in stub."); DebugBreak(); } - _entry_size = MathMax(_stub.GetChild(_data_entry_idx).TotalNumChildren(), - _data.GetChild(_data_entry_idx).TotalNumChildren()); + _entry_size = MathMax(_stub PTR_DEREF GetChild(_data_entry_idx) PTR_DEREF TotalNumChildren(), + _data PTR_DEREF GetChild(_data_entry_idx) PTR_DEREF TotalNumChildren()); - if (!SerializerCsv::FillRow(_data.GetChild(_data_entry_idx), - _stub != NULL ? _stub.GetChild(_data_entry_idx) : NULL, _cells, _column_types, - _column, _row, _data_entry_idx, _level + 1, _flags)) { + if (!SerializerCsv::FillRow(_data PTR_DEREF GetChild(_data_entry_idx), + _stub != NULL ? _stub PTR_DEREF GetChild(_data_entry_idx) : NULL, _cells, + _column_types, _column, _row, _data_entry_idx, _level + 1, _flags)) { return false; } _column += (int)_entry_size; } - } else if (_stub.IsArray()) { - for (_data_entry_idx = 0; _data_entry_idx < _data.NumChildren(); ++_data_entry_idx) { - _entry_size = MathMax(_stub.GetChild(_data_entry_idx).TotalNumChildren(), - _data.GetChild(_data_entry_idx).TotalNumChildren()); + } else if (_stub PTR_DEREF IsArray()) { + for (_data_entry_idx = 0; _data_entry_idx < _data PTR_DEREF NumChildren(); ++_data_entry_idx) { + _entry_size = MathMax(_stub PTR_DEREF GetChild(_data_entry_idx) PTR_DEREF TotalNumChildren(), + _data PTR_DEREF GetChild(_data_entry_idx) PTR_DEREF TotalNumChildren()); - if (!SerializerCsv::FillRow(_data.GetChild(_data_entry_idx), _stub.GetChild(0), _cells, _column_types, _column, - _row, _data_entry_idx, _level + 1, _flags)) { + if (!SerializerCsv::FillRow(_data PTR_DEREF GetChild(_data_entry_idx), _stub PTR_DEREF GetChild(0), _cells, + _column_types, _column, _row, _data_entry_idx, _level + 1, _flags)) { return false; } @@ -277,14 +278,14 @@ class SerializerCsv { bool _include_titles_tree = (_flags & SERIALIZER_CSV_INCLUDE_TITLES_TREE) == SERIALIZER_CSV_INCLUDE_TITLES_TREE; if (_column_types != NULL) { - if (_data.GetValueParam() == NULL) { + if (_data PTR_DEREF GetValueParam() == NULL) { Alert("Error: Expected value here! Stub is probably initialized without proper structure."); DebugBreak(); } - _column_types.Set(_column, 0, _data.GetValueParam().GetType()); + _column_types PTR_DEREF Set(_column, 0, _data PTR_DEREF GetValueParam() PTR_DEREF GetType()); } - _cells.Set(_column, _row, ParamToString(_data.GetValueParam())); + _cells.Set(_column, _row, ParamToString(_data PTR_DEREF GetValueParam())); } return true; diff --git a/Std.h b/Std.h index 59afc3671..8337ec71d 100644 --- a/Std.h +++ b/Std.h @@ -34,6 +34,10 @@ #include #endif +#ifndef __MQL__ +#define __FUNCSIG__ __FUNCTION__ +#endif + #ifdef __MQL__ #define ASSIGN_TO_THIS(TYPE, VALUE) ((TYPE)this) = ((TYPE)VALUE) #else @@ -93,6 +97,7 @@ * ARRAY_REF(, ) */ #define ARRAY_REF(T, N) REF(T) N ARRAY_DECLARATION_BRACKETS +#define FIXED_ARRAY_REF(T, N, S) ARRAY_REF(T, N) #define CONST_ARRAY_REF(T, N) const N ARRAY_DECLARATION_BRACKETS @@ -118,6 +123,7 @@ * ARRAY_REF(, ) */ #define ARRAY_REF(T, N) _cpp_array& N +#define FIXED_ARRAY_REF(T, N, S) T(&N)[S] #define CONST_ARRAY_REF(T, N) const _cpp_array& N diff --git a/Storage/ValueStorage.h b/Storage/ValueStorage.h index 6f704c47a..8e7fa6e66 100644 --- a/Storage/ValueStorage.h +++ b/Storage/ValueStorage.h @@ -256,20 +256,6 @@ int ArrayCopy(ARRAY_REF(D, _target), ValueStorage &_source, int _dst_start = return _num_copied; } -/** - * iHigest() version working on ValueStorage. - */ -int iHighest(ValueStorage &_price, int _count = WHOLE_ARRAY, int _start = 0) { - return iPeak(_price, _count, _start, IPEAK_HIGHEST); -} - -/** - * iLowest() version working on ValueStorage. - */ -int iLowest(ValueStorage &_price, int _count = WHOLE_ARRAY, int _start = 0) { - return iPeak(_price, _count, _start, IPEAK_LOWEST); -} - /** * iLowest() version working on ValueStorage. */ @@ -315,4 +301,18 @@ int iPeak(ValueStorage &_price, int _count, int _start, ENUM_IPEAK _type return _price_size - _peak_idx - 1; } +/** + * iHigest() version working on ValueStorage. + */ +int iHighest(ValueStorage &_price, int _count = WHOLE_ARRAY, int _start = 0) { + return iPeak(_price, _count, _start, IPEAK_HIGHEST); +} + +/** + * iLowest() version working on ValueStorage. + */ +int iLowest(ValueStorage &_price, int _count = WHOLE_ARRAY, int _start = 0) { + return iPeak(_price, _count, _start, IPEAK_LOWEST); +} + #endif // VALUE_STORAGE_H diff --git a/Storage/ValueStorage.history.h b/Storage/ValueStorage.history.h index ed11af3c9..73d64a74f 100644 --- a/Storage/ValueStorage.history.h +++ b/Storage/ValueStorage.history.h @@ -31,7 +31,6 @@ #endif // Includes. -#include "../Indicator/IndicatorData.h" #include "ValueStorage.h" // Forward declarations. diff --git a/Storage/ValueStorage.spread.h b/Storage/ValueStorage.spread.h index 98e3689fc..890b168a1 100644 --- a/Storage/ValueStorage.spread.h +++ b/Storage/ValueStorage.spread.h @@ -25,7 +25,6 @@ */ // Includes. -#include "../Chart.struct.h" #include "ObjectsCache.h" #include "ValueStorage.history.h" diff --git a/String.extern.h b/String.extern.h index f4ea595a4..8c1cde2f6 100644 --- a/String.extern.h +++ b/String.extern.h @@ -101,4 +101,30 @@ unsigned short StringGetCharacter(string string_value, int pos) { int StringToCharArray(string text_string, ARRAY_REF(unsigned char, array), int start = 0, int count = -1, unsigned int codepage = CP_ACP); + +bool StringInit(string& string_var, int new_len = 0, unsigned short character = 0) { + string_var = string(new_len, (char)character); + return true; +} + +/** + * It replaces all the found substrings of a string by a set sequence of symbols. + * + * @docs + * - https://www.mql5.com/en/docs/strings/stringreplace + */ +int StringReplace(string& str, const string& find, const string& replacement) { + int num_replacements; + for (size_t pos = 0;; pos += replacement.length()) { + // Locate the substring to replace + pos = str.find(find, pos); + if (pos == string::npos) break; + // Replace by erasing and inserting + str.erase(pos, find.length()); + str.insert(pos, replacement); + ++num_replacements; + } + return num_replacements; +} + #endif diff --git a/Terminal.define.h b/Terminal.define.h index 129089236..a316eea43 100644 --- a/Terminal.define.h +++ b/Terminal.define.h @@ -38,141 +38,275 @@ #define CP_UTF8 65001 // UTF-8 code page. // Colors. -#define AliceBlue 0xFFF8F0 -#define AntiqueWhite 0xD7EBFA -#define Aqua 0xFFFF00 -#define Aquamarine 0xD4FF7F -#define Beige 0xDCF5F5 -#define Bisque 0xC4E4FF -#define Black 0x000000 -#define BlanchedAlmond 0xCDEBFF -#define Blue 0xFF0000 -#define BlueViolet 0xE22B8A -#define Brown 0x2A2AA5 -#define BurlyWood 0x87B8DE -#define CadetBlue 0xA09E5F -#define Chartreuse 0x00FF7F -#define Chocolate 0x1E69D2 -#define Coral 0x507FFF -#define CornflowerBlue 0xED9564 -#define Cornsilk 0xDCF8FF -#define Crimson 0x3C14DC -#define DarkBlue 0x8B0000 -#define DarkGoldenrod 0x0B86B8 -#define DarkGray 0xA9A9A9 -#define DarkGreen 0x006400 -#define DarkKhaki 0x6BB7BD -#define DarkOliveGreen 0x2F6B55 -#define DarkOrange 0x008CFF -#define DarkOrchid 0xCC3299 -#define DarkSalmon 0x7A96E9 -#define DarkSlateBlue 0x8B3D48 -#define DarkSlateGray 0x4F4F2F -#define DarkTurquoise 0xD1CE00 -#define DarkViolet 0xD30094 -#define DeepPink 0x9314FF -#define DeepSkyBlue 0xFFBF00 -#define DimGray 0x696969 -#define DodgerBlue 0xFF901E -#define FireBrick 0x2222B2 -#define ForestGreen 0x228B22 -#define Gainsboro 0xDCDCDC -#define Gold 0x00D7FF -#define Goldenrod 0x20A5DA -#define Gray 0x808080 -#define Green 0x008000 -#define GreenYellow 0x2FFFAD -#define Honeydew 0xF0FFF0 -#define HotPink 0xB469FF -#define IndianRed 0x5C5CCD -#define Indigo 0x82004B -#define Ivory 0xF0FFFF -#define Khaki 0x8CE6F0 -#define Lavender 0xFAE6E6 -#define LavenderBlush 0xF5F0FF -#define LawnGreen 0x00FC7C -#define LemonChiffon 0xCDFAFF -#define LightBlue 0xE6D8AD -#define LightCoral 0x8080F0 -#define LightCyan 0xFFFFE0 -#define LightGoldenrod 0xD2FAFA -#define LightGray 0xD3D3D3 -#define LightGreen 0x90EE90 -#define LightPink 0xC1B6FF -#define LightSalmon 0x7AA0FF -#define LightSeaGreen 0xAAB220 -#define LightSkyBlue 0xFACE87 -#define LightSlateGray 0x998877 -#define LightSteelBlue 0xDEC4B0 -#define LightYellow 0xE0FFFF -#define Lime 0x00FF00 -#define LimeGreen 0x32CD32 -#define Linen 0xE6F0FA -#define Magenta 0xFF00FF -#define Maroon 0x000080 -#define MediumAquamarine 0xAACD66 -#define MediumBlue 0xCD0000 -#define MediumOrchid 0xD355BA -#define MediumPurple 0xDB7093 -#define MediumSeaGreen 0x71B33C -#define MediumSlateBlue 0xEE687B -#define MediumSpringGreen 0x9AFA00 -#define MediumTurquoise 0xCCD148 -#define MediumVioletRed 0x8515C7 -#define MidnightBlue 0x701919 -#define MintCream 0xFAFFF5 -#define MistyRose 0xE1E4FF -#define Moccasin 0xB5E4FF -#define NavajoWhite 0xADDEFF -#define Navy 0x800000 -#define OldLace 0xE6F5FD -#define Olive 0x008080 -#define OliveDrab 0x238E6B -#define Orange 0x00A5FF -#define OrangeRed 0x0045FF -#define Orchid 0xD670DA -#define PaleGoldenrod 0xAAE8EE -#define PaleGreen 0x98FB98 -#define PaleTurquoise 0xEEEEAF -#define PaleVioletRed 0x9370DB -#define PapayaWhip 0xD5EFFF -#define PeachPuff 0xB9DAFF -#define Peru 0x3F85CD -#define Pink 0xCBC0FF -#define Plum 0xDDA0DD -#define PowderBlue 0xE6E0B0 -#define Purple 0x800080 -#define Red 0x0000FF -#define RosyBrown 0x8F8FBC -#define RoyalBlue 0xE16941 -#define SaddleBrown 0x13458B -#define Salmon 0x7280FA -#define SandyBrown 0x60A4F4 -#define SeaGreen 0x578B2E -#define Seashell 0xEEF5FF -#define Sienna 0x2D52A0 -#define Silver 0xC0C0C0 -#define SkyBlue 0xEBCE87 -#define SlateBlue 0xCD5A6A -#define SlateGray 0x908070 -#define Snow 0xFAFAFF -#define SpringGreen 0x7FFF00 -#define SteelBlue 0xB48246 -#define Tan 0x8CB4D2 -#define Teal 0x808000 -#define Thistle 0xD8BFD8 -#define Tomato 0x4763FF -#define Turquoise 0xD0E040 -#define Violet 0xEE82EE -#define Wheat 0xB3DEF5 -#define White 0xFFFFFF -#define WhiteSmoke 0xF5F5F5 -#define Yellow 0x00FFFF -#define YellowGreen 0x32CD9A +#define clrAliceBlue 0x00F0F8FF +#define clrAntiqueWhite 0x00FAEBD7 +#define clrAqua 0x0000FFFF +#define clrAquamarine 0x007FFFD4 +#define clrBeige 0x00F5F5DC +#define clrBisque 0x00FFE4C4 +#define clrBlack 0x00000000 +#define clrBlanchedAlmond 0x00FFEBCD +#define clrBlue 0x000000FF +#define clrBlueViolet 0x008A2BE2 +#define clrBrown 0x00A52A2A +#define clrBurlyWood 0x00DEB887 +#define clrCadetBlue 0x005F9EA0 +#define clrChartreuse 0x007FFF00 +#define clrChocolate 0x00D2691E +#define clrCoral 0x00FF7F50 +#define clrCornflowerBlue 0x006495ED +#define clrCornsilk 0x00FFF8DC +#define clrCrimson 0x00DC143C +#define clrDarkBlue 0x0000008B +#define clrDarkGoldenrod 0x00B8860B +#define clrDarkGray 0x00A9A9A9 +#define clrDarkGreen 0x00006400 +#define clrDarkKhaki 0x00BDB76B +#define clrDarkOliveGreen 0x00556B2F +#define clrDarkOrange 0x00FF8C00 +#define clrDarkOrchid 0x009932CC +#define clrDarkSalmon 0x00E9967A +#define clrDarkSeaGreen 0x008FBC8F +#define clrDarkSlateBlue 0x00483D8B +#define clrDarkSlateGray 0x002F4F4F +#define clrDarkTurquoise 0x0000CED1 +#define clrDarkViolet 0x009400D3 +#define clrDeepPink 0x00FF1493 +#define clrDeepSkyBlue 0x0000BFFF +#define clrDimGray 0x00696969 +#define clrDodgerBlue 0x001E90FF +#define clrFireBrick 0x00B22222 +#define clrForestGreen 0x00228B22 +#define clrGainsboro 0x00DCDCDC +#define clrGold 0x00FFD700 +#define clrGoldenrod 0x00DAA520 +#define clrGray 0x00808080 +#define clrGreen 0x00008000 +#define clrGreenYellow 0x00ADFF2F +#define clrHoneydew 0x00F0FFF0 +#define clrHotPink 0x00FF69B4 +#define clrIndianRed 0x00CD5C5C +#define clrIndigo 0x004B0082 +#define clrIvory 0x00FFFFF0 +#define clrKhaki 0x00F0E68C +#define clrLavender 0x00E6E6FA +#define clrLavenderBlush 0x00FFF0F5 +#define clrLawnGreen 0x007CFC00 +#define clrLemonChiffon 0x00FFFACD +#define clrLightBlue 0x00ADD8E6 +#define clrLightCoral 0x00F08080 +#define clrLightCyan 0x00E0FFFF +#define clrLightGoldenrodYellow 0x00FAFAD2 +#define clrLightGreen 0x0090EE90 +#define clrLightGrey 0x00D3D3D3 +#define clrLightPink 0x00FFB6C1 +#define clrLightSalmon 0x00FFA07A +#define clrLightSeaGreen 0x0020B2AA +#define clrLightSkyBlue 0x0087CEFA +#define clrLightSlateGray 0x00778899 +#define clrLightSteelBlue 0x00B0C4DE +#define clrLightYellow 0x00FFFFE0 +#define clrLime 0x0000FF00 +#define clrLimeGreen 0x0032CD32 +#define clrLinen 0x00FAF0E6 +#define clrMagenta 0x00FF00FF +#define clrMaroon 0x00800000 +#define clrMediumAquamarine 0x0066CDAA +#define clrMediumBlue 0x000000CD +#define clrMediumOrchid 0x00BA55D3 +#define clrMediumPurple 0x009370DB +#define clrMediumSeaGreen 0x003CB371 +#define clrMediumSlateBlue 0x007B68EE +#define clrMediumSpringGreen 0x0000FA9A +#define clrMediumTurquoise 0x0048D1CC +#define clrMediumVioletRed 0x00C71585 +#define clrMidnightBlue 0x00191970 +#define clrMintCream 0x00F5FFFA +#define clrMistyRose 0x00FFE4E1 +#define clrMoccasin 0x00FFE4B5 +#define clrNavajoWhite 0x00FFDEAD +#define clrNavy 0x00000080 +#define clrOldLace 0x00FDF5E6 +#define clrOlive 0x00808000 +#define clrOliveDrab 0x006B8E23 +#define clrOrange 0x00FFA500 +#define clrOrangeRed 0x00FF4500 +#define clrOrchid 0x00DA70D6 +#define clrPaleGoldenrod 0x00EEE8AA +#define clrPaleGreen 0x0098FB98 +#define clrPaleTurquoise 0x00AFEEEE +#define clrPaleVioletRed 0x00DB7093 +#define clrPapayaWhip 0x00FFEFD5 +#define clrPeachPuff 0x00FFDAB9 +#define clrPeru 0x00CD853F +#define clrPink 0x00FFC0CB +#define clrPlum 0x00DDA0DD +#define clrPowderBlue 0x00B0E0E6 +#define clrPurple 0x00800080 +#define clrRed 0x00FF0000 +#define clrRosyBrown 0x00BC8F8F +#define clrRoyalBlue 0x004169E1 +#define clrSaddleBrown 0x008B4513 +#define clrSalmon 0x00FA8072 +#define clrSandyBrown 0x00F4A460 +#define clrSeaGreen 0x002E8B57 +#define clrSeashell 0x00FFF5EE +#define clrSienna 0x00A0522D +#define clrSilver 0x00C0C0C0 +#define clrSkyBlue 0x0087CEEB +#define clrSlateBlue 0x006A5ACD +#define clrSlateGray 0x00708090 +#define clrSnow 0x00FFFAFA +#define clrSpringGreen 0x0000FF7F +#define clrSteelBlue 0x004682B4 +#define clrTan 0x00D2B48C +#define clrTeal 0x00008080 +#define clrThistle 0x00D8BFD8 +#define clrTomato 0x00FF6347 +#define clrTurquoise 0x0040E0D0 +#define clrViolet 0x00EE82EE +#define clrWheat 0x00F5DEB3 +#define clrWhite 0x00FFFFFF +#define clrWhiteSmoke 0x00F5F5F5 +#define clrYellow 0x00FFFF00 +#define clrYellowGreen 0x009ACD32 + +#define AliceBlue clrAliceBlue +#define AntiqueWhite clrAntiqueWhite +#define Aqua clrAqua +#define Aquamarine clrAquamarine +#define Beige clrBeige +#define Bisque clrBisque +#define Black clrBlack +#define BlanchedAlmond clrBlanchedAlmond +#define Blue clrBlue +#define BlueViolet clrBlueViolet +#define Brown clrBrown +#define BurlyWood clrBurlyWood +#define CadetBlue clrCadetBlue +#define Chartreuse clrChartreuse +#define Chocolate clrChocolate +#define Coral clrCoral +#define CornflowerBlue clrCornflowerBlue +#define Cornsilk clrCornsilk +#define Crimson clrCrimson +#define DarkBlue clrDarkBlue +#define DarkGoldenrod clrDarkGoldenrod +#define DarkGray clrDarkGray +#define DarkGreen clrDarkGreen +#define DarkKhaki clrDarkKhaki +#define DarkOliveGreen clrDarkOliveGreen +#define DarkOrange clrDarkOrange +#define DarkOrchid clrDarkOrchid +#define DarkSalmon clrDarkSalmon +#define DarkSeaGreen clrDarkSeaGreen +#define DarkSlateBlue clrDarkSlateBlue +#define DarkSlateGray clrDarkSlateGray +#define DarkTurquoise clrDarkTurquoise +#define DarkViolet clrDarkViolet +#define DeepPink clrDeepPink +#define DeepSkyBlue clrDeepSkyBlue +#define DimGray clrDimGray +#define DodgerBlue clrDodgerBlue +#define FireBrick clrFireBrick +#define ForestGreen clrForestGreen +#define Gainsboro clrGainsboro +#define Gold clrGold +#define Goldenrod clrGoldenrod +#define Gray clrGray +#define Green clrGreen +#define GreenYellow clrGreenYellow +#define Honeydew clrHoneydew +#define HotPink clrHotPink +#define IndianRed clrIndianRed +#define Indigo clrIndigo +#define Ivory clrIvory +#define Khaki clrKhaki +#define Lavender clrLavender +#define LavenderBlush clrLavenderBlush +#define LawnGreen clrLawnGreen +#define LemonChiffon clrLemonChiffon +#define LightBlue clrLightBlue +#define LightCoral clrLightCoral +#define LightCyan clrLightCyan +#define LightGoldenrod clrLightGoldenrod +#define LightGray clrLightGray +#define LightGreen clrLightGreen +#define LightPink clrLightPink +#define LightSalmon clrLightSalmon +#define LightSeaGreen clrLightSeaGreen +#define LightSkyBlue clrLightSkyBlue +#define LightSlateGray clrLightSlateGray +#define LightSteelBlue clrLightSteelBlue +#define LightYellow clrLightYellow +#define Lime clrLime +#define LimeGreen clrLimeGreen +#define Linen clrLinen +#define Magenta clrMagenta +#define Maroon clrMaroon +#define MediumAquamarine clrMediumAquamarine +#define MediumBlue clrMediumBlue +#define MediumOrchid clrMediumOrchid +#define MediumPurple clrMediumPurple +#define MediumSeaGreen clrMediumSeaGreen +#define MediumSlateBlue clrMediumSlateBlue +#define MediumSpringGreen clrMediumSpringGreen +#define MediumTurquoise clrMediumTurquoise +#define MediumVioletRed clrMediumVioletRed +#define MidnightBlue clrMidnightBlue +#define MintCream clrMintCream +#define MistyRose clrMistyRose +#define Moccasin clrMoccasin +#define NavajoWhite clrNavajoWhite +#define Navy clrNavy +#define OldLace clrOldLace +#define Olive clrOlive +#define OliveDrab clrOliveDrab +#define Orange clrOrange +#define OrangeRed clrOrangeRed +#define Orchid clrOrchid +#define PaleGoldenrod clrPaleGoldenrod +#define PaleGreen clrPaleGreen +#define PaleTurquoise clrPaleTurquoise +#define PaleVioletRed clrPaleVioletRed +#define PapayaWhip clrPapayaWhip +#define PeachPuff clrPeachPuff +#define Peru clrPeru +#define Pink clrPink +#define Plum clrPlum +#define PowderBlue clrPowderBlue +#define Purple clrPurple +#define Red clrRed +#define RosyBrown clrRosyBrown +#define RoyalBlue clrRoyalBlue +#define SaddleBrown clrSaddleBrown +#define Salmon clrSalmon +#define SandyBrown clrSandyBrown +#define SeaGreen clrSeaGreen +#define Seashell clrSeashell +#define Sienna clrSienna +#define Silver clrSilver +#define SkyBlue clrSkyBlue +#define SlateBlue clrSlateBlue +#define SlateGray clrSlateGray +#define Snow clrSnow +#define SpringGreen clrSpringGreen +#define SteelBlue clrSteelBlue +#define Tan clrTan +#define Teal clrTeal +#define Thistle clrThistle +#define Tomato clrTomato +#define Turquoise clrTurquoise +#define Violet clrViolet +#define Wheat clrWheat +#define White clrWhite +#define WhiteSmoke clrWhiteSmoke +#define Yellow clrYellow +#define YellowGreen clrYellowGreen + #ifndef __MQL__ #define clrNONE -1 #define CLR_NONE -1 -#define DarkSeaGreen 0x8BBC8F #endif // Custom user errors. diff --git a/Trade.mqh b/Trade.mqh index f6eea3136..eb74a6564 100644 --- a/Trade.mqh +++ b/Trade.mqh @@ -31,7 +31,6 @@ class Trade; // Includes. #include "Account/AccountMt.h" -#include "Chart.mqh" #include "Convert.mqh" #include "DictStruct.mqh" #include "Indicator/IndicatorData.h"