Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.007-dev-new (Chart refactor, OpenCL) #749

Open
wants to merge 161 commits into
base: v3.006-dev-new
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
161 commits
Select commit Hold shift + click to select a range
54f131e
Chart: ChartTf: Adds SecsToTf()
kenorb Oct 28, 2021
b706c3d
Indicator: Removes Chart inheritance (1st part of refactor) [WIP]
kenorb Oct 28, 2021
ad92ef6
Merge remote-tracking branch 'origin/master' into dev-indi-no-chart
kenorb Oct 29, 2021
191c573
Merge tag 'v2.009' into dev-indi-no-chart
kenorb Nov 8, 2021
cac1c7d
Merge branch 'dev-indicator-refactor' into dev-indi-no-chart
kenorb Dec 8, 2021
fd383ca
Merge remote-tracking branch 'origin/dev-v2012' into dev-indi-no-chart
kenorb Jan 28, 2022
931fbfa
Merge remote-tracking branch 'origin/master' into dev-indi-no-chart
kenorb Jan 28, 2022
3dd06ee
Adds .devcontainer
kenorb Aug 2, 2022
6ee2308
Adds additional vscode C++ extensions
kenorb Aug 2, 2022
88ffea4
Converts tabs into spaces in devcontainer.json
kenorb Aug 2, 2022
ea47c03
devcontainer: Adds vscode Vim extension
kenorb Aug 2, 2022
d0b8d22
Moves Indicator and IndicatorBase into Indicator/
kenorb Aug 7, 2022
ff1b4ba
Indicator: Adds initial IndicatorRenko class
kenorb Aug 7, 2022
f0fcb4f
Indicator/README: Adds class diagram
kenorb Aug 7, 2022
b37f79b
Adds .clang-tidy
kenorb Aug 15, 2022
72699d9
Adds clang-format pre-commit hook
kenorb Aug 15, 2022
a8ddd3b
Adds clang-format pre-commit hook
kenorb Aug 15, 2022
ad2401a
Merge branch 'v3.004-dev' of https://github.com/EA31337/EA31337-class…
nseam Aug 16, 2022
facfa03
Almost complete IndicatorRenko. Just need to implement RenkoCondition…
nseam Aug 16, 2022
155a9fe
Almost working Renko. Somehow platform's Tick() is executed more ofte…
nseam Aug 17, 2022
a2bdfe3
Almost working Renko indicator. There is a problem with completed can…
nseam Aug 19, 2022
0ecb54d
Moves Indicator related files into Indicator/
kenorb Aug 7, 2022
8b9072d
Moves Tick.struct.h to Tick/
kenorb Aug 19, 2022
943f662
Moves Serializer files to Serializer/
kenorb Aug 19, 2022
345c088
Merge pull request #659 from EA31337/v3.004-dev-rename
kenorb Aug 22, 2022
baa4942
WIP. Fixes Dict's logic inside InsertInto(). Also changed the way Ove…
nseam Aug 24, 2022
c875e5f
Merge branch 'v3.004-dev' of https://github.com/EA31337/EA31337-class…
nseam Aug 24, 2022
ee7c872
WIP. Added Candle regeneration from historic ticks if candle was wipe…
nseam Aug 25, 2022
ab065cf
WIP. ItemsHistory and ItemsHistoryItemProvider classes to store and (…
nseam Sep 7, 2022
cc084fd
WIP. Making ItemsHistory for Candle and CandleTf indicators. Trying t…
nseam Sep 8, 2022
09b3bb5
WIP. Closer to the end of ItemsHistory class and candle providers for…
nseam Sep 17, 2022
293da01
WIP. Blocked because of too complicated relationship between ItemsHis…
nseam Sep 20, 2022
cc29ec8
WIP. Got rid of parent-child relationship between ItemsHistory and It…
nseam Sep 21, 2022
1b54b0c
WIP. ItemsHistory and IndicatorTf now properly stores candles' histor…
nseam Sep 26, 2022
3bddda8
Should fix problem "'array' - constant variable cannot be passed as r…
nseam Sep 27, 2022
477e69a
WIP. Almost working candle regeneration for IndicatorTf. There are di…
nseam Sep 29, 2022
43e9bf0
WIP. Fixing tests. Added ItemsHistory ItemProvider stub for Renko ind…
nseam Oct 6, 2022
df96a23
WIP. IndicatorTick is now using ItemsHistory for tick storage purpose…
nseam Oct 7, 2022
415997f
WIP. Made indicators to use our #define for built-in indicator calls.…
nseam Oct 11, 2022
0b85195
WIP. What's left is to find why in MT4 there's a problem with getting…
nseam Oct 12, 2022
fdaf6e7
WIP. Fixing indicators that depends on candles that not yet occured.
nseam Oct 13, 2022
7e46225
WIP. Fixing indicator tests.
nseam Oct 14, 2022
13fa803
WIP. Looks like indicators' custom buffer requires refactoring and us…
nseam Oct 25, 2022
0e9563e
WIP. Fixing inconsistencies in shift given into indicators' params an…
nseam Oct 25, 2022
6c4ac8d
WIP. Added explanation of shift parameters in Indicator/IndicatorData…
nseam Oct 28, 2022
ecc90c4
WIP. Shift parameters refactoring for Indicator/IndicatorData/other c…
nseam Oct 31, 2022
545f320
WIP. Indi_Bands now uses OnCalculate() method. Fixing shifts in all t…
nseam Nov 3, 2022
2c77ffe
WIP. Fixing tests.
nseam Nov 4, 2022
5f225c4
WIP. Adding candle invalidation. Still not working. Required for Indi…
nseam Nov 10, 2022
0a6aade
WIP. Fixing C++ errors.
nseam Nov 10, 2022
4cdd0d2
WIP. Fixing C++ include loops.
nseam Nov 11, 2022
fc3de69
WIP. Fixing MQL/C++ errors. Moving serialization methods to separate …
nseam Nov 11, 2022
5d9031f
WIP. Added rates_total validation for all the indicators in `Indicato…
nseam Nov 14, 2022
5287625
WIP. Writing stubs/most important methods' implementations for Emscri…
nseam Nov 17, 2022
d393683
WIP. Added missing C++ methods regarding String printing/manipulation…
nseam Nov 30, 2022
e36c9c9
WIP. Trying to run emscripten-generated code in the browser.
nseam Dec 1, 2022
42409e3
WIP. Trying to make smart pointers to work in JS.
nseam Dec 15, 2022
8b18790
Merge pull request #662 from nseam/dev-indi-renko
kenorb Dec 19, 2022
da13c54
WIP. Making Account and Exchange classes to work via Emscripten. Also…
nseam Dec 21, 2022
ff982e3
WIP. End up with include loop.
nseam Jan 9, 2023
36993ce
WIP. Fixing Emscripten compilation errors.
nseam Jan 12, 2023
efa69da
WIP. Fixing Emscripten compilation errors.
nseam Jan 14, 2023
db0b8a0
WIP. Making code C++/Emscripten-compatible.
nseam Jan 19, 2023
f4c5d18
WIP. Code is now compiling for a FX31337-wasm's tests/js/TestRunner.js
nseam Jan 20, 2023
c09b514
IndicatorsTest now compiles in MT5. Need to check other tests.
nseam Jan 26, 2023
88108ce
WIP. Fixing MT5 tests.
nseam Jan 27, 2023
17cd38a
Fixed C++ and MQL5 errors for tests in /tests folder.
nseam Feb 2, 2023
a30a476
WIP. Trying to make tests to run on MT4.
nseam Feb 7, 2023
720ec62
WIP. Should fix tests in MT4 and MT5.
nseam Feb 8, 2023
032e8e7
WIP. Should fix errors in MT4, MT5 & C++ for TaskRunner.
nseam Feb 9, 2023
11b6ce5
Added missing includes.
nseam Feb 16, 2023
f78b9fd
Addes required flags for emcc and gcc.
nseam Feb 16, 2023
a13a079
Made tests to continue even if one of them fails.
nseam Feb 17, 2023
2a5f72c
Added ToString() override to Indicator class, so IndicatorsTest will …
nseam Feb 17, 2023
a36e135
WIP. Making FX's Indicator.cpp's to compile.
nseam Feb 17, 2023
ba94fa8
Sets job max-parallel to 4 as per API limits
kenorb Feb 21, 2023
ccade19
WIP. Using Indi_TickProvider to provide tick for Candle indicator and…
nseam Feb 23, 2023
ee07184
Merge branch 'dev-fx-emcc' of https://github.com/nseam/EA31337-classe…
nseam Feb 23, 2023
16ebdc4
Fixing MQL4 errors.
nseam Feb 24, 2023
65b8f29
WIP. Fixing MT4 errors.
nseam Feb 25, 2023
478b640
WIP. Testing RSI over IndicatorTfDummy over Indi_TickProvider. Now we…
nseam Mar 1, 2023
30d6f7f
WIP. Testing RSI over IndicatorTfDummy over Indi_TickProvider. RSI re…
nseam Mar 2, 2023
db3442d
Fixes recent syntax errors for C++.
nseam Mar 8, 2023
93a46bb
Little changes for array #defines.
nseam Apr 7, 2023
42de20c
WIP. Making a Tester class and exporting IndicatorTfDummy and RSI ind…
nseam Apr 20, 2023
3bc9a57
src/IndicatorTest.cpp
nseam Apr 28, 2023
7f16aa1
Little changes for array #defines.
nseam Apr 7, 2023
050cee4
Empty commit to run tests.
nseam May 24, 2023
2d7e339
Fixes Indi_RSI #elif error. Also, added PERIOD_TF_IRREGULAR enum valu…
nseam May 24, 2023
930cda4
Fixes tests using Platform::FetchDefaultCandleIndicator() as method n…
nseam May 24, 2023
df4bb44
Tiny internal changes. Part of testing emcc API.
nseam Jun 1, 2023
b3a7f4a
Fixes warning "too many arguments for function-like macro 'RUNTIME_ER…
nseam Jun 5, 2023
69220b5
Should fix problem with MA expecting additional bar, despite it has a…
nseam Jun 8, 2023
03bcdf3
Little changes required by emcc support.
nseam Jun 8, 2023
4faba09
Merge branch 'v3.004-dev' into dev-fx-emcc
nseam Jun 13, 2023
d53d07a
Should fix problems with DrawIndicatorTest as Platform::AddWithDefaul…
nseam Jun 15, 2023
f31618f
Merge branch 'dev-fx-emcc' of https://github.com/nseam/EA31337-classe…
nseam Jun 15, 2023
b246c9d
Fixing CompileTest
nseam Jun 15, 2023
78d8634
Fixes problem with not preserving TF passed to Candle indicators.
nseam Jun 15, 2023
94d2da4
Fixes ZigZag and ZigZagColor value validation.
nseam Jun 16, 2023
e89966d
Merge pull request #665 from nseam/dev-fx-emcc
kenorb Jun 16, 2023
294eeff
ADXW: Renames variables to avoid global conflicts
kenorb Jun 23, 2023
4c26b6c
Indi_ADXW: Fixes logic for SetCustomIndicatorName()
kenorb Jun 23, 2023
db83ebb
ADXW: Renames variables to avoid global conflicts
kenorb Jun 23, 2023
c48da70
Indi_ADXW: Fixes logic for SetCustomIndicatorName()
kenorb Jun 23, 2023
1b5830f
Indicators: Renames some variables to avoid global variable conflict
kenorb Jun 24, 2023
a593ae8
Merge branch 'v3.003-dev' into v3.004-dev
kenorb Jun 24, 2023
2fa7dd0
Merge branch 'v3.004-dev' into v3.005-dev
kenorb Jun 24, 2023
7b292b7
Improves Fibonacci calculation for Pivot
kenorb Sep 10, 2023
bbf8284
ACQUIRE_BUFFERn / RELEASE_BUFFERn functionality required for EA31337/…
nseam Mar 18, 2024
20a08a7
Refs EA31337/EA31337-indicators-stats#2. Closed to finish Indi_Accoun…
nseam Mar 22, 2024
4e763ae
WIP. Refs EA31337/EA31337-indicators-stats#2. Indi_AccountStats close…
nseam Mar 27, 2024
d6a3f57
Refs #738. WIP. OpenCL wrapper class and OpenCL integration for Matri…
nseam Apr 12, 2024
2f2fce7
Refs #738. WIP. OpenCL integration for Matrix class needs rework as p…
nseam Apr 19, 2024
b612dac
Refs #738. WIP. Partially working Matrix multiplication via OpenCL. N…
nseam Apr 24, 2024
0000130
Refs EA31337/EA31337-indicators-stats#2. Closed to finish Indi_Accoun…
nseam Mar 22, 2024
5330e44
WIP. Refs EA31337/EA31337-indicators-stats#2. Indi_AccountStats close…
nseam Mar 27, 2024
640e07c
Merge tag 'v2.012' into v3.004-dev-new
kenorb Apr 26, 2024
dce2921
Refs #738. WIP. Matrix multiplication via OpenCL. Working on OpenCL b…
nseam Apr 26, 2024
af7b695
Merge tag 'v2.012' into v3.004-dev-new
kenorb Apr 27, 2024
d290033
Std: Uses Alert() and DebugBreak() for MQL only
kenorb Apr 27, 2024
ad24e5b
Refs #738. Matrix multiplication via OpenCL. Ready for testing.
nseam May 1, 2024
0b707a1
Merge remote-tracking branch 'origin/dev-indi-no-chart2' into v3.007-…
kenorb Apr 30, 2024
a4fefe2
Merge remote-tracking branch 'origin/dev-indi-no-chart' into v3.007-d…
kenorb May 1, 2024
5e14147
Merge remote-tracking branch 'origin/v3.003-dev-stats' into v3.007-de…
kenorb May 1, 2024
979924a
Merge branch 'v3.007-dev-new' into HEAD
kenorb May 1, 2024
0b9bbfd
Merge remote-tracking branch 'nseam/v3.003-dev-stats' into v3.007-dev…
kenorb May 1, 2024
6f4492c
Refs #738. Matrix multiplication fallback for MT4. CPU version now us…
nseam May 2, 2024
4a8e935
Refs #738. Matrix multiplication fallback for MT4. CPU version now us…
nseam May 2, 2024
3165600
Merge remote-tracking branch 'nseam/v3.007-dev-new' into v3.007-dev-new
kenorb May 3, 2024
82244e2
Fixes Account.test.mq5, AccountForex.test.mq5 and Exchange.test.mq5 t…
kenorb May 3, 2024
fd565d1
Merge remote-tracking branch 'origin/v3.004-dev' into v3.007-dev-new
kenorb May 3, 2024
3b58324
Merge remote-tracking branch 'origin/v3.004-dev-cpp' into v3.008-dev-new
kenorb May 4, 2024
3a3e450
Merge remote-tracking branch 'origin/v3.004-dev-indi-rename' into v3.…
kenorb May 4, 2024
c68bbce
Merge remote-tracking branch 'origin/v3.003-dev-vscode' into v3.008-d…
kenorb May 4, 2024
ffed2e8
Merge remote-tracking branch 'origin/v3.004-dev-tasks' into v3.008-de…
kenorb May 4, 2024
e98b191
Merge remote-tracking branch 'origin/v3.004-dev-cpp2' into v3.008-dev…
kenorb May 4, 2024
9aed662
Merge remote-tracking branch 'origin/v3.004-dev-new-std-fix' into v3.…
kenorb May 4, 2024
9a9d453
Merge remote-tracking branch 'origin/v3.005-dev' into v3.008-dev-new
kenorb May 4, 2024
8095e11
Refs #11. WIP. Making indicators to use Platform::OnCalculate(), Plat…
nseam May 6, 2024
8e90bfc
Merge branch 'v3.007-dev-new' of https://github.com/EA31337/EA31337-c…
nseam May 6, 2024
6859c3a
Fixed problem with casting string to ENUM_LOG_LEVEL via indicator par…
nseam May 6, 2024
36a2b12
Fixed problem with casting string to ENUM_LOG_LEVEL via indicator par…
nseam May 6, 2024
474a694
Merge pull request #751 from nseam/v3.008-dev-new-enum-log-level-casting
kenorb May 7, 2024
42ccf6a
Legacy code for MT4. OnCalculate() automatic ticking, ArraySetAsSerie…
nseam May 17, 2024
7a9c15c
Merge pull request #754 from nseam/v3.007-dev-new-mt5-code-in-mt4-ind…
kenorb May 20, 2024
d8eb065
WIP. Trying to make indicators to work with historic ticks.
nseam May 22, 2024
92ee47a
WIP. Fixes In ItemsHistory and ItemsHistoryTfCandleProvider for Candl…
nseam May 22, 2024
b9173b9
Merge remote-tracking branch 'origin/v3.007-dev-new' into v3.008-dev-new
kenorb Jun 17, 2024
7187581
Fixed problem with casting string to ENUM_LOG_LEVEL via indicator par…
nseam May 6, 2024
28205be
Merge remote-tracking branch 'origin/v3.008-dev-new' into v3.008-dev-new
kenorb Jun 17, 2024
6a38ad3
Committing the ItemsHistory-related code before merging `v3.008-dev-n…
nseam Jun 26, 2024
2911097
Merge branch 'v3.008-dev-new' into v3.007-dev-new-itemshistory-fixes.…
nseam Jun 26, 2024
3228d70
Merge branch 'v3.008-dev-new' of https://github.com/EA31337/EA31337-c…
nseam Jun 26, 2024
63f1ddb
Fixes compilation errors in MT4 and MT5.
nseam Jun 27, 2024
c132e9b
Added missing files.
nseam Jun 27, 2024
2a805d1
Removed unnecessary include. Fixes LinearWeightedMAOnBuffer() call in…
nseam Jun 27, 2024
e7ba4d5
WIP. Dict now uses class instead of struct in order to prevent copyin…
nseam Jul 1, 2024
80672f1
Merge pull request #757 from nseam/v3.008-dev-new--dict-uses-class-ge…
kenorb Jul 7, 2024
eb38f88
Comments out Alert()/DebugBreak() for non-MQL
kenorb Jul 27, 2024
146a127
Fixes typo in devcontainer.json
kenorb Aug 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refs EA31337/EA31337-indicators-stats#2. Closed to finish Indi_Accoun…
…tStats indicator.
nseam authored and kenorb committed Apr 24, 2024
commit 00001304f0216660b8d793c0ab06c5bb7126bfdb
1 change: 1 addition & 0 deletions Account/Account.h
Original file line number Diff line number Diff line change
@@ -56,4 +56,5 @@ class Account : public AccountBase {
*/
~Account() {}
};

#endif // ACCOUNT_H
40 changes: 40 additions & 0 deletions Account/AccountBase.h
Original file line number Diff line number Diff line change
@@ -56,6 +56,46 @@ class AccountBase : public Dynamic {
* Class deconstructor.
*/
~AccountBase() {}

/**
* Returns balance value of the current account.
*/
virtual datetime GetDateTime() { return TimeCurrent(); };

/**
* Returns balance value of the current account.
*/
virtual float GetBalance() = 0;

/**
* Returns credit value of the current account.
*/
virtual float GetCredit() = 0;

/**
* Returns profit value of the current account.
*/
virtual float GetProfit() = 0;

/**
* Returns equity value of the current account.
*/
virtual float GetEquity() = 0;

/**
* Returns margin value of the current account.
*/
virtual float GetMarginUsed() = 0;

/**
* Returns free margin value of the current account.
*/
virtual float GetMarginFree() = 0;

/**
* Get account available margin.
*/
virtual float GetMarginAvail() = 0;
};

#endif // ACCOUNTBASE_H
15 changes: 8 additions & 7 deletions Account/AccountMt.h
Original file line number Diff line number Diff line change
@@ -42,12 +42,13 @@ class AccountMt;
#include "Account.define.h"
#include "Account.enum.h"
#include "Account.extern.h"
#include "Account.h"
#include "Account.struct.h"

/**
* Class to provide functions that return parameters of the current account.
*/
class AccountMt {
class AccountMt : public AccountBase {
protected:
// Struct variables.
BufferStruct<AccountEntry> entries;
@@ -136,7 +137,7 @@ class AccountMt {
* Returns balance value of the current account.
*/
static double AccountBalance() { return AccountInfoDouble(ACCOUNT_BALANCE); }
float GetBalance() {
float GetBalance() override {
// @todo: Adds caching.
// return UpdateStats(ACC_BALANCE, AccountBalance());
return (float)AccountMt::AccountBalance();
@@ -146,7 +147,7 @@ class AccountMt {
* Returns credit value of the current account.
*/
static double AccountCredit() { return AccountInfoDouble(ACCOUNT_CREDIT); }
float GetCredit() {
float GetCredit() override {
// @todo: Adds caching.
// return UpdateStats(ACC_CREDIT, AccountCredit());
return (float)AccountMt::AccountCredit();
@@ -156,7 +157,7 @@ class AccountMt {
* Returns profit value of the current account.
*/
static double AccountProfit() { return AccountInfoDouble(ACCOUNT_PROFIT); }
float GetProfit() {
float GetProfit() override {
// @todo: Adds caching.
// return UpdateStats(ACC_PROFIT, AccountProfit());
return (float)AccountMt::AccountProfit();
@@ -166,7 +167,7 @@ class AccountMt {
* Returns equity value of the current account.
*/
static double AccountEquity() { return AccountInfoDouble(ACCOUNT_EQUITY); }
float GetEquity() {
float GetEquity() override {
// @todo: Adds caching.
// return UpdateStats(ACC_EQUITY, AccountEquity());
return (float)AccountMt::AccountEquity();
@@ -198,7 +199,7 @@ class AccountMt {
* Returns free margin value of the current account.
*/
static double AccountFreeMargin() { return AccountInfoDouble(ACCOUNT_MARGIN_FREE); }
float GetMarginFree() {
float GetMarginFree() override {
// @todo: Adds caching.
// return UpdateStats(ACC_MARGIN_FREE, AccountFreeMargin());
return (float)AccountMt::AccountFreeMargin();
@@ -267,7 +268,7 @@ class AccountMt {
* Get account available margin.
*/
static double AccountAvailMargin() { return fmin(AccountFreeMargin(), AccountTotalBalance()); }
float GetMarginAvail() { return (float)AccountAvailMargin(); }
float GetMarginAvail() override { return (float)AccountAvailMargin(); }

/**
* Returns the calculation mode of free margin allowed to open orders on the current account.
25 changes: 24 additions & 1 deletion Indicator.enum.h
Original file line number Diff line number Diff line change
@@ -44,6 +44,7 @@ enum ENUM_INDICATOR_ACTION {
enum ENUM_INDICATOR_TYPE {
INDI_NONE = 0, // (None)
INDI_AC, // Accelerator Oscillator
INDI_ACCOUNT_STATS, // Account Stats
INDI_AD, // Accumulation/Distribution
INDI_ADX, // Average Directional Index
INDI_ADXW, // ADX by Welles Wilder
@@ -237,9 +238,24 @@ enum ENUM_INDI_VS_TYPE {
INDI_VS_TYPE_INDEX_8,
INDI_VS_TYPE_INDEX_9,
INDI_VS_TYPE_INDEX_FIRST = INDI_VS_TYPE_INDEX_0,
INDI_VS_TYPE_INDEX_LAST = INDI_VS_TYPE_INDEX_9
INDI_VS_TYPE_INDEX_LAST = INDI_VS_TYPE_INDEX_9,

// Account Stats.
INDI_VS_TYPE_ACCOUNT_STATS_DATE_TIME,
INDI_VS_TYPE_ACCOUNT_STATS_BALANCE,
INDI_VS_TYPE_ACCOUNT_STATS_CREDIT,
INDI_VS_TYPE_ACCOUNT_STATS_EQUITY,
INDI_VS_TYPE_ACCOUNT_STATS_PROFIT,
INDI_VS_TYPE_ACCOUNT_STATS_MARGIN_USED,
INDI_VS_TYPE_ACCOUNT_STATS_MARGIN_FREE,
INDI_VS_TYPE_ACCOUNT_STATS_MARGIN_AVAIL,
INDI_VS_TYPE_ACCOUNT_STATS_INDEX_FIRST = INDI_VS_TYPE_ACCOUNT_STATS_DATE_TIME,
INDI_VS_TYPE_ACCOUNT_STATS_INDEX_LAST = INDI_VS_TYPE_ACCOUNT_STATS_MARGIN_AVAIL,
};

#define INDI_VS_TYPE_ACCOUNT_STATS_BUFFERS_COUNT \
(INDI_VS_TYPE_ACCOUNT_STATS_INDEX_LAST - INDI_VS_TYPE_ACCOUNT_STATS_INDEX_FIRST + 1)

// Indicator flags.
enum ENUM_INDI_FLAGS {
INDI_FLAG_INDEXABLE_BY_SHIFT, // Indicator supports indexation by shift.
@@ -269,4 +285,11 @@ enum ENUM_INDI_DS_MODE_KIND {
INDI_DS_MODE_KIND_AP, // Mode is a value from ENUM_APPLIED_PRICE enumeration. It is used to retrieve value storage
// based on ENUM_INDI_VS_TYPE enumeration, e.g., PRICE_OPEN becomes ENUM_INDI_VS_PRICE_OPEN.
};

// Type of entry
enum ENUM_INDI_EMITTED_ENTRY_TYPE {
INDI_EMITTED_ENTRY_TYPE_PARENT, // Undetermined type of entry from direct parent indicator.
INDI_EMITTED_ENTRY_TYPE_TICK,
INDI_EMITTED_ENTRY_TYPE_CANDLE,
};
//+------------------------------------------------------------------+
28 changes: 22 additions & 6 deletions Indicator/IndicatorCandle.h
Original file line number Diff line number Diff line change
@@ -32,6 +32,7 @@
// Includes.
#include "../Buffer/BufferCandle.h"
#include "../Candle.struct.h"
#include "../Indicator.enum.h"
#include "../Indicator.mqh"
#include "../Storage/ValueStorage.price_median.h"
#include "../Storage/ValueStorage.price_typical.h"
@@ -310,7 +311,7 @@ class IndicatorCandle : public Indicator<TS> {
void EmitHistory() override {
for (DictStructIterator<long, CandleOCTOHLC<TV>> iter(icdata.Begin()); iter.IsValid(); ++iter) {
IndicatorDataEntry _entry = CandleToEntry(iter.Key(), iter.Value());
EmitEntry(_entry);
EmitEntry(_entry, INDI_EMITTED_ENTRY_TYPE_CANDLE);
}
}

@@ -342,7 +343,7 @@ class IndicatorCandle : public Indicator<TS> {
/**
* Adds tick's price to the matching candle and updates its OHLC values.
*/
void UpdateCandle(long _tick_timestamp, double _price) {
CandleOCTOHLC<double> UpdateCandle(long _tick_timestamp, double _price) {
long _candle_timestamp = CalcCandleTimestamp(_tick_timestamp);

#ifdef __debug_verbose__
@@ -368,6 +369,8 @@ class IndicatorCandle : public Indicator<TS> {
}

icdata.Add(_candle, _candle_timestamp);

return _candle;
}

/**
@@ -380,12 +383,25 @@ class IndicatorCandle : public Indicator<TS> {
/**
* Called when data source emits new entry (historic or future one).
*/
void OnDataSourceEntry(IndicatorDataEntry& entry) override {
// Updating candle from bid price.
UpdateCandle(entry.timestamp, entry[1]);
void OnDataSourceEntry(IndicatorDataEntry& entry,
ENUM_INDI_EMITTED_ENTRY_TYPE type = INDI_EMITTED_ENTRY_TYPE_PARENT) override {
Indicator<TS>::OnDataSourceEntry(entry, type);

if (type != INDI_EMITTED_ENTRY_TYPE_TICK) {
return;
}

long _candle_timestamp = CalcCandleTimestamp(entry.timestamp);

// Updating tick & bar indices.
counter.OnTick(CalcCandleTimestamp(entry.timestamp));
counter.OnTick(_candle_timestamp);

// Updating candle from bid price.
CandleOCTOHLC<double> _candle = UpdateCandle(entry.timestamp, entry[1]);

// Emitting candle for children.
IndicatorDataEntry _candle_entry = CandleToEntry(_candle_timestamp, _candle);
EmitEntry(_candle_entry, INDI_EMITTED_ENTRY_TYPE_CANDLE);
};

/**
2 changes: 1 addition & 1 deletion Indicator/IndicatorTick.h
Original file line number Diff line number Diff line change
@@ -164,7 +164,7 @@ class IndicatorTick : public Indicator<TS> {
void EmitHistory() override {
for (DictStructIterator<long, TickAB<TV>> iter(itdata.Begin()); iter.IsValid(); ++iter) {
IndicatorDataEntry _entry = TickToEntry(iter.Key(), iter.Value());
EmitEntry(_entry);
EmitEntry(_entry, INDI_EMITTED_ENTRY_TYPE_TICK);
}
}

12 changes: 7 additions & 5 deletions Indicator/tests/classes/IndicatorTfDummy.h
Original file line number Diff line number Diff line change
@@ -48,11 +48,13 @@ class IndicatorTfDummy : public IndicatorTf<IndicatorTfDummyParams> {

string GetName() override { return "IndicatorTfDummy(" + IntegerToString(iparams.spc) + ")"; }

void OnDataSourceEntry(IndicatorDataEntry& entry) override {
// When overriding OnDataSourceEntry() we have to remember to call parent
// method, because IndicatorCandle also need to invoke it in order to
// create/update matching candle.
IndicatorTf<IndicatorTfDummyParams>::OnDataSourceEntry(entry);
void OnDataSourceEntry(IndicatorDataEntry& entry,
ENUM_INDI_EMITTED_ENTRY_TYPE type = INDI_EMITTED_ENTRY_TYPE_PARENT) override {
IndicatorTf<IndicatorTfDummyParams>::OnDataSourceEntry(entry, type);

if (type != INDI_EMITTED_ENTRY_TYPE_TICK) {
return;
}

#ifdef __debug_indicator__
Print(GetFullName(), " got new tick at ", entry.timestamp,
16 changes: 8 additions & 8 deletions Indicator/tests/classes/IndicatorTickDummy.h
Original file line number Diff line number Diff line change
@@ -59,13 +59,13 @@ class IndicatorTickDummy : public IndicatorTick<IndicatorTickDummyParams, double
TickAB<double> _t7(4.2f, 4.21f);
TickAB<double> _t8(4.8f, 4.81f);

EmitEntry(TickToEntry(1000, _t1));
EmitEntry(TickToEntry(1500, _t2));
EmitEntry(TickToEntry(2000, _t3));
EmitEntry(TickToEntry(3000, _t4));
EmitEntry(TickToEntry(4000, _t5));
EmitEntry(TickToEntry(4100, _t6));
EmitEntry(TickToEntry(4200, _t7));
EmitEntry(TickToEntry(4800, _t8));
EmitEntry(TickToEntry(1000, _t1), INDI_EMITTED_ENTRY_TYPE_TICK);
EmitEntry(TickToEntry(1500, _t2), INDI_EMITTED_ENTRY_TYPE_TICK);
EmitEntry(TickToEntry(2000, _t3), INDI_EMITTED_ENTRY_TYPE_TICK);
EmitEntry(TickToEntry(3000, _t4), INDI_EMITTED_ENTRY_TYPE_TICK);
EmitEntry(TickToEntry(4000, _t5), INDI_EMITTED_ENTRY_TYPE_TICK);
EmitEntry(TickToEntry(4100, _t6), INDI_EMITTED_ENTRY_TYPE_TICK);
EmitEntry(TickToEntry(4200, _t7), INDI_EMITTED_ENTRY_TYPE_TICK);
EmitEntry(TickToEntry(4800, _t8), INDI_EMITTED_ENTRY_TYPE_TICK);
};
};
10 changes: 7 additions & 3 deletions IndicatorData.mqh
Original file line number Diff line number Diff line change
@@ -1616,10 +1616,10 @@ class IndicatorData : public IndicatorBase {
/**
* Sends entry to listening indicators.
*/
void EmitEntry(IndicatorDataEntry& entry) {
void EmitEntry(IndicatorDataEntry& entry, ENUM_INDI_EMITTED_ENTRY_TYPE type = INDI_EMITTED_ENTRY_TYPE_PARENT) {
for (int i = 0; i < ArraySize(listeners); ++i) {
if (listeners[i].ObjectExists()) {
listeners[i].Ptr().OnDataSourceEntry(entry);
listeners[i].Ptr().OnDataSourceEntry(entry, type);
}
}
}
@@ -1683,7 +1683,11 @@ class IndicatorData : public IndicatorBase {
/**
* Called when data source emits new entry (historic or future one).
*/
virtual void OnDataSourceEntry(IndicatorDataEntry& entry){};
virtual void OnDataSourceEntry(IndicatorDataEntry& entry,
ENUM_INDI_EMITTED_ENTRY_TYPE type = INDI_EMITTED_ENTRY_TYPE_PARENT) {
// Sending entry to all chilren listeners (from highest parent to lowest child).
EmitEntry(entry, type);
};

virtual void OnTick() {}

207 changes: 207 additions & 0 deletions Indicators/Account/Indi_AccountStats.mqh
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
//+------------------------------------------------------------------+
//| EA31337 framework |
//| Copyright 2016-2021, EA31337 Ltd |
//| https://github.com/EA31337 |
//+------------------------------------------------------------------+

/*
* This file is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

// Includes.
#include "../../Account/AccountBase.h"
#include "../../BufferStruct.mqh"
#include "../../Indicator.mqh"
#include "../../Platform.h"
#include "../../Storage/Objects.h"

// Structs.
struct Indi_AccountStats_Params : IndicatorParams {
// Applied price.
ENUM_APPLIED_PRICE ap;

// Account to use.
Ref<AccountBase> account;

// Struct constructor.
Indi_AccountStats_Params(AccountBase *_account = nullptr, int _shift = 0)
: IndicatorParams(INDI_ACCOUNT_STATS), account(_account) {
SetShift(_shift);
};
Indi_AccountStats_Params(Indi_AccountStats_Params &_params) { THIS_REF = _params; };

// Getters.
AccountBase *GetAccount() { return account.Ptr(); }
ENUM_APPLIED_PRICE GetAppliedPrice() override { return ap; }

// Setters.
void SetAccount(AccountBase *_account) { account = _account; }
void SetAppliedPrice(ENUM_APPLIED_PRICE _ap) { ap = _ap; }
};

/**
* Price Indicator.
*/
class Indi_AccountStats : public Indicator<Indi_AccountStats_Params> {
Ref<ValueStorage<datetime>> buffer_date_time;
Ref<ValueStorage<double>> buffer_balance;
Ref<ValueStorage<double>> buffer_credit;
Ref<ValueStorage<double>> buffer_equity;
Ref<ValueStorage<double>> buffer_profit;
Ref<ValueStorage<double>> buffer_margin_used;
Ref<ValueStorage<double>> buffer_margin_free;
Ref<ValueStorage<double>> buffer_margin_avail;

public:
/**
* Class constructor.
*/
Indi_AccountStats(Indi_AccountStats_Params &_p, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_BUILTIN,
IndicatorData *_indi_src = NULL, int _indi_src_mode = 0)
: Indicator(_p,
IndicatorDataParams::GetInstance(INDI_VS_TYPE_ACCOUNT_STATS_BUFFERS_COUNT, TYPE_DOUBLE, _idstype,
IDATA_RANGE_PRICE, _indi_src_mode),
_indi_src) {
InitAccountStats();
};
Indi_AccountStats(int _shift = 0, ENUM_IDATA_SOURCE_TYPE _idstype = IDATA_BUILTIN, IndicatorData *_indi_src = NULL,
int _indi_src_mode = 0)
: Indicator(Indi_AccountStats_Params(),
IndicatorDataParams::GetInstance(INDI_VS_TYPE_ACCOUNT_STATS_BUFFERS_COUNT, TYPE_DOUBLE, _idstype,
IDATA_RANGE_PRICE, _indi_src_mode),
_indi_src) {
InitAccountStats();
};
void InitAccountStats() {
buffer_date_time = new NativeValueStorage<datetime>();
buffer_balance = new NativeValueStorage<double>();
buffer_credit = new NativeValueStorage<double>();
buffer_equity = new NativeValueStorage<double>();
buffer_profit = new NativeValueStorage<double>();
buffer_margin_used = new NativeValueStorage<double>();
buffer_margin_free = new NativeValueStorage<double>();
buffer_margin_avail = new NativeValueStorage<double>();
}

/**
* Returns possible data source types. It is a bit mask of ENUM_INDI_SUITABLE_DS_TYPE.
*/
virtual unsigned int GetSuitableDataSourceTypes() {
// We require that candle indicator is attached.
return INDI_SUITABLE_DS_TYPE_CANDLE;
}

/**
* Returns possible data source modes. It is a bit mask of ENUM_IDATA_SOURCE_TYPE.
*/
unsigned int GetPossibleDataModes() override { return IDATA_BUILTIN; }

/**
* Checks whether indicator has a valid value for a given shift.
*/
virtual bool HasValidEntry(int _shift = 0) { return GetBarTime(_shift) != 0; }

/**
* Returns the indicator's value.
*/
virtual IndicatorDataEntryValue GetEntryValue(int _mode = 0, int _shift = -1) {
int _ishift = _shift >= 0 ? _shift : iparams.GetShift();

// Converting mode into value storage type.
ENUM_INDI_VS_TYPE _vs_type = (ENUM_INDI_VS_TYPE)(INDI_VS_TYPE_ACCOUNT_STATS_INDEX_FIRST + _mode);

// Retrieving data from specific value storage.
switch (_vs_type) {
case INDI_VS_TYPE_ACCOUNT_STATS_DATE_TIME:
return ((ValueStorage<datetime> *)GetSpecificValueStorage(_vs_type))PTR_DEREF FetchSeries(_ishift);
case INDI_VS_TYPE_ACCOUNT_STATS_BALANCE:
case INDI_VS_TYPE_ACCOUNT_STATS_CREDIT:
case INDI_VS_TYPE_ACCOUNT_STATS_EQUITY:
case INDI_VS_TYPE_ACCOUNT_STATS_PROFIT:
case INDI_VS_TYPE_ACCOUNT_STATS_MARGIN_USED:
case INDI_VS_TYPE_ACCOUNT_STATS_MARGIN_FREE:
case INDI_VS_TYPE_ACCOUNT_STATS_MARGIN_AVAIL:
return ((ValueStorage<double> *)GetSpecificValueStorage(_vs_type))PTR_DEREF FetchSeries(_ishift);
default:
Alert("Error: Indi_AccountStats: Invalid mode passed to GetEntryValue()!");
DebugBreak();
return EMPTY_VALUE;
}
}

/**
* Returns value storage of given kind.
*/
IValueStorage *GetSpecificValueStorage(ENUM_INDI_VS_TYPE _type) override {
// Returning Price indicator which provides applied price in the only buffer #0.
switch (_type) {
case INDI_VS_TYPE_ACCOUNT_STATS_DATE_TIME:
return buffer_date_time.Ptr();
case INDI_VS_TYPE_ACCOUNT_STATS_BALANCE:
return buffer_balance.Ptr();
case INDI_VS_TYPE_ACCOUNT_STATS_CREDIT:
return buffer_credit.Ptr();
case INDI_VS_TYPE_ACCOUNT_STATS_EQUITY:
return buffer_equity.Ptr();
case INDI_VS_TYPE_ACCOUNT_STATS_PROFIT:
return buffer_profit.Ptr();
case INDI_VS_TYPE_ACCOUNT_STATS_MARGIN_USED:
return buffer_margin_used.Ptr();
case INDI_VS_TYPE_ACCOUNT_STATS_MARGIN_FREE:
return buffer_margin_free.Ptr();
case INDI_VS_TYPE_ACCOUNT_STATS_MARGIN_AVAIL:
return buffer_margin_avail.Ptr();
default:
// Trying in parent class.
return Indicator<Indi_AccountStats_Params>::GetSpecificValueStorage(_type);
}
}

/**
* Checks whether indicator support given value storage type.
*/
bool HasSpecificValueStorage(ENUM_INDI_VS_TYPE _type) override {
switch (_type) {
case INDI_VS_TYPE_ACCOUNT_STATS_DATE_TIME:
case INDI_VS_TYPE_ACCOUNT_STATS_BALANCE:
case INDI_VS_TYPE_ACCOUNT_STATS_CREDIT:
case INDI_VS_TYPE_ACCOUNT_STATS_EQUITY:
case INDI_VS_TYPE_ACCOUNT_STATS_PROFIT:
case INDI_VS_TYPE_ACCOUNT_STATS_MARGIN_USED:
case INDI_VS_TYPE_ACCOUNT_STATS_MARGIN_FREE:
case INDI_VS_TYPE_ACCOUNT_STATS_MARGIN_AVAIL:
return true;
default:
// Trying in parent class.
return Indicator<Indi_AccountStats_Params>::HasSpecificValueStorage(_type);
}
}

/**
* Called when data source emits new entry (historic or future one).
*/
virtual void OnDataSourceEntry(IndicatorDataEntry &entry,
ENUM_INDI_EMITTED_ENTRY_TYPE type = INDI_EMITTED_ENTRY_TYPE_PARENT) {
Indicator<Indi_AccountStats_Params>::OnDataSourceEntry(entry, type);

if (type != INDI_EMITTED_ENTRY_TYPE_CANDLE) {
return;
}

// Adding new account stats entry.

Print("New candle: ", entry.ToString<double>());
}
};
27 changes: 27 additions & 0 deletions Indicators/Account/tests/Indi_AccountStats.test.mq4
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//+------------------------------------------------------------------+
//| EA31337 framework |
//| Copyright 2016-2021, EA31337 Ltd |
//| https://github.com/EA31337 |
//+------------------------------------------------------------------+

/*
* This file is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* @file
* Test functionality of Indi_AC indicator class.
*/

#include "Indi_AC.test.mq5"
61 changes: 61 additions & 0 deletions Indicators/Account/tests/Indi_AccountStats.test.mq5
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//+------------------------------------------------------------------+
//| EA31337 framework |
//| Copyright 2016-2021, EA31337 Ltd |
//| https://github.com/EA31337 |
//+------------------------------------------------------------------+

/*
* This file is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

// Includes.
#include "../../../Account/AccountMt.h"
#include "../../../Platform.h"
#include "../../../Test.mqh"
#include "../Indi_AccountStats.mqh"

/**
* @file
* Test functionality of Indi_AccountStats indicator class.
*/

Ref<Indi_AccountStats> indi_account_mt;

int OnInit() {
Ref<AccountMt> account_mt = new AccountMt();
Indi_AccountStats_Params indi_params(account_mt.Ptr());
indi_account_mt = new Indi_AccountStats(indi_params);

Platform::Init();

Platform::AddWithDefaultBindings(indi_account_mt.Ptr());

bool _result = true;
assertTrueOrFail(indi_account_mt REF_DEREF IsValid(), "Error on IsValid!");
return (_result && _LastError == ERR_NO_ERROR ? INIT_SUCCEEDED : INIT_FAILED);
}

void OnTick() {
Platform::Tick();
if (Platform::IsNewHour()) {
IndicatorDataEntry _entry = indi_account_mt REF_DEREF GetEntry();
bool _is_ready = indi_account_mt REF_DEREF Get<bool>(STRUCT_ENUM(IndicatorState, INDICATOR_STATE_PROP_IS_READY));
bool _is_valid = _entry.IsValid();
Print(indi_account_mt REF_DEREF ToString(), _is_ready ? "" : " (Not yet ready)");
if (_is_ready && !_is_valid) {
Print(indi_account_mt REF_DEREF ToString(), " (Invalid entry!)");
assertTrueOrExit(_entry.IsValid(), "Invalid entry!");
}
}
}
8 changes: 0 additions & 8 deletions Indicators/Indi_AMA.mqh
Original file line number Diff line number Diff line change
@@ -256,14 +256,6 @@ class Indi_AMA : public Indicator<IndiAMAParams> {
return _value;
}

/**
* Called when data source emits new entry (historic or future one).
*/
void OnDataSourceEntry(IndicatorDataEntry &entry) override {
// Just to be able to make a breakpoint here.
int x = 4;
};

/**
* Called if data source is requested, but wasn't yet set. May be used to initialize indicators that must operate on
* some data source.
6 changes: 3 additions & 3 deletions Indicators/Tick/Indi_TickMt.mqh
Original file line number Diff line number Diff line change
@@ -159,7 +159,7 @@ class Indi_TickMt : public IndicatorTick<Indi_TickMtParams, double> {
_tmp_ticks[i].ask, ", ", _tmp_ticks[i].bid);
#endif

EmitEntry(TickToEntry(_tmp_ticks[i].time, _tick));
EmitEntry(TickToEntry(_tmp_ticks[i].time, _tick), INDI_EMITTED_ENTRY_TYPE_TICK);

if (_num_yet_to_copy <= 0) {
break;
@@ -205,7 +205,7 @@ class Indi_TickMt : public IndicatorTick<Indi_TickMtParams, double> {
// DebugBreak();
// Just emitting zeroes in case of error.
TickAB<double> _tick(0, 0);
EmitEntry(TickToEntry(TimeCurrent(), _tick));
EmitEntry(TickToEntry(TimeCurrent(), _tick), INDI_EMITTED_ENTRY_TYPE_TICK);
return;
}

@@ -224,6 +224,6 @@ class Indi_TickMt : public IndicatorTick<Indi_TickMtParams, double> {
TickAB<double> _tick(_ask, _bid);
IndicatorDataEntry _entry(TickToEntry(_time, _tick));
StoreEntry(_entry);
EmitEntry(_entry);
EmitEntry(_entry, INDI_EMITTED_ENTRY_TYPE_TICK);
}
};
5 changes: 5 additions & 0 deletions Storage/IValueStorage.h
Original file line number Diff line number Diff line change
@@ -72,6 +72,11 @@ class IValueStorage : public Dynamic {
DebugBreak();
return false;
}

/**
* Returns real array index for this given shift.
**/
virtual int GetRealIndex(int _shift) { return IsSeries() ? (Size() - 1 - _shift) : _shift; }
};

/**
9 changes: 9 additions & 0 deletions Storage/ValueStorage.h
Original file line number Diff line number Diff line change
@@ -181,6 +181,15 @@ class ValueStorage : public IValueStorage {
DebugBreak();
}

/**
* Inserts new value at the end of the buffer. If buffer works as As-Series,
* then new value will act as the one at index 0.
*/
virtual void Append(C _value) {
Alert(__FUNCSIG__, " does not implement Append()!");
DebugBreak();
}

/**
* Sets buffer drawing attributes. Currently does nothing.
*/
19 changes: 14 additions & 5 deletions Storage/ValueStorage.native.h
Original file line number Diff line number Diff line change
@@ -60,19 +60,28 @@ class NativeValueStorage : public ValueStorage<C> {
* Fetches value from a given shift. Takes into consideration as-series flag.
*/
C Fetch(int _shift) override {
if (_shift < 0 || _shift >= ArraySize(_values)) {
if (_shift < 0 || _shift >= Size()) {
return (C)EMPTY_VALUE;
// Print("Invalid buffer data index: ", _shift, ". Buffer size: ", ArraySize(_values));
// DebugBreak();
}

return _values[_shift];
int _index = GetRealIndex(_shift);

return _values[_index];
}

/**
* Stores value at a given shift. Takes into consideration as-series flag.
*/
void Store(int _shift, C _value) override { Array::ArrayStore(_values, _shift, _value, 4096); }
void Store(int _shift, C _value) override {
if (_shift < 0 || _shift >= Size()) {
Alert("Error: NativeValueStorage: Invalid buffer data index: ", _shift, ". Buffer size: ", Size());
DebugBreak();
}

int _index = GetRealIndex(_shift);

Array::ArrayStore(_values, _index, _value, 4096);
}

/**
* Returns number of values available to fetch (size of the values buffer).