Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by M_D. 04/26/24 20:22
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (M_D, AndrewAMD, Quad, Ayumi), 806 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 3 1 2 3
Re: Downloading and Displaying Stock Market Data [Re: DejaVu] #415319
01/17/13 11:26
01/17/13 11:26
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
You must not add functions to a compiled DLL. A DLL is only meant to be called from your program which contains the functions you need.

If you have the DATE definition in your code, then I can not answer why you get error messages indicating that this definition is missing. But it might have other reasons. If you really need to compile the DLL and can't find the problem yourself, you may upload your complete VC++ 2010 project for that DLL, and I'll look into it.

Re: Downloading and Displaying Stock Market Data [Re: jcl] #415325
01/17/13 13:04
01/17/13 13:04
Joined: Jan 2013
Posts: 11
DejaVu Offline OP
Newbie
DejaVu  Offline OP
Newbie

Joined: Jan 2013
Posts: 11
That's complicated, what would you recommend me to do? I mean I did all that's recommended to do, can you give me some step-by-step tutorial of how to compile the program which will download the data and save it in good way to produce the database? What are .dll files used for?

EDIT: Please.

Last edited by DejaVu; 01/17/13 13:04.

A name means nothing on the battlefield.
After a week no one has a name.
Re: Downloading and Displaying Stock Market Data [Re: DejaVu] #415326
01/17/13 13:07
01/17/13 13:07
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Ok, but I need to know how much experience you already have with VC++. How many programs have you written so far? And what is the deadline for your project?

Re: Downloading and Displaying Stock Market Data [Re: jcl] #415327
01/17/13 13:13
01/17/13 13:13
Joined: Jan 2013
Posts: 11
DejaVu Offline OP
Newbie
DejaVu  Offline OP
Newbie

Joined: Jan 2013
Posts: 11
I've done basic ones, calculators, basic arrays, basic functions, but that's all, all in Win32 console, the deadline is may, but it would be good to finish it by the half term holiday, which is in next month to get it marked by teachers and told what to improve to get more marks, also I have to do coursework all along. And thanks for helping me! grin


A name means nothing on the battlefield.
After a week no one has a name.
Re: Downloading and Displaying Stock Market Data [Re: DejaVu] #415338
01/17/13 15:48
01/17/13 15:48
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Win32 console should be fine for the moment. First you need to write a console program that opens the broker DLL and downloads prices from FXCM. That should be doable in a few days even for a beginner.

Make yourself familiar with LoadLibrary and GetProcAddress - that are the two functions that you'll need. First load the DLL and call the BrokerOpen function. Post here if you encounter a problem.

Re: Downloading and Displaying Stock Market Data [Re: jcl] #415373
01/17/13 20:32
01/17/13 20:32
Joined: Jan 2013
Posts: 11
DejaVu Offline OP
Newbie
DejaVu  Offline OP
Newbie

Joined: Jan 2013
Posts: 11
Ok, I got to this:
Quote:
#include <iostream>
#include <Windows.h>
#include <conio.h>

using namespace std;

typedef int (*MsgFunction)(int);

HINSTANCE hinstDLL ;

int main()
{
MsgFunction MsgBox(0) ;
hinstDLL = LoadLibraryA("FXCM.dll") ;

if(hinstDLL != 0)
{
MsgBox = (MsgFunction)GetProcAddress(hinstDLL, "MsgBox");
}

if(MsgBox == 0)
{
cout << "MsgBox is NULL \n";
}

int x = MsgBox(5);

if(x == 5)
{
cout << "Message Displayed! \n" ;
}

FreeLibrary(hinstDLL) ;
return 0 ;
getch() ;
}


Works, how do I call BrokerOpen function, because I get this after I try to run the file
Quote:
MsgBox is NULL


A name means nothing on the battlefield.
After a week no one has a name.
Re: Downloading and Displaying Stock Market Data [Re: DejaVu] #415410
01/18/13 09:10
01/18/13 09:10
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
For BrokerOpen you need a different function type:

typedef int (*BROKER_OPEN)(char* Name,FARPROC fpError,FARPROC fpProgress);

and then

Code:
BROKER_OPEN BrokerOpen = (BROKER_OPEN)GetProcAddress(h,"BrokerOpen");
if(BrokerOpen) {
 char brokername[50] = "";
 long version = (*BrokerOpen)(brokername,NULL,NULL);
}



