Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
Deeplearning Script
by wolfi. 02/26/24 12:46
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/22/24 16:22
AssetAdd() vs. modern asset list?
by jcl. 02/21/24 15:01
How many still using A8
by Aku_Aku. 02/20/24 12:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 521 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
Page 17 of 18 1 2 15 16 17 18
Re: Sierra Chart Plugin [Re: AndrewAMD] #482858
04/07/21 15:24
04/07/21 15:24
Joined: May 2018
Posts: 134
S
SBGuy Offline
Member
SBGuy  Offline
Member
S

Joined: May 2018
Posts: 134
I don't think brokerCommand will help me because I get real time data and trade via a different broker plugin, selected from the Zorro dropdown list.

Just ran the new DLL and it seems to work fine.

Except that I had to change the default port sequence to: 1099, 11097, and 11098

The old sequence was 1099, 11098, and 11097 before for Listening Port, Historical Data Port, and the TLS Historical Data Port.

Re: Sierra Chart Plugin [Re: AndrewAMD] #482859
04/07/21 15:42
04/07/21 15:42
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Good. Let me know if there are issues.

Re: Sierra Chart Plugin [Re: AndrewAMD] #482876
04/10/21 19:46
04/10/21 19:46
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Bugfix update, version 1.0.0.2 can be downloaded here:
https://github.com/AndrewAMD/SierraChartZorroPlugin/releases/tag/v1.0.0.2

Re: Sierra Chart Plugin [Re: AndrewAMD] #482914
04/16/21 13:21
04/16/21 13:21
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Bugfix update, version 1.0.0.3 can be downloaded here:
https://github.com/AndrewAMD/SierraChartZorroPlugin/releases/tag/v1.0.0.3

Re: Sierra Chart Plugin [Re: AndrewAMD] #482990
04/21/21 12:39
04/21/21 12:39
Joined: Mar 2020
Posts: 41
J
jbhunter Offline
Newbie
jbhunter  Offline
Newbie
J

Joined: Mar 2020
Posts: 41
I am attempting to get some historical data from SierraCharts using the plugin. I have been successful for daily bars just using the zorro assetHistory(). However I am attempting to use SBGuy's assetHistorySC function posted earlier to get intraday historical data for some equities. I have set BarPeriod=1. Function below and some example output. The data bars received is is only going back about 6 months or so. It always seems to get around 50k items from Sierra. I have set Global Settings...Day/Trade Service Settings...Common Settings...Maximum Historical Intraday Days to Download to 1825 (5 years). I have noticed that I actually see data in SierraCharts go back much further, so I believe the data is there in the scid file from Sierra, but I cannot get it all to zorro.

Any thoughts? I believe the right parameters are called in the BrokerHistory2. Could this be another SierraCharts setting required? Any help would be appreciated.

A line from the Sierra log
Code
HD Server | HD Request #1 | Socket: 2 | Symbol: BRX | ServiceCode:  | RecordInterval: 60 | MaximumDaysRequested: 0 | Start date-time: 1999-12-31  00:00:00 | ClientReqID: 1 | Username: _. | Thread:7384 | 2021-04-21  08:17:44.869



Zorro Output
Code
 StartDate=0 EndDate=2021  NumYears=3  BarPeriod=1
Cmd=C:\Users\User\Zorro\Zorro.exe -h -stay -run Sierra_GetAsset_BC.c
 asset=BRX
Downloading data [BRX]... Start=19991231   End=20210422

#1: Launching thread...
#1: Trying endpoint 127.0.0.1:11099 (TLS 1.2)
1: Connected to SC DTC Protocol server. Service=scdataallservices|SymbolSettings=scdataallservices
1: WARNING: Trading not supported
1: TradeAccounts detected: Sim1
1: Using: Sim1
1: Warning: no balance confirmed for this account!
1: 0 historical orders detected.
1: 0 open orders detected.
1: 0 open positions detected.SC: items allocated = 11207530
BrokerHistory2 (BRX, 19991231, 20210422, 1, -1, myT6)

