From 4d428e72e3d8351c5beb867e93b54dfa93fd38ce Mon Sep 17 00:00:00 2001 From: Adrian Kierzkowski Date: Fri, 6 Sep 2024 19:02:34 +0200 Subject: [PATCH] C++ compatibility fixes. --- EA.mqh | 13 +++--- EA.struct.h | 8 ++-- Indicators/Price/Indi_MA.h | 64 +++++++++++++------------- Indicators/PriceRange/Indi_Envelopes.h | 14 +++--- Market.mqh | 2 +- Math/Matrix.h | 29 ++++++------ Serializer/SerializerNodeParam.h | 4 +- Storage/Dict/Buffer/BufferTick.h | 6 +-- Storage/ValueStorage.native.h | 6 +-- Strategy.mqh | 13 ++++-- Strategy.struct.h | 11 +++-- SummaryReport.mqh | 24 +++++----- Task/Task.h | 4 +- Task/TaskObject.h | 2 +- 14 files changed, 104 insertions(+), 96 deletions(-) diff --git a/EA.mqh b/EA.mqh index f758b5068..b894673d4 100644 --- a/EA.mqh +++ b/EA.mqh @@ -97,7 +97,8 @@ class EA : public Taskable { */ void InitTask() { // Add and process init task. - TaskObject _taskobj_init(eparams.GetStruct(STRUCT_ENUM(EAParams, EA_PARAM_STRUCT_TASK_ENTRY)), + TaskEntry _task_entry(eparams.GetStruct(STRUCT_ENUM(EAParams, EA_PARAM_STRUCT_TASK_ENTRY))); + TaskObject _taskobj_init(_task_entry, THIS_PTR, THIS_PTR); estate.Set(STRUCT_ENUM(EAState, EA_STATE_FLAG_ON_INIT), true); _taskobj_init.Process(); @@ -418,14 +419,14 @@ class EA : public Taskable { if (!_result) { // && _strade.IsTradeRecommended( MqlTradeRequestProxy _request_proxy(_request); logger.Debug(StringFormat("Error while sending a trade request! Entry: %s", - SerializerConverter::FromObject(_request_proxy).ToString()), + C_STR(SerializerConverter::FromObject(_request_proxy).ToString())), __FUNCTION_LINE__, - StringFormat("Code: %d, Msg: %s", _LastError, Terminal::GetErrorText(_LastError))); + StringFormat("Code: %d, Msg: %s", _LastError, C_STR(Terminal::GetErrorText(_LastError)))); if (_trade PTR_DEREF IsTradeRecommended()) { logger.Debug(StringFormat("Error while sending a trade request! Entry: %s", - SerializerConverter::FromObject(_request_proxy).ToString()), + C_STR(SerializerConverter::FromObject(_request_proxy).ToString())), __FUNCTION_LINE__, - StringFormat("Code: %d, Msg: %s", _LastError, Terminal::GetErrorText(_LastError))); + StringFormat("Code: %d, Msg: %s", _LastError, C_STR(Terminal::GetErrorText(_LastError)))); } #ifdef __debug_ea__ Print(__FUNCTION_LINE__ + "(): " + SerializerConverter::FromObject(_request_proxy).ToString()); @@ -774,7 +775,7 @@ class EA : public Taskable { bool StrategyAdd(ENUM_TIMEFRAMES _tf, int64 _magic_no = 0, int _type = 0) { bool _result = true; _magic_no = _magic_no > 0 ? _magic_no : rand(); - Ref _strat = ((SClass *)NULL).Init(_tf, THIS_PTR); + Ref _strat = new SClass(_tf, THIS_PTR); _strat REF_DEREF Set(STRAT_PARAM_ID, _magic_no); _strat REF_DEREF Set(TRADE_PARAM_MAGIC_NO, _magic_no); _strat REF_DEREF Set(STRAT_PARAM_LOG_LEVEL, diff --git a/EA.struct.h b/EA.struct.h index 46eae797c..0efcb2a16 100644 --- a/EA.struct.h +++ b/EA.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. @@ -204,7 +204,9 @@ struct EAParams { } void SetTaskEntry(TaskEntry &_task_entry) { task_init = _task_entry; } // Printers. - string ToString(string _dlm = ",") { return StringFormat("%s v%s by %s (%s)", name, ver, author, desc); } + string ToString(string _dlm = ",") { + return StringFormat("%s v%s by %s (%s)", C_STR(name), C_STR(ver), C_STR(author), C_STR(desc)); + } }; /* Defines struct to store results for EA processing. */ diff --git a/Indicators/Price/Indi_MA.h b/Indicators/Price/Indi_MA.h index df7ae2fc8..edf284fdc 100644 --- a/Indicators/Price/Indi_MA.h +++ b/Indicators/Price/Indi_MA.h @@ -21,24 +21,24 @@ */ #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 // Prevents processing this includes file for the second time. #ifndef INDI_MA_MQH -#define INDI_MA_MQH - -// Includes. -#include "../../Indicator/Indicator.h" -#include "../../Refs.mqh" -#include "../../Storage/Dict/Dict.h" -#include "../../Storage/Dict/DictObject.h" -#include "../../Storage/Singleton.h" -#include "../../Storage/String.h" -#include "../../Storage/ValueStorage.h" - -#ifndef __MQL__ + #define INDI_MA_MQH + + // Includes. + #include "../../Indicator/Indicator.h" + #include "../../Refs.mqh" + #include "../../Storage/Dict/Dict.h" + #include "../../Storage/Dict/DictObject.h" + #include "../../Storage/Singleton.h" + #include "../../Storage/String.h" + #include "../../Storage/ValueStorage.h" + + #ifndef __MQL__ // Enums. // @see: https://www.mql5.com/en/docs/constants/indicatorconstants/enum_ma_method enum ENUM_MA_METHOD { @@ -47,7 +47,7 @@ enum ENUM_MA_METHOD { MODE_SMMA, // Smoothed averaging. MODE_LWMA, // Linear-weighted averaging. }; -#endif + #endif // Structs. struct IndiMAParams : IndicatorParams { @@ -65,11 +65,11 @@ struct IndiMAParams : IndicatorParams { ENUM_APPLIED_PRICE _ap = PRICE_OPEN, int _shift = 10) : period(_period), ma_shift(_ma_shift), ma_method(_ma_method), applied_array(_ap), IndicatorParams(INDI_MA) { if (custom_indi_name == "") { -#ifdef __MQL5__ + #ifdef __MQL5__ SetCustomIndicatorName("Examples\\Custom Moving Average"); -#else + #else SetCustomIndicatorName("Custom Moving Averages"); -#endif + #endif } shift = _shift; }; @@ -127,20 +127,20 @@ class Indi_MA : public Indicator { static double iMA(string _symbol, ENUM_TIMEFRAMES _tf, unsigned int _ma_period, unsigned int _ma_shift, ENUM_MA_METHOD _ma_method, ENUM_APPLIED_PRICE _applied_price, int _shift = 0, IndicatorData *_obj = NULL) { -#ifdef __MQL__ -#ifdef __MQL4__ + #ifdef __MQL__ + #ifdef __MQL4__ return ::iMA(_symbol, _tf, _ma_period, _ma_shift, _ma_method, _applied_price, _shift); -#else // __MQL5__ + #else // __MQL5__ INDICATOR_BUILTIN_CALL_AND_RETURN(::iMA(_symbol, _tf, _ma_period, _ma_shift, _ma_method, _applied_price), 0, _shift); -#endif -#else // Non-MQL. + #endif + #else // Non-MQL. // @todo: Use Platform class. RUNTIME_ERROR( "Not implemented. Please use an On-Indicator mode and attach " "indicator via Platform::Add/AddWithDefaultBindings()."); return DBL_MAX; -#endif + #endif } /** @@ -162,16 +162,16 @@ class Indi_MA : public Indicator { */ static double iMAOnArray(ARRAY_REF(double, price), int total, int ma_period, int ma_shift, ENUM_MA_METHOD ma_method, int shift, IndiBufferCache *cache = NULL) { -#ifdef __MQL4__ + #ifdef __MQL4__ return ::iMAOnArray(price, total, ma_period, ma_shift, ma_method, shift); -#else + #else // We're reusing the same native array for each consecutive calculation. NativeValueStorage *_array_storage = Singleton>::Get(); _array_storage PTR_DEREF SetData(price); return iMAOnArray(PTR_TO_REF((ValueStorage *)_array_storage), total, ma_period, ma_shift, ma_method, shift, cache); -#endif + #endif } /** @@ -565,7 +565,7 @@ class Indi_MA : public Indicator { } static int LinearWeightedMAOnBuffer(const int rates_total, const int prev_calculated, const int begin, - const int period, const ARRAY_REF(double, price), ARRAY_REF(double, buffer), + const int period, ARRAY_REF(double, price), ARRAY_REF(double, buffer), int &weight_sum) { int i, k; @@ -849,14 +849,14 @@ class Indi_MA : public Indicator { } }; -#ifdef __MQL4__ + #ifdef __MQL4__ // MQL4 version of the method doesn't have last parameter. int LinearWeightedMAOnBuffer(const int rates_total, const int prev_calculated, const int begin, const int period, - const double &price[], double &buffer[]) { + double &price[], double &buffer[]) { int _weight_sum; return Indi_MA::LinearWeightedMAOnBuffer(rates_total, prev_calculated, begin, period, price, buffer, _weight_sum); } -#else // !__MQL__4 + #else // !__MQL__4 // Defines global functions (for MQL4 backward compability). double iMA(string _symbol, int _tf, int _ma_period, int _ma_shift, ENUM_MA_METHOD _ma_method, int _ap, int _shift) { ResetLastError(); @@ -868,6 +868,6 @@ double iMAOnArray(ARRAY_REF(double, _arr), int _total, int _period, int _ma_shif ResetLastError(); return Indi_MA::iMAOnArray(_arr, _total, _period, _ma_shift, _ma_method, _abs_shift, _cache); } -#endif // __MQL4__ + #endif // __MQL4__ #endif // INDI_MA_MQH diff --git a/Indicators/PriceRange/Indi_Envelopes.h b/Indicators/PriceRange/Indi_Envelopes.h index ed6fa936f..cddee7762 100644 --- a/Indicators/PriceRange/Indi_Envelopes.h +++ b/Indicators/PriceRange/Indi_Envelopes.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. @@ -116,9 +116,9 @@ class Indi_Envelopes : public Indicator { // UPPER_LINE, 1 - LOWER_LINE int _shift = 0, IndicatorData *_obj = NULL) { #ifdef __MQL__ -#ifdef __MQL4__ + #ifdef __MQL4__ return ::iEnvelopes(_symbol, _tf, _ma_period, _ma_method, _ma_shift, _ap, _deviation, _mode, _shift); -#else // __MQL5__ + #else // __MQL5__ switch (_mode) { case LINE_UPPER: _mode = 0; @@ -130,7 +130,7 @@ class Indi_Envelopes : public Indicator { INDICATOR_BUILTIN_CALL_AND_RETURN(::iEnvelopes(_symbol, _tf, _ma_period, _ma_shift, _ma_method, _ap, _deviation), _mode, _shift); -#endif + #endif #else // Non-MQL. // @todo: Use Platform class. RUNTIME_ERROR( @@ -151,7 +151,7 @@ class Indi_Envelopes : public Indicator { _ma_method, _ma_shift, _deviation, _mode, _shift, _target PTR_DEREF GetCache()); } - static double iEnvelopesOnArray(CONST_ARRAY_REF(double, price), int total, int ma_period, ENUM_MA_METHOD ma_method, + static double iEnvelopesOnArray(ARRAY_REF(double, price), int total, int ma_period, ENUM_MA_METHOD ma_method, int ma_shift, double deviation, int mode, int shift, IndiBufferCache *_cache = NULL) { #ifdef __MQL4__ @@ -331,7 +331,7 @@ double iEnvelopes(string _symbol, int _tf, int _period, int _ma_method, int _ma_ return Indi_Envelopes::iEnvelopes(_symbol, (ENUM_TIMEFRAMES)_tf, _period, (ENUM_MA_METHOD)_ma_method, _ma_shift, (ENUM_APPLIED_PRICE)_ap, _deviation, _mode, _shift); } -double iEnvelopesOnArray(CONST_ARRAY_REF(double, _arr), int _total, int _ma_period, int _ma_method, int _ma_shift, +double iEnvelopesOnArray(ARRAY_REF(double, _arr), int _total, int _ma_period, int _ma_method, int _ma_shift, double _deviation, int _mode, int _shift) { ResetLastError(); return Indi_Envelopes::iEnvelopesOnArray(_arr, _total, _ma_period, (ENUM_MA_METHOD)_ma_method, _ma_shift, _deviation, diff --git a/Market.mqh b/Market.mqh index 441d7c580..94322431b 100644 --- a/Market.mqh +++ b/Market.mqh @@ -271,7 +271,7 @@ class Market : public SymbolInfo { case MARKET_COND_SPREAD_GT_20: return GetSpreadInPts() > 20; default: - logger.Error(StringFormat("Invalid market condition: %s!", EnumToString(_cond), __FUNCTION_LINE__)); + logger.Error(StringFormat("Invalid market condition: %s!", C_STR(EnumToString(_cond)), __FUNCTION_LINE__)); return false; } } diff --git a/Math/Matrix.h b/Math/Matrix.h index 898bddc94..1733501c6 100644 --- a/Math/Matrix.h +++ b/Math/Matrix.h @@ -25,30 +25,29 @@ #define MATRIX_MQH #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 - #ifdef __MQL5__ -#define MATRIX_USE_OPENCL + #define MATRIX_USE_OPENCL #endif #ifdef USE_MQL_MATH_STAT -#ifdef __MQL5__ -#include -#endif + #ifdef __MQL5__ + #include + #endif #endif // Includes. #include "Math.h" #ifdef MATRIX_USE_OPENCL -#include "OpenCL.h" + #include "OpenCL.h" -#resource "Matrix.matmul.cl" as string CLSource_Matrix_MatMul -#resource "Matrix.matmul.naive.cl" as string CLSource_Matrix_MatMul_Naive -#resource "Matrix.matmul.test.cl" as string CLSource_Matrix_MatMul_Test + #resource "Matrix.matmul.cl" as string CLSource_Matrix_MatMul + #resource "Matrix.matmul.naive.cl" as string CLSource_Matrix_MatMul_Naive + #resource "Matrix.matmul.test.cl" as string CLSource_Matrix_MatMul_Test #endif // MATRIX_USE_OPENCL #define MATRIX_DIMENSIONS 6 @@ -843,7 +842,7 @@ class Matrix { return; } - Initialize(_right.ptr_first_dimension.Clone()); + Initialize(_right.ptr_first_dimension PTR_DEREF Clone()); #ifdef MATRIX_USE_OPENCL InitializeOpenCL(); #endif @@ -2673,7 +2672,7 @@ unsigned long Matrix::version_counter = 0; #ifdef MATRIX_USE_OPENCL -#ifdef __MQL__ + #ifdef __MQL__ template Ref Matrix::cl_program_matmul; template @@ -2684,7 +2683,7 @@ template DictStruct> Matrix::cl_buffers_in_1; template DictStruct> Matrix::cl_buffers_out; -#else + #else template Ref Matrix::cl_program_matmul; template @@ -2695,7 +2694,7 @@ template DictStruct> Matrix::cl_buffers_in_1; template DictStruct> Matrix::cl_buffers_out; -#endif // __MQL__ + #endif // __MQL__ #endif // MATRIX_USE_OPENCL diff --git a/Serializer/SerializerNodeParam.h b/Serializer/SerializerNodeParam.h index 32539c707..1ae965e89 100644 --- a/Serializer/SerializerNodeParam.h +++ b/Serializer/SerializerNodeParam.h @@ -116,7 +116,7 @@ class SerializerNodeParam { /** * Returns new SerializerNodeParam object from given source value. */ - static SerializerNodeParam* FromValue(datetime value) { return FromLong(value); } + static SerializerNodeParam* FromValue(datetime value) { return FromLong((int64)value); } /** * Returns new SerializerNodeParam object from given source value. @@ -345,7 +345,7 @@ SerializerNodeParam* SerializerNodeParam::FromLong(int64 value) { /** * Returns new SerializerNodeParam object from given source value. */ -SerializerNodeParam* SerializerNodeParam::FromLong(uint64 value) { return FromLong((signed int64)value); } +SerializerNodeParam* SerializerNodeParam::FromLong(uint64 value) { return FromLong((uint64)value); } /** * Returns new SerializerNodeParam object from given source value. diff --git a/Storage/Dict/Buffer/BufferTick.h b/Storage/Dict/Buffer/BufferTick.h index d5ea9baf5..620ee6223 100644 --- a/Storage/Dict/Buffer/BufferTick.h +++ b/Storage/Dict/Buffer/BufferTick.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. @@ -77,7 +77,7 @@ class BufferTickValueStorage : ValueStorage { /** * Returns number of values available to fetch (size of the values buffer). */ - int Size() override { return (int)THIS_ATTR buffer_tick.Size(); } + int Size() override { return (int)THIS_ATTR buffer_tick PTR_DEREF Size(); } }; /** diff --git a/Storage/ValueStorage.native.h b/Storage/ValueStorage.native.h index 84686630d..6a61b80f1 100644 --- a/Storage/ValueStorage.native.h +++ b/Storage/ValueStorage.native.h @@ -25,8 +25,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,7 +55,7 @@ class NativeValueStorage : public ValueStorage { /** * Initializes array with given one. */ - void SetData(CONST_ARRAY_REF(C, _arr)) { + void SetData(ARRAY_REF(C, _arr)) { bool _was_series = ArrayGetAsSeries(_arr); ArraySetAsSeries(_arr, false); ArraySetAsSeries(_values, false); diff --git a/Strategy.mqh b/Strategy.mqh index 66a45c73d..4f51cc261 100644 --- a/Strategy.mqh +++ b/Strategy.mqh @@ -340,7 +340,8 @@ class Strategy : public Taskable { // return StringFormat("%s%s[%s];s:%gp%s", _prefix != "" ? _prefix + ": " : "", name, trade REF_DEREF // chart.TfToString(), GetCurrSpread(), _suffix != "" ? "| " + _suffix : ""); - return StringFormat("%s%s[%s]%s", _prefix, name, trade REF_DEREF GetSource() PTR_DEREF GetSymbolTf(), _suffix); + return StringFormat("%s%s[%s]%s", C_STR(_prefix), C_STR(name), + C_STR(trade REF_DEREF GetSource() PTR_DEREF GetSymbolTf()), C_STR(_suffix)); } /** @@ -348,7 +349,8 @@ class Strategy : public Taskable { */ string GetOrderCloseComment(string _prefix = "", string _suffix = "") { // @todo: Add spread. - return StringFormat("%s%s[%s]%s", _prefix, name, trade REF_DEREF GetSource() PTR_DEREF GetSymbolTf(), _suffix); + return StringFormat("%s%s[%s]%s", C_STR(_prefix), C_STR(name), + C_STR(trade REF_DEREF GetSource() PTR_DEREF GetSymbolTf()), C_STR(_suffix)); } /** @@ -655,7 +657,7 @@ class Strategy : public Taskable { /** * Prints strategy's details. */ - string const ToString() override { return StringFormat("%s: %s", GetName(), sparams.ToString()); } + string const ToString() override { return StringFormat("%s: %s", C_STR(GetName()), C_STR(sparams.ToString())); } /* Virtual methods */ @@ -701,8 +703,9 @@ class Strategy : public Taskable { ENUM_TIMEFRAMES _stf = Get(STRAT_PARAM_TF); unsigned int _stf_secs = ChartTf::TfToSeconds(_stf); if (sparams.order_close_time != 0) { - long _close_time_arg = sparams.order_close_time > 0 ? sparams.order_close_time * 60 - : (int)round(-sparams.order_close_time * _stf_secs); + long _close_time_arg = sparams.order_close_time > 0 + ? sparams.order_close_time * 60 + : (long)MathRound((long)-sparams.order_close_time * (long)_stf_secs); _order PTR_DEREF Set(ORDER_PARAM_COND_CLOSE, ORDER_COND_LIFETIME_GT_ARG, _index); _order PTR_DEREF Set(ORDER_PARAM_COND_CLOSE_ARG_VALUE, _close_time_arg, _index); _index++; diff --git a/Strategy.struct.h b/Strategy.struct.h index 5df14b88f..178197aed 100644 --- a/Strategy.struct.h +++ b/Strategy.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. @@ -445,9 +445,10 @@ struct StgEntry { unsigned short signals; StgStatsPeriod stats_period[FINAL_ENUM_STRATEGY_STATS_PERIOD]; string ToCSV() { - return StringFormat("%s,%s,%s,%s", stats_period[(int)EA_STATS_DAILY].ToCSV(), - stats_period[(int)EA_STATS_WEEKLY].ToCSV(), stats_period[(int)EA_STATS_MONTHLY].ToCSV(), - stats_period[(int)EA_STATS_TOTAL].ToCSV()); + return StringFormat("%s,%s,%s,%s", C_STR(stats_period[(int)EA_STATS_DAILY].ToCSV()), + C_STR(stats_period[(int)EA_STATS_WEEKLY].ToCSV()), + C_STR(stats_period[(int)EA_STATS_MONTHLY].ToCSV()), + C_STR(stats_period[(int)EA_STATS_TOTAL].ToCSV())); } // Struct setters. void SetStats(StgStatsPeriod &_stats, ENUM_STRATEGY_STATS_PERIOD _period) { stats_period[(int)_period] = _stats; } diff --git a/SummaryReport.mqh b/SummaryReport.mqh index 405ab6482..d1a68aae2 100644 --- a/SummaryReport.mqh +++ b/SummaryReport.mqh @@ -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 #include "Convert.mqh" @@ -307,17 +307,19 @@ class SummaryReport { string output = ""; _currency = _currency != "" ? _currency : AccountInfoString(ACCOUNT_CURRENCY); output += StringFormat("Currency pair symbol: %s", _Symbol) + sep; - output += StringFormat("Initial deposit: %.2f %s", GetInitDeposit(), _currency) + sep; - output += StringFormat("Total net profit: %.2f %s", summary_profit, _currency) + sep; - output += StringFormat("Gross profit: %.2f %s", gross_profit, _currency) + sep; - output += StringFormat("Gross loss: %.2f %s", gross_loss, _currency) + sep; - output += StringFormat("Absolute drawdown: %.2f %s", abs_dd, _currency) + sep; output += - StringFormat("Maximal drawdown: %.1f %s (%.1f%%)", max_dd, _currency, max_dd_pct) + - sep; + StringFormat("Initial deposit: %.2f %s", GetInitDeposit(), C_STR(_currency)) + sep; output += - StringFormat("Relative drawdown: (%.1f%%) %.1f %s", rel_dd_pct, rel_dd, _currency) + - sep; + StringFormat("Total net profit: %.2f %s", summary_profit, C_STR(_currency)) + sep; + output += StringFormat("Gross profit: %.2f %s", gross_profit, C_STR(_currency)) + sep; + output += StringFormat("Gross loss: %.2f %s", gross_loss, C_STR(_currency)) + sep; + output += StringFormat("Absolute drawdown: %.2f %s", abs_dd, C_STR(_currency)) + sep; + output += StringFormat("Maximal drawdown: %.1f %s (%.1f%%)", max_dd, C_STR(_currency), + max_dd_pct) + + sep; + output += StringFormat("Relative drawdown: (%.1f%%) %.1f %s", rel_dd_pct, rel_dd, + C_STR(_currency)) + + sep; output += StringFormat("Profit factor: %.2f", profit_factor) + sep; output += StringFormat("Expected payoff: %.2f", expected_payoff) + sep; output += StringFormat("Trades total %d", summary_trades) + sep; diff --git a/Task/Task.h b/Task/Task.h index a2604b925..548df0483 100644 --- a/Task/Task.h +++ b/Task/Task.h @@ -51,7 +51,7 @@ class Task : public Taskable { * Class constructor. */ Task() {} - Task(const TaskEntry &_entry) { Add(_entry); } + Task(TaskEntry &_entry) { Add(_entry); } /** * Class copy constructor. @@ -68,7 +68,7 @@ class Task : public Taskable { /** * Adds new task. */ - void Add(const TaskEntry &_entry) { tasks.Push(_entry); } + void Add(TaskEntry &_entry) { tasks.Push(_entry); } /* Virtual methods */ diff --git a/Task/TaskObject.h b/Task/TaskObject.h index e5fe49fc1..942f6b7d7 100644 --- a/Task/TaskObject.h +++ b/Task/TaskObject.h @@ -54,7 +54,7 @@ class TaskObject : public Task { /** * Class constructor with task entry as argument. */ - TaskObject(const TaskEntry &_tentry, TA *_obja = nullptr, TC *_objc = nullptr) + TaskObject(TaskEntry &_tentry, TA *_obja = nullptr, TC *_objc = nullptr) : Task(_tentry), obja(_obja), objc(_objc) {} /**