Skip to content

Commit

Permalink
Fixes tests using Platform::FetchDefaultCandleIndicator() as method n…
Browse files Browse the repository at this point in the history
…ow requires both, symbol and time-frame to be passed.
  • Loading branch information
nseam committed May 25, 2023
1 parent 2d7e339 commit 930cda4
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Indicator/tests/IndicatorCandle.test.mq5
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Ref<IndicatorData> 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;
}

Expand Down
2 changes: 1 addition & 1 deletion Indicator/tests/IndicatorRenko.test.mq5
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Ref<IndicatorData> 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));
Expand Down
6 changes: 3 additions & 3 deletions Indicator/tests/IndicatorTf.test.mq5
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ Ref<Indi_AMA> 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());
Expand All @@ -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));
Expand Down
2 changes: 2 additions & 0 deletions PlatformTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#include "DateTime.struct.h"
#endif

#include "Std.h"

class PlatformTime {
static MqlDateTime current_time;
static int64 current_timestamp_s;
Expand Down
2 changes: 1 addition & 1 deletion tests/3DTest.mq5
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int OnInit() {
_mesh.Ptr().SetShaderVS(_shader_v.Ptr());
_mesh.Ptr().SetShaderPS(_shader_p.Ptr());

Ref<Chart3D> _chart = new Chart3D(Platform::FetchDefaultCandleIndicator(), CHART3D_TYPE_CANDLES);
Ref<Chart3D> _chart = new Chart3D(Platform::FetchDefaultCandleIndicator("EURUSD", PERIOD_M1), CHART3D_TYPE_CANDLES);

unsigned int _rand_color = rand() * 1256;

Expand Down
2 changes: 1 addition & 1 deletion tests/BufferFXTTest.mq5
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/DrawIndicatorTest.mq5
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion tests/OrderTest.mq5
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down

0 comments on commit 930cda4

Please sign in to comment.