Incorrect OHLC Data When Gathering Data From MT4 Strategy Builder

bmkinyua

Trader
Dec 26, 2018
24
1
19
37
I have 2 EAs that I intend to use to gather custom data by running the EA in MT4 strategy builder and a CSV file is dropped containing the data. the file is working fine except for saving the OHLC data. It is saving the same price all through OHLC per one timestamp. See below:

timeopenhighlowcloseatrccimacdrsistochwpr
1/4/1999 0:00​
1.1801​
1.1801​
1.1801​
1.1801​
0.01175​
44.63768​
0.002918​
53.89172​
55.36649​
-32.4219​
1/5/1999 0:00​
1.1815​
1.1815​
1.1815​
1.1815​
0.011264​
42.66631​
0.003031​
55.10526​
34.04255​
-31.2115​
1/6/1999 0:00​
1.1761​
1.1761​
1.1761​
1.1761​
0.01075​
-16.7771​
0.002355​
50.26119​
13.56707​
-51.2438​
1/7/1999 0:00​
1.1623​
1.1623​
1.1623​
1.1623​
0.011279​
-135.825​
0.000225​
40.57499​
14.68254​
-83.0918​
1/8/1999 0:00​
1.1713​
1.1713​
1.1713​
1.1713​
0.011114​
-58.9161​
0.000358​
47.53685​
35.36364​
-61.3527​
1/11/1999 0:00​
1.1575​
1.1575​
1.1575​
1.1575​
0.01135​
-140.599​
-0.00166​
38.43279​
25.09921​
-90.3226​
1/12/1999 0:00​
1.1504​
1.1504​
1.1504​
1.1504​
0.011236​
-148.168​
-0.00341​
34.77543​
8.826584​
-96.4583​

I have attached the codes... kindly assist identify and rectify the issue(s).
 

Attachments

  • gatherData.mq4
    4.8 KB · Views: 3
  • gatherData weekly monthly.mq4
    4.4 KB · Views: 2

Enivid

Administrator
Staff member
Nov 30, 2008
18,607
1,366
144
Odesa
www.earnforex.com
I have 2 EAs that I intend to use to gather custom data by running the EA in MT4 strategy builder and a CSV file is dropped containing the data. the file is working fine except for saving the OHLC data. It is saving the same price all through OHLC per one timestamp. See below:

timeopenhighlowcloseatrccimacdrsistochwpr
1/4/1999 0:00​
1.1801​
1.1801​
1.1801​
1.1801​
0.01175​
44.63768​
0.002918​
53.89172​
55.36649​
-32.4219​
1/5/1999 0:00​
1.1815​
1.1815​
1.1815​
1.1815​
0.011264​
42.66631​
0.003031​
55.10526​
34.04255​
-31.2115​
1/6/1999 0:00​
1.1761​
1.1761​
1.1761​
1.1761​
0.01075​
-16.7771​
0.002355​
50.26119​
13.56707​
-51.2438​
1/7/1999 0:00​
1.1623​
1.1623​
1.1623​
1.1623​
0.011279​
-135.825​
0.000225​
40.57499​
14.68254​
-83.0918​
1/8/1999 0:00​
1.1713​
1.1713​
1.1713​
1.1713​
0.011114​
-58.9161​
0.000358​
47.53685​
35.36364​
-61.3527​
1/11/1999 0:00​
1.1575​
1.1575​
1.1575​
1.1575​
0.01135​
-140.599​
-0.00166​
38.43279​
25.09921​
-90.3226​
1/12/1999 0:00​
1.1504​
1.1504​
1.1504​
1.1504​
0.011236​
-148.168​
-0.00341​
34.77543​
8.826584​
-96.4583​

I have attached the codes... kindly assist identify and rectify the issue(s).
Did you check your broker's data at those dates? Does it have different Open, High, Low, Close values for 1999?
 

Enivid

Administrator
Staff member
Nov 30, 2008
18,607
1,366
144
Odesa
www.earnforex.com
My broker's data (where I checked this script) runs only back to 2011, but I get normal results for all dates with different OHLC data.
I had to comment out the line #57 for it to show data beyond the current bar.
 

Attachments

  • Indi2csv.csv
    398.6 KB · Views: 0

bmkinyua

Trader
Dec 26, 2018
24
1
19
37
My broker's data (where I checked this script) runs only back to 2011, but I get normal results for all dates with different OHLC data.
I had to comment out the line #57 for it to show data beyond the current bar.
do you know a way to get the single line that has unique values of ohlc?... coz in the many results per a certain timeline, there is one result that is ok... that is when you comment out line 57...
11/29/2001 0:00 0.8879 0.8879 0.8879 0.8879 0.00721429 98.56785178 -0.00480557 47.96106641 94.1031941 -48.7544484
11/29/2001 0:00 0.8879 0.8921 0.8855 0.8877 0.00767143 106.7495969 -0.00476302 48.6578629 86.19909502 -49.46619217
 

bmkinyua

Trader
Dec 26, 2018
24
1
19
37
But that's a script, no? How and why would you run it in the Strategy Tester?
I use the ea with the intention of gathering the specific historical data then feed the data to another machine learning system.
Post automatically merged:

So I a getting errors coz of the incorrect ohlc data when I run the ea in strategy tester.
 

Enivid

Administrator
Staff member
Nov 30, 2008
18,607
1,366
144
Odesa
www.earnforex.com
So what's the particular problem is? You do realize that an EA in the Strategy Tester runs differently from the script you run normally on a chart? The former doesn't have access to all the chart history at once, it gets it tick-by-tick (depending on your testing settings).
 

bmkinyua

Trader
Dec 26, 2018
24
1
19
37
yes... i do realize strategy tester is different... so i was wondering if the community can assist edit the code to pick the data that has the corrct ohlc from strategy tester per time stamp.
 

bmkinyua

Trader
Dec 26, 2018
24
1
19
37
I want to collect data for all chart times and the file becomes too big... try it even with 4h chart the file becomes too big... so1 minute chart is just impossible to collect the data.
 

bmkinyua

Trader
Dec 26, 2018
24
1
19
37
I was able to rectify this
.
 

Attachments

  • gatherDataFinal (2).mq4
    4.4 KB · Views: 3
  • gatherDataWeeklyMonthly.mq4
    2.4 KB · Views: 2