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.006-dev-new #747

Open
wants to merge 134 commits into
base: v3.005-dev-new
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
134 commits
Select commit Hold shift + click to select a range
eb6a75e
Exchange: Expands test
kenorb Feb 19, 2022
680ced7
Account: Renames Account to AccountMt
kenorb Feb 19, 2022
2835438
Account/AccountMt: Fixes zero division
kenorb Feb 19, 2022
3b0e961
Removes SVG class
kenorb Feb 19, 2022
f4964bc
Removes BasicTrade class
kenorb Feb 19, 2022
64a7445
Removes Ticker class
kenorb Feb 19, 2022
b5ec498
Exchange: Uses AccountBase instead of AccountMt
kenorb Feb 22, 2022
eaf8ebb
Merge remote-tracking branch 'origin/dev-v2012-exchange' into dev-v20…
kenorb Feb 22, 2022
ae158f3
WIP. Getting rid of Chart as a base of IndicatorBase.
nseam Feb 24, 2022
22a81ff
Working IndicatorsTest. Let GHA to check other tests.
nseam Feb 25, 2022
924c93a
State of the art of getting rid of Chart as a base of IndicatorBase.
nseam Mar 4, 2022
7430f55
WIP. Getting rid of Chart as a base of IndicatorBase.
nseam Mar 9, 2022
ce45e58
WIP. Getting rid of Chart as a base of IndicatorBase.
nseam Mar 10, 2022
a97d43c
WIP. Getting rid of Chart as a base of IndicatorBase.
nseam Mar 17, 2022
aa6adf9
WIP. Need to think how to pass IndicatorTick or SymbolInfo into Trade…
nseam Mar 18, 2022
5ca81a2
WIP. Refactoring of Indicators' GetValue() data fetching (Built-in an…
nseam Mar 21, 2022
573c217
WIP. IndicatorsTest works locally. Not sure yet about indicators' res…
nseam Mar 22, 2022
c2e4154
WIP. Getting rid of Chart class. IndicatorCandle will take care of OH…
nseam Mar 24, 2022
d9557cd
WIP. Rethinking ideas.
nseam Mar 25, 2022
4719aca
WIP. Modifying OnCalculate() macros to use IndicatorCandle and Indica…
nseam Apr 5, 2022
6d037f7
WIP. Again modifying OnCalculate() macros to use IndicatorCandle and …
nseam Apr 6, 2022
d0bd92c
WIP. Probably half of work done. Need to get rid of TFs and Symbols f…
nseam Apr 7, 2022
75b0d72
WIP. IndicatorsTest now compiles and works partially. We now need to …
nseam Apr 8, 2022
39baebb
WIP. Closer to the end. Now we have problems with prices/volume retri…
nseam Apr 14, 2022
ffa40db
WIP. Struggling with OHLC mismatches.
nseam Apr 22, 2022
104cdbf
WIP. Issues with BufferCandle performance.
nseam Apr 22, 2022
f2cfd4c
WIP. Stack overflow in Indi_Bands.
nseam Apr 27, 2022
ad1570f
WIP. Fixed candle aggregation from MT platform. Now need to fix Indic…
nseam May 6, 2022
6ad5acd
State of the art before required on-indicator mode refactor.
nseam May 12, 2022
14e98ce
WIP. 2 step out of 3 in refactoring Chart/Candle/Tick indicators to b…
nseam May 12, 2022
07e09e9
WIP. Tried to fix IndicatorTick buffers.
nseam May 13, 2022
49d7edf
WIP. Making Strategy and Trade classes to work with IndicatorBase and…
nseam May 16, 2022
275c0c2
WIP. Somehow last entry of Tick indicator has missing prices.
nseam May 17, 2022
236a145
WIP. Need to find a way to make IndicatorTick to fetch data by index …
nseam May 18, 2022
cb04689
WIP. Partially working StrategyTest-RSI. There are still problems wit…
nseam May 20, 2022
29d50c3
WIP. Working IndicatorsTest in MT5, but not yet in MT4.
nseam May 31, 2022
61e8fb4
WIP. We now need to support PRICE_MEDIAN, PRICE_TYPICAL and PRICE_WEI…
nseam Jun 2, 2022
3e86b71
WIP. Trying to make Indi_DEMA to work on Indi_Price.
nseam Jun 3, 2022
228235b
WIP. Committed as is. Replacing generic GetDataSource() usages with G…
nseam Jun 7, 2022
37f45d6
WIP. GetSuitableDataSource() now need some testing. To do that, we ne…
nseam Jun 8, 2022
afd2685
WIP. Setting required data source types and modes for indicators.
nseam Jun 9, 2022
3c32929
WIP. Finished setting required data source types and modes for indica…
nseam Jun 10, 2022
28c6a80
WIP. Next attempt to run self-validating indicators. Need a way to ac…
nseam Jun 20, 2022
e1ea8ab
WIP. Challenge with indicators' requirements regarding their data sou…
nseam Jun 21, 2022
6b773c1
WIP. IndicatorsTest is almost ready. There is still Indi_DEMA on Indi…
nseam Jun 23, 2022
c1193bd
Refs #337 New week detection. Added check if it's the first day of th…
nseam Apr 22, 2022
92c58e2
WIP. Fixing test by test. Added Platform class' methods for adding in…
nseam Jun 27, 2022
aba07ba
WIP. Removed unnecessary files. Moved IndicatorTickReal into Indi_Tic…
nseam Jun 28, 2022
5dc3ec3
WIP. Fixing remaining tests. Some are still to be fixed.
nseam Jun 30, 2022
61831f3
Removes Stats class
kenorb Feb 19, 2022
54d0f24
WIP. Need to rewrite NormalizePrice/NormalizeSLTP/NormalizeSL methods…
nseam Jul 7, 2022
8a8d672
WIP. Next part of fixes. Still some Trade class fixes needed.
nseam Jul 8, 2022
4dd405d
WIP. 3DTest and BufferFXTTest left to fix.
nseam Jul 11, 2022
860fca1
WIP. All tests now compiles.
nseam Jul 11, 2022
66a905b
Getting rid of IndicatorData class.
nseam Jul 11, 2022
3acc79e
Fixed problem with default constructor for IndicatorDataEntryValue.
nseam Jul 11, 2022
7e6cf88
Removed `__debug__`
nseam Jul 12, 2022
6872c2c
Now platform will select Candle indicator in case where target accept…
nseam Jul 12, 2022
d808c38
Added newlines.
nseam Jul 12, 2022
a3f4f46
Got rid of IndicatorDataTest.
nseam Jul 12, 2022
2272f15
Fixing white-spaces.
nseam Jul 12, 2022
d5edc2b
Should fix OrderTest.
nseam Jul 19, 2022
a169700
Should fix major problems with tests.
nseam Jul 20, 2022
e85b816
Should fix IndicatorsTest.
nseam Jul 20, 2022
578bdae
Fixed Indi_Math. Got rid of TF in Indicator's constructors.
nseam Jul 20, 2022
24d4ffd
Changed array of pointers to IValueStorage into array of references. …
nseam Jul 20, 2022
5a7af99
Got rid of EventSetTimer() as it doesn't work in MT4 when running in …
nseam Jul 21, 2022
a420ecc
Should fix bug preventing Dict to overwrite slots if resize is prohib…
nseam Jul 29, 2022
3988624
TradeTest will now finish itself gracefully.
nseam Jul 29, 2022
77aa902
Just to force test run.
nseam Jul 29, 2022
790d0a4
ADXW indicator didn't have IsValidEntry() method.
nseam Jul 29, 2022
109b35e
Maybe better TickMt's history retriever. However, it also doesn't ret…
nseam Jul 30, 2022
0d78e48
Should fix ZigZag's and ZigZag's Color "array out of range" error. Al…
nseam Jul 30, 2022
e5d1eda
Added error handling to iTime(), iBars(), iBarShift() methods' calls.
nseam Jul 31, 2022
061c7b1
Indicator: Fixes timeframe assignment in class constructor
kenorb Jul 23, 2022
8cf1e13
Trade: Disables filling modes for MQL4
kenorb Jul 25, 2022
86afa7a
EA/Strategy/Trade: Adds AddTaskObject()
kenorb Jul 28, 2022
4882af3
Got rid of zero as invalid indicator value. Now (double)INT_MAX is an…
nseam Aug 1, 2022
0cd5ae3
EA/Strategy/Trade: AddTask: Fixes code syntax to avoid issues with in…
kenorb Jul 28, 2022
fa952c7
Merge remote-tracking branch 'origin/v3.002-dev-cleanup' into v3.002-dev
kenorb Aug 1, 2022
e48b921
Merge pull request #653 from nseam/dev-indi-no-chart4
kenorb Aug 1, 2022
7fb7a28
Indicator/IndicatorTf: Fixes issue with MQL4 error 4066 (ERR_HISTORY_…
kenorb Aug 3, 2022
c624758
GHA: Uses MT4 4.0.0.1359 to test indicators
kenorb Aug 3, 2022
49fe5a6
Indicator: Fixes issue with ::iTime not being rounded in MT4
kenorb Aug 3, 2022
7fb5268
GHA: Changes back BtDays to 4-8
kenorb Aug 3, 2022
280a0d4
Indicator: GetEntryAlter: Fixes issue with shift
kenorb Aug 4, 2022
aff3a2d
Indi_Ichimoku: Shift 2nd and 3rd buffer by senkou_span_shift bars [GH…
kenorb Aug 4, 2022
de63053
Indi_AppliedPrice: Fixes infinite loop when run on indicator
kenorb Aug 4, 2022
a7669c8
Indicators: Fixes potential issues with OnIndicator mode
kenorb Aug 4, 2022
a33519b
Merge tag 'v3.000' into dev-indi-no-chart4
kenorb Aug 5, 2022
29a8d5c
GHA: Test: Sets BtDays to 4-8 to avoid time limits
kenorb Aug 5, 2022
46c02c8
Indi_ZigZag: Fixes indicator path for MQL4
kenorb Aug 5, 2022
65e28a0
Trade: Reenables CalcLotSize()
kenorb Aug 5, 2022
25e67e7
IndicatorsTest: Reenables indicators for testing
kenorb Aug 5, 2022
abc5f1b
IndicatorsTest: Reenables more indicators for testing
kenorb Aug 5, 2022
ec62fc0
Strategy/Trade: Reenables previously disabled code
kenorb Aug 5, 2022
9b72e7a
GHA: Sets BtYears to 2021
kenorb Aug 8, 2022
fdb1d34
IndicatorsTest: Disables Indi_Price for MQL4 due to failure
kenorb Aug 8, 2022
c27b9ec
Strategy/Trade: Reenables previously disabled code
kenorb Aug 5, 2022
434477e
Merge tag 'v3.001' into dev-indi-no-chart4
kenorb Aug 8, 2022
866e3eb
IndicatorData: IndicatorDataEntryValue: Adds support for datetime type
kenorb Aug 12, 2022
c9be418
Merge remote-tracking branch 'origin/dev-indi-no-chart4' into v3.003-dev
kenorb Aug 12, 2022
1095289
IndicatorData: IndicatorDataEntryValue: Adds support for datetime type
kenorb Aug 12, 2022
e92f7d3
Merge remote-tracking branch 'origin/dev-indi-no-chart4' into v3.003-dev
kenorb Aug 13, 2022
0ef50df
Fixes pointer syntax for C++
kenorb Aug 17, 2022
ed64915
Order: Adds missing order filling (fixes GH-664)
kenorb May 21, 2023
b7a4607
Trade: Improves performance issues
kenorb May 21, 2023
6ccd108
Merge tag 'v3.000.1' into 'v3.001'
kenorb May 22, 2023
d0e1a19
StrategyAdd: Pass EA ptr to Init()
kenorb May 28, 2023
4ac509b
Generic ArraySize() now takes reference to constant.
nseam Jun 16, 2023
c254a48
Disables TradeSignalManager.test.cpp test due to errors
kenorb Jun 16, 2023
3687d5f
Merge remote-tracking branch 'origin/v3.001-dev' into v3.002-dev
kenorb Jun 17, 2023
aa368d3
Cherry-pick: Added SerializeStub() method to Chart class. Added more …
nseam Jan 12, 2022
bbe90f0
Adds close retry counter (GH-703)
kenorb Aug 4, 2023
b55af2e
Workaround for closing order conditions after orders are loaded from …
kenorb Aug 12, 2023
27053b8
Order:Trade: Improves error handling
kenorb Aug 12, 2023
df24a71
Order: Improves error handling
kenorb Aug 12, 2023
d7908ac
Fix for orders are opened instead of being closed (GH-707)
kenorb Aug 12, 2023
f99f420
Final fix for orders are opened instead of being closed for both MT4 …
kenorb Aug 12, 2023
a723dd7
Merge pull request #708 from EA31337/dev-v2013
kenorb Aug 12, 2023
1fc4f06
Merge branch 'v3.001-dev-new' into v3.001-dev
kenorb Apr 23, 2024
251e4a2
GHA: Test: Includes compile workflow
kenorb Apr 23, 2024
df05be8
Fixes compilation errors on build 4275
kenorb Apr 23, 2024
2881654
Fixing CompileTest
nseam Jun 15, 2023
d8f7dcf
GHA: Compile: Ignores compiling platform files
kenorb Apr 23, 2024
53b8c0c
GHA: Compile: Fixes uploading artifacts after compilation
kenorb Apr 24, 2024
52c8fcc
Merge branch 'v3.001-dev' into v3.002-dev
kenorb Apr 24, 2024
9b55d28
Merge branch 'v3.001-dev-new' into v3.002-dev
kenorb Apr 24, 2024
df47294
Fixes Std.h(54,9) : warning 30: macro redefinition
kenorb Apr 24, 2024
cfe9343
Merge tag 'v2.013.1' into v3.006-dev-new
kenorb Apr 27, 2024
1beff41
Merge branch 'v3.001-dev' into v3.006-dev-new
kenorb Apr 27, 2024
24eb87f
Merge branch 'v3.002-dev' into v3.006-dev-new
kenorb Apr 27, 2024
f28c6f7
Merge branch 'v3.005-dev-new' into v3.006-dev-new
kenorb Apr 27, 2024
5b9c843
Merge remote-tracking branch 'origin/v3.003-dev' into v3.006-dev-new
kenorb Apr 28, 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
2 changes: 2 additions & 0 deletions .github/workflows/compile-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
jobs:

FileList:
if: ${{ false }} # @fixme
outputs:
filelist: ${{ steps.get-files.outputs.filelist }}
runs-on: ubuntu-latest
Expand All @@ -29,6 +30,7 @@ jobs:
run: echo ${{ steps.get-files.outputs.filelist }}

Compile:
if: ${{ false }} # @fixme
runs-on: ubuntu-latest
needs: [FileList]
strategy:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-buffer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
uses: fx31337/mql-tester-action@master
with:
Script: ${{ matrix.test }}
RunOnError: show_logs 200
timeout-minutes: 10

cleanup:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test-indicator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ jobs:
with:
BtDays: 4-8
BtMonths: 1
BtYears: 2020
BtYears: 2021
MtVersion: 4.0.0.1359
RunOnError: show_logs 200
TestExpert: ${{ matrix.test }}
timeout-minutes: 10

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test-indicators-special.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ jobs:
with:
BtDays: 4-8
BtMonths: 1
BtYears: 2020
BtYears: 2021
MtVersion: 4.0.0.1359
RunOnError: show_logs 200
TestExpert: ${{ matrix.test }}
timeout-minutes: 10

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test-indicators-tick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ jobs:
with:
BtDays: 4-8
BtMonths: 1
BtYears: 2020
BtYears: 2021
MtVersion: 4.0.0.1359
RunOnError: show_logs 200
TestExpert: ${{ matrix.test }}
timeout-minutes: 10

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/test-indicators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- Indi_CCI.test
- Indi_CHO.test
- Indi_CHV.test
- Indi_ColorBars.test
# - Indi_ColorBars.test # @fixme
- Indi_ColorCandlesDaily.test
- Indi_ColorLine.test
- Indi_CustomMovingAverage.test
Expand Down Expand Up @@ -110,7 +110,9 @@ jobs:
with:
BtDays: 4-8
BtMonths: 1
BtYears: 2020
BtYears: 2021
MtVersion: 4.0.0.1359
RunOnError: show_logs 200
TestExpert: ${{ matrix.test }}
timeout-minutes: 10

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ jobs:
uses: fx31337/mql-tester-action@master
with:
Script: ${{ matrix.test }}
RunOnError: show_logs 200
1 change: 1 addition & 0 deletions .github/workflows/test-trade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
uses: fx31337/mql-tester-action@master
with:
Script: ${{ matrix.test }}
RunOnError: show_logs 200
timeout-minutes: 10

cleanup:
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ jobs:
strategy:
matrix:
test:
- AccountTest
- BufferStructTest
- BufferTest
- ChartTest
- CompileIndicatorsTest
- DatabaseTest
# - DrawIndicatorTest
- EATest
- IndicatorDataTest
- IndicatorTest
- IndicatorsTest
- MailTest
Expand All @@ -69,11 +67,12 @@ jobs:
- name: Run ${{ matrix.test }}
uses: fx31337/mql-tester-action@master
with:
BtDays: 1-8
BtDays: 4-12
BtMonths: 1
BtYears: 2020
BtYears: 2021
Version: 4
TestExpert: ${{ matrix.test }}
RunOnError: show_logs 200
timeout-minutes: 10

Scripts-MQL4:
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"files.associations": {
"indicatorcandle.h": "c"
"indicatorcandle.h": "c",
"*.mqh": "c"
}
}
17 changes: 8 additions & 9 deletions 3D/Chart3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/

#include "../Bar.struct.h"
#include "../IndicatorData.mqh"
#include "../Indicators/Indi_MA.mqh"
#include "../Instances.h"
#include "../Refs.mqh"
Expand Down Expand Up @@ -72,9 +73,6 @@ class Chart3D : public Dynamic {
// References to chart type renderers.
Ref<Chart3DType> renderers[3];

// OHLC prices fetcher callback.
Chart3DPriceFetcher price_fetcher;

// Whether graphics were initialized.
bool initialized;

Expand All @@ -85,17 +83,18 @@ class Chart3D : public Dynamic {
Chart3DType* current_renderer;

Instances<Chart3D> instances;
Ref<IndicatorData> source;

public:
/**
* Constructor.
*/
Chart3D(Chart3DPriceFetcher _price_fetcher, ENUM_CHART3D_TYPE _type = CHART3D_TYPE_CANDLES) : instances(&this) {
price_fetcher = _price_fetcher;
Chart3D(IndicatorData* _source, ENUM_CHART3D_TYPE _type = CHART3D_TYPE_CANDLES) : instances(&this) {
type = _type;
offset.x = offset.y = 0.0f;
offset.z = 25.0f;
initialized = false;
source = _source;
#ifdef __MQL5__
Interface::AddListener(chart3d_interface_listener, &this);
#endif
Expand Down Expand Up @@ -172,8 +171,8 @@ class Chart3D : public Dynamic {
float GetMinBarsPrice() {
return (float)ChartStatic::iLow(
Symbol(), PERIOD_CURRENT,
ChartStatic::iLowest(Symbol(), PERIOD_CURRENT, MODE_LOW, GetBarsVisibleShiftStart() - GetBarsVisibleShiftEnd(),
GetBarsVisibleShiftEnd()));
source REF_DEREF GetLowest(MODE_LOW, GetBarsVisibleShiftStart() - GetBarsVisibleShiftEnd(),
GetBarsVisibleShiftEnd()));
}

/**
Expand All @@ -182,8 +181,8 @@ class Chart3D : public Dynamic {
float GetMaxBarsPrice() {
return (float)ChartStatic::iHigh(
Symbol(), PERIOD_CURRENT,
ChartStatic::iHighest(Symbol(), PERIOD_CURRENT, MODE_HIGH,
GetBarsVisibleShiftStart() - GetBarsVisibleShiftEnd(), GetBarsVisibleShiftEnd()));
source REF_DEREF GetHighest(MODE_HIGH, GetBarsVisibleShiftStart() - GetBarsVisibleShiftEnd(),
GetBarsVisibleShiftEnd()));
}

/**
Expand Down
8 changes: 4 additions & 4 deletions 3D/Chart3DCandles.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ class Chart3DCandles : public Chart3DType {
for (int _shift = chart3d.GetBarsVisibleShiftStart(); _shift != chart3d.GetBarsVisibleShiftEnd(); --_shift) {
BarOHLC _ohlc = chart3d.GetPrice(PERIOD_CURRENT, _shift);

float _height = chart3d.GetPriceScale(_ohlc.GetMaxOC()) - chart3d.GetPriceScale(_ohlc.GetMinOC());
float _height = chart3d.GetPriceScale((float)_ohlc.GetMaxOC()) - chart3d.GetPriceScale((float)_ohlc.GetMinOC());
float higher = _ohlc.IsBear();

cube1.Ptr().GetTSR().translation.x = chart3d.GetBarPositionX(_shift);
cube1.Ptr().GetTSR().translation.y = chart3d.GetPriceScale(_ohlc.GetMinOC()) + _height / 2;
cube1.Ptr().GetTSR().translation.y = chart3d.GetPriceScale((float)_ohlc.GetMinOC()) + _height / 2;
cube1.Ptr().GetTSR().scale.y = _height;

// Print(cube1.Ptr().GetTSR().translation.y);
Expand All @@ -72,8 +72,8 @@ class Chart3DCandles : public Chart3DType {
_device.Render(cube1.Ptr());

cube2.Ptr().GetTSR().translation.x = chart3d.GetBarPositionX(_shift);
float _line_height = chart3d.GetPriceScale(_ohlc.GetHigh()) - chart3d.GetPriceScale(_ohlc.GetLow());
cube2.Ptr().GetTSR().translation.y = chart3d.GetPriceScale(_ohlc.GetLow()) + _line_height / 2;
float _line_height = chart3d.GetPriceScale((float)_ohlc.GetHigh()) - chart3d.GetPriceScale((float)_ohlc.GetLow());
cube2.Ptr().GetTSR().translation.y = chart3d.GetPriceScale((float)_ohlc.GetLow()) + _line_height / 2;
cube2.Ptr().GetTSR().scale.y = _line_height;
cube2.Ptr().GetMaterial().SetColor(higher ? 0x22FF11 : 0xFF1122);
_device.Render(cube2.Ptr());
Expand Down
3 changes: 2 additions & 1 deletion Account/AccountBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@

// Includes.
//#include "../Serializer.mqh"
#include "../Refs.mqh"
#include "AccountBase.struct.h"

/**
* Class to provide functions that return parameters of the current account.
*/
class AccountBase {
class AccountBase : public Dynamic {
protected:
/**
* Init code (called on constructor).
Expand Down
40 changes: 0 additions & 40 deletions Account/AccountMt.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,46 +317,6 @@ class AccountMt {
*/
static string GetType() { return AccountMt::GetServerName() != "" ? (IsDemo() ? "Demo" : "Live") : "Off-line"; }

/* Setters */

double UpdateStats(ENUM_ACC_STAT_VALUE _type, double _value) {
static datetime _last_check = TimeCurrent();
bool _stats_rotate = false;
int _tindex = (int)_type;
for (unsigned int _pindex = 0; _pindex < FINAL_ENUM_ACC_STAT_PERIOD; _pindex++) {
acc_stats[_tindex][_pindex][(int)ACC_VALUE_MIN][(int)ACC_VALUE_CURR] =
fmin(acc_stats[_tindex][_pindex][(int)ACC_VALUE_MIN][(int)ACC_VALUE_CURR], _value);
acc_stats[_tindex][_pindex][(int)ACC_VALUE_MAX][(int)ACC_VALUE_CURR] =
fmin(acc_stats[_tindex][_pindex][(int)ACC_VALUE_MAX][(int)ACC_VALUE_CURR], _value);
acc_stats[_tindex][_pindex][(int)ACC_VALUE_AVG][(int)ACC_VALUE_CURR] =
(acc_stats[_tindex][_pindex][(int)ACC_VALUE_AVG][(int)ACC_VALUE_CURR] + _value) / 2;
switch (_pindex) {
case ACC_DAILY:
_stats_rotate = _last_check < ChartStatic::iTime(_Symbol, PERIOD_D1);
break;
case ACC_WEEKLY:
_stats_rotate = _last_check < ChartStatic::iTime(_Symbol, PERIOD_W1);
break;
case ACC_MONTHLY:
_stats_rotate = _last_check < ChartStatic::iTime(_Symbol, PERIOD_MN1);
break;
}
if (_stats_rotate) {
acc_stats[_tindex][_pindex][(int)ACC_VALUE_MIN][(int)ACC_VALUE_PREV] =
acc_stats[_tindex][_pindex][(int)ACC_VALUE_MIN][(int)ACC_VALUE_CURR];
acc_stats[_tindex][_pindex][(int)ACC_VALUE_MAX][(int)ACC_VALUE_PREV] =
acc_stats[_tindex][_pindex][(int)ACC_VALUE_MAX][(int)ACC_VALUE_CURR];
acc_stats[_tindex][_pindex][(int)ACC_VALUE_AVG][(int)ACC_VALUE_PREV] =
acc_stats[_tindex][_pindex][(int)ACC_VALUE_AVG][(int)ACC_VALUE_CURR];
acc_stats[_tindex][_pindex][(int)ACC_VALUE_MIN][(int)ACC_VALUE_CURR] = _value;
acc_stats[_tindex][_pindex][(int)ACC_VALUE_MAX][(int)ACC_VALUE_CURR] = _value;
acc_stats[_tindex][_pindex][(int)ACC_VALUE_AVG][(int)ACC_VALUE_CURR] = _value;
_last_check = TimeCurrent();
}
}
return _value;
}

/* Class getters */

/**
Expand Down
3 changes: 3 additions & 0 deletions Array.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,9 @@ template <typename X>
static void ArrayStore(ARRAY_REF(X, array), int _idx, X value, int reserve_size = 0) {
if (_idx >= ArraySize(array)) {
ArrayResize(array, MathMax(_idx + 1, ArraySize(array)), reserve_size);
} else if (_idx < 0) {
Print("_idx cannot be negative! " + IntegerToString(_idx) + " passed.");
DebugBreak();
}

array[_idx] = value;
Expand Down
Loading
Loading