Problem with lesson 1

Examples step by step how to make your own automated strategy or user indicator
Message
Author
timpanogos1
Posts: 1
Joined: Mon Sep 28, 2009 11:11 pm

Problem with lesson 1

#1 Postby timpanogos1 » Mon Sep 28, 2009 11:19 pm

I followed your instructions to create the DemoStrategy file on Delphi. I cut and pasted your code into Delphi, saved it, compiled it, then copied the .dll file to the ForexTester folder as you described.

Then I restarted FT and when I open the Strategies window, the name of the Strategy is truncated to "D", and the description is "D".

Here is my code, which I copied from your post:

library DemoStrategy;

uses
SysUtils, StrategyInterfaceUnit, TechnicalFunctions;

procedure InitStrategy; stdcall;
begin
StrategyShortName('DemoStrategy');
StrategyDescription('Demo strategy that does nothing');
end;

procedure DoneStrategy; stdcall;
begin

end;

procedure ResetStrategy; stdcall;
begin

end;

procedure GetSingleTick; stdcall;
begin

end;

exports
InitStrategy,
DoneStrategy,
ResetStrategy,
GetSingleTick;

end.


I am using Delphi 2010, and FT 2.3

Just to see if it would work, I tried the same thing on the '8 hour strategy' you have in your other lesson. The same thing happened. And there was only one parameter available, which was the currency parameter.

Something is not quite right. Could you help me with this?

Thanks,

Brandon

User avatar
Terranin
Site Admin
Posts: 833
Joined: Sat Oct 21, 2006 4:39 pm

Re: Problem with lesson 1

#2 Postby Terranin » Thu Oct 01, 2009 10:04 am

timpanogos1 wrote:I followed your instructions to create the DemoStrategy file on Delphi. I cut and pasted your code into Delphi, saved it, compiled it, then copied the .dll file to the ForexTester folder as you described.

Then I restarted FT and when I open the Strategies window, the name of the Strategy is truncated to "D", and the description is "D".

Here is my code, which I copied from your post:

library DemoStrategy;

uses
SysUtils, StrategyInterfaceUnit, TechnicalFunctions;

procedure InitStrategy; stdcall;
begin
StrategyShortName('DemoStrategy');
StrategyDescription('Demo strategy that does nothing');
end;

procedure DoneStrategy; stdcall;
begin

end;

procedure ResetStrategy; stdcall;
begin

end;

procedure GetSingleTick; stdcall;
begin

end;

exports
InitStrategy,
DoneStrategy,
ResetStrategy,
GetSingleTick;

end.


I am using Delphi 2010, and FT 2.3

Just to see if it would work, I tried the same thing on the '8 hour strategy' you have in your other lesson. The same thing happened. And there was only one parameter available, which was the currency parameter.

Something is not quite right. Could you help me with this?

Thanks,

Brandon


Probably you use Delphi version with Unicode support. So each symbol in string is coded with 2 bytes. Check settings in project and use normal strings.
Hasta la vista
Mike

msmccray65
Posts: 8
Joined: Sun Nov 08, 2009 12:14 pm

Re: Problem with lesson 1

#3 Postby msmccray65 » Sun Nov 15, 2009 6:32 pm

Where do I go to do that? I've downloaded the free 30 day Delphi trial to troubleshoot some lazarus problems and have the same Unicode issue.

Thanks,
Michael

User avatar
Terranin
Site Admin
Posts: 833
Joined: Sat Oct 21, 2006 4:39 pm

Re: Problem with lesson 1

#4 Postby Terranin » Sun Nov 15, 2009 6:55 pm

msmccray65 wrote:Where do I go to do that? I've downloaded the free 30 day Delphi trial to troubleshoot some lazarus problems and have the same Unicode issue.

Thanks,
Michael



Do not have the latest Delphi version. I think all declarations of "string" there mean wide strings. Try to find in project settings compatibility mode with previous versions of Delphi or replace all string types to AnsiString in API units and use the same strings in your project.
Hasta la vista

Mike

msmccray65
Posts: 8
Joined: Sun Nov 08, 2009 12:14 pm

Re: Problem with lesson 1

#5 Postby msmccray65 » Sun Nov 15, 2009 10:20 pm

Terranin wrote:
msmccray65 wrote:Where do I go to do that? I've downloaded the free 30 day Delphi trial to troubleshoot some lazarus problems and have the same Unicode issue.

Thanks,
Michael



Do not have the latest Delphi version. I think all declarations of "string" there mean wide strings. Try to find in project settings compatibility mode with previous versions of Delphi or replace all string types to AnsiString in API units and use the same strings in your project.


If you convert the 'string' variables to 'ANSIstring' it does work with a warning. I couldn't find a compatibility mode on their software. Given the 30 day trial for Delphi 2010, I hope to get Lazarus to work otherwise I'll have to use C++.

Thanks,
Michael

Arnold
Posts: 1
Joined: Sun Aug 12, 2012 7:29 am
Location: South Africa

Compile error with lesson 1

#6 Postby Arnold » Sun Aug 12, 2012 8:18 am

Hi

As introduction, this will be my first post inthe forum. I recently bought FT2 because Iwant to backtest some ideas. After reading the first few stickies on the forum I purchased Delphi XE2.

I am following along on th programming lesson 1 and ran into a problem after compiling the forum first lesson. The compiler finds a problem when compiling DemoStrategy , it opens the StategyInterfaceUnit file and redlines a line, (see the attached file), there is also an error message on the bottom.

Maybe one of you guys can tell me how to fix it?
Attachments
Lessen 1 - Compile error.jpg
Lessen 1 - Compile error.jpg (141.63 KiB) Viewed 12329 times

KelvinHand
Posts: 103
Joined: Sun Jan 02, 2011 6:05 pm

Re: Compile error with lesson 1

#7 Postby KelvinHand » Tue Aug 28, 2012 1:07 am

Arnold wrote:Hi

As introduction, this will be my first post inthe forum. I recently bought FT2 because Iwant to backtest some ideas. After reading the first few stickies on the forum I purchased Delphi XE2.

I am following along on th programming lesson 1 and ran into a problem after compiling the forum first lesson. The compiler finds a problem when compiling DemoStrategy , it opens the StategyInterfaceUnit file and redlines a line, (see the attached file), there is also an error message on the bottom.

Maybe one of you guys can tell me how to fix it?


I don't use Delphi XE2. but I think problem could be quite simple
"File not found" refer to Library Graphics.DCU.

This indicate the compiler try to search the lib path and could not find the file.


Based on your picture quit similar.
Goto "Tool" -> "Environment options"-> "Library" Tab.
In the directories section Lib Path:

for example:
Check for the variable such as ...$(DELPHI)\Lib; ....

This should point to you library location.

$(DELPHI) is setup in the "Environment Variables" Tab pointing you to the direction of your delphi library

for example:
DELPHI = c:\program files (x86)\borland\delphi7

Examples above is only my configuration, may not be your default.

To confirm the Graphics.DCU is in c:\program files (x86)\borland\delphi7\lib. Do manual check it is in that folder.

And trail by error.

Otherwise seek help from the vendor you brought from.

Hope this help you.


Return to “Programming lessons”

Who is online

Users browsing this forum: No registered users and 15 guests