Skip to content

Commit 6791784

Browse files
committed
revert commit dbd86ea: "update input validation"
1 parent 63700ce commit 6791784

3 files changed

Lines changed: 75 additions & 75 deletions

File tree

mql40/libraries/rsfHistory1.mq4

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -429,35 +429,35 @@ bool HistorySet1.Close(int hSet) {
429429

430430

431431
/**
432-
* Add a single tick to a symbol's HistorySet. The tick is stored as Close price of the last bar.
432+
* Fügt dem HistorySet eines Symbols einen Tick hinzu. Der Tick wird als letzter Tick (Close) der entsprechenden Bar gespeichert.
433+
*
434+
* @param int hSet - Set-Handle des Symbols
435+
* @param datetime time - Zeitpunkt des Ticks
436+
* @param double value - Datenwert
437+
* @param int flags - zusätzliche, das Schreiben steuernde Flags (default: keine)
438+
* • HST_BUFFER_TICKS: buffert aufeinanderfolgende Ticks und schreibt die Daten erst beim jeweils nächsten
439+
* BarOpen-Event
440+
* • HST_FILL_GAPS: füllt entstehende Gaps mit dem letzten Schlußkurs vor dem Gap
433441
*
434-
* @param int hSet - handle of the HistorySet
435-
* @param datetime time - tick time
436-
* @param double value - tick value
437-
* @param int flags [optional] - additional flags that control writing (default: none)
438-
* HST_BUFFER_TICKS: Buffer ticks and flush data only at the next BarOpen event for the respective file.
439-
* HST_FILL_GAPS: Fills any gaps with the last price before the gap.
440442
* @return bool - success status
441443
*/
442444
bool HistorySet1.AddTick(int hSet, datetime time, double value, int flags = NULL) {
443-
// validation
445+
// Validierung
444446
if (hSet <= 0) return(!catch("HistorySet1.AddTick(1) invalid parameter hSet: "+ hSet, ERR_INVALID_PARAMETER));
445447
if (hSet != hs.hSet.lastValid) {
446448
if (hSet >= ArraySize(hs.hSet)) return(!catch("HistorySet1.AddTick(2) invalid parameter hSet: "+ hSet, ERR_INVALID_PARAMETER));
447-
if (hs.hSet[hSet] == 0) return(!catch("HistorySet1.AddTick(3) invalid parameter hSet: "+ hSet +" (unknown handle, symbol="+ hs.symbol[hSet] +")", ERR_INVALID_PARAMETER));
448-
if (hs.hSet[hSet] < 0) return(!catch("HistorySet1.AddTick(4) invalid parameter hSet: "+ hSet +" (closed handle, symbol="+ hs.symbol[hSet] +")", ERR_INVALID_PARAMETER));
449+
if (hs.hSet[hSet] == 0) return(!catch("HistorySet1.AddTick(3) invalid parameter hSet: "+ hSet +" (unknown handle, symbol="+ DoubleQuoteStr(hs.symbol[hSet]) +")", ERR_INVALID_PARAMETER));
450+
if (hs.hSet[hSet] < 0) return(!catch("HistorySet1.AddTick(4) invalid parameter hSet: "+ hSet +" (closed handle, symbol="+ DoubleQuoteStr(hs.symbol[hSet]) +")", ERR_INVALID_PARAMETER));
449451
hs.hSet.lastValid = hSet;
450452
}
451-
if (time <= 0) return(!catch("HistorySet1.AddTick(5) invalid parameter time: "+ time +" (symbol="+ hs.symbol[hSet] +")", ERR_INVALID_PARAMETER));
452-
if (value <= 0) return(!catch("HistorySet1.AddTick(6) invalid parameter value: "+ NumberToStr(value, ".1+") +" (must be positive, symbol="+ hs.symbol[hSet] +")", ERR_INVALID_PARAMETER));
453-
if (value >= EMPTY_VALUE) return(!catch("HistorySet1.AddTick(7) invalid parameter value: "+ NumberToStr(value, ".1+") +" (too large, symbol="+ hs.symbol[hSet] +")", ERR_INVALID_PARAMETER));
453+
if (time <= 0) return(!catch("HistorySet1.AddTick(5) invalid parameter time: "+ time +" (symbol="+ DoubleQuoteStr(hs.symbol[hSet]) +")", ERR_INVALID_PARAMETER));
454454

455-
int hFile, sizeOfPeriods = ArraySize(periods);
455+
// Dateihandles holen und jeweils Tick hinzufügen
456+
int hFile, sizeOfPeriods=ArraySize(periods);
456457

457-
// get file handles and add tick
458458
for (int i=0; i < sizeOfPeriods; i++) {
459459
hFile = hs.hFile[hSet][i];
460-
if (!hFile) { // open files that haven't been opened yet
460+
if (!hFile) { // noch ungeöffnete Dateien öffnen
461461
hFile = HistoryFile1.Open(hs.symbol[hSet], periods[i], hs.description[hSet], hs.digits[hSet], hs.format[hSet], FILE_READ|FILE_WRITE, hs.directory[hSet]);
462462
if (!hFile) return(false);
463463
hs.hFile[hSet][i] = hFile;
@@ -1317,14 +1317,16 @@ bool HistoryFile1.MoveBars(int hFile, int fromOffset, int destOffset) {
13171317

13181318

13191319
/**
1320-
* Add a single tick to a history file. The tick must belong to the youngest bar in the file and becomes the bar's close price.
1320+
* Fügt einer Historydatei einen weiteren Tick hinzu. Der Tick muß zur jüngsten Bar der Datei gehören und wird als Close-Preis gespeichert.
1321+
*
1322+
* @param int hFile - Handle der Historydatei
1323+
* @param datetime time - Zeitpunkt des Ticks
1324+
* @param double value - Datenwert
1325+
* @param int flags - zusätzliche, das Schreiben steuernde Flags (default: keine)
1326+
* • HST_BUFFER_TICKS: puffert aufeinanderfolgende Ticks und schreibt die Daten erst beim jeweils nächsten
1327+
* BarOpen-Event
1328+
* • HST_FILL_GAPS: füllt entstehende Gaps mit dem letzten Schlußkurs vor dem Gap
13211329
*
1322-
* @param int hFile - handle of the history file
1323-
* @param datetime time - tick time
1324-
* @param double value - tick value
1325-
* @param int flags [optional] - additional flags that control writing (default: none)
1326-
* HST_BUFFER_TICKS: Buffer ticks and flush data only at the next BarOpen event for the file.
1327-
* HST_FILL_GAPS: Fills any gaps with the last price before the gap.
13281330
* @return bool - success status
13291331
*/
13301332
bool HistoryFile1.AddTick(int hFile, datetime time, double value, int flags = NULL) {
@@ -1337,8 +1339,6 @@ bool HistoryFile1.AddTick(int hFile, datetime time, double value, int flags = NU
13371339
}
13381340
if (time <= 0) return(!catch("HistoryFile1.AddTick(5) invalid parameter time: "+ time +" ("+ hf.symbol[hFile] +","+ PeriodDescription(hf.period[hFile]) +")", ERR_INVALID_PARAMETER));
13391341
if (time < hf.total.to.openTime[hFile]) return(!catch("HistoryFile1.AddTick(6) cannot add tick to a closed bar: tickTime="+ TimeToStr(time, TIME_FULL) +", last bar.time="+ TimeToStr(hf.total.to.openTime[hFile], TIME_FULL) +" ("+ hf.symbol[hFile] +","+ PeriodDescription(hf.period[hFile]) +")", ERR_INVALID_PARAMETER));
1340-
if (value <= 0) return(!catch("HistoryFile1.AddTick(7) invalid parameter value: "+ NumberToStr(value, ".1+") +" (must be positive, symbol="+ hf.symbol[hFile] +","+ PeriodDescription(hf.period[hFile]) +")", ERR_INVALID_PARAMETER));
1341-
if (value >= EMPTY_VALUE) return(!catch("HistoryFile1.AddTick(8) invalid parameter value: "+ NumberToStr(value, ".1+") +" (too large, symbol="+ hf.symbol[hFile] +","+ PeriodDescription(hf.period[hFile]) +")", ERR_INVALID_PARAMETER));
13421342

13431343
double bar[6];
13441344
bool barExists[1];

mql40/libraries/rsfHistory2.mq4

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -429,35 +429,35 @@ bool HistorySet2.Close(int hSet) {
429429

430430

431431
/**
432-
* Add a single tick to a symbol's HistorySet. The tick is stored as Close price of the last bar.
432+
* Fügt dem HistorySet eines Symbols einen Tick hinzu. Der Tick wird als letzter Tick (Close) der entsprechenden Bar gespeichert.
433+
*
434+
* @param int hSet - Set-Handle des Symbols
435+
* @param datetime time - Zeitpunkt des Ticks
436+
* @param double value - Datenwert
437+
* @param int flags - zusätzliche, das Schreiben steuernde Flags (default: keine)
438+
* • HST_BUFFER_TICKS: buffert aufeinanderfolgende Ticks und schreibt die Daten erst beim jeweils nächsten
439+
* BarOpen-Event
440+
* • HST_FILL_GAPS: füllt entstehende Gaps mit dem letzten Schlußkurs vor dem Gap
433441
*
434-
* @param int hSet - handle of the HistorySet
435-
* @param datetime time - tick time
436-
* @param double value - tick value
437-
* @param int flags [optional] - additional flags that control writing (default: none)
438-
* HST_BUFFER_TICKS: Buffer ticks and flush data only at the next BarOpen event for the respective file.
439-
* HST_FILL_GAPS: Fills any gaps with the last price before the gap.
440442
* @return bool - success status
441443
*/
442444
bool HistorySet2.AddTick(int hSet, datetime time, double value, int flags = NULL) {
443-
// validation
445+
// Validierung
444446
if (hSet <= 0) return(!catch("HistorySet2.AddTick(1) invalid parameter hSet: "+ hSet, ERR_INVALID_PARAMETER));
445447
if (hSet != hs.hSet.lastValid) {
446448
if (hSet >= ArraySize(hs.hSet)) return(!catch("HistorySet2.AddTick(2) invalid parameter hSet: "+ hSet, ERR_INVALID_PARAMETER));
447-
if (hs.hSet[hSet] == 0) return(!catch("HistorySet2.AddTick(3) invalid parameter hSet: "+ hSet +" (unknown handle, symbol="+ hs.symbol[hSet] +")", ERR_INVALID_PARAMETER));
448-
if (hs.hSet[hSet] < 0) return(!catch("HistorySet2.AddTick(4) invalid parameter hSet: "+ hSet +" (closed handle, symbol="+ hs.symbol[hSet] +")", ERR_INVALID_PARAMETER));
449+
if (hs.hSet[hSet] == 0) return(!catch("HistorySet2.AddTick(3) invalid parameter hSet: "+ hSet +" (unknown handle, symbol="+ DoubleQuoteStr(hs.symbol[hSet]) +")", ERR_INVALID_PARAMETER));
450+
if (hs.hSet[hSet] < 0) return(!catch("HistorySet2.AddTick(4) invalid parameter hSet: "+ hSet +" (closed handle, symbol="+ DoubleQuoteStr(hs.symbol[hSet]) +")", ERR_INVALID_PARAMETER));
449451
hs.hSet.lastValid = hSet;
450452
}
451-
if (time <= 0) return(!catch("HistorySet2.AddTick(5) invalid parameter time: "+ time +" (symbol="+ hs.symbol[hSet] +")", ERR_INVALID_PARAMETER));
452-
if (value <= 0) return(!catch("HistorySet2.AddTick(6) invalid parameter value: "+ NumberToStr(value, ".1+") +" (must be positive, symbol="+ hs.symbol[hSet] +")", ERR_INVALID_PARAMETER));
453-
if (value >= EMPTY_VALUE) return(!catch("HistorySet2.AddTick(7) invalid parameter value: "+ NumberToStr(value, ".1+") +" (too large, symbol="+ hs.symbol[hSet] +")", ERR_INVALID_PARAMETER));
453+
if (time <= 0) return(!catch("HistorySet2.AddTick(5) invalid parameter time: "+ time +" (symbol="+ DoubleQuoteStr(hs.symbol[hSet]) +")", ERR_INVALID_PARAMETER));
454454

455-
int hFile, sizeOfPeriods = ArraySize(periods);
455+
// Dateihandles holen und jeweils Tick hinzufügen
456+
int hFile, sizeOfPeriods=ArraySize(periods);
456457

457-
// get file handles and add tick
458458
for (int i=0; i < sizeOfPeriods; i++) {
459459
hFile = hs.hFile[hSet][i];
460-
if (!hFile) { // open files that haven't been opened yet
460+
if (!hFile) { // noch ungeöffnete Dateien öffnen
461461
hFile = HistoryFile2.Open(hs.symbol[hSet], periods[i], hs.description[hSet], hs.digits[hSet], hs.format[hSet], FILE_READ|FILE_WRITE, hs.directory[hSet]);
462462
if (!hFile) return(false);
463463
hs.hFile[hSet][i] = hFile;
@@ -1317,14 +1317,16 @@ bool HistoryFile2.MoveBars(int hFile, int fromOffset, int destOffset) {
13171317

13181318

13191319
/**
1320-
* Add a single tick to a history file. The tick must belong to the youngest bar in the file and becomes the bar's close price.
1320+
* Fügt einer Historydatei einen weiteren Tick hinzu. Der Tick muß zur jüngsten Bar der Datei gehören und wird als Close-Preis gespeichert.
1321+
*
1322+
* @param int hFile - Handle der Historydatei
1323+
* @param datetime time - Zeitpunkt des Ticks
1324+
* @param double value - Datenwert
1325+
* @param int flags - zusätzliche, das Schreiben steuernde Flags (default: keine)
1326+
* • HST_BUFFER_TICKS: puffert aufeinanderfolgende Ticks und schreibt die Daten erst beim jeweils nächsten
1327+
* BarOpen-Event
1328+
* • HST_FILL_GAPS: füllt entstehende Gaps mit dem letzten Schlußkurs vor dem Gap
13211329
*
1322-
* @param int hFile - handle of the history file
1323-
* @param datetime time - tick time
1324-
* @param double value - tick value
1325-
* @param int flags [optional] - additional flags that control writing (default: none)
1326-
* HST_BUFFER_TICKS: Buffer ticks and flush data only at the next BarOpen event for the file.
1327-
* HST_FILL_GAPS: Fills any gaps with the last price before the gap.
13281330
* @return bool - success status
13291331
*/
13301332
bool HistoryFile2.AddTick(int hFile, datetime time, double value, int flags = NULL) {
@@ -1337,8 +1339,6 @@ bool HistoryFile2.AddTick(int hFile, datetime time, double value, int flags = NU
13371339
}
13381340
if (time <= 0) return(!catch("HistoryFile2.AddTick(5) invalid parameter time: "+ time +" ("+ hf.symbol[hFile] +","+ PeriodDescription(hf.period[hFile]) +")", ERR_INVALID_PARAMETER));
13391341
if (time < hf.total.to.openTime[hFile]) return(!catch("HistoryFile2.AddTick(6) cannot add tick to a closed bar: tickTime="+ TimeToStr(time, TIME_FULL) +", last bar.time="+ TimeToStr(hf.total.to.openTime[hFile], TIME_FULL) +" ("+ hf.symbol[hFile] +","+ PeriodDescription(hf.period[hFile]) +")", ERR_INVALID_PARAMETER));
1340-
if (value <= 0) return(!catch("HistoryFile2.AddTick(7) invalid parameter value: "+ NumberToStr(value, ".1+") +" (must be positive, symbol="+ hf.symbol[hFile] +","+ PeriodDescription(hf.period[hFile]) +")", ERR_INVALID_PARAMETER));
1341-
if (value >= EMPTY_VALUE) return(!catch("HistoryFile2.AddTick(8) invalid parameter value: "+ NumberToStr(value, ".1+") +" (too large, symbol="+ hf.symbol[hFile] +","+ PeriodDescription(hf.period[hFile]) +")", ERR_INVALID_PARAMETER));
13421342

13431343
double bar[6];
13441344
bool barExists[1];

0 commit comments

Comments
 (0)