Find last opened position
Find last opened position
30 Aug 2018, 22:26
Hi all,
Does it exist Method for find last opened position?
cBot opens several positions with the same label, how I can find last of them? or probably exist a way for modification label for the positions?
Thank you.
Replies
anton.kovalchuk
31 Aug 2018, 11:57
Gool..!!!!!
Thank you a lot Panagiotis Charalampous
@anton.kovalchuk
jani
25 Nov 2019, 23:21
RE:
Panagiotis Charalampous said:
Hi Anton,
Here is how
Positions.Where(x => x.Label == "My Label").OrderByDescending(x => x.EntryTime).First();Best Regards,
Panagiotis
Could you show an example how this is used in a cBot? For example if I want to print out the last opened position time?
I'm trying to limit trade openings OnTick with a timer or a bar counter. Would be nice to have an example code for this I know many other people are looking for the same thing...
@jani
PanagiotisCharalampous
26 Nov 2019, 08:28
Hi Jan,
Here it is
Print(Positions.Where(x => x.Label == "My Label").OrderByDescending(x => x.EntryTime).First().EntryTime);
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
31 Aug 2018, 10:44
Hi Anton,
Here is how
Best Regards,
Panagiotis
@PanagiotisCharalampous