Check your Strategy calculation time in MilliSeconds

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
faraz
Posts: 144
Joined: 25 Feb 2011
Has thanked: 26 times
Been thanked: 57 times

Check your Strategy calculation time in MilliSeconds

Postby faraz » 21 May 2014

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
Attachments
Test2.zip
(4.4 KiB) Downloaded 400 times

User avatar
PatrickSocal
Posts: 58
Joined: 27 Apr 2013
Location: San Diego, CA
Has thanked: 23 times
Been thanked: 30 times

Re: Check your Strategy calculation time in MilliSeconds

Postby PatrickSocal » 19 Oct 2014

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?

faraz
Posts: 144
Joined: 25 Feb 2011
Has thanked: 26 times
Been thanked: 57 times

Re: Check your Strategy calculation time in MilliSeconds

Postby faraz » 20 Oct 2014

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.


Return to “User Contributed Studies and Indicator Library”