You need to enable JavaScript in order to visit our site!
 
Logo PTMC
NAVIGATION
CANCEL
 
or via PTMC account
Restore password
or via PTMC account
Logo PTMC
NAVIGATION
or via PTMC account
Restore password
or via PTMC account
or via PTMC account
Restore password
or via PTMC account
PTMC team 12.07 2016

​How to debug a trading strategy with Visual Studio

Hey there, Protraders!

PTMC is not only a robust trading platform, but also a great tool for auto-trading implementation. It has powerful Algo Studio's backtesting features in the box and it grants an ability to boost your work with Visual Studio developing environment which is used by many coders around the world.

In previous review we shown you how to create a custom panel for PTMC trading platform using Visual Studio. This guide aims at arranging synergy between Algo Studio's backtesting and Visual Studio debugging. Lets start!

1) Set up the coding environment

Use MS Visual Studio.

Select File → New → Project .

In the following dialog window choose “.Net Framework 3,5”.

Select “Class Library” from drop-down list.

It is important to use .Net Framework 3,5 for PTMC coding.

Set up the coding environment. Select "Class Library" from drop-down list.

2) Add references in Solution Explorer

Rightclick on References → Add Reference

Add references in Solution Explorer

Browse for additional PTLRuntime.dll and Commons.dll files from the PTMC root folder (AppData\Roaming\ProtraderMC(xxbit)).

These files basically introduce API and are crucial for PTMC add-ons functioning.

If you use Visual Studio version higher than 2012, it is necessary to change option in menu DebugOptionsDebuggingGeneral (check Use Managed Compatibility Mode)

Debugging settings for Visual Studio 2012

Now, create an entry point for a debugging purpose (use PTMC API's method OnQuote()).

You can create an entry point for a debugging purpose

3) Check PTMC version

Check the version of your PTMC client.

If it is 32 bit version, it is important to choose target platform.

By default it is stated as "any CPU", which is 32 bit.

You can select manually x86. Do not build it on x64, it won't work.

If your PTMC client is 64 bit — any option will work.

Select or check PTMC version

4) Debbuging

Compile an application in Visual Studio.

Return to PTMC client and run Algo Studio (in Tools menu).

Open module and browse for your newly build .dll file (Documents\Visual Studio\Projects).

Get back to your Visual Studio and select menu Debug → Attach to Process.

Find process algostudio.exe and bind to it.

Place a breakpoint at OnQuote() method.

Visual Studio Debbuging

Return to Algo Studio and run backtesting.

Now you are able to debug your market strategy in Visual Studio. Enjoy this powerful option from PTMC!


Have not tried PTMC yet? There is no better way to boost knowledge than to use it! Start trading with PTMC now!

Discussion
Join PTMC community to post your comments
  • dreyes 13.07.2016
  • dreyes 13.07.2016
  • Bogdan Alexey 13.07.2016
  • Alejandrez Miguel 13.07.2016
PTMC is a professional trading platform that combines all the best charting and analytical tools to trade on different financial markets. It is developed by PFSOFT UK LTD, a global provider of trading technology for banks & brokers
© 2024. PTMC is based on Protrader technology
PFSOFT UK LTD
71-75, Shelton Street,
Covent Garden,
London, WC2H9SQ,
United Kingdom
Support & Development
PFSOFT Ukraine
Office #701
Mechnikova Street, 10B
49000, Dnipro, Ukraine
Contact us
Phone: +380 56 740 30 01
E-mail: info@protrader.org
Skype: PTMC_support
Find more ways to contact
Join us in social networks