How to use Delphi debugger to debug your strategy

Examples step by step how to make your own automated strategy or user indicator
Message
Author
User avatar
Terranin
Site Admin
Posts: 833
Joined: Sat Oct 21, 2006 4:39 pm

How to use Delphi debugger to debug your strategy

#1 Postby Terranin » Fri Aug 14, 2009 6:50 pm

Here it is steps how to use Delphi debugger with strategy in Forex Tester:

1. You need to copy all your strategy files (strategy *.dpr and StrategyInterfaceUnit.pas, TechnicalFunctions.pas) to the <ForexTester>\Strategies\ folder.

2. Compile your strategy before you start ForexTester in this folder. Enable all debug options in Project -> Options -> Compiler. (do not install strategy via File menu, you need to compile it exactly in this folder).

3. Start ForexTester.

4. In Delphi go to menu Run -> Attach to process and select there ForexTester.exe.

5. Now you can set breakpoints, go step by step, and see variables. Works fine for me.
Attachments
1.png
1.png (51.64 KiB) Viewed 13748 times
2.png
2.png (23.62 KiB) Viewed 13748 times
3.png
3.png (14.09 KiB) Viewed 13748 times
4.png
4.png (52.39 KiB) Viewed 13748 times
5.png
5.png (51.65 KiB) Viewed 13748 times
Hasta la vista
Mike

superdoug3
Posts: 58
Joined: Thu Apr 29, 2010 2:37 pm
Location: vernon, BC, Canada

#2 Postby superdoug3 » Thu Jun 03, 2010 3:40 pm

My environment
Delphi 7, XP / SP3, FT2.6.1
my Stratedgy runs in FT2.6.1 but has bugs

Successfully ran through all of your steps to get Delphi 7 into debug mode, then I set a break point in proc InitStrategy, I then hit F9 to run Delphi with FT.
error message is 'can not debug project unless a host appl is defined, use the Run/Parameters dialog box.
Now, according to taskmanager, FT has stopped responding

FT Support
Posts: 905
Joined: Sat Jul 11, 2009 10:54 am
Contact:

#3 Postby FT Support » Fri Jun 04, 2010 2:36 am

Hello,

Please check that you cave attached Delphi to the ForexTester.exe process and that you have your Delphi project in [Forex Tester path]/Strategies folder.

superdoug3
Posts: 58
Joined: Thu Apr 29, 2010 2:37 pm
Location: vernon, BC, Canada

#4 Postby superdoug3 » Fri Jun 04, 2010 6:06 pm

It appears that there is another step to add to this process
in Run/Parameters, you browse to ForexTester > forextester.exe

Now it is running debugger, but I am still having problems,
I set breakpoint inside of getsingleTick, F9 to run, asks me if I want to rebuild because modified, YES, F9 again runs to breakpoint and says 'debugger detected, please close it down and restart'


do you have a link on how I should run Delphi Debugger. I only know
F5 - set breakpoint
F4 - run to here

when I X out of Delphi, seems to have damaged FT and I have to reinstall FT again. Maybe I should unattach FT from Delphi before X out of Delphi ?

Running Delphi 7 on XP-SP3 with FT V 6.2.1

Michalec
Posts: 1
Joined: Sun Nov 24, 2013 9:42 pm

#5 Postby Michalec » Sat Nov 30, 2013 12:39 am

1.Run your app
2.Run Process Explorer (after downloading it ;-)
3.Double click on your executable in the process list
Select the Threads tab and there you will see:
The Thread ID
CPU Usage
Cycles Delta
And the start address
The TID ought to be enough to nail down your CPU hogging thread.

arodatos
Posts: 3
Joined: Tue Oct 18, 2016 5:18 am

Re: How to use Delphi debugger to debug your strategy

#6 Postby arodatos » Wed Oct 19, 2016 5:03 am

Hello everybody,
I’m little bit frustrated with this tutorial, seems that everyone is getting the same error. In my view, It would be so helpful to have *.dpr files of the following strategies (included en FT3):

• Strategy1.dll
• Strategy2.dll
• Strategy3.dll
• …
I mean from Strategy 1 to 7.

Please, could someone help us with this?
Many thanks
Alvaro

wasaykh
Posts: 3
Joined: Fri Oct 21, 2016 11:49 pm

Re: How to use Delphi debugger to debug your strategy

#7 Postby wasaykh » Sat Oct 22, 2016 10:06 am

Yes, agree with Alvaro,

Please help post the source *.dpr files of strategies 1 to 7

Thanks!

arodatos
Posts: 3
Joined: Tue Oct 18, 2016 5:18 am

Re: How to use Delphi debugger to debug your strategy

#8 Postby arodatos » Mon Oct 24, 2016 11:58 am

Dear all,
FT3 support sent me the *dpr file from strategies 1 to 7. If someone is interested, send me an e-mail to alrodatos@gmail.com. I’ll send it back to you.
Regards.
Álvaro


Return to “Programming lessons”

Who is online

Users browsing this forum: No registered users and 3 guests