Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Nymphodora, Quad), 923 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Dealing with gaps in MT4 M1 data #478877
01/04/20 02:46
01/04/20 02:46
Joined: Jun 2019
Posts: 2
VIC
G
giantj Offline OP
Guest
giantj  Offline OP
Guest
G

Joined: Jun 2019
Posts: 2
VIC
Hi,

I'm building a strategy where I need the strategy to be run in the 1 minute timeframe but I also need to be build price OHLC for the H1 timeframe.

So I have set by BarPeriod to 1 and I've built series for High, Low and Close by changing the timeframe to 60 / Period ... pretty standard code:

Code
        BarPeriod = 1; 
	BarOffset = 0;
	StartDate = 20191107; 
	EndDate   = 20191111; 
	LookBack = 60/BarPeriod * 24 * 5; 
	MaxLong = MaxShort = 1;

	TimeFrame = 60 / BarPeriod;
	FrameOffset = 0;
	BarOffset = 0;
	
	vars H1Close = series(priceClose());
	vars H1High = series(priceHigh());
	vars H1Low = series(priceLow());
	
	TimeFrame = BarPeriod;
	vars M1Close = series(priceClose());
	vars M1High = series(priceHigh());
	vars M1Low = series(priceLow());


I noticed that occasionally the data downloaded from my MT4 provided has missing entries on the 1 minute timeframe. This seems to impact how the H1 data gets calculated.

For example, if the previous H1 entry was calculated at 1am, and there are 2 missing entries between 1am and 2am, the next H1 entry is only calculated at 2:02am. With my strategy, I check on the hour for the last H1 High and Low values. But in the scenario above, it will still have the previous one stored in H1Close[0], and not the latest one.

Is there a way around this without having to build my own version of priceHigh and priceLow for a 1 hour period to specifically work in a 60 min timeframe rather than the last 60 entries?

Or maybe there is an easy way to pad the historical data where there are missing entries? If so, how would I go about that?

Thanks,

GJ


Last edited by giantj; 01/04/20 02:48.
Re: Dealing with gaps in MT4 M1 data [Re: giantj] #478878
01/04/20 07:11
01/04/20 07:11
Joined: Feb 2017
Posts: 369
D
Dalla Offline
Senior Member
Dalla  Offline
Senior Member
D

Joined: Feb 2017
Posts: 369

Re: Dealing with gaps in MT4 M1 data [Re: Dalla] #478881
01/04/20 16:47
01/04/20 16:47
Joined: Dec 2019
Posts: 53
ozgur Offline
Junior Member
ozgur  Offline
Junior Member

Joined: Dec 2019
Posts: 53
Originally Posted by Dalla


Hi Dalla,
OP asks to get incomplete candle values in run(). frameSync() would return closed candle values.

I also found out frameSync(24) skips day if data is missing; see below log as an example. frameSync(1) can have this issue as well, not robust without extra checks IMHO.

Quote

