0% found this document useful (0 votes)
13 views4 pages

TradeStation Forum - Step-by-Step Guide To Creating A TS-Compatible DLL

This document is a step-by-step guide for creating a DLL compatible with TradeStation using Visual C++ 2010 Express. It outlines the process of setting up a new project, adding source files, defining functions, and configuring the project to build the DLL. The guide concludes with instructions on how to use the created DLL in a TradeStation indicator, demonstrating its functionality.

Uploaded by

Alexander Rios
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views4 pages

TradeStation Forum - Step-by-Step Guide To Creating A TS-Compatible DLL

This document is a step-by-step guide for creating a DLL compatible with TradeStation using Visual C++ 2010 Express. It outlines the process of setting up a new project, adding source files, defining functions, and configuring the project to build the DLL. The guide concludes with instructions on how to use the created DLL in a TradeStation indicator, demonstrating its functionality.

Uploaded by

Alexander Rios
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

29/10/24, 15:23 TradeStation Forum - Step-by-Step Guide to Creating a TS-Compatible DLL

TradeStation Community Developer Center Institutional Services Call Tradestation 800.822.0512 Client Center LogOff

You are logged in to the forums as YanquiTrucho


NO NEW PRIVATE MESSAGES

TradeStation Wiki | Most Recent Forum Posts | My Forum Subscriptions | Forum Help | Quick Forum Search Go | Advanced Forum Search

Home > All Forums > TradeStation and EasyLanguage Support >
EasyLanguage > EasyLanguage-DLL > Step-by-Step Guide to Creating a TS-Compatible DLL

3 Pages 1 2 3
Next Page

Author Topic

Mathemagician
Posted - 08/18/2012 21:02:35

10090 Posts This is a step by step guide to creating a DLL that can be called from TS. It's something I would have found useful but
doesn't exist, so here goes...

If you don't have Visual C++ 2010 Express, you can get it for free from here: http://www.microsoft.com/visualstudio/en-
us/products/2010-editions/express

The first step is to create a new project for our DLL:


In Visual Studio Express 2010, click File/New Project.
Select Win32 Project. Name it "TestDLL".
Click Next.
Select DLL as the Application Type and check the Empty Project box. Click Finish.

Now, we make sure Visual Studio is showing us all of the menus:


Select the Tools/Settings/Expert Settings menu item.

Next we add a C++ file to our project, which will contain our functions:
Right-click "Source Files", select Add, select New Item, select C++ File. Name the file "TestDLL.cpp" and click Add.

Now we add a simple test function that will just add 1 to whatever number you send it:
Put this in the TestDLL.cpp file you just created:

long __stdcall TestFunction(long intFromTS)


{
return intFromTS + 1;
}

select all

Next, we add a DEF file to our project so that Visual Studio knows which files we want to make available
outside the DLL:
Right-click "Source Files", select Add, select New Item, select C++ File. Name the file "TestDLL.def" and click Add.
Put this in the TestDLL.def file you just created:

LIBRARY TestDLL
EXPORTS
TestFunction

select all

Now we have to tell the linker to include our DEF file:

https://community.tradestation.com/Discussions/Topic.aspx?Topic_ID=122154&SearchTerm=SDK&txtExactMatch= 1/4
29/10/24, 15:23 TradeStation Forum - Step-by-Step Guide to Creating a TS-Compatible DLL
Click the Project/TestDLL Properties menu item.
Select All Configurations from the dropdown list at the top left of the Properties window.
Within the project properties, go to Linker/Input. (You may need to check the Show All Settings box.)
Type TestDLL.def into the Module Definition File property.
Click OK.

For now, we should use the Release configuration so that our DLL can run on any machine:
On the Visual Studio toolbar, change the active configuration from Debug to Release.

Now we're ready to build the project:


Click the Build/Build menu item.

Our DLL is ready to use! Let's put it where TS can find it:
Go to the project's Release output directory (something/Visual Studio 2010/Projects/TestProject/Release).
Copy the TestDLL.dll file to the Tradestation Program directory.

Now, let's use our new DLL in a simple indicator:


Within TS, create a new indicator called "Test Function".
Put this code into the indicator:

external: "TestDLL.dll", Long, "TestFunction", Long;

plot1(TestFunction(1));

select all

Add the indicator to a chart.


It should plot a steady line at 2.

Congratulations! The DLL you just created should run on any PC, not just the one that you built it on. Hopefully,
you can take it from there!

4trading
Posted - 08/18/2012 22:03:39

9422 Posts thanks Math

QiWeed
Posted - 08/18/2012 22:58:23

198 Posts Great tutorial, can't wait to try it out...


Thanks
Tom

Mathemagician
Posted - 08/18/2012 23:01:12

10090 Posts Here's how to create a COM wrapper using C++ that will let you access a .NET DLL written in C#:
https://community.tradestation.com/Discussions/Topic.aspx?Topic_ID=122156

campysteve
Posted - 08/19/2012 13:17:42

458 Posts Thanks JJ, very informative and much needed......

pinetree
Posted - 08/19/2012 15:56:00

261 Posts Good job, now I have to figure out C#. I have at least 4 books on it, so time to get past the first chapters building a form!!

Thanks Math

Tom47
Posted - 08/19/2012 17:47:09

18790 Posts This is the kind of guide that non programmers or wannabe programmers like me really need. Thanks for going to the
trouble. I'd be interested in knowing how long it took you to do this.

Mathemagician
Posted - 08/19/2012 18:12:45

10090 Posts
quote:

Originally posted by Tom47


