Page 1 of 1

Check your Strategy calculation time in MilliSeconds

Posted: 21 May 2014
by faraz
Hello,

Attached strategy is a test strategy to calculate how much time Multicharts take to calculate code. It is very useful for auto trading and monitoring your PC optimal status.

Simple remove all these lines from code

Code: Select all

if lastbaronchart then Print(oText);
and place your code in it.

I added so many lines to make sure we get some difference. Small strategies get 0 millisecond. May be when when MC add Micro Second then we can calculate small strategies delay in calculation as well.

Once you run the strategy you will get this kind of response in PL Editor Output tab
Start 5/21/2014 14:02:51.593 End 5/21/2014 14:02:51.921 MilliSecond Difference 228.00

For Auto Trading purposes, You might like these links as well;
http://www.multicharts.com/discussion/v ... 64#p104664
http://www.multicharts.com/discussion/v ... =5&t=46551
http://www.multicharts.com/discussion/v ... =5&t=46468
http://www.multicharts.com/discussion/v ... f=5&t=3339

Good Luck and Successful Trading......

Thanks

Re: Check your Strategy calculation time in MilliSeconds

Posted: 19 Oct 2014
by PatrickSocal
Hi Faraz,

Thanks for the code... I've used something similar, and also used the code from here: viewtopic.php?f=1&t=46208#p103344
to call the Windows GetTickCount function.

I like computerdatetime better than calculate_time_ms, because the latter is limited by the resolution of the system timer, which is about 15 ms. computerdatetime seems to have resolution around 1 ms on my machine. I'm not sure what underlying Windows call it's using.

A Windows call that usually provides the finest resolution available is QueryPerformanceCounter. I created a thread for it here: viewtopic.php?f=1&t=47409

Perhaps you've written MC code to call DLL's like this before?

Re: Check your Strategy calculation time in MilliSeconds

Posted: 20 Oct 2014
by faraz
Hi Faraz,

Thanks for the code... I've used something similar, and also used the code from here: viewtopic.php?f=1&t=46208#p103344
to call the Windows GetTickCount function.

I like computerdatetime better than calculate_time_ms, because the latter is limited by the resolution of the system timer, which is about 15 ms. computerdatetime seems to have resolution around 1 ms on my machine. I'm not sure what underlying Windows call it's using.

A Windows call that usually provides the finest resolution available is QueryPerformanceCounter. I created a thread for it here: viewtopic.php?f=1&t=47409

Perhaps you've written MC code to call DLL's like this before?

Once I tested DLL and found calling DLL in code increase delay in execution so I never used DLL again.