SmartQuant Discussion
http://www.smartquant.com/forums/

Hot to set a time stop?
http://www.smartquant.com/forums/viewtopic.php?f=42&t=7541
Page 1 of 1

Author:  fliesch [ Sat Jul 11, 2009 12:47 am ]
Post subject:  Hot to set a time stop?

Somehow I am not able to program a time stop after e.g. 10 bars after entry.

Any help?

Author:  MaRCHeW [ Sat Jul 11, 2009 11:04 am ]
Post subject: 

Hi :)

Count new bar from order entry or its better way use DateTime structure which will be check order entry time and present time.

Regards
MaRCHeW

Author:  fliesch [ Sat Jul 11, 2009 11:26 pm ]
Post subject: 

"DateTime structure which will be check order entry time and present time. "

Position.EntryTime ok.
Present time: Clock.Now or Bar.EndTime?

But how to calculate the difference? In Bars? Tried something with Bar.Duration but did not work.

Author:  Johnson [ Mon Jul 13, 2009 2:24 pm ]
Post subject: 

Check out the TimeSpan class. Its easy.

For example:
Code:
TimeSpan ts = new TimeSpan();
ts = datetime1 - datetime2;
if (ts.Minutes > 15)
   Console.WriteLine("hi");
[/code]

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/