Find positions closed on this day before cBot starts
Find positions closed on this day before cBot starts
13 Mar 2018, 12:40
Dear Pangiotis,
Is it possible to find programmatically the list of position closed and their attributes berfore robot starts (or whatever is possible)?
The robot may have been stopped for whatever reason, and after it is restarted , information about positions before restart.
Regards
Replies
alexander.n.fedorov
13 Mar 2018, 13:07
That is what I did:
"
[Robot(TimeZone = TimeZones.RussianStandardTime, AccessRights = AccessRights.None)]
public class LondonRange : Robot
{
...
public HistoricalTrade FindLast;
...
OnStart()
...
Severity Code Description Project File Line Suppression State
Error CS0501 'LondonRange.FindLast(string)' must declare a body because it is not marked abstract, extern, or partial London Range C:\Users\User\Documents\cAlgo\Sources\Robots\London Range\London Range\London Range.cs 77 Active
"
After that I am lost
please advise
@alexander.n.fedorov
alexander.n.fedorov
13 Mar 2018, 14:04
I was able to this:
"
...
foreach(HistoricalTrade trade in History)
{
if (trade.Label == Instance)
Print("closed trade ID = {0}, trade closing time = {1}", trade.ClosingDealId, trade.ClosingTime );
}
...
13/03/2018 15:00:00.941 | closed trade ID = 47704059, trade closing time = 12.03.2018 13:06:03
...
"
The I could cycle through the trades and find the last one, but what would be the syntax for "Find.Last" . How do I invoke the label there?
@alexander.n.fedorov
PanagiotisCharalampous
13 Mar 2018, 14:08
Hi Alexander,
You can use History.FindLast()
Best Regards,
Panagiotis
@PanagiotisCharalampous
alexander.n.fedorov
13 Mar 2018, 14:12
Pangiotis,
You very kind. It worked. Thank you
Regards
Alexander
@alexander.n.fedorov
PanagiotisCharalampous
13 Mar 2018, 12:45
Hi Alexander,
You can use History to access historical trades. Let me know if this helps.
Best Regards,
Panagiotis
@PanagiotisCharalampous