| View previous topic :: View next topic |
| Author |
Message |
plasmapelz
Joined: 09 Sep 2008 Posts: 39
|
Posted: Tue Sep 09, 2008 9:31 pm Post subject: Debugging strategies and indicators |
|
|
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 |
|
 |
Terranin Site Admin

Joined: 21 Oct 2006 Posts: 831
|
Posted: Wed Sep 10, 2008 1:35 am Post subject: 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 |
|
| Back to top |
|
 |
plasmapelz
Joined: 09 Sep 2008 Posts: 39
|
Posted: Wed Sep 10, 2008 11:00 am Post subject: |
|
|
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 |
|
 |
Terranin Site Admin

Joined: 21 Oct 2006 Posts: 831
|
Posted: Wed Sep 10, 2008 1:18 pm Post subject: |
|
|
| 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 |
|
 |
plasmapelz
Joined: 09 Sep 2008 Posts: 39
|
Posted: Wed Sep 10, 2008 4:52 pm Post subject: |
|
|
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.
|
|
| Back to top |
|
 |
Terranin Site Admin

Joined: 21 Oct 2006 Posts: 831
|
Posted: Wed Sep 10, 2008 5:06 pm Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
plasmapelz
Joined: 09 Sep 2008 Posts: 39
|
Posted: Wed Sep 10, 2008 7:51 pm Post subject: |
|
|
| 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 . 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 |
|
 |
plasmapelz
Joined: 09 Sep 2008 Posts: 39
|
Posted: Wed Sep 10, 2008 8:30 pm Post subject: |
|
|
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 .
|
|
| Back to top |
|
 |
Terranin Site Admin

Joined: 21 Oct 2006 Posts: 831
|
Posted: Wed Sep 10, 2008 9:25 pm Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
pmxgs0
Joined: 04 Aug 2009 Posts: 11
|
|
| Back to top |
|
 |
Terranin Site Admin

Joined: 21 Oct 2006 Posts: 831
|
Posted: Mon Feb 15, 2010 12:36 am Post subject: |
|
|
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 |
|
 |
|