-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes BarsCalculated() method and historic values retrieval (prices, …
…volumes, spread). Also boost up Dicts' performance.
- Loading branch information
Showing
18 changed files
with
241 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//+------------------------------------------------------------------+ | ||
//| 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 | ||
* Includes Dicts's enums and defines. | ||
*/ | ||
|
||
#ifndef __MQL__ | ||
// Allows the preprocessor to include a header file when it is needed. | ||
#pragma once | ||
#endif | ||
|
||
#define DICT_GROW_UP_PERCENT_DEFAULT 25 | ||
#define DICT_PERFORMANCE_PROBLEM_AVG_CONFLICTS 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
//+------------------------------------------------------------------+ | ||
//| 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 | ||
* DictSlotsRef struct. | ||
*/ | ||
|
||
#ifndef __MQL__ | ||
// Allows the preprocessor to include a header file when it is needed. | ||
#pragma once | ||
#endif | ||
|
||
// Includes. | ||
#include "Dict.enum.h" | ||
|
||
template <typename K, typename V> | ||
class DictSlot; | ||
|
||
template <typename K, typename V> | ||
struct DictSlotsRef { | ||
DictSlot<K, V> DictSlots[]; | ||
|
||
// Incremental index for dict operating in list mode. | ||
int _list_index; | ||
|
||
int _num_used; | ||
|
||
int _num_conflicts; | ||
|
||
float _avg_conflicts; | ||
|
||
DictSlotsRef() { | ||
_list_index = 0; | ||
_num_used = 0; | ||
_num_conflicts = 0; | ||
_avg_conflicts = 0; | ||
} | ||
|
||
/** | ||
* Adds given number of conflicts for an insert action, so we can store average number of conflicts. | ||
*/ | ||
void AddConflicts(int num) { | ||
if (num != 0) { | ||
_avg_conflicts += float(num) / ++_num_conflicts; | ||
} | ||
} | ||
|
||
/** | ||
* Checks whethere there is no performance problems with slots. | ||
*/ | ||
bool IsPerformant() { return _avg_conflicts < DICT_PERFORMANCE_PROBLEM_AVG_CONFLICTS; } | ||
}; |
Oops, something went wrong.