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...
Debugging strategies and indicators
- Terranin
- Site Admin
- Posts: 833
- Joined: Sat Oct 21, 2006 4:39 pm
Re: Debugging strategies and indicators
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
Mike
-
- Posts: 39
- Joined: Tue Sep 09, 2008 6:08 am
- Terranin
- Site Admin
- Posts: 833
- Joined: Sat Oct 21, 2006 4:39 pm
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
Mike
-
- Posts: 39
- Joined: Tue Sep 09, 2008 6:08 am
Thanks !
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.
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.
- Terranin
- Site Admin
- Posts: 833
- Joined: Sat Oct 21, 2006 4:39 pm
plasmapelz wrote:Thanks !
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
Mike
-
- Posts: 39
- Joined: Tue Sep 09, 2008 6:08 am
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 . 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 3:22 pm, edited 1 time in total.
-
- Posts: 39
- Joined: Tue Sep 09, 2008 6:08 am
Oh, I see that it works !
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 .
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 .
- Terranin
- Site Admin
- Posts: 833
- Joined: Sat Oct 21, 2006 4:39 pm
plasmapelz wrote:Oh, I see that it works !
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 .
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
Mike
-
- Posts: 11
- Joined: Tue Aug 04, 2009 1:08 pm
Attach to process (sample sma strategy) question
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
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
[[/img]Terranin wrote:plasmapelz wrote:Oh, I see that it works !
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 .
Ok, nice to hear that it works. I did not try it by myself, so I thought it does not work.
- Attachments
-
- ap.jpg (204.39 KiB) Viewed 18329 times
- Terranin
- Site Admin
- Posts: 833
- Joined: Sat Oct 21, 2006 4:39 pm
Who is online
Users browsing this forum: No registered users and 9 guests