Skip to content

Commit

Permalink
WIP. Should fix errors in MT4, MT5 & C++ for TaskRunner.
Browse files Browse the repository at this point in the history
  • Loading branch information
nseam committed Feb 9, 2023
1 parent 720ec62 commit 032e8e7
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/compile-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
with:
compiler: gcc-latest
- name: Compile ${{ matrix.file }} via emcc
if: always()
run: emcc "${{ matrix.file }}"
- name: Compile ${{ matrix.file }} via g++
if: always()
run: g++ -c "${{ matrix.file }}"
7 changes: 6 additions & 1 deletion Chart.struct.tf.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,12 @@ struct ChartTf {
static unsigned int TfToSeconds(const ENUM_TIMEFRAMES _tf) {
switch (_tf) {
case PERIOD_CURRENT:
return PeriodSeconds(_tf);
#ifdef __MQL__
return ::PeriodSeconds(_tf);
#else
RUNTIME_ERROR("PeriodSeconds(PERIOD_CURRENT) is not implemented! Returning 0.");
return 0;
#endif
case PERIOD_M1: // 1 minute.
return 60;
case PERIOD_M2: // 2 minutes (non-standard).
Expand Down
5 changes: 4 additions & 1 deletion Indicator/IndicatorData.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ struct ExternInstantiateIndicatorBufferValueStorageDouble {
#include "../Flags.h"
#include "../Storage/IValueStorage.h"
#include "../Storage/ItemsHistory.h"
#include "../Storage/ValueStorage.indicator.h"
#include "../SymbolInfo.struct.h"
#include "Indicator.enum.h"
#include "IndicatorBase.h"
Expand Down Expand Up @@ -1940,6 +1939,10 @@ int CopyBuffer(IndicatorData* _indi, int _mode, int _start, int _count, ValueSto
return _num_copied;
}

// clang-format off
#include "../Storage/ValueStorage.indicator.h"
// clang-format on

IValueStorage* ExternInstantiateIndicatorBufferValueStorageDouble::InstantiateIndicatorBufferValueStorageDouble(
IndicatorData* _indi, int _mode) {
return new IndicatorBufferValueStorage<double>(_indi, _mode);
Expand Down
2 changes: 1 addition & 1 deletion Storage/ValueStorage.history.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class HistoryValueStorage : public ValueStorage<C> {
/**
* Initializes storage with given value.
*/
virtual void Initialize(C _value) {
virtual void Initialize(C _value) override {
Print("HistoryValueStorage does not implement Initialize()!");
DebugBreak();
}
Expand Down
9 changes: 7 additions & 2 deletions Storage/ValueStorage.indicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

// Forward declarations.
class IndicatorData;
template <typename C>
class HistoryValueStorage;

// Includes.
#include "../Indicator/IndicatorData.h"
Expand All @@ -50,10 +52,13 @@ class IndicatorBufferValueStorage : public HistoryValueStorage<C> {
* Constructor.
*/
IndicatorBufferValueStorage(IndicatorData* _indi_candle, int _mode = 0, bool _is_series = false)
: mode(_mode), HistoryValueStorage(_indi_candle) {}
: HistoryValueStorage<C>(_indi_candle), mode(_mode) {}

/**
* Fetches value from a given shift. Takes into consideration as-series flag.
*/
C Fetch(int _rel_shift) override { return indi_candle REF_DEREF GetValue<C>(mode, RealShift(_rel_shift)); }
C Fetch(int _rel_shift) override {
IndicatorData* _indi = THIS_ATTR indi_candle.Ptr();
return _indi PTR_DEREF GetValue<C>(mode, THIS_ATTR RealShift(_rel_shift));
}
};
2 changes: 1 addition & 1 deletion Tick/Tick.struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct MqlTick {
MqlTick() {}

// Copy constructor.
MqlTick(){const MqlTick & r} {
MqlTick(const MqlTick &r) {
time = r.time;
ask = r.ask;
bid = r.bid;
Expand Down

0 comments on commit 032e8e7

Please sign in to comment.