[26366: Thu 18-03-22 23:00] 1.2319/1.2320\1.2300/1.2302 0 1.230240
[26367: Fri 18-03-23 00:00] 1.2302/1.2310\1.2302/1.2307 -23 1.230690
[26368: Fri 18-03-23 01:00] 1.2307/1.2324\1.2307/1.2321 0 1.232070
[26369: Fri 18-03-23 02:00] 1.2321/1.2329\1.2317/1.2324 0 1.232440
[26370: Fri 18-03-23 03:00] 1.2324/1.2342\1.2320/1.2337 0 1.233690
[26371: Fri 18-03-23 04:00] 1.2337/1.2338\1.2326/1.2330 0 1.232980
[26372: Fri 18-03-23 05:00] 1.2330/1.2342\1.2327/1.2333 0 1.233330
[26373: Fri 18-03-23 06:00] 1.2333/1.2338\1.2331/1.2335 0 1.233490
[26374: Fri 18-03-23 07:00] 1.2335/1.2336\1.2332/1.2335 0 1.233470
[26375: Fri 18-03-23 08:00] 1.2335/1.2339\1.2331/1.2332 0 1.233210
[26376: Fri 18-03-23 09:00] 1.2332/1.2347\1.2332/1.2345 0 1.234520
[26377: Fri 18-03-23 10:00] 1.2345/1.2349\1.2317/1.2322 0 1.232200
[26378: Fri 18-03-23 11:00] 1.2322/1.2341\1.2320/1.2336 0 1.233650
[26379: Fri 18-03-23 12:00] 1.2336/1.2340\1.2320/1.2324 0 1.232440
[26380: Fri 18-03-23 13:00] 1.2324/1.2334\1.2324/1.2331 0 1.233060
[26381: Fri 18-03-23 14:00] 1.2331/1.2346\1.2328/1.2344 0 1.234450
[26382: Fri 18-03-23 15:00] 1.2345/1.2360\1.2334/1.2338 0 1.233830
[26383: Fri 18-03-23 16:00] 1.2339/1.2346\1.2323/1.2337 0 1.233680
[26384: Fri 18-03-23 17:00] 1.2337/1.2355\1.2336/1.2337 0 1.233750
[26385: Fri 18-03-23 18:00] 1.2337/1.2363\1.2335/1.2359 0 1.235870
[26386: Fri 18-03-23 19:00] 1.2359/1.2367\1.2349/1.2363 0 1.236290
[26387: Fri 18-03-23 20:00] 1.2363/1.2368\1.2356/1.2362 0 1.236200
[26388: Fri 18-03-23 21:00] 1.2362/1.2374\1.2356/1.2368 0 1.236770
[26389: Fri 18-03-23 22:00] 1.2368/1.2371\1.2361/1.2365 0 1.236520
[26390: Fri 18-03-23 23:00] 1.2365/1.2367\1.2351/1.2355 0 1.235480
[26391: Mon 18-03-26 01:00] 1.2355/1.2362\1.2353/1.2359 0 1.235930
[26392: Mon 18-03-26 02:00] 1.2359/1.2368\1.2358/1.2367 0 1.236740
[26393: Mon 18-03-26 03:00] 1.2367/1.2367\1.2354/1.2355 0 1.235460
[26394: Mon 18-03-26 04:00] 1.2355/1.2383\1.2352/1.2370 0 1.236980
[26395: Mon 18-03-26 05:00] 1.2370/1.2372\1.2364/1.2371 0 1.237050
[26396: Mon 18-03-26 06:00] 1.2371/1.2377\1.2367/1.2376 0 1.237550
[26397: Mon 18-03-26 07:00] 1.2376/1.2381\1.2372/1.2373 0 1.237350
[26398: Mon 18-03-26 08:00] 1.2373/1.2376\1.2372/1.2374 0 1.237370
[26399: Mon 18-03-26 09:00] 1.2374/1.2374\1.2365/1.2366 0 1.236630
[26400: Mon 18-03-26 10:00] 1.2366/1.2371\1.2362/1.2362 0 1.236220
[26401: Mon 18-03-26 11:00] 1.2362/1.2394\1.2359/1.2383 0 1.238300
[26402: Mon 18-03-26 12:00] 1.2383/1.2399\1.2374/1.2392 0 1.239230
[26403: Mon 18-03-26 13:00] 1.2392/1.2417\1.2392/1.2406 0 1.240610
[26404: Mon 18-03-26 14:00] 1.2406/1.2413\1.2399/1.2404 0 1.240350
[26405: Mon 18-03-26 15:00] 1.2404/1.2417\1.2404/1.2407 0 1.240700
[26406: Mon 18-03-26 16:00] 1.2407/1.2413\1.2400/1.2401 0 1.240070
[26407: Mon 18-03-26 17:00] 1.2401/1.2440\1.2398/1.2437 0 1.243660
[26408: Mon 18-03-26 18:00] 1.2437/1.2449\1.2434/1.2442 0 1.244190
[26409: Mon 18-03-26 19:00] 1.2442/1.2447\1.2437/1.2440 0 1.244030
[26410: Mon 18-03-26 20:00] 1.2440/1.2450\1.2437/1.2444 0 1.244450
[26411: Mon 18-03-26 21:00] 1.2444/1.2456\1.2442/1.2453 0 1.245280
[26412: Mon 18-03-26 22:00] 1.2453/1.2462\1.2452/1.2455 0 1.245540
[26413: Mon 18-03-26 23:00] 1.2455/1.2457\1.2450/1.2452 0 1.245200
[26414: Tue 18-03-27 00:00] 1.2452/1.2453\1.2441/1.2444 -46 1.244430
[26415: Tue 18-03-27 01:00] 1.2444/1.2457\1.2443/1.2448 0 1.244780
[26416: Tue 18-03-27 02:00] 1.2448/1.2453\1.2444/1.2452 0 1.245230
[26417: Tue 18-03-27 03:00] 1.2452/1.2458\1.2449/1.2457 0 1.245750
[26418: Tue 18-03-27 04:00] 1.2457/1.2457\1.2447/1.2450 0 1.244990
[26419: Tue 18-03-27 05:00] 1.2450/1.2454\1.2443/1.2443 0 1.244330
[26420: Tue 18-03-27 06:00] 1.2443/1.2450\1.2443/1.2447 0 1.244680
[26421: Tue 18-03-27 07:00] 1.2447/1.2455\1.2447/1.2452 0 1.245190
[26422: Tue 18-03-27 08:00] 1.2452/1.2455\1.2449/1.2450 0 1.245000
[26423: Tue 18-03-27 09:00] 1.2450/1.2452\1.2443/1.2449 0 1.244910
[26424: Tue 18-03-27 10:00] 1.2449/1.2477\1.2446/1.2465 0 1.246550
[26425: Tue 18-03-27 11:00] 1.2465/1.2474\1.2459/1.2465 0 1.246540
[26426: Tue 18-03-27 12:00] 1.2465/1.2466\1.2426/1.2430 0 1.243030
[26427: Tue 18-03-27 13:00] 1.2430/1.2431\1.2410/1.2414 0 1.241400
[26428: Tue 18-03-27 14:00] 1.2414/1.2420\1.2405/1.2407 0 1.240720
[26429: Tue 18-03-27 15:00] 1.2407/1.2408\1.2390/1.2391 0 1.239140
[26430: Tue 18-03-27 16:00] 1.2391/1.2391\1.2372/1.2387 0 1.238730
[26431: Tue 18-03-27 17:00] 1.2387/1.2399\1.2378/1.2391 0 1.239110
[26432: Tue 18-03-27 18:00] 1.2391/1.2409\1.2390/1.2393 0 1.239340
[26433: Tue 18-03-27 19:00] 1.2393/1.2414\1.2390/1.2409 0 1.240860
[26434: Tue 18-03-27 20:00] 1.2409/1.2416\1.2407/1.2414 0 1.241360
[26435: Tue 18-03-27 21:00] 1.2414/1.2415\1.2404/1.2409 0 1.240950
[26436: Tue 18-03-27 22:00] 1.2409/1.2412\1.2400/1.2400 0 1.240040
[26437: Tue 18-03-27 23:00] 1.2400/1.2406\1.2395/1.2397 0 1.239660
[26438: Wed 18-03-28 00:00] 1.2397/1.2405\1.2397/1.2403 -23 1.240310

Last edited by ozgur; 01/04/20 16:50.
Re: Dealing with gaps in MT4 M1 data [Re: Dalla] #478882
01/04/20 23:23
01/04/20 23:23
Joined: Jun 2019
Posts: 2
VIC
G
giantj Offline OP
Guest
giantj  Offline OP
Guest
G

Joined: Jun 2019
Posts: 2
VIC
Thanks @Dalla, frameSync did the job for me.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1