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: 7775
- Joined: Aug 29 2006
- Location: Global Citizen
- Has thanked: 1036 times
- Been thanked: 2233 times
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
- faraz
- Posts: 221
- Joined: Feb 25 2011
- Location: 1stChoiceStrategy.com
- Has thanked: 26 times
- Been thanked: 71 times
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: Aug 25 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
- faraz
- Posts: 221
- Joined: Feb 25 2011
- Location: 1stChoiceStrategy.com
- Has thanked: 26 times
- Been thanked: 71 times
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));
- faraz
- Posts: 221
- Joined: Feb 25 2011
- Location: 1stChoiceStrategy.com
- Has thanked: 26 times
- Been thanked: 71 times
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
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: Aug 25 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
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
- Henry MultiСharts
- Posts: 9165
- Joined: Aug 25 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Done. Easy fix Thank you for reporting.
- faraz
- Posts: 221
- Joined: Feb 25 2011
- Location: 1stChoiceStrategy.com
- Has thanked: 26 times
- Been thanked: 71 times
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
- faraz
- Posts: 221
- Joined: Feb 25 2011
- Location: 1stChoiceStrategy.com
- Has thanked: 26 times
- Been thanked: 71 times
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.
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...
- faraz
- Posts: 221
- Joined: Feb 25 2011
- Location: 1stChoiceStrategy.com
- Has thanked: 26 times
- Been thanked: 71 times
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