#2: Launching thread...
#2: Trying endpoint 127.0.0.1:11097 (TLS 1.2)
#2: Logon successful.
2: Data is being downloaded from a remote source. Download will start when this is done.
#2: Joining thread...SC: items received = 50821
t6 = History\temp-BRX.t6
LOADED TEMP
Saving to, C:\Users\User\Zorro\History\Sierra\BRX.t6




Code
int assetHistorySC(string theAsset)
{
	if (!Init)	return 0;

	int barperiod = BarPeriod;
	//----------------------------------
	//		setup start and end dates
	//----------------------------------
	int M1back = (LookBack*BarPeriod)/(7*60); 	// days of lback
	int DailyLBack = (LookBack+2*UnstablePeriod);
	int start = min(ymd(wdate(NOW)-6*365), ymd(dmy(StartDate)-2*ifelse(barperiod<1440,M1back, DailyLBack)));	//6 years or more
	int end;
	

	string t6Out[100];
	if (barperiod<1440) {
		sprintf(t6Out,strf("%s%s.t6",History,theAsset));
		barperiod = 1;
		end = ymd(wdate(NOW)+1);	// +1 to get most current M1 bar
	}
	else	{
		sprintf(t6Out,"History\\%s.t6",theAsset);
		end = ymd(wdate(NOW)-1);	 // -1 to get up to yesterday
	}
	
	//-------------------------------------
	// check to see if exiting t6 is in range	
	//-------------------------------------

	if (file_length(t6Out))	{
		int records = dataLoad(33,t6Out,7);	
		int fileStart = ymd(dataVar(33,-1,0));	
		int fileEnd = ymd(dataVar(33,0,0));
		
		//printf("fileStart=%d  fileEnd=%d\n",fileStart, fileEnd);
			
		// if Test or Train, don't download if data in range
		if (	(!Live && EndDate<=fileEnd && barperiod==1440)
			|| (Live && end<=fileEnd && barperiod==1440)
			)	
		{
			printf("\n[%s] historical data up to date... no download\n");
			dataNew(33,0,0);
			return 0;	// range already inside
		}	
		// if not enough data, its probably a newly listed stock/asset with limited history
		if (start<fileStart)		
			printf("\nWARNING:  historical data for [%s] may not be early enough\n",theAsset);

		// set start to last date in file, to upate to current date
		start = fileEnd;		

	}

	printf("Downloading data [%s]... Start=%d   End=%d\n", theAsset, start, end);

	//----------------------------------
	//			index symbol conversions
	//----------------------------------
	if (theAsset == "SPX") theAsset = "$SPX";
	if (theAsset == "DJI") theAsset = "$DOWI";	
	if (theAsset == "INX") theAsset = "$INX";
	
	//----------------------------------
	//				get data		
	//----------------------------------

	if(once(Init)) connectToSierraChart();

	int reqbars = (int) (dmy(end) - dmy(start))*ifelse(barperiod==1440,1,1440);	// D1 or M1 data only 
	printf("SC: items allocated = %d\n",reqbars+10);

	T6* myT6=malloc((reqbars+10)*sizeof(T6));
	printf("BrokerHistory2 (%s, %d, %d, %i, -1, myT6)\n", theAsset, start, end, barperiod);
	int items = BrokerHistory2 (theAsset, dmy(start), dmy(end), barperiod, -1, myT6);	
	printf("SC: items received = %d\n",items);
	if (!items)	{
		printf("ERROR:  No historical data returned from SierraChart... maybe out of data cache range.\n");
		free(myT6);
		quit("#quit");
	}

	FILE *fp;
	string tempT6 = strf("History\\temp-%s.t6",theAsset);
	printf("t6 = %s\n", tempT6);
	fp = fopen(tempT6, "wb");
	fwrite(myT6 , sizeof(T6), items, fp );
	fclose(fp);
	free(myT6);
	
	dataLoad(33,tempT6,7);	// load it into 33
	dataSort(33);				// make sure it's sorted 
	printf("LOADED TEMP\n");
	//---------------------------------
	//	pre-pend to existing	t6
	//---------------------------------
	if (file_length(t6Out)>0)	{
		printf("Appending to, %s\n", t6Out);
		dataLoad(22,t6Out,7);
		dataMerge(22,33);		
		dataSave(22,t6Out);
		dataNew(22,0,0);	
	}
	else	{
		printf("Saving to, %s\n", t6Out);
		dataSave(33,t6Out);
		dataNew(33,0,0);	
	}

	file_delete(tempT6);
	return 0;
}

