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 (Quad, AndrewAMD), 567 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
Page 10 of 18 1 2 8 9 10 11 12 17 18
Re: Sierra Chart Plugin [Re: AndrewAMD] #478645
11/19/19 00:07
11/19/19 00:07
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online OP
Serious User
AndrewAMD  Online OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
It’s in beta, and I planned on rewriting the backend in the near future.

In other words, don't do it.

For your own purposes, you can instead dynamically load the DLL and invoke BrokerOpen, BrokerLogin, and BrokerHistory2, all entirely from a Zorro script.

Re: Sierra Chart Plugin [Re: AndrewAMD] #478646
11/19/19 01:01
11/19/19 01:01
Joined: May 2018
Posts: 134
S
SBGuy Offline
Member
SBGuy  Offline
Member
S

Joined: May 2018
Posts: 134
Great! Look forward to it. Any idea on ETA?

My need isn't urgent. My multiple data provider approach via Zorro script, while not elegant, is working so far. Sierra Chart has all the data I'm looking for a very reasonable price, an would be an elegant solution.

Thanks again for your hard work on this!

Re: Sierra Chart Plugin [Re: AndrewAMD] #478647
11/19/19 01:47
11/19/19 01:47
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online OP
Serious User
AndrewAMD  Online OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
No ETA, just delays. wink

Re: Sierra Chart Plugin [Re: AndrewAMD] #478654
11/20/19 20:46
11/20/19 20:46
Joined: May 2018
Posts: 134
S
SBGuy Offline
Member
SBGuy  Offline
Member
S

Joined: May 2018
Posts: 134
Got some time today, so I thought I'd give it a try. It crashed in BrokerLogin. I did use my real username/login.

I've never loaded a DLL function before in. Any guidance would be appreciated

Code

#include <stdio.h>
#include <default.c>
#include <contract.c>

int __cdecl BrokerOpen (char*, FARPROC, FARPROC); 
API(BrokerOpen,Plugin\\SierraChart)

int __cdecl BrokerLogin (char*, char*, char*, char* );
API(BrokerLogin,Plugin\\SierraChart)

int __cdecl BrokerHistory2 (char* , DATE , DATE , int , int , T6* );
API(BrokerHistory2,Plugin\\SierraChart)


void run()
{

   StartDate = 20190101;
   EndDate = 20191031;
   Verbose = 7|DIAG;

   String temp = "AAPL";
   History = "_SC.t6";

   BokerOpen("SierraChart",0, 0);
   _POS("11111");

   BrokerLogin ("USERXXX", "PWDXXXX", "Demo", "0000");
   _POS("22222");

   T6* myT6;
   int items = BrokerHistory2 (temp, dmy(20190101), dmy(20191031), 1440, -1, myT6);
   FILE *fp;
   string fname = strf("History\\%s%s",temp, History);
   fp = fopen(fname, "wb");
   fwrite(myT6 , items , sizeof(myT6) , fp );

   asset(temp);    

   var Price = priceClose();
   printf("price = %.4f\n",Price);

}



Last edited by SBGuy; 11/20/19 20:46.
Re: Sierra Chart Plugin [Re: AndrewAMD] #478655
11/21/19 00:40
11/21/19 00:40
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online OP
Serious User
AndrewAMD  Online OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Why did you hand over null pointers to fpError and fpProgress? I bet my plugin crashes on calling BrokerError and BrokerProgress. (Obviously, there's no reason to check if the pointers are valid tongue )

Also, char* Accounts is an output, so why are you supplying a string literal?

Mind you, my plugin was designed to be used by Zorro. laugh

Re: Sierra Chart Plugin [Re: AndrewAMD] #478656
11/21/19 01:29
11/21/19 01:29
Joined: May 2018
Posts: 134
S
SBGuy Offline
Member
SBGuy  Offline
Member
S

Joined: May 2018
Posts: 134
Since I am not Zorro, I don't know how to pass the correct arguments :-)

So, what should I put in as arguments for pointers to fpErrpr and fpProgress?

Re: Sierra Chart Plugin [Re: AndrewAMD] #478657
11/21/19 03:35
11/21/19 03:35
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online OP
Serious User
AndrewAMD  Online OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Make up your own function and pass a function pointer. You know what to do, right? Just do what the manual says the functions do.

Also, your BrokerHistory2 call is wrong. You don't even know how much memory you need - you need to call GET_MAXTICKS, and then call malloc.

~~~~ IN GENERAL~~~~
Any time that the plugin outputs memory (such as T6 ticks or strings), the caller is responsible for supplying the memory. You have supplied memory zero times. Fix this.

If you're not sure whether or not it's an output, read the manual.

Last edited by AndrewAMD; 11/21/19 15:00.
Re: Sierra Chart Plugin [Re: AndrewAMD] #478659
11/21/19 16:52
11/21/19 16:52
Joined: May 2018
Posts: 134
S
SBGuy Offline
Member
SBGuy  Offline
Member
S

Joined: May 2018
Posts: 134
Hi Andrew, my programming skills are not close to your level by any measure. This DLL loading thing is completely new to me.

I've read the manual and continued to hack at it and still doesn't work. I even copied SierraChart.dll to SierraChart2.dll, put in the root Zorro directory, and tried a different way of loading the DLL.

I'm getting a compile error about wrong type CONV:POINTER::DOUBLE at the BrokerOpen line. I don't think I'm passing the function pointers in correctly. I tried my best with my rusty skills. Here's my stripped down code. I'll worry about BrokerHistory once I get pass BrokerOpen :-)

Any thoughts?

Thanks.

Code
#include <stdio.h>
#include <default.c>
#include <contract.c>

int __cdecl BrokerOpen (char*, FARPROC, FARPROC); 
BrokerOpen = DefineApi("SierraChart2:BrokerOpen");

int __cdecl BrokerLogin (char*, char*, char*, char*);
BrokerLogin = DefineApi("SierraChart2:BrokerLogin");

int __cdecl BrokerHistory2 (char* , DATE , DATE , int , int , T6* );
BrokerLogin = DefineApi("SierraChart2:BrokerHistory2");

int BrokerError(char* message) {
	printf(message);
}

int BrokerProgress(DWORD progress) {
	printf("stuff");
}

void run()
{

   StartDate = 20190101;
   EndDate = 20191031;
   Verbose = 7|DIAG;

	string temp = "AAPL";
	History = "_SC.t6";

	string temp1[100];
	BrokerOpen(temp1, &BrokerError, &BrokerProgress);

	char retAcct[1024];
	BrokerLogin ("XXXXX", "XXXXXX", "Demo", retAcct);

}



Re: Sierra Chart Plugin [Re: AndrewAMD] #478660
11/21/19 17:30
11/21/19 17:30
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online OP
Serious User
AndrewAMD  Online OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Try casting your pointers to void* or FARPROC

Re: Sierra Chart Plugin [Re: AndrewAMD] #478661
11/21/19 18:02
11/21/19 18:02
Joined: May 2018
Posts: 134
S
SBGuy Offline
Member
SBGuy  Offline
Member
S

Joined: May 2018
Posts: 134
No dice. same syntax error.

Page 10 of 18 1 2 8 9 10 11 12 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