Gross profit
            
                 04 Feb 2022, 12:17
            
                    
Hi,
Is it possible to have the total gross profit and total gross loss without extracting the data from an excel statement in the history section?
Thank you
Replies
                     florent.herb
                     07 Feb 2022, 10:43
                                    
RE:
amusleh said:
Hi,
You can use History with Linq:
var grossProfitTotal = History.Select(trade => trade.GrossProfit).Sum(); var netProfitTotal = History.Select(trade => trade.NetProfit).Sum();
Hi,
Is it in C# langage? And would it work for total gross loss?
Regards
@florent.herb
                     amusleh
                     08 Feb 2022, 08:19
                                    
RE: RE:
florent.herb said:
amusleh said:
Hi,
You can use History with Linq:
var grossProfitTotal = History.Select(trade => trade.GrossProfit).Sum(); var netProfitTotal = History.Select(trade => trade.NetProfit).Sum();
Hi,
Is it in C# langage? And would it work for total gross loss?
Regards
Hi,
It's C#, and you can use it on your cBots/Indicators.
You can calculate the gross loss by using history, ex:
// First it filters the losing trades, then is sum their gross return
var grossLossTotal = History.Where(trade => trade.GrossProfit < 0).Select(trade => trade.GrossProfit).Sum();
@amusleh
                     florent.herb
                     10 Feb 2022, 12:04
                                    
Absolute value
Hi,
Thank you for your answer!
One question. How to code in C# absolute values? Thank you for your help.
Regards,
HERB Florent
@florent.herb
                     amusleh
                     11 Feb 2022, 08:14
                                    
RE: Absolute value
florent.herb said:
Hi,
Thank you for your answer!
One question. How to code in C# absolute values? Thank you for your help.
Regards,
HERB Florent
Hi,
Do you mean how to get the absolute value of a number? you can use Math.Abs to get a number absolute value.
@amusleh

amusleh
07 Feb 2022, 09:30
Hi,
You can use History with Linq:
@amusleh