Optimize Portfolio Horribly Slow, using DLL in strategy

Questions about MultiCharts and user contributed studies.
Posts: 1
Joined: 20 May 2010

Optimize Portfolio Horribly Slow, using DLL in strategy

Postby rodent » 20 May 2010

This may not be a multicharts problem, but I took an existing DLL that worked for regular strategy trading in TS and then started using it in Multicharts. I try to optimize portfolio with this DLL, and it runs very, very slowly.

So I have a few questions:

1) What process do I attach a debugger to in order to debug DLLs and figure out what is causing them to run so slowly?
2) How do I figure out where the program is spending its time to fix the speed issue?

Also, a few things I have noticed:

When the portfolio optimizer runs, I can see that the DLL is loaded multiple times. Not just once. I want to know which process these DLLs are being loaded into, because I see multiple DLL_PROCESS_ATTACH reasons in DllMain for the DLL execution.

So if my DLL accesses a database to load tables of data, this part is slow. So I changed my code to cache as much data as possible and to avoid load costs; however, the optimizer is still running very slowly.

I need some tips/tricks to speed up this process and make my strategies run faster, so it doesn't take up my entire license period just to run one optimization.

A sample of a function that my DLL calls would be something like this:

Code: Select all

external: "D:\code\TSDataBridge\Debug\DataBridge.dll", double, "GetOmega", IEasyLanguageObject,
        int {year}, int {month}, int {day}, string {sym}, string {invsym};

   _year( numericsimple ),
   _month( numericsimple ),
   _day( Numericsimple ),
   _sym( string ),
   _invsym( string );

ELGetOmega = GetOmega( self, _year, _month, _day, _sym, _invsym );

Any assistance at all would be very helpful.

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 486 times

Postby Dave Masalov » 25 May 2010

Dear rodent,

If you are talking about portfolio optimization, I believe that the process using your DLL file is PortfolioBacktester.exe. You can try to change the number of Dll loads in DLL_PROCESS_ATTACH using librarycount. This may speed up the performance.

Return to “MultiCharts”