Stop cBot from triggering again after a Stop Loss is taken

Created at 01 Dec 2021, 08:25
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!
SU

sue.bugg

Joined 09.01.2021

Stop cBot from triggering again after a Stop Loss is taken
01 Dec 2021, 08:25


Hi

My bot runs between certain hours of the day, 5 min chart. I have it set to maximum 1 trade at a time. If bot triggers and hits the stop loss, while still in the times allocated to trade and on "Play", it can re-trigger, taking another trade. I don't want it to take any more than 1 trade in the allocated trade perod, regardless of outcome. Do you know how to make the bot stop playing completely, once a trade is entered?

At the moment, I sit at computer, wait for trigger, then manually stop the bot. Have it running on 15 assets across 1.5 hours. Would prefer to press "play", then walk away, knowing they will only trigger maximum of once per asset

Thank you

Sue


@sue.bugg
Replies

amusleh
01 Dec 2021, 09:38

Hi,

You can limit the number of orders your cBot opens programmatically, there are lots of different ways you can do such a thing with code.

Use Positions opened/closed events and when a position got opened by your cBot you can put your cBot on a sleep mode by using a boolean flag until the position is closed.


@amusleh

sue.bugg
01 Dec 2021, 10:10

RE:

amusleh said:

Hi,

You can limit the number of orders your cBot opens programmatically, there are lots of different ways you can do such a thing with code.

Use Positions opened/closed events and when a position got opened by your cBot you can put your cBot on a sleep mode by using a boolean flag until the position is closed.

Hi Amusleh

Thank you for the information. The cBot already goes to sleep once a position is opened. It awakens once the position is closed, if still in the trading time frame. Most losses occur much quicker than a profit. If it closes in a Loss before the 1.5 hours is up (the set trading times), it will take another trade if triggered (all parameters of cBot met). I don't want it to take another trade. Just one trade per asset in total for the trading period. So, once a postion is opened, I want it to go to sleep, turn off, stop completely until I manually turn it back on again the next trading day. Does that make sense?

Thanks

Sue


@sue.bugg

amusleh
01 Dec 2021, 10:31

RE: RE:

sue.bugg said:

amusleh said:

Hi,

You can limit the number of orders your cBot opens programmatically, there are lots of different ways you can do such a thing with code.

Use Positions opened/closed events and when a position got opened by your cBot you can put your cBot on a sleep mode by using a boolean flag until the position is closed.

Hi Amusleh

Thank you for the information. The cBot already goes to sleep once a position is opened. It awakens once the position is closed, if still in the trading time frame. Most losses occur much quicker than a profit. If it closes in a Loss before the 1.5 hours is up (the set trading times), it will take another trade if triggered (all parameters of cBot met). I don't want it to take another trade. Just one trade per asset in total for the trading period. So, once a postion is opened, I want it to go to sleep, turn off, stop completely until I manually turn it back on again the next trading day. Does that make sense?

Thanks

Sue

Hi,

You can code this behavior easily, you can limit your cBot to not open more than one trade during specific time period.

If you know how to code then you can do it easily, otherwise you can post your cBot code and I will help or you can post a job request or ask our consultants to do it for you.


@amusleh

sue.bugg
02 Dec 2021, 03:49 ( Updated at: 05 Dec 2021, 02:09 )

RE: RE: RE:

amusleh said:

sue.bugg said:

amusleh said:

Hi,

You can limit the number of orders your cBot opens programmatically, there are lots of different ways you can do such a thing with code.

Use Positions opened/closed events and when a position got opened by your cBot you can put your cBot on a sleep mode by using a boolean flag until the position is closed.

Hi Amusleh

Thank you for the information. The cBot already goes to sleep once a position is opened. It awakens once the position is closed, if still in the trading time frame. Most losses occur much quicker than a profit. If it closes in a Loss before the 1.5 hours is up (the set trading times), it will take another trade if triggered (all parameters of cBot met). I don't want it to take another trade. Just one trade per asset in total for the trading period. So, once a postion is opened, I want it to go to sleep, turn off, stop completely until I manually turn it back on again the next trading day. Does that make sense?

Thanks

Sue

Hi,

You can code this behavior easily, you can limit your cBot to not open more than one trade during specific time period.

If you know how to code then you can do it easily, otherwise you can post your cBot code and I will help or you can post a job request or ask our consultants to do it for you.

 



            

 


@sue.bugg

PanagiotisCharalampous
02 Dec 2021, 08:52

Hi Sue,

Are you just looking for the Stop() method?

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous

sue.bugg
03 Dec 2021, 04:56

RE:

PanagiotisCharalampous said:

Hi Sue,

Are you just looking for the Stop() method?

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

Hi Panagiotis

Thank you. I had a brief look last night, looks like what I need. I'll see if I can figure out how & where it should go in the code. Very limited knowledge, so not sure I'll be able to do it

Thanks

Sue


@sue.bugg