Forex Tester Forum (Professional Training Software for Traders) Forum Index Forex Tester Forum (Professional Training Software for Traders)

Back to main site   Risk disclosure
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Debugging strategies and indicators

 
Post new topic   Reply to topic    Forex Tester Forum (Professional Training Software for Traders) Forum Index -> FT API
View previous topic :: View next topic  
Author Message
plasmapelz



Joined: 09 Sep 2008
Posts: 39

PostPosted: Tue Sep 09, 2008 9:31 pm    Post subject: Debugging strategies and indicators Reply with quote

Hi,

Is it possible to attach a delphi/C++ debugger to strategy DLL's while they are executed, to see what's going on and find memory leaks and other problems?
Would be very helpful to have a tutorial for this in the programming lessons section or in the application help...
Back to top
View user's profile Send private message
Terranin
Site Admin


Joined: 21 Oct 2006
Posts: 831

PostPosted: Wed Sep 10, 2008 1:35 am    Post subject: Re: Debugging strategies and indicators Reply with quote

plasmapelz wrote:
Hi,

Is it possible to attach a delphi/C++ debugger to strategy DLL's while they are executed, to see what's going on and find memory leaks and other problems?
Would be very helpful to have a tutorial for this in the programming lessons section or in the application help...


Unfortunately, it is not possible. You can only use command "Breakpoint" in strategy to pause it and show some info.

_________________
Hasta la vista
Mike
Back to top
View user's profile Send private message
plasmapelz



Joined: 09 Sep 2008
Posts: 39

PostPosted: Wed Sep 10, 2008 11:00 am    Post subject: Reply with quote

Thanks.

Is there a simple way to show information? Since the command line is not really available... Something built in to ForexTester?
Is "Breakpoint" part of the FT API or standard Delphi?
Back to top
View user's profile Send private message
Terranin
Site Admin


Joined: 21 Oct 2006
Posts: 831

PostPosted: Wed Sep 10, 2008 1:18 pm    Post subject: Reply with quote

plasmapelz wrote:
Thanks.

Is there a simple way to show information? Since the command line is not really available... Something built in to ForexTester?
Is "Breakpoint" part of the FT API or standard Delphi?


This command is a part of ForexTester API, you can show information with such commands:

- Print() - will print your string into the ForexTester Journal, see Journal panel
- Breakpoint() - will pause strategy execution and show dialog window with your message

_________________
Hasta la vista
Mike
Back to top
View user's profile Send private message
plasmapelz



Joined: 09 Sep 2008
Posts: 39

PostPosted: Wed Sep 10, 2008 4:52 pm    Post subject: Reply with quote

Thanks Very Happy!

For Visual Studio C++ it is possible to attach the debugger to a running process and then step into the .dll code that is executed. Don't know how/whether this works with Delphi or Turbodelphi, but it could be an option to try...
At the moment I am not at my computer, but I will check later and post the results.
Back to top
View user's profile Send private message
Terranin
Site Admin


Joined: 21 Oct 2006
Posts: 831

PostPosted: Wed Sep 10, 2008 5:06 pm    Post subject: Reply with quote

plasmapelz wrote:
Thanks Very Happy!

For Visual Studio C++ it is possible to attach the debugger to a running process and then step into the .dll code that is executed. Don't know how/whether this works with Delphi or Turbodelphi, but it could be an option to try...
At the moment I am not at my computer, but I will check later and post the results.


ForexTester has some protection from debugging as a part of antihacking shield.

_________________
Hasta la vista
Mike
Back to top
View user's profile Send private message
plasmapelz



Joined: 09 Sep 2008
Posts: 39

PostPosted: Wed Sep 10, 2008 7:51 pm    Post subject: Reply with quote

Quote:
ForexTester has some protection from debugging as a part of antihacking shield.


Do you plan to change this?
For real work with the strategies and indicator API I think it is absolutely necessary to have a sophisticated debugging model. It costs too much time to track bugs with Print(), when the code grows...

