position.NetProfit question

Created at 24 Mar 2023, 00:27
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!
GO

Goulk

Joined 17.11.2022

position.NetProfit question
24 Mar 2023, 00:27


Hello everyone!

I have a very simple question.

I tried to make the "PRINT" of the X.NETPROFIT a specific location is I saw that alone positive results such as: +23 +52 +68 ecc... ok...

Is it possible to get negative results?  Like -12 -32 -59 ecc...

I need this because in my strategy I have conditions that are activated when the position goes also in negative.

How do I get this? can I get it to a specific position?

Thx for your time,

var NetProfit = PositionLabelID.Where(x => x.TradeType == TradeType && x.Comment == "BOOBY").Sum(x => x.NetProfit);

print(NetProfit, " PROFIT")

 

 


@Goulk
Replies

PanagiotisChar
24 Mar 2023, 08:32

Hi there,

Is it possible to get negative results?  Like -12 -32 -59 ecc...

Yes it is. If your position has negative profit then it will print negative numbers.

How do I get this? can I get it to a specific position?

All positions have a NetProfit property e.g. Positions[0].NetProfit

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 


@PanagiotisChar

Goulk
24 Mar 2023, 09:51

RE:

PanagiotisChar said:

Hi there,

Is it possible to get negative results?  Like -12 -32 -59 ecc...

Yes it is. If your position has negative profit then it will print negative numbers.

How do I get this? can I get it to a specific position?

All positions have a NetProfit property e.g. Positions[0].NetProfit

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

Thanks, It was my coding error. :D
Thx For your time.

@Goulk