Trade Duration in mins
01 Apr 2016, 23:39
Hi all,
How do i calculate trade duration in mins,
Suppose i want to close losing position after 10 mins from entry,
position.entrytime give us time of entry but how to compare it to current time & get answer in mins.
Spotware team please help
Replies
commando1
02 Apr 2016, 00:29
Super .... thanks it worked
foreach (var Position in Positions)
{
if ((Time - Position.EntryTime).TotalMinutes >= 10.0 && Position.NetProfit < 0)
{
ClosePosition(Position);
}
@commando1

solark
02 Apr 2016, 00:02
RE:
Either OnBar or OnTick (depends on your situtation) you'll want
if ((x.Robot.Time - p.EntryTime).TotalMinutes >= 10.0) { //Over 10 minutes }where `p` is your Position
@solark