I hope there is a different way to protect the application from hacking? There should be - I know quite a few commercial applications where you can debug self written dll extensions. Even Microsoft allows it Wink. Most programs that I know let you step only in your own DLL, so you don't see the source code of the host application itself. This would be perfectly OK to debug a strategy DLL...


Last edited by plasmapelz on Wed Sep 10, 2008 8:22 pm; edited 1 time in total
Back to top
View user's profile Send private message
plasmapelz



Joined: 09 Sep 2008
Posts: 39

PostPosted: Wed Sep 10, 2008 8:30 pm    Post subject: Reply with quote

Oh, I see that it works Very Happy!

Just start Turbo Delphi and Forextester, make sure that the strategy DLL is loaded in Forextester. Open the strategy project in Turbo Delphi. Choose Start->"Attach to process" and select "ForexTester.exe" from the list. Click "continue" (the green arrow), to release control from ForexTester.
Then you can set breakpoints in the GetSingleTick() procedure (click next to the line left). They are hit as soon as you enter testing mode and connect using your strategy. The procedure stops at the breakpoint and you'll see all the variables and their values in Turbo Delphi and can step through the code with F7/F8/F9.

Very helpful indeed! That's all that I need for debugging... no worries Wink.
Back to top
View user's profile Send private message
Terranin
Site Admin


Joined: 21 Oct 2006
Posts: 831

PostPosted: Wed Sep 10, 2008 9:25 pm    Post subject: Reply with quote

plasmapelz wrote:
Oh, I see that it works Very Happy!

Just start Turbo Delphi and Forextester, make sure that the strategy DLL is loaded in Forextester. Open the strategy project in Turbo Delphi. Choose Start->"Attach to process" and select "ForexTester.exe" from the list. Click "continue" (the green arrow), to release control from ForexTester.
Then you can set breakpoints in the GetSingleTick() procedure (click next to the line left). They are hit as soon as you enter testing mode and connect using your strategy. The procedure stops at the breakpoint and you'll see all the variables and their values in Turbo Delphi and can step through the code with F7/F8/F9.

Very helpful indeed! That's all that I need for debugging... no worries Wink.


Ok, nice to hear that it works. I did not try it by myself, so I thought it does not work.

_________________
Hasta la vista
Mike
Back to top
View user's profile Send private message
pmxgs0



Joined: 04 Aug 2009
Posts: 11

PostPosted: Sun Feb 14, 2010 11:11 pm    Post subject: Attach to process (sample sma strategy) question Reply with quote

Hi,

I'm just starting to learn Delphi and I was trying to use the debugger in the strategy included in FT folder (SMA),through attach to process, but I'm always getting an error " Cannot get price.. (please see attached).

Does anyone know what is the problem?

thanks

Terranin wrote:
plasmapelz wrote:
Oh, I see that it works Very Happy!

Just start Turbo Delphi and Forextester, make sure that the strategy DLL is loaded in Forextester. Open the strategy project in Turbo Delphi. Choose Start->"Attach to process" and select "ForexTester.exe" from the list. Click "continue" (the green arrow), to release control from ForexTester.
Then you can set breakpoints in the GetSingleTick() procedure (click next to the line left). They are hit as soon as you enter testing mode and connect using your strategy. The procedure stops at the breakpoint and you'll see all the variables and their values in Turbo Delphi and can step through the code with F7/F8/F9.

Very helpful indeed! That's all that I need for debugging... no worries Wink.


Ok, nice to hear that it works. I did not try it by myself, so I thought it does not work.
[[/img]


ap.jpg
 Description:
 Filesize:  204.39 KB
 Viewed:  4257 Time(s)

ap.jpg


Back to top
View user's profile Send private message
Terranin
Site Admin


Joined: 21 Oct 2006
Posts: 831

PostPosted: Mon Feb 15, 2010 12:36 am    Post subject: Reply with quote

You can have this error when you generated ticks for some pair, for example GBPJPY, and did not generate ticks for USDJPY. You will get profit in JPY but it should be converted into USD. Without extra information (generated ticks for USDJPY) it is not possible.
_________________
Hasta la vista
Mike
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Forex Tester Forum (Professional Training Software for Traders) Forum Index -> FT API All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group