Re: Sierra Chart Plugin [Re: AndrewAMD] #482992
04/21/21 12:53
04/21/21 12:53
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
No idea, but you're not using the latest plugin. Download it here:
https://github.com/AndrewAMD/SierraChartZorroPlugin/releases/tag/v1.0.0.3

The documentation has completely changed, too. Read:
https://github.com/AndrewAMD/SierraChartZorroPlugin

Also, I have no plans on supporting that method of access. Use AssetHistory:
https://manual.zorro-project.com/loadhistory.htm

I might eventually put in a separate brokerCommand if I have time to spare.
(Or I can expedite it with a sponsorship.)

Re: Sierra Chart Plugin [Re: AndrewAMD] #482993
04/21/21 15:08
04/21/21 15:08
Joined: May 2018
Posts: 134
S
SBGuy Offline
Member
SBGuy  Offline
Member
S

Joined: May 2018
Posts: 134
Hi Andrew,

I had this same 180 day problem back in 2019 and you lifted the limit. Here's what you said. Perhaps forgot to include the IGNORE_MAX_DAYS thing in the new plugin? Would appreciate you putting it back in. It apparently didn't cause any problems since 2019.

=========================================================================
I hacked off max_days with a macro IGNORE_MAX_DAYS.

Can you see if it fixes your issue?

You can download it here:
https://github.com/AndrewAMD/SierraChartZorroPlugin/raw/master/releases/0.9.3.1/SierraChart.dll

Re: Sierra Chart Plugin [Re: AndrewAMD] #482995
04/21/21 15:54
04/21/21 15:54
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
It is impossible to have that problem with the latest version of the plugin, since MaxDaysToReturn is never set.

I don't know why you are linking to the old version, the new one is much better!
Originally Posted by AndrewAMD
No idea, but you're not using the latest plugin. Download it here:
https://github.com/AndrewAMD/SierraChartZorroPlugin/releases/tag/v1.0.0.3

The documentation has completely changed, too. Read:
https://github.com/AndrewAMD/SierraChartZorroPlugin

Also, I have no plans on supporting that method of access. Use AssetHistory:
https://manual.zorro-project.com/loadhistory.htm

I might eventually put in a separate brokerCommand if I have time to spare.
(Or I can expedite it with a sponsorship.)

Re: Sierra Chart Plugin [Re: AndrewAMD] #482997
04/21/21 16:22
04/21/21 16:22
Joined: Mar 2020
Posts: 41
J
jbhunter Offline
Newbie
jbhunter  Offline
Newbie
J

Joined: Mar 2020
Posts: 41
Thanks for the quick responses. When I try to use assetHistory(ticker,1) I get results like this.


Code
  StartDate=0 EndDate=20210421  NumYears=3  BarPeriod=1.000000
Cmd="C:\Users\User\Zorro\Zorro.exe" Sierra_GetAsset_test -stay
 ass=BRX
