Getting started with Visual C++ 2005

How to create strategies and indicators
Message
Author
AspenFox
Posts: 4
Joined: Tue Jun 07, 2016 2:14 pm

Getting started with Visual C++ 2005

#1 Postby AspenFox » Tue Jun 07, 2016 2:24 pm

Hi. I'm trying to get started with C++ & Forex Tester 2. I'm an experienced software professional but normally work on the linux side, though I have done a lot of MT4 programming as well.

I've got Visual C++ 2005 installed and tried to follow the tutorial instructions for C++ at this link:

viewtopic.php?t=1013

However, on the "Application Setting" page of the setup wizard, about half way down that page web page, I do not have the option of selecting "DLL". That option is ghosted.

The main problem I get when compiling is there is an include directive: "#include <windows.h>", and Visual C++ cannot find that file. It seems to be not included with Forex Tester, and not part of C++.

Is VC++ 2005 the right package to be using or is it outdated? Any advice is appreciated. Thanks.

AspenFox
Posts: 4
Joined: Tue Jun 07, 2016 2:14 pm

Re: Getting started with Visual C++ 2005

#2 Postby AspenFox » Wed Jun 08, 2016 12:14 pm

I should add that the <windows.h> include file is part of the ForexTester2 example indicator, Ishimoku.

Why does FT2 have an example indicator call for an include a file it does not provide?

FX Helper
Posts: 957
Joined: Mon Apr 01, 2013 3:55 am

Re: Getting started with Visual C++ 2005

#3 Postby FX Helper » Thu Jun 09, 2016 7:46 am

Hello

Windows.h should be available with any C++ compiler.
If you don't have it then we can recommend you to download it from the Internet.

AspenFox
Posts: 4
Joined: Tue Jun 07, 2016 2:14 pm

Re: Getting started with Visual C++ 2005

#4 Postby AspenFox » Fri Jun 10, 2016 1:40 pm

Thanks for the reply, FX Helper.

I did try that but to no avail. What I did do is start over with MS Visual C++ 2010. I didn't realize that was a separate package from 2005.

Still not able to reach home plate though. With 2010 I was able to select DLL on the new project menu, and compile with no issues related to windows.h. I do get a completed DLL file, though it's put in the "Debug" folder for some reason.

Next question should be simple: How do I add it to Forex Tester 2? I find the DLL file in the "Debug" folder, and I copy it to the ForexTester2\Indicators (the same as I would with MT4). I then go to Forex Tester and open a list of indicators to add to a chart, and it's not there. Restarting FT2 doesn't help.

I do notice all the other indicators in the folder have separate files with "idx" extensions, and my indicator does not have that. Perhaps that's the problem? If so, how do I create an idx file(s) for my new indicator?

Maybe 2005 wasn't installed with correct options or something, but anyone having a similar problem should just not use 2005. The setup instructions for 2005 are pretty much the same with 2010 (though the page I saw didn't include how to add the DLL indicator to a chart).

Thanks for whatever help I can get.

FX Helper
Posts: 957
Joined: Mon Apr 01, 2013 3:55 am

Re: Getting started with Visual C++ 2005

#5 Postby FX Helper » Mon Jun 13, 2016 9:57 am

Hello,

Please try to add this strategy via File -> Install -> Install New Strategy menu.

Then you should be able to see this strategy in the Tools -> Strategies List menu.

Regarding the .idx file, it is just a file with indicator's settings, it is created after you add an indicator on chart.

AspenFox
Posts: 4
Joined: Tue Jun 07, 2016 2:14 pm

Re: Getting started with Visual C++ 2005

#6 Postby AspenFox » Mon Jun 13, 2016 2:21 pm

Thanks again, FXHelper. I did since find the "Install" sections, but also started again. This time, I'm getting warnings and errors when compiling a strategy. These are occurring strictly with the example code provided in FT2, related only to the include file "strategyinterfaceunit.h". I've added no coding of my own. It appears there is some kind of incompatible versions of code somewhere?

Code: Select all

------ Build started: Project: DemoStrategy, Configuration: Debug Win32 ------
  DemoStrategy.cpp
c:\forextester2\examples\strategies\c++\strategyinterfaceunit.h(1110): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
          c:\program files\microsoft visual studio 10.0\vc\include\string.h(105) : see declaration of 'strcpy'
c:\forextester2\examples\strategies\c++\strategyinterfaceunit.h(1606): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
          c:\program files\microsoft visual studio 10.0\vc\include\string.h(105) : see declaration of 'strcpy'
c:\forextester2\examples\strategies\c++\strategyinterfaceunit.h(1607): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
          c:\program files\microsoft visual studio 10.0\vc\include\string.h(110) : see declaration of 'strcat'
c:\forextester2\examples\strategies\c++\strategyinterfaceunit.h(1726): error C2572: 'ObjectsDeleteAll' : redefinition of default parameter : parameter 2
          c:\forextester2\examples\strategies\c++\strategyinterfaceunit.h(634) : see declaration of 'ObjectsDeleteAll'
c:\forextester2\examples\strategies\c++\strategyinterfaceunit.h(1726): error C2572: 'ObjectsDeleteAll' : redefinition of default parameter : parameter 1
          c:\forextester2\examples\strategies\c++\strategyinterfaceunit.h(634) : see declaration of 'ObjectsDeleteAll'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Return to “FT API”

Who is online

Users browsing this forum: No registered users and 2 guests