Account.Equity & Label
Account.Equity & Label
21 May 2013, 22:26
running robots in two different pairs...
trying to have profit/loss targets for each based on overall Account.Equity
How can I get the current equity associated with an individual robot or label
ie
start with 10,000 in each pair... with target of +250 in each
pair 1
I execute 10 trades with label of "X"
"X" trades produce +250
pair 2
I execute 10 trades with label of "Y"
"Y" trades produce -50
so Account.Equity is 10,000 +250 -50 = 10,200
How can I determine that "X" should stop based on Account.Equity?
Can I track Account.Equity.Label (X) ?
Replies
Balena
18 Jun 2013, 02:43
RE:
The Position.NetProfit/Position.GrossProfit is available.
I'm using these per your example in the reference guide... but I can't get it to give a correct amount... is it in pips?
it's like it's only counting on trade in a position that has 10 trades (scaling in)
Also, I now have unique labels for each pair running the same strategy.. How can I get the net p/l of all trades with the same label?
Thanks!
@Balena
cAlgo_Fanatic
18 Jun 2013, 10:55
You can calculate the net profit (double) for each label like so:
foreach (var pos in Account.Positions) { if (pos.Label == "123") netProfit += pos.NetProfit; }
or using a Linq expression:
var netProfit = Account.Positions.Where(pos => pos.Label == "123").Sum(pos => pos.NetProfit);
You can assign that each robot has a unique label or you may check which is the position in the account by the symbol instead of the label:
foreach (var pos in Account.Positions) { if (pos.SymbolCode == "EURUSD") netProfit += pos.NetProfit; }
The net profit is equal to the equity - balance.
@cAlgo_Fanatic
cAlgo_Fanatic
22 May 2013, 15:08
The Position.NetProfit/Position.GrossProfit is available.
@cAlgo_Fanatic