From 075c3e8ae4757ea0292c96ba2a99534bcfe3ae2f Mon Sep 17 00:00:00 2001 From: Adrian Kierzkowski Date: Thu, 17 Oct 2024 18:23:43 +0200 Subject: [PATCH] EMCC compatibility fixes. --- Exchange/Account/Account.struct.h | 6 +++--- Exchange/Account/AccountMt.h | 6 +++--- Exchange/Exchange.h | 8 ++++---- Exchange/Exchange.struct.h | 20 ++++++++++++-------- Indicator/Indicator.struct.h | 6 +++--- Indicator/IndicatorData.h | 19 +++++++++---------- Math/Math.h | 8 +++----- Math/Matrix.h | 12 ------------ Platform/Order.h | 16 +++++++--------- Platform/Order.struct.h | 17 +++++++++++++++-- Platform/Platform.h | 13 +++++++++---- Platform/Platform.struct.h | 10 ++++++---- Platform/Plot.h | 6 +++--- Serializer/Serializer.h | 2 +- Storage/Dict/DictStruct.h | 3 ++- Storage/String.extern.h | 26 ++++++++++++-------------- Task/Task.h | 9 ++++----- Trade.mqh | 2 +- Trade.struct.h | 20 ++++++++++---------- 19 files changed, 107 insertions(+), 102 deletions(-) diff --git a/Exchange/Account/Account.struct.h b/Exchange/Account/Account.struct.h index bbd949095..a0c4a8218 100644 --- a/Exchange/Account/Account.struct.h +++ b/Exchange/Account/Account.struct.h @@ -26,8 +26,8 @@ */ #ifndef __MQL__ -// Allows the preprocessor to include a header file when it is needed. -#pragma once + // Allows the preprocessor to include a header file when it is needed. + #pragma once #endif // Forward class declaration. @@ -123,7 +123,7 @@ struct AccountParams { // Default constructor. AccountParams(int _login = 0, string _name = "Current", string _currency = "USD", string _company = "Unknown", string _server = "Unknown") - : company(_company), currency(_currency), login(_login), name(_name), server(_server) {} + : login(_login), company(_company), currency(_currency), name(_name), server(_server) {} // Constructor based on JSON string. AccountParams(string _entry) { SerializerConverter::FromString(_entry).ToStruct(THIS_REF); } // Copy constructor. diff --git a/Exchange/Account/AccountMt.h b/Exchange/Account/AccountMt.h index 43fe0e556..19b957e7f 100644 --- a/Exchange/Account/AccountMt.h +++ b/Exchange/Account/AccountMt.h @@ -178,7 +178,7 @@ class AccountMt : public AccountBase { * Returns margin value of the current account. */ static double AccountMargin() { return AccountInfoDouble(ACCOUNT_MARGIN); } - float GetMarginUsed() const { + float GetMarginUsed() const override { // @todo: Adds caching. // return UpdateStats(ACC_MARGIN_USED, AccountMargin()); return (float)AccountMt::AccountMargin(); @@ -616,7 +616,7 @@ class AccountMt : public AccountBase { /** * Returns text info about the account. */ - string const ToString() { + string const ToString() override { return StringFormat( "Type: %s, Server/Company/Name: %s/%s/%s, Currency: %s, Balance: %g, Credit: %g, Equity: %g, Profit: %g, " "Margin Used/Free/Avail: %g(%.1f%%)/%g/%g, Orders limit: %g: Leverage: 1:%d, StopOut Level: %d (Mode: %d)", @@ -639,7 +639,7 @@ class AccountMt : public AccountBase { /** * Returns serialized representation of the object instance. */ - SerializerNodeType Serialize(Serializer &_s) { + SerializerNodeType Serialize(Serializer &_s) override { AccountEntry _entry = GetEntry(); _s.PassStruct(THIS_REF, "account-entry", _entry, SERIALIZER_FIELD_FLAG_DYNAMIC); return SerializerNodeObject; diff --git a/Exchange/Exchange.h b/Exchange/Exchange.h index f6a4d0aaa..bb1ddf0f7 100644 --- a/Exchange/Exchange.h +++ b/Exchange/Exchange.h @@ -129,7 +129,7 @@ class Exchange : public Taskable { /** * Checks a condition. */ - bool Check(const TaskConditionEntry &_entry) { + bool Check(const TaskConditionEntry &_entry) override { bool _result = true; switch (_entry.GetId()) { default: @@ -142,7 +142,7 @@ class Exchange : public Taskable { /** * Gets a data param entry. */ - DataParamEntry Get(const TaskGetterEntry &_entry) { + DataParamEntry Get(const TaskGetterEntry &_entry) override { DataParamEntry _result; switch (_entry.GetId()) { default: @@ -154,7 +154,7 @@ class Exchange : public Taskable { /** * Runs an action. */ - bool Run(const TaskActionEntry &_entry) { + bool Run(const TaskActionEntry &_entry) override { bool _result = true; switch (_entry.GetId()) { case EXCHANGE_ACTION_ADD_ACCOUNT: @@ -176,7 +176,7 @@ class Exchange : public Taskable { /** * Sets an entry value. */ - bool Set(const TaskSetterEntry &_entry, const DataParamEntry &_entry_value) { + bool Set(const TaskSetterEntry &_entry, const DataParamEntry &_entry_value) override { bool _result = true; switch (_entry.GetId()) { default: diff --git a/Exchange/Exchange.struct.h b/Exchange/Exchange.struct.h index 34430b5a9..dd2fd9b7d 100644 --- a/Exchange/Exchange.struct.h +++ b/Exchange/Exchange.struct.h @@ -26,8 +26,8 @@ */ #ifndef __MQL__ -// Allows the preprocessor to include a header file when it is needed. -#pragma once + // Allows the preprocessor to include a header file when it is needed. + #pragma once #endif // Includes. @@ -55,12 +55,15 @@ struct ExchangeParams { // Getters. template T Get(ENUM_EXCHANGE_PARAM _param) { + T _out; switch (_param) { case EXCHANGE_PARAM_ID: return (T)id; case EXCHANGE_PARAM_NAME: - // return (T)name; // @todo + ConvertBasic::Convert(name, _out); + return _out; default: + Alert("Unsupported param: ", EnumToString(_param)); break; } SetUserError(ERR_INVALID_PARAMETER); @@ -68,15 +71,16 @@ struct ExchangeParams { } // Setters. template - void Set(ENUM_TRADE_PARAM _param, T _value) { + void Set(ENUM_EXCHANGE_PARAM _param, T _value) { switch (_param) { case EXCHANGE_PARAM_ID: - ConvertBasic::Convert(_value, id); - return; + ConvertBasic::Convert(id, _value); + break; case EXCHANGE_PARAM_NAME: - ConvertBasic::Convert(_value, name); - return; + ConvertBasic::Convert(name, _value); + break; default: + Alert("Unsupported param: ", EnumToString(_param)); break; } SetUserError(ERR_INVALID_PARAMETER); diff --git a/Indicator/Indicator.struct.h b/Indicator/Indicator.struct.h index c488930ce..4e26b636b 100644 --- a/Indicator/Indicator.struct.h +++ b/Indicator/Indicator.struct.h @@ -71,10 +71,10 @@ struct IndicatorParams { /* Special methods */ // Constructor. IndicatorParams(ENUM_INDICATOR_TYPE _itype = INDI_NONE, ENUM_TIMEFRAMES _tf = PERIOD_CURRENT, string _name = "") - : bps(0), - custom_indi_name(""), + : custom_indi_name(""), name(_name), shift(0), + bps(0), // max_modes(_max_modes), // max_buffers(10), // idstype(_idstype), @@ -84,7 +84,7 @@ struct IndicatorParams { itype(_itype) { Init(); }; - IndicatorParams(string _name) : bps(0), custom_indi_name(""), name(_name), shift(0) { Init(); }; + IndicatorParams(string _name) : custom_indi_name(""), name(_name), shift(0), bps(0) { Init(); }; /* Getters */ template T Get(STRUCT_ENUM(IndicatorParams, ENUM_INDI_PARAMS_PROP) _prop) const { diff --git a/Indicator/IndicatorData.h b/Indicator/IndicatorData.h index 9e88ffe43..3bf08dc2e 100644 --- a/Indicator/IndicatorData.h +++ b/Indicator/IndicatorData.h @@ -35,8 +35,8 @@ struct ExternInstantiateIndicatorBufferValueStorageDouble { }; // Includes. -#include "../Platform/Chart/Bar.struct.h" #include "../Exchange/SymbolInfo/SymbolInfo.struct.h" +#include "../Platform/Chart/Bar.struct.h" #include "../Platform/Chart/Chart.struct.tf.h" #include "../Storage/Cache/IndiBufferCache.h" #include "../Storage/Flags.struct.h" @@ -220,7 +220,7 @@ class IndicatorData : public IndicatorBase { /** * Get full name of the indicator (with "over ..." part). */ - string GetFullName() { + string GetFullName() override { int _max_modes = Get(STRUCT_ENUM(IndicatorDataParams, IDATA_PARAM_MAX_MODES)); string _mode; @@ -408,13 +408,13 @@ class IndicatorData : public IndicatorBase { */ template double GetMax(int start_bar = 0, int count = WHOLE_ARRAY) { - double max = NULL; + double max = -DBL_MAX; int last_bar = count == WHOLE_ARRAY ? (int)(GetBarShift(GetLastBarTime())) : (start_bar + count - 1); int _max_modes = Get(STRUCT_ENUM(IndicatorDataParams, IDATA_PARAM_MAX_MODES)); for (int shift = start_bar; shift <= last_bar; ++shift) { double value = GetEntry(shift).GetMax(_max_modes); - if (max == NULL || value > max) { + if (max == -DBL_MAX || value > max) { max = value; } } @@ -1323,7 +1323,7 @@ class IndicatorData : public IndicatorBase { /** * Returns the indicator's entry value. */ - virtual IndicatorDataEntryValue GetEntryValue(int _mode = 0, int _abs_shift = 0) = 0; + virtual IndicatorDataEntryValue GetEntryValue(int _mode = 0, int _abs_shift = 0) override = 0; /** * Returns the shift of the maximum value over a specific number of periods depending on type. @@ -1386,7 +1386,7 @@ class IndicatorData : public IndicatorBase { /** * Get name of the indicator. */ - virtual string GetName() { return EnumToString(GetType()); } + virtual string GetName() override { return EnumToString(GetType()); } /** * Gets open price for a given, optional shift. @@ -1404,7 +1404,7 @@ class IndicatorData : public IndicatorBase { /** * Gets OHLC price values. */ - virtual BarOHLC GetOHLC(int _rel_shift = 0) { + virtual BarOHLC GetOHLC(int _rel_shift = 0) override { if (GetCandle() == THIS_PTR) { Alert(GetFullName(), " candle indicator must override ", __FUNCTION__, "()!"); DebugBreak(); @@ -1608,7 +1608,6 @@ class IndicatorData : public IndicatorBase { } /** - /** * Traverses source indicators' hierarchy and tries to find Ask, Bid, Spread, * Volume and Tick Volume-featured indicator. IndicatorTick satisfies such * requirements. @@ -2158,12 +2157,12 @@ class IndicatorData : public IndicatorBase { /** * Converts relative shift into absolute one. */ - virtual int ToAbsShift(int _rel_shift) = 0; + virtual int ToAbsShift(int _rel_shift) override = 0; /** * Converts absolute shift into relative one. */ - virtual int ToRelShift(int _abs_shift) = 0; + virtual int ToRelShift(int _abs_shift) override = 0; /** * Loads and validates built-in indicators whose can be used as data source. diff --git a/Math/Math.h b/Math/Math.h index 04d27f20b..7e55b2581 100644 --- a/Math/Math.h +++ b/Math/Math.h @@ -21,8 +21,8 @@ */ #ifndef __MQL__ -// Allows the preprocessor to include a header file when it is needed. -#pragma once + // Allows the preprocessor to include a header file when it is needed. + #pragma once #endif // Includes. @@ -264,7 +264,7 @@ class Math { int data_count = ArraySize(probability); if (data_count == 0) return false; - int error_code = 0, i; + int i; ArrayResize(result, data_count); //--- case sigma==0 @@ -402,8 +402,6 @@ class Math { return true; } - int err_code = 0; - for (i = 0; i < data_count; i++) { result[i] = RandomNonZero(); } diff --git a/Math/Matrix.h b/Math/Matrix.h index 1733501c6..916d7cb6f 100644 --- a/Math/Matrix.h +++ b/Math/Matrix.h @@ -2538,13 +2538,9 @@ class Matrix { void FromString(string text) { ARRAY(MatrixDimension*, _dimensions), *_root_dimension = NULL; - int _dimensions_length[MATRIX_DIMENSIONS] = {0, 0, 0, 0, 0}; int i, _number_start_pos; - bool _had_values; X _number; bool _expecting_value_or_child = true; - bool _expecting_comma = false; - bool _expecting_end = false; for (i = 0; i < StringLen(text); ++i) { unsigned short _char = StringGetCharacter(text, i), c; @@ -2556,8 +2552,6 @@ class Matrix { return; } - _had_values = false; - if (ArraySize(_dimensions) != 0) { _dimensions[ArraySize(_dimensions) - 1].type = MATRIX_DIMENSION_TYPE_CONTAINERS; } @@ -2574,13 +2568,11 @@ class Matrix { } _expecting_value_or_child = true; - _expecting_end = true; break; case ']': ArrayResize(_dimensions, ArraySize(_dimensions) - 1, MATRIX_DIMENSIONS); _expecting_value_or_child = true; - _expecting_comma = false; break; case '0': @@ -2609,15 +2601,11 @@ class Matrix { i -= 2; _dimensions[ArraySize(_dimensions) - 1].type = MATRIX_DIMENSION_TYPE_VALUES; _dimensions[ArraySize(_dimensions) - 1].AddValue(_number); - _expecting_end = true; _expecting_value_or_child = true; - _expecting_comma = false; break; case ',': _expecting_value_or_child = true; - _expecting_comma = false; - _expecting_end = false; break; case ' ': case '\t': diff --git a/Platform/Order.h b/Platform/Order.h index 88ccbf307..e2f232d2e 100644 --- a/Platform/Order.h +++ b/Platform/Order.h @@ -1774,8 +1774,6 @@ class Order : public SymbolInfo { * Update specific double value of the current order. */ bool RefreshDummy(ENUM_ORDER_PROPERTY_DOUBLE _prop_id) { - bool _result = false; - double _value = WRONG_VALUE; ResetLastError(); switch (_prop_id) { case ORDER_PRICE_CURRENT: @@ -2850,14 +2848,14 @@ class Order : public SymbolInfo { bool ExecuteAction(ENUM_ORDER_ACTION _action, ARRAY_REF(DataParamEntry, _args)) { switch (_action) { case ORDER_ACTION_CLOSE: - switch (oparams.dummy) { - case false: - return ArraySize(_args) > 0 ? OrderClose((ENUM_ORDER_REASON_CLOSE)_args[0].integer_value) - : OrderClose(ORDER_REASON_CLOSED_BY_ACTION); - case true: - return ArraySize(_args) > 0 ? OrderCloseDummy((ENUM_ORDER_REASON_CLOSE)_args[0].integer_value) - : OrderCloseDummy(ORDER_REASON_CLOSED_BY_ACTION); + if (oparams.dummy) { + return ArraySize(_args) > 0 ? OrderCloseDummy((ENUM_ORDER_REASON_CLOSE)_args[0].integer_value) + : OrderCloseDummy(ORDER_REASON_CLOSED_BY_ACTION); + } else { + return ArraySize(_args) > 0 ? OrderClose((ENUM_ORDER_REASON_CLOSE)_args[0].integer_value) + : OrderClose(ORDER_REASON_CLOSED_BY_ACTION); } + break; case ORDER_ACTION_OPEN: return !oparams.dummy ? OrderSend() >= 0 : OrderSendDummy() >= 0; case ORDER_ACTION_COND_CLOSE_ADD: diff --git a/Platform/Order.struct.h b/Platform/Order.struct.h index 7d5411688..db37432dd 100644 --- a/Platform/Order.struct.h +++ b/Platform/Order.struct.h @@ -270,8 +270,7 @@ struct OrderData { double volume_init; // Initial volume. public: OrderData() - : close_tries(0), - magic(0), + : magic(0), position_id(0), position_by_id(0), ticket(0), @@ -279,6 +278,7 @@ struct OrderData { comment(""), commission(0), profit(0), + total_profit(0), price_open(0), price_close(0), price_current(0), @@ -294,6 +294,7 @@ struct OrderData { time_setup_msc(0), sl(0), tp(0), + close_tries(0), last_error(ERR_NO_ERROR), symbol(NULL), volume_curr(0), @@ -398,6 +399,9 @@ struct OrderData { case ORDER_POSITION_BY_ID: return (T)position_by_id; case ORDER_REASON: + #ifndef __MQL__ + case __ORDER_REASON: + #endif return (T)reason; case ORDER_TICKET: return (T)ticket; @@ -413,6 +417,9 @@ struct OrderData { return comment; #ifndef __MQL4__ case ORDER_EXTERNAL_ID: + #ifndef __MQL__ + case __ORDER_EXTERNAL_ID: + #endif return ext_id; #endif case ORDER_SYMBOL: @@ -631,6 +638,9 @@ struct OrderData { position_by_id = _value; return; case ORDER_REASON: + #ifndef __MQL__ + case __ORDER_REASON: + #endif reason = (ENUM_ORDER_REASON)_value; return; case ORDER_TICKET: @@ -647,6 +657,9 @@ struct OrderData { return; #ifndef __MQL4__ case ORDER_EXTERNAL_ID: + #ifndef __MQL__ + case __ORDER_EXTERNAL_ID: + #endif ext_id = _value; return; #endif diff --git a/Platform/Platform.h b/Platform/Platform.h index 4abbc6e35..2ec428f3b 100644 --- a/Platform/Platform.h +++ b/Platform/Platform.h @@ -241,6 +241,11 @@ class Platform : public Taskable { ++global_tick_index; } + /** + * Checks whether previous Tick() performed a tick or not. + */ + static bool HadTick() { return last_tick_result; } + /** * Called by indicators' OnCalculate() method in order to prepare history via * IndicatorData::EmitHistory() and to call Tick() for each OnCalculate() @@ -560,7 +565,7 @@ class Platform : public Taskable { /** * Checks a condition. */ - bool Check(const TaskConditionEntry &_entry) { + bool Check(const TaskConditionEntry &_entry) override { bool _result = true; switch (_entry.GetId()) { default: @@ -573,7 +578,7 @@ class Platform : public Taskable { /** * Gets a data param entry. */ - DataParamEntry Get(const TaskGetterEntry &_entry) { + DataParamEntry Get(const TaskGetterEntry &_entry) override { DataParamEntry _result; switch (_entry.GetId()) { default: @@ -585,7 +590,7 @@ class Platform : public Taskable { /** * Runs an action. */ - bool Run(const TaskActionEntry &_entry) { + bool Run(const TaskActionEntry &_entry) override { bool _result = true; switch (_entry.GetId()) { case PLATFORM_ACTION_ADD_EXCHANGE: @@ -607,7 +612,7 @@ class Platform : public Taskable { /** * Sets an entry value. */ - bool Set(const TaskSetterEntry &_entry, const DataParamEntry &_entry_value) { + bool Set(const TaskSetterEntry &_entry, const DataParamEntry &_entry_value) override { bool _result = true; switch (_entry.GetId()) { default: diff --git a/Platform/Platform.struct.h b/Platform/Platform.struct.h index b8997e10a..f7d893ab8 100644 --- a/Platform/Platform.struct.h +++ b/Platform/Platform.struct.h @@ -55,11 +55,13 @@ struct PlatformParams { // Getters. template T Get(ENUM_PLATFORM_PARAM _param) { + T _out; switch (_param) { case PLATFORM_PARAM_ID: return (T)id; case PLATFORM_PARAM_NAME: - return (T)name; + ConvertBasic::Convert(name, _out); + return _out; default: break; } @@ -68,13 +70,13 @@ struct PlatformParams { } // Setters. template - void Set(ENUM_TRADE_PARAM _param, T _value) { + void Set(ENUM_PLATFORM_PARAM _param, T _value) { switch (_param) { case PLATFORM_PARAM_ID: - ConvertBasic::Convert(_value, id); + ConvertBasic::Convert(id, _value); return; case PLATFORM_PARAM_NAME: - ConvertBasic::Convert(_value, name); + ConvertBasic::Convert(name, _value); return; default: break; diff --git a/Platform/Plot.h b/Platform/Plot.h index 969d2b9c5..c1c5154e1 100644 --- a/Platform/Plot.h +++ b/Platform/Plot.h @@ -291,7 +291,7 @@ class Plot : public Object { * Plot a vertical line. */ bool DrawVLine(string oname, datetime tm) { - bool result = Plot::ObjectCreate(NULL, oname, OBJ_VLINE, 0, tm, 0); + bool result = Plot::ObjectCreate(0, oname, OBJ_VLINE, 0, tm, 0); if (!result) PrintFormat("%(): Can't create vertical line! code #", __FUNCTION__, GetLastError()); return (result); } @@ -300,7 +300,7 @@ class Plot : public Object { * Plot a horizontal line. */ bool DrawHLine(string oname, double value) { - bool result = Plot::ObjectCreate(NULL, oname, OBJ_HLINE, 0, 0, value); + bool result = Plot::ObjectCreate(0, oname, OBJ_HLINE, 0, 0, value); if (!result) PrintFormat("%(): Can't create horizontal line! code #", __FUNCTION__, GetLastError()); return (result); } @@ -309,7 +309,7 @@ class Plot : public Object { * Delete a vertical line. */ bool DeleteVertLine(string oname) { - bool result = Plot::ObjectDelete(NULL, oname); + bool result = Plot::ObjectDelete(0, oname); if (!result) PrintFormat("%(): Can't delete vertical line! code #", __FUNCTION__, GetLastError()); return (result); } diff --git a/Serializer/Serializer.h b/Serializer/Serializer.h index 359e0332d..764f0db1e 100644 --- a/Serializer/Serializer.h +++ b/Serializer/Serializer.h @@ -461,7 +461,7 @@ class Serializer { * Returns next structure or structure by given key. */ template - X REF_CPP Struct(string key = "") { + X Struct(string key = "") { X value; PassStruct(THIS_REF, key, value); return value; diff --git a/Storage/Dict/DictStruct.h b/Storage/Dict/DictStruct.h index c4a4efa3a..0b83995ec 100644 --- a/Storage/Dict/DictStruct.h +++ b/Storage/Dict/DictStruct.h @@ -511,7 +511,8 @@ class DictStruct : public DictBase { // Note that we're retrieving value by a key (as we are in an // object!). - Set(key, s.Struct(i.Key())); + V _value = s.Struct(i.Key()); + Set(key, _value); } else { Push(s.Struct()); } diff --git a/Storage/String.extern.h b/Storage/String.extern.h index bd8f3079e..22be3ed8d 100644 --- a/Storage/String.extern.h +++ b/Storage/String.extern.h @@ -21,21 +21,21 @@ */ #ifndef __MQL__ -// Allows the preprocessor to include a header file when it is needed. -#pragma once + // Allows the preprocessor to include a header file when it is needed. + #pragma once -// Includes. -#include + // Includes. + #include -#include -#include -#include -#include -#include + #include + #include + #include + #include + #include -#include "../Math/Math.extern.h" -#include "../Platform/Terminal.define.h" -#include "../Std.h" + #include "../Math/Math.extern.h" + #include "../Platform/Terminal.define.h" + #include "../Std.h" // Define external global functions. double StringToDouble(string value) { return std::stod(value); } @@ -121,8 +121,6 @@ bool StringInit(string& string_var, int new_len = 0, unsigned short character = string CharArrayToString(ARRAY_REF(unsigned char, arr), int start = 0, int count = -1, unsigned int codepage = CP_ACP) { if (count == -1) count = (arr.size() - start); - int _end = MathMin(count - start, arr.size()); - string result; StringInit(result, count); diff --git a/Task/Task.h b/Task/Task.h index 548df0483..7f21b9665 100644 --- a/Task/Task.h +++ b/Task/Task.h @@ -320,11 +320,10 @@ class Task : public Taskable { #include EMSCRIPTEN_BINDINGS(Task) { - emscripten::class_("Task").smart_ptr>("Ref").constructor(emscripten::optional_override([]() { - return Ref(new Task()); - })) - //.function("Add", optional_override([](Task &self, Ref task) { self.Add(task.Ptr()); })) - ; + emscripten::class_("Task") + .smart_ptr>("Ref") + .constructor(emscripten::optional_override([]() { return Ref(new Task()); })) + .function("Add", emscripten::optional_override([](Task &self, TaskEntry taskEntry) { self.Add(taskEntry); })); } #endif diff --git a/Trade.mqh b/Trade.mqh index d849be21b..cc38d285f 100644 --- a/Trade.mqh +++ b/Trade.mqh @@ -915,7 +915,7 @@ HistorySelect(0, TimeCurrent()); // Select history for access. */ int OrdersCloseViaCmd(ENUM_ORDER_TYPE _cmd, ENUM_ORDER_REASON_CLOSE _reason = ORDER_REASON_CLOSED_UNKNOWN, string _comment = "") { - int _oid = 0, _closed = 0; + int _closed = 0; Ref _order; _comment = _comment != "" ? _comment : "TOCVC:"; for (DictStructIterator> iter = orders_active.Begin(); iter.IsValid(); ++iter) { diff --git a/Trade.struct.h b/Trade.struct.h index 0468ca32a..f1dff61a9 100644 --- a/Trade.struct.h +++ b/Trade.struct.h @@ -141,23 +141,23 @@ struct TradeParams { ENUM_LOG_LEVEL log_level; // Log verbosity level. // Constructors. TradeParams(float _lot_size = 0, float _risk_margin = 1.0f, unsigned int _slippage = 0, ENUM_LOG_LEVEL _ll = V_INFO) - : bars_min(100), + : lot_size(_lot_size), + risk_margin(_risk_margin), order_comment(""), - log_level(_ll), - lot_size(_lot_size), + slippage(_slippage), magic_no(0), - risk_margin(_risk_margin), - slippage(_slippage) { + bars_min(100), + log_level(_ll) { SetLimits(0); } TradeParams(uint64 _magic_no, ENUM_LOG_LEVEL _ll = V_INFO) - : bars_min(100), - lot_size(0), + : lot_size(0), + risk_margin(1.0f), order_comment(""), - log_level(_ll), + slippage(0), magic_no(_magic_no), - risk_margin(1.0f), - slippage(0) {} + bars_min(100), + log_level(_ll) {} TradeParams(const TradeParams &_tparams) { THIS_REF = _tparams; } // Deconstructor. ~TradeParams() {}