Hi,
I want to monitor my pc script calculation time to make sure my pc is running strategy on optimal level all the time.
So I need a code which can provide millisecond difference to see how much time script used for calculation.
(Time) minus (time) = millisecond
Awaiting
Calculate script run time millisecond difference [SOLVED]
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: Calculate script run time millisecond difference
What is your CPU speed?Hi,
I want to monitor my pc script calculation time to make sure my pc is running strategy on optimal level all the time.
So I need a code which can provide millisecond difference to see how much time script used for calculation.
(Time) minus (time) = millisecond
Awaiting
Re: Calculate script run time millisecond difference
3.30ghzWhat is your CPU speed?
8 core
8gb ram
120gb ssd
windows server 2012 r2
I had run time issues with batch file. I want to make sure Multicharts is not facing this script issues. I am doubtful because few days back Order & Position Tracker show 8 seconds delay in issuing trade order. Normally I get 0 seconds delay in issuing order. But to be on safe side and monitoring purposes I need this code.
Thanks
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: Calculate script run time millisecond difference
For the moment, I think I go with these 2 lines, to keep code low bit as well and will manually calculate difference.
Code: Select all
Print("Start"," ",DateTimeToString_Ms(DateTime));
// Put all my code here
Print("End"," ",DateTimeToString_Ms(DateTime));
Re: Calculate script run time millisecond difference
For the moment, I think I go with these 2 lines, to keep code low bit as well and will manually calculate difference.
ThanksCode: Select all
Print("Start"," ",DateTimeToString_Ms(DateTime));
// Put all my code here
Print("End"," ",DateTimeToString_Ms(DateTime));
This function is providing bar Closed millisecond. if bar is 10:30 then it gave 10:30:00.000 all the time even.
This is bit better but its not in milliseconds
Code: Select all
CurrentTime_s
Do we have any better deeper computer clock function which can provide Milliseconds?
Thanks
Re: Calculate script run time millisecond difference
Code: Select all
MillisecondsFromDateTime(DateTime)
The Wiki is incorrect and needs to be edited.. https://www.multicharts.com/trading-sof ... omDateTime
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: Calculate script run time millisecond difference
Please check the code I have provided in this post.Do we have any better deeper computer clock function which can provide Milliseconds?
What is exactly incorrect in the description?MillisecondsFromDateTime(DateTime) should do what you want.
The Wiki is incorrect and needs to be edited.. https://www.multicharts.com/trading-soft ... omDateTime
Re: Calculate script run time millisecond difference
- Attachments
-
- 2014-05-20_0905.png
- (15.55 KiB) Downloaded 1224 times
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: Calculate script run time millisecond difference
Ok, I will check the millisecond link and code again.
But I found the issue. My strategy is using IOG and in IOG mode strategy don't recalculate at bar close. It only re-calculate if a TICK comes. If no tick at bar close then no re-calculation. Need to add RecalcLastBarAfter(1); to my code.
Thanks
But I found the issue. My strategy is using IOG and in IOG mode strategy don't recalculate at bar close. It only re-calculate if a TICK comes. If no tick at bar close then no re-calculation. Need to add RecalcLastBarAfter(1); to my code.
Thanks
Re: Calculate script run time millisecond difference
should do what you want.Code: Select all
MillisecondsFromDateTime(DateTime)
The Wiki is incorrect and needs to be edited.. https://www.multicharts.com/trading-sof ... omDateTime
I think We need to REPLACE "DateTime" in the code.
Re: Calculate script run time millisecond difference
I use it in several filters and very much am thankful we have it now But this isn't with time based bars...
I've never used this with IOG on. Couldn't you IntrabarPersist it? Of course its not being calculated EVERY MS, but at every tick which is what executes every other function ie: orders, alerts, indicators...
I've never used this with IOG on. Couldn't you IntrabarPersist it? Of course its not being calculated EVERY MS, but at every tick which is what executes every other function ie: orders, alerts, indicators...
Re: Calculate script run time millisecond difference [SOLVED]
Solved by Andrew.......
Thank you Andrew
Code: Select all
Print(DateTimeToString_Ms(computerdatetime));
Thank you Andrew
Re: Calculate script run time millisecond difference
I have added a final testing strategy on this below link which can provide Millisecond time stamp for;
a) Strategy calculation start time
b) Strategy calculation End time
c) Milli Second difference
http://www.multicharts.com/discussion/v ... 88#p104988
Thanks
a) Strategy calculation start time
b) Strategy calculation End time
c) Milli Second difference
http://www.multicharts.com/discussion/v ... 88#p104988
Thanks