Gamestudio Links
Zorro Links
Newest Posts
Bmap creation - wrong Alpha values
by txesmi. 12/11/19 12:43
A9
by preacherX. 12/11/19 11:01
Error Message 010: invalid stops
by Volker. 12/11/19 08:25
AssetFix & Assets.csv
by MatPed. 12/11/19 07:03
How to handle profit in a TMF during training
by StefanCGN. 12/09/19 20:09
Simulate complex commission costs [Test]
by AndrewAMD. 12/09/19 13:52
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
6 registered members (Iglarion, timW, MatPed, Quad, 2 invisible), 659 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
PabloMF, deepscreener, wzschultz, Alit, cmor
18341 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 10 of 12 1 2 8 9 10 11 12
Re: Sierra Chart Plugin [Re: AndrewAMD] #478645
11/19/19 00:07
11/19/19 00:07
Joined: Feb 2017
Posts: 816
Chicago
AndrewAMD Online OP
User
AndrewAMD  Online OP
User

Joined: Feb 2017
Posts: 816
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: 88
S
SBGuy Offline
Junior Member
SBGuy  Offline
Junior Member
S

Joined: May 2018
Posts: 88
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: 816
Chicago
AndrewAMD Online OP
User
AndrewAMD  Online OP
User

Joined: Feb 2017
Posts: 816
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: 88
S
SBGuy Offline
Junior Member
SBGuy  Offline
Junior Member
S

Joined: May 2018
Posts: 88
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: 816
Chicago
AndrewAMD Online OP
User
AndrewAMD  Online OP
User

Joined: Feb 2017
Posts: 816
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: 88
S
SBGuy Offline
Junior Member
SBGuy  Offline
Junior Member
S

Joined: May 2018
Posts: 88
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: 816
Chicago
AndrewAMD Online OP
User
AndrewAMD  Online OP
User

Joined: Feb 2017
Posts: 816
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: 88
S
SBGuy Offline
Junior Member
SBGuy  Offline
Junior Member
S

Joined: May 2018
Posts: 88
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: 816
Chicago
AndrewAMD Online OP
User
AndrewAMD  Online OP
User

Joined: Feb 2017
Posts: 816
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: 88
S
SBGuy Offline
Junior Member
SBGuy  Offline
Junior Member
S

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

Page 10 of 12 1 2 8 9 10 11 12

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