Load AssetsSierra
Login 0 SierraChart..
!1: Connected to SC DTC Protocol server. Service=scdataallservices|SymbolSettings=scdataallservices
!1: WARNING: Trading not supported
!1: TradeAccounts detected: Sim1
!1: Using: Sim1
!1: Warning: no balance confirmed for this account!
!1: 0 historical orders detected.
!1: 0 open orders detected.
!1: 0 open positions detected. at UTC 04-21 16:17
(null): 6 MB allocated
!2: short read
!2: Connect failure.
!BRX 01-01 00:00:00 to 04-21 16:17:57 failed
!BRX 01-01 00:00:00 to 04-21 16:16:57 failed
!BRX 01-01 00:00:00 to 04-21 16:15:57 failed
!BRX 01-01 00:00:00 to 04-21 16:14:57 failed
!BRX 01-01 00:00:00 to 04-21 16:13:57 failed
!BRX 01-01 00:00:00 to 04-21 16:12:57 failed
!BRX 01-01 00:00:00 to 04-21 16:11:57 failed
!BRX 01-01 00:00:00 to 04-21 16:10:57 failed
!BRX 01-01 00:00:00 to 04-21 16:09:57 failed
!BRX 01-01 00:00:00 to 04-21 16:08:57 failed
!BRX 01-01 00:00:00 to 04-21 16:07:57 failed
!BRX 01-01 00:00:00 to 04-21 16:06:57 failed - BRX history unavailable!
Error 056: Can't download BRX 2021 history
(null): 6 MB allocated
!BRX 01-01 00:00:00 to 12-31 23:59:59 failed
!BRX 01-01 00:00:00 to 12-31 23:58:59 failed
!BRX 01-01 00:00:00 to 12-31 23:57:59 failed
!BRX 01-01 00:00:00 to 12-31 23:56:59 failed
!BRX 01-01 00:00:00 to 12-31 23:55:59 failed
!BRX 01-01 00:00:00 to 12-31 23:54:59 failed
!BRX 01-01 00:00:00 to 12-31 23:53:59 failed
!BRX 01-01 00:00:00 to 12-31 23:52:59 failed
!BRX 01-01 00:00:00 to 12-31 23:51:59 failed
!BRX 01-01 00:00:00 to 12-31 23:50:59 failed
!BRX 01-01 00:00:00 to 12-31 23:49:59 failed
!BRX 01-01 00:00:00 to 12-31 23:48:59 failed - BRX history unavailable!
Error 056: Can't download BRX 2020 history
(null): 6 MB allocated
!BRX 01-01 00:00:00 to 12-31 23:59:59 failed
!BRX 01-01 00:00:00 to 12-31 23:58:59 failed
!BRX 01-01 00:00:00 to 12-31 23:57:59 failed
!BRX 01-01 00:00:00 to 12-31 23:56:59 failed
!BRX 01-01 00:00:00 to 12-31 23:55:59 failed
!BRX 01-01 00:00:00 to 12-31 23:54:59 failed
!BRX 01-01 00:00:00 to 12-31 23:53:59 failed
!BRX 01-01 00:00:00 to 12-31 23:52:59 failed
!BRX 01-01 00:00:00 to 12-31 23:51:59 failed
!BRX 01-01 00:00:00 to 12-31 23:50:59 failed
!BRX 01-01 00:00:00 to 12-31 23:49:59 failed
!BRX 01-01 00:00:00 to 12-31 23:48:59 failed - BRX history unavailable!
Error 056: Can't download BRX 2019 history
Logout.. ok


When I update to the latest plugin version I get this


Code
 StartDate=0 EndDate=20210421  NumYears=3  BarPeriod=1.000000
Cmd="C:\Users\User\Zorro\Zorro.exe" Sierra_GetAsset_test -stay
 ass=BRX
Load AssetsSierra
Login 0 SierraChart..
!M: Connecting to 127.0.0.1:11099...
!M: Requesting binary encoding...
!M: readloop_handler1: End of file
Can't connect!

Re: Sierra Chart Plugin [Re: AndrewAMD] #482998
04/21/21 16:23
04/21/21 16:23
Joined: May 2018
Posts: 134
S
SBGuy Offline
Member
SBGuy  Offline
Member
S

Joined: May 2018
Posts: 134
Ah, very good Andrew. Yeah, the old link was just for your reference.

Sorry, jbhunter, don't know what's wrong with your setup. I have 1,000 days max on SC setting and was able to get 1,000 days of M1 data for your BRX example into a .t6 file. I am using the version 1.0.xx of the plugin

My code may have changed since I posted it. For what it's worth, here's the latest code. It's not the best code, but it works for me. Just put BarPeriod as the second argument.

You'll have to debug your problem further on your own.

