Code: Select all
Function TS call rate MC call rate
50-bar sma 600K cps 3400K cps
200-bar sma 150K cps 900K cps
Bollinger band 270K cps 2460K cps
Code: Select all
external: "kernel32.dll", int, "GetTickCount";
vars:
tickCntBegin (0),
tickCntEnd (0),
timeElapsed (0),
niter (1000000),
idx (0),
callRate (0);
if (currentBar = 300) then
once begin
tickCntBegin = GetTickCount;
for idx = 1 to niter begin
// indicator to be benchmarked goes here
value1 = average(close, 200);
end;
tickCntEnd = GetTickCount;
timeElapsed = tickCntEnd - tickCntBegin;
if (timeElapsed > 10) then begin
callRate = niter*1000/timeElapsed;
print ("time elapsed = ", timeElapsed:0:0, " ms", newline,
callRate:0:0, " calls per second");
end else
print ("increase number of iterations since time elapsed is too low");
end;