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
4 registered members (Nymphodora, AndrewAMD, Quad, TipmyPip), 889 guests, and 6 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
wdate() and priceClose is 24h off #477537
07/04/19 19:44
07/04/19 19:44
Joined: Oct 2018
Posts: 79
S
SnoopySniff Offline OP
Junior Member
SnoopySniff  Offline OP
Junior Member
S

Joined: Oct 2018
Posts: 79
I am exporting priceClose() values to a csv-file. The price values do not match the date. The price values are off by 24h earlier. Any idea? Thank you.

Code
#include <default.c>
#include <windows.h>

typedef struct SYSTEMTIME {
  WORD wYear;
  WORD wMonth;
  WORD wDayOfWeek;
  WORD wDay;
  WORD wHour;
  WORD wMinute;
  WORD wSecond;
  WORD wMilliseconds;
} SYSTEMTIME;
SYSTEMTIME myNow;

char TargetFile[100];
char exportString[100];

function run() {
		
	if(is(INITRUN)) {
		
		BarPeriod = 30;
		StartDate = 20190630;
		// EndDate = 20190625;
		
		// UpdateDays = -1; 
		LookBack = 1440/BarPeriod*1;
		
		assetList("History\\_AssetsMath28.csv");
		
		sprintf(TargetFile, "Exports\\tempAllAssets.csv");
		sprintf(exportString, "Date");
		file_write(TargetFile, exportString, 0);
		
		while(asset(loop(Assets))) {
			sprintf(exportString, ",%s", Asset);
			file_append(TargetFile, exportString, 0);
		}
		
		sprintf(exportString, "\n");
		file_append(TargetFile, exportString, 0);		
		
	}

	GetSystemTime(&myNow);
	string strDateCurrent = strf("%02d.%02d.%02d", myNow.wDay, myNow.wMonth, myNow.wYear);
	string strDateBar = strdate("%d.%m.%Y", wdate(0));
	
	if(strcmp(strDateCurrent, strDateBar)==0) {

		printf("\n %s", strf("%02d.%02d.%02d", myNow.wDay, myNow.wMonth, myNow.wYear));
		printf("\n bar --> %s", strdate("%d.%m.%Y", wdate(0)));
	
		sprintf(exportString, "%s",strdate("%d.%m.%y %H:%M", wdate(0)));
		sprintf(TargetFile, "Exports\\tempAllAssets.csv");
		file_append(TargetFile, exportString, 0);
		
		while(asset(loop(Assets))) {

			vars pc = series(priceClose());
			
			sprintf(TargetFile, "Exports\\tempAllAssets.csv");
			sprintf(exportString, ",%.10f", pc[0]);
			
			file_append(TargetFile, exportString, 0);
		}
		
		sprintf(exportString, "\n");
		file_append(TargetFile, exportString, 0);	
	}		
}

Last edited by SnoopySniff; 07/04/19 20:07.
Re: wdate() and priceClose is 24h off [Re: SnoopySniff] #477538
07/04/19 20:48
07/04/19 20:48
Joined: Oct 2018
Posts: 79
S
SnoopySniff Offline OP
Junior Member
SnoopySniff  Offline OP
Junior Member
S

Joined: Oct 2018
Posts: 79
Update: When I set Lookback to 0 I get the correct closePrice(); But just one line. What I need is an export of n prices.

Does it have to do with my historical data source? I am using ICMarkets for it and I discovered that the the price which can be downloaded (UpdateDays = -1;) feels like about a day older. That seems to me the cause.

But if so, how does Zorro say that f.I. priceClose(24hago) is the priceClose(now)?

This is for instance supposed to be a closePrice(0) but it's from about closePrice(24hago):
Code
Date	EUR/AUD
04.07.2019 20:40	1,603860021


I am irritated.

Last edited by SnoopySniff; 07/04/19 21:00.
Re: wdate() and priceClose is 24h off [Re: SnoopySniff] #477539
07/04/19 21:06
07/04/19 21:06
Joined: Oct 2018
Posts: 79
S
SnoopySniff Offline OP
Junior Member
SnoopySniff  Offline OP
Junior Member
S

Joined: Oct 2018
Posts: 79
I have it! It was ICMarkets! :-)

Still open is the issue with the shift of 24h.

Last edited by SnoopySniff; 07/07/19 07:44.

Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1