Code
int assetHistorySC(string theAsset, int theBP)
{
	if (!Init)	return 0;

	int barperiod = theBP;
	//----------------------------------
	//		setup start and end dates
	//----------------------------------
	int M1back = (LookBack*BarPeriod)/(7*60); 	// days of lback
	int DailyLBack = (LookBack+2*UnstablePeriod);
	int start = min(ymd(wdate(NOW)-6*365), ymd(dmy(StartDate)-2*ifelse(barperiod<1440,M1back, DailyLBack)));	//6 years or more
	int end;
	
	
	if (!EndDate) 
		if (hour(NOW)>=21) EndDate = ymd(wdate(NOW));
		else EndDate = ymd(wdate(NOW)-1);

	string t6Out[100];
	if (barperiod<1440) {
		sprintf(t6Out,strf("History\\%s%s",theAsset,History));
		barperiod = 1;
		end = ymd(wdate(NOW)+1);	// +1 to get most current M1 bar
	}
	else	{
		sprintf(t6Out,"History\\%s.t6",theAsset);
		if (hour(NOW)>=21) end = ymd(wdate(NOW));
		else end = ymd(wdate(NOW)-1);	 // -1 to get up to yesterday		
	}
	
	//-------------------------------------
	// check to see if exiting t6 is in range	
	//-------------------------------------

	if (file_length(t6Out))	{
		int records = dataLoad(33,t6Out,7);	
		int fileStart = ymd(dataVar(33,-1,0));	
		int fileEnd = ymd(dataVar(33,0,0));
		
		//printf("fileStart=%d  fileEnd=%d\n",fileStart, fileEnd);
			
		// if Test or Train, don't download if data in range
		if (	(!Live && EndDate<=fileEnd && barperiod==1440)
			|| (Live && end<=fileEnd && barperiod==1440)
			)	
		{
			if (Live || DEBUG) printf("\n[%s] historical data up to date... no download\n");
			dataNew(33,0,0);
			return 0;	// range already inside
		}	
		// if not enough data, its probably a newly listed stock/asset with limited history
		if (start<fileStart)		
			if (Live || DEBUG) printf("\nWARNING:  historical data for [%s] may not be early enough\n",theAsset);

		// set start to last date in file, to upate to current date
		start = fileEnd;		

	}

	if (start==end) return 0;
	
	if (Live || DEBUG) printf("Downloading data [%s]... Start=%d   End=%d\n", theAsset, start, end);

	//----------------------------------
	//			index symbol conversions
	//----------------------------------
	if (theAsset == "SPX") theAsset = "$SPX";
	if (theAsset == "DJI") theAsset = "$DOWI";	
	if (theAsset == "INX") theAsset = "$INX";
	
	//----------------------------------
	//				get data		
	//----------------------------------

	if(once(Init)) connectToSierraChart();

	int reqbars = (int) (dmy(end) - dmy(start))*ifelse(barperiod==1440,1,1440);	// D1 or M1 data only 
	//printf("SC: items allocated = %d\n",reqbars+10);

	T6* myT6=malloc((reqbars+10)*sizeof(T6));
	int items = 0;
	int i;
	for (i=0;i<=2;i++)
	{
		items = BrokerHistory2 (theAsset, dmy(start), dmy(end), barperiod, -1, myT6);	
		if (Live || DEBUG) printf("SC: items received = %d\n",items);

		if (!items)	{
			if (Live || DEBUG) printf("ERROR:  No historical data returned from SierraChart... maybe out of data cache range.\n");
			connectToSierraChart();
			wait(1000);
		}
		else	{
			break;
		}
	}
		
	FILE *fp;
	string tempT6 = strf("History\\temp-%s.t6",theAsset);
	fp = fopen(tempT6, "wb");
	fwrite(myT6 , sizeof(T6), items, fp );
	fclose(fp);
	free(myT6);
	
	dataLoad(33,tempT6,7);	// load it into 33
	dataSort(33);				// make sure it's sorted 
	
	//---------------------------------
	//	pre-pend to existing	t6
	//---------------------------------
	if (file_length(t6Out)>0)	{
		dataLoad(22,t6Out,7);
		dataMerge(22,33);		
		dataSave(22,t6Out);
		dataNew(22,0,0);	
	}
	else	{
		dataSave(33,t6Out);
		dataNew(33,0,0);	
	}

	file_delete(tempT6);
	return 0;
}



Page 17 of 18 1 2 15 16 17 18

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