You can see on the "Broker Plugin" page which functions you have and how they must be typedef'd.

For your purpose you only need BrokerLogin, BrokerAsset, and BrokerHistory.

Re: Downloading and Displaying Stock Market Data [Re: DejaVu] #415415
01/18/13 11:15
01/18/13 11:15
Joined: Jan 2013
Posts: 11
DejaVu Offline OP
Newbie
DejaVu  Offline OP
Newbie

Joined: Jan 2013
Posts: 11
Quote:
#include <iostream>
#include <Windows.h>
#include <conio.h>

using namespace std;

typedef int (*MsgFunction)(int);
typedef int (*BROKER_OPEN)(char* Name,FARPROC fpError,FARPROC fpProgress);

HINSTANCE hinstDLL ;

int main()
{
MsgFunction MsgBox(0) ;
hinstDLL = LoadLibraryA("FXCM.dll") ;

if(hinstDLL != 0)
{
MsgBox = (MsgFunction)GetProcAddress(hinstDLL, "MsgBox");
}

if(MsgBox == 0)
{
cout << "MsgBox is NULL \n";
}

int x = MsgBox(5);

BROKER_OPEN BrokerOpen = (BROKER_OPEN)GetProcAddress(hinstDLL,"BrokerOpen");
if(BrokerOpen)
{
char brokername[50] = "";
long version = (*BrokerOpen)(brokername,NULL,NULL);
}

if(x == 5)
{
cout << "Message Displayed! \n" ;
}

FreeLibrary(hinstDLL) ;
return 0 ;
getch() ;
}


I got problem with higlighted part, you wrote h but it didn't work, I have tried to put it into as a variable-didn't work, so I put hinstDLL and when I try to run it with FXCM.dll it gives me: "Message box is NULL".

EDIT:

When I keep it this way
Quote:
#include <iostream>
#include <Windows.h>
#include <conio.h>

using namespace std;

typedef int (*MsgFunction)(int);
typedef int (*BROKER_OPEN)(char* Name,FARPROC fpError,FARPROC fpProgress);

HINSTANCE hinstDLL ;

int main()
{
MsgFunction MsgBox(0) ;
hinstDLL = LoadLibraryA("FXCM.dll") ;

if(hinstDLL != 0)
{
MsgBox = (MsgFunction)GetProcAddress(hinstDLL, "MsgBox");
}

if(MsgBox == 0)
{
cout << "MsgBox is NULL \n";
}

int x = MsgBox(5);

if(x == 5)
{
cout << "Message Displayed! \n" ;
}

BROKER_OPEN BrokerOpen = (BROKER_OPEN)GetProcAddress(h,"BrokerOpen");
if(BrokerOpen)
{
char brokername[50] = "";
long version = (*BrokerOpen)(brokername,NULL,NULL);
}

FreeLibrary(hinstDLL) ;
return 0 ;
getch() ;
}


I get this:
Quote:
1>------ Build started: Project: DLLtutApp, Configuration: Debug Win32 ------
1> main.cpp
1>c:\users\master roshi\documents\visual studio 2010\projects\dlltutapp\dlltutapp\main.cpp(34): error C2065: 'h' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Last edited by DejaVu; 01/18/13 18:32.

A name means nothing on the battlefield.
After a week no one has a name.
Re: Downloading and Displaying Stock Market Data [Re: DejaVu] #415468
01/19/13 08:21
01/19/13 08:21
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
When I write a code example, it is not meant for you to type it in literally. It for _understanding_ how to use the GetProcAddress mechanism. My example code does not compile and does not use your variables.

I can help you understanding how to use a DLL and download prices, but I can not write pieces of your program.

Re: Downloading and Displaying Stock Market Data [Re: jcl] #415539
01/20/13 00:49
01/20/13 00:49
Joined: Jan 2013
Posts: 11
DejaVu Offline OP
Newbie
DejaVu  Offline OP
Newbie

Joined: Jan 2013
Posts: 11
Okay, sorry, I thought it was ment to be added in. I'll work on it, as you've said, in terms of tutorials provided by website, is there everything I need?


A name means nothing on the battlefield.
After a week no one has a name.
Page 2 of 3 1 2 3

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