Setting Net Profit as a condition to run the cbots main logic.

Created at 21 Feb 2023, 08:55
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!
HU

humza.jelani

Joined 21.02.2023

Setting Net Profit as a condition to run the cbots main logic.
21 Feb 2023, 08:55


Hi,

Is it possible to set a value for Net Profit on a per symbol basis? This value has to reset every day. 

Given that the same cbot is running on, say, 5 different charts/instruments/symbols.

And I want the cbots logic to run only if the Net Profit hasn't been reached for the specific market, say, GBP/USD. 

For instance, net profit of 10 pips or $100 has been reached for USD/JPY but not for other markets - if this is possible then the cbot would stop trading USD/JPY as the condition has been met.

Is this possible?  


@humza.jelani
Replies

PanagiotisChar
21 Feb 2023, 09:16

Hi there,

Here is an example

var netProfit = Positions.Where(p => p.SymbolName == SymbolName).Sum(p => p.NetProfit);

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 


@PanagiotisChar

humza.jelani
21 Feb 2023, 09:33

RE:

PanagiotisChar said:

Hi there,

Here is an example

var netProfit = Positions.Where(p => p.SymbolName == SymbolName).Sum(p => p.NetProfit);

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

Including this example what would the code look like if the intention was to reset the net profit for the specific symbol on a daily basis? 

Or is it done automatically whenever a new trading session begins?

I'm asking for a useable sample code.


@humza.jelani

humza.jelani
21 Feb 2023, 09:36

RE: RE: I do not know how to code I'm just sorting out the core logic units of the cbot. In the given example how would the SymbolName be defined?

humza.jelani said:

PanagiotisChar said:

Hi there,

Here is an example

var netProfit = Positions.Where(p => p.SymbolName == SymbolName).Sum(p => p.NetProfit);

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

Including this example what would the code look like if the intention was to reset the net profit for the specific symbol on a daily basis? 

Or is it done automatically whenever a new trading session begins?

I'm asking for a useable sample code.

 


@humza.jelani

PanagiotisChar
21 Feb 2023, 09:57

Hi there,

Including this example what would the code look like if the intention was to reset the net profit for the specific symbol on a daily basis? 

You can check the Server.Time and reset the value whenever the day changes. If you don't know how to program, then better assign the job to a professional.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us


@PanagiotisChar