Time difference? (Duration of trade)

Created at 23 Aug 2016, 17:52
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
CL

cloesd

Joined 28.02.2015

Time difference? (Duration of trade)
23 Aug 2016, 17:52


Hi,

I'm trying to write a bot that uses duration a trade has been opened.

 

So far I've got:

 

 Print(positionPain.EntryTime - Time);

 

Which prints: -00:01:34.47000 etc.

 

But I need to compare this to some set value. For example if trade has been opened for longer than 2 hours.

 

I tried using greater than sign:

"if (positionPain.EntryTime - Time > 120)"

But it didn't work.

How can I conduct logical operations on a 'time' difference?


@cloesd
Replies

rmssf
25 Aug 2016, 23:13

Hi,

That is specific to the C# programming language.

This may be useful:

https://msdn.microsoft.com/en-us/library/8ysw4sby(v=vs.110).aspx

 

Regards,

Rui


@rmssf