Total Pips

Created at 02 Apr 2020, 12:44
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
DO

dordkash@gmail.com

Joined 30.09.2017

Total Pips
02 Apr 2020, 12:44


Hi
I want to write a code in my BOT that shows me all the Pips in a row in the log when the test is over
I've written the code below but it shows for each separate position

            foreach (var HI in History.FindAll(label))
            {


                Print("PIPS   ", HI.Pips);
            }
 


@dordkash@gmail.com
Replies

PanagiotisCharalampous
02 Apr 2020, 14:26

Hi there,

You can try the below

 var pips = History.Where(x => x.Label == label).Sum(p => p.Pips);

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

dordkash@gmail.com
02 Apr 2020, 21:02 ( Updated at: 21 Dec 2023, 09:21 )

RE:

PanagiotisCharalampous said:

Hi there,

You can try the below

 var pips = History.Where(x => x.Label == label).Sum(p => p.Pips);

Best Regards,

Panagiotis 

Join us on Telegram

I wrote this
But that's how it works

I posted a photo


@dordkash@gmail.com

PanagiotisCharalampous
03 Apr 2020, 08:20

Hi there,

Can you post your complete cBot? Where do you print the values? In OnBar()? You should do it in OnStop().

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

dordkash@gmail.com
03 Apr 2020, 12:40

RE:

PanagiotisCharalampous said:

Hi there,

Can you post your complete cBot? Where do you print the values? In OnBar()? You should do it in OnStop().

Best Regards,

Panagiotis 

Join us on Telegram

thank you so much


@dordkash@gmail.com