From 930cda41307f322211f032252be0f875eb504e7c Mon Sep 17 00:00:00 2001 From: Adrian Kierzkowski Date: Wed, 24 May 2023 19:31:44 +0200 Subject: [PATCH] Fixes tests using Platform::FetchDefaultCandleIndicator() as method now requires both, symbol and time-frame to be passed. --- Indicator/tests/IndicatorCandle.test.mq5 | 2 +- Indicator/tests/IndicatorRenko.test.mq5 | 2 +- Indicator/tests/IndicatorTf.test.mq5 | 6 +++--- PlatformTime.h | 2 ++ tests/3DTest.mq5 | 2 +- tests/BufferFXTTest.mq5 | 2 +- tests/DrawIndicatorTest.mq5 | 2 +- tests/OrderTest.mq5 | 2 +- 8 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Indicator/tests/IndicatorCandle.test.mq5 b/Indicator/tests/IndicatorCandle.test.mq5 index 79ba7453a..c2bbf072f 100644 --- a/Indicator/tests/IndicatorCandle.test.mq5 +++ b/Indicator/tests/IndicatorCandle.test.mq5 @@ -36,7 +36,7 @@ Ref indi_candle; */ int OnInit() { Platform::Init(); - Platform::Add(indi_candle = Platform::FetchDefaultCandleIndicator()); + Platform::Add(indi_candle = Platform::FetchDefaultCandleIndicator("EURUSD", PERIOD_M1)); return _LastError == ERR_NO_ERROR ? INIT_SUCCEEDED : INIT_FAILED; } diff --git a/Indicator/tests/IndicatorRenko.test.mq5 b/Indicator/tests/IndicatorRenko.test.mq5 index 483749ff6..80ff7d3b5 100644 --- a/Indicator/tests/IndicatorRenko.test.mq5 +++ b/Indicator/tests/IndicatorRenko.test.mq5 @@ -47,7 +47,7 @@ Ref indi_renko; int OnInit() { Platform::Init(); // Platform ticks. - indi_tick = Platform::FetchDefaultTickIndicator(); + indi_tick = Platform::FetchDefaultTickIndicator("EURUSD"); // Renko with 10 pips limit. Platform::Add(indi_renko = new IndicatorRenko(1)); diff --git a/Indicator/tests/IndicatorTf.test.mq5 b/Indicator/tests/IndicatorTf.test.mq5 index 139e1275f..f4db42ced 100644 --- a/Indicator/tests/IndicatorTf.test.mq5 +++ b/Indicator/tests/IndicatorTf.test.mq5 @@ -55,13 +55,13 @@ Ref indi_ama_custom; int OnInit() { Platform::Init(); // Platform ticks. - indi_tick = Platform::FetchDefaultTickIndicator(); + indi_tick = Platform::FetchDefaultTickIndicator("EURUSD"); // 1-second candles. // indicators.Add(indi_tf = new IndicatorTfDummy(1)); // 1:1 candles from platform using current timeframe. - indi_tf_real = Platform::FetchDefaultCandleIndicator(); + indi_tf_real = Platform::FetchDefaultCandleIndicator("EURUSD", PERIOD_M1); // 1-second candles. // indicators.Add(indi_ama = new Indi_AMA()); @@ -70,7 +70,7 @@ int OnInit() { _ama_params.applied_price = PRICE_OPEN; // AMA on platform candles. - Platform::Add(indi_ama_orig_sim = new Indi_AMA(_ama_params)); + Platform::AddWithDefaultBindings(indi_ama_orig_sim = new Indi_AMA(_ama_params), "EURUSD", PERIOD_M1); // Original built-in AMA indicator on platform OHLCs. Platform::Add(indi_ama_orig = new Indi_AMA(_ama_params, IDATA_BUILTIN)); diff --git a/PlatformTime.h b/PlatformTime.h index b67cc43dc..5cad5dd3c 100644 --- a/PlatformTime.h +++ b/PlatformTime.h @@ -37,6 +37,8 @@ #include "DateTime.struct.h" #endif +#include "Std.h" + class PlatformTime { static MqlDateTime current_time; static int64 current_timestamp_s; diff --git a/tests/3DTest.mq5 b/tests/3DTest.mq5 index 35b329fd5..16e64e77f 100644 --- a/tests/3DTest.mq5 +++ b/tests/3DTest.mq5 @@ -66,7 +66,7 @@ int OnInit() { _mesh.Ptr().SetShaderVS(_shader_v.Ptr()); _mesh.Ptr().SetShaderPS(_shader_p.Ptr()); - Ref _chart = new Chart3D(Platform::FetchDefaultCandleIndicator(), CHART3D_TYPE_CANDLES); + Ref _chart = new Chart3D(Platform::FetchDefaultCandleIndicator("EURUSD", PERIOD_M1), CHART3D_TYPE_CANDLES); unsigned int _rand_color = rand() * 1256; diff --git a/tests/BufferFXTTest.mq5 b/tests/BufferFXTTest.mq5 index ea1f59814..120f60725 100644 --- a/tests/BufferFXTTest.mq5 +++ b/tests/BufferFXTTest.mq5 @@ -36,7 +36,7 @@ BufferFXT *ticks; */ int OnInit() { Platform::Init(); - ticks = new BufferFXT(Platform::FetchDefaultCandleIndicator()); + ticks = new BufferFXT(Platform::FetchDefaultCandleIndicator("EURUSD", PERIOD_M1)); // Test 1. // @todo return (GetLastError() > 0 ? INIT_FAILED : INIT_SUCCEEDED); diff --git a/tests/DrawIndicatorTest.mq5 b/tests/DrawIndicatorTest.mq5 index 7863ca883..070545a33 100644 --- a/tests/DrawIndicatorTest.mq5 +++ b/tests/DrawIndicatorTest.mq5 @@ -47,7 +47,7 @@ int bar_processed; */ int OnInit() { Platform::Init(); - candles = Platform::FetchDefaultCandleIndicator(); + candles = Platform::FetchDefaultCandleIndicator("EURUSD", PERIOD_M1); bool _result = true; // Initialize indicators. _result &= InitIndicators(); diff --git a/tests/OrderTest.mq5 b/tests/OrderTest.mq5 index 7a0fc2dae..65b5beddf 100644 --- a/tests/OrderTest.mq5 +++ b/tests/OrderTest.mq5 @@ -48,7 +48,7 @@ Order *orders_dummy[MAX_ORDERS]; */ int OnInit() { Platform::Init(); - _candles = Platform::FetchDefaultCandleIndicator(); + _candles = Platform::FetchDefaultCandleIndicator("EURUSD", PERIOD_M1); bool _result = true; bar_processed = 0; assertTrueOrFail(GetLastError() == ERR_NO_ERROR, StringFormat("Error: %d!", GetLastError()));