Multicharts code Timing process?
Posted: Jul 07 2011
Hello
I got interrogation on MC code timing process. A simple delay code will produce on a regular basis of 1 second an updated print, but will monopolize all MC resource to it
This code works perfectly. But the "While cmp < 20" use all the resource of MC . All process clock is devoted to the routine. It won't allow to stop the indicator using Format Studies Indicators, Stop.
So I modified the code to remove the While conditionOnly, this time the delay code is not executed. No new value of CMP is
I did try to replace the "While CMP < 20" for
- If LastbarOnTheChart then Begin.
- If BarStatus = 1 Then Begin
- If BarStatus = 2 then Begin
What could be the condition to trigger this time delay routine test?
Any help appreciated
Martin
I got interrogation on MC code timing process. A simple delay code will produce on a regular basis of 1 second an updated print, but will monopolize all MC resource to it
Code: Select all
inputs : Seconds.Delay (1);
vars : Targettime(0);
Vars: CMP (0);
Targettime = ComputerDateTime + (Seconds.Delay*0.0000115740) ;
While cmp <20 begin
IF ComputerDateTime >= Targettime then Begin
CMP = CMP +1;
print (CMP:0:0, " ", time:5:8);
Targettime= ComputerDateTime + (Seconds.Delay*0.0000115740) ;
end; //IF ComputerDateTime >= Targettime then Begin
end; // While cmp <20 begin
So I modified the code to remove the While condition
Code: Select all
inputs : Seconds.Delay (1);
vars : Targettime(0);
Vars: CMP (0);
Targettime = ComputerDateTime + (Seconds.Delay*0.0000115740) ;
Print (Cmp:0:0, " start");
IF ComputerDateTime >= Targettime then Begin
CMP = CMP +1;
print (CMP:0:0, " ", time:5:8);
Targettime= ComputerDateTime + (Seconds.Delay*0.0000115740) ;
end;
I did try to replace the "While CMP < 20" for
- If LastbarOnTheChart then Begin.
- If BarStatus = 1 Then Begin
- If BarStatus = 2 then Begin
What could be the condition to trigger this time delay routine test?
Any help appreciated
Martin