This is the kind of guide that non programmers or wannabe programmers like me really need. Thanks for going
to the trouble. I'd be interested in knowing how long it took you to do this.

https://community.tradestation.com/Discussions/Topic.aspx?Topic_ID=122154&SearchTerm=SDK&txtExactMatch= 2/4
29/10/24, 15:23 TradeStation Forum - Step-by-Step Guide to Creating a TS-Compatible DLL
Putting both of these together took just about the whole bottle of wine.

Tom47
Posted - 08/19/2012 18:39:27

18790 Posts
quote:

Originally posted by Mathemagician

quote:

Originally posted by Tom47


This is the kind of guide that non programmers or wannabe programmers like me really need.
Thanks for going to the trouble. I'd be interested in knowing how long it took you to do this.

Putting both of these together took just about the whole bottle of wine.

That's what I was afraid of.

Honza K.
Posted - 08/20/2012 04:01:26

2523 Posts Great addition Math, many thanks for your effort!

drjohn
Posted - 08/21/2012 12:48:12

48 Posts If any of you could recommend an instructional book to learn the C languages for someone who knows EasyLanguage what
would it be?

Mathemagician
Posted - 08/21/2012 13:44:01

10090 Posts I found the videos here to be extremely helpful: http://www.learnvisualstudio.net/

Hilotrader
Posted - 11/24/2012 07:16:58

53 Posts Hello
I did all this as described - but got :
Cannot find function TestFunction in DLL file Test.DLL.dll
Did I miss sth.?

Kind regs
Jojo

Mathemagician
Posted - 11/24/2012 09:32:11

10090 Posts That's most likely the DEF file. Make sure you've done all of those steps.

Surrey_Lad
Posted - 11/24/2012 09:53:52

60 Posts Excellent introduction to the subject - enabling others to go that one step further

Hilotrader
Posted - 11/25/2012 10:44:59

53 Posts Did everything again - deleted everything and did again - after compiling the release got error
the programm"C\.....\Release\TestDLL.dll" cannot be started .Had a look again to
TestDLL.def in the Module Definition File property and it has disappeared ????
Tried several times with click ok only other times with take over and then ok ,
but same result very strange

Mathemagician
Posted - 11/25/2012 10:48:16

10090 Posts When changing settings make sure All Configurations is selected at the top of that form. Otherwise, you might be changing
settings for only the Debug configuration.

Hilotrader
Posted - 11/25/2012 11:21:50

53 Posts sorry same result after select All configurations - puh

LongScalper
Posted - 11/25/2012 11:21:51

1454 Posts What are some practical uses for this kind of programming? Thanks...

Hilotrader
Posted - 11/25/2012 11:24:14

53 Posts

https://community.tradestation.com/Discussions/Topic.aspx?Topic_ID=122154&SearchTerm=SDK&txtExactMatch= 3/4
29/10/24, 15:23 TradeStation Forum - Step-by-Step Guide to Creating a TS-Compatible DLL

LongScalper you can do calcs you cannot do within TS


Posted - 11/25/2012 11:45:59

1454 Posts gotcha Hilo... I understand the language capabilities exceed that of TS but maybe expand on that a bit.
Not looking for anything proprietary, guess my analytical universe needs to be widened some.
What practical results/answers do you arrive at with the more extensive calculations. Is it for
more detailed auto trading features or for trading pattern discovery or both or something else?

Hilotrader
Posted - 11/25/2012 11:51:46

53 Posts I'm sorry - just started with this Dll stuff - was always ahead of my mind - but with this genious
explanations of Mathemagician - Thank you here

maybe look around here for starting:


https://community.tradestation.com/discussions/topic.aspx?topic_id=78430

Hilotrader
Posted - 12/15/2012 09:56:49

53 Posts Is it possible for what reason ever , that this stuff is not working with Win7?
I can not imagine why such a simple dll is always returning
"Cannot find function TestFunction in DLL file Test.DLL.dll "
this happened several times even when testing other dll's from the forum.
Maybe you can help me out there.

theHook
Posted - 12/15/2012 10:10:18

7019 Posts Hilotrader, Where did you store the DLL? Is your system a 64 bit or 32 bit system?

Hilotrader
Posted - 12/15/2012 10:21:58

53 Posts Just found out you have to write


LIBRARY "TestDLL"
EXPORTS
TestFunction

with ""
oh whao but answering the question - 64 bit

theHook
Posted - 12/15/2012 10:45:03

7019 Posts Where did you put the DLL, SysWow64 or in the TradeStation Program subfolder? If it is working, Great!

Next Page

3 Pages 1 2 3

Quick Reply
Message:

Submit Reply Preview Reply Reset Form

All support, education and training services and materials on the TradeStation Securities Web site are for informational purposes and to help customers learn more about how to use the power of
TradeStation software and services. No type of trading or investment advice or strategy is being made, given or in any manner provided by TradeStation Securities or its affiliates.

Call a TradeStation Specialist 800.808.9336

TradeStation Securities, Inc. and TradeStation Technologies, Inc. are each wholly owned subsidiaries of TradeStation Group, Inc., all operating, and providing products and services, under the
TradeStation brand and trademark. When applying for, or purchasing, accounts, subscriptions, products and services, it is important that you know which company you will be dealing
with. Please click here for further important information explaining what this means.

Important Documents Security Center Privacy Notice FAQ

TradeStation.com Discussion
This page was generated in 3.67 seconds.
2003-2024 TradeStation.com.

https://community.tradestation.com/Discussions/Topic.aspx?Topic_ID=122154&SearchTerm=SDK&txtExactMatch= 4/4

You might also like