# Controlling Losses in Dbot

**URL:** <https://community.deriv.com/t/controlling-losses-in-dbot/38095>\
**Category:** Deriv Bot\
**Tags:** dbot\
**Created:** [October 19, 2022, 6:06am UTC](https://community.deriv.com/t/controlling-losses-in-dbot/38095 "2022-10-19T06:06:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deriv\_adminN5](https://sea2.discourse-cdn.com/flex020/user_avatar/community.deriv.com/deriv_adminn5/32/5126_2.png) [@Deriv\_adminN5](https://community.deriv.com/u/Deriv_adminN5)\
**Post date:** [October 19, 2022, 6:06am UTC](https://community.deriv.com/t/controlling-losses-in-dbot/38095/1 "2022-10-19T06:06:10Z")

</div>

Hi Deriv Community!

There are many ways you can control your losses in DBot. Here’s a simple example of how you can implement loss control in your Dbot strategy. You may follow the guidelines below to limit your losses.

1. Create the following **variables** :

 ![Create these variables](https://us1.discourse-cdn.com/flex020/uploads/deriv/original/2X/d/dba0fcd0ade560dc6d7924b2ce4832bbddcbcec9.png)

_ **If you would like to know how to create variables in Dbot, you may refer to the post below:** _

> [@](#):
>
> Hi Deriv Community! sparkles Here’s how you can add variables to your Dbot strategy. If you would like to know more about Dbot, please refer to this post: Once you’ve logged in to Dbot site [here](https://app.deriv.com/bot), you can head over to the left side corner, you will see the Blocks menu. [[Blocks menu]](https://us1.discourse-cdn.com/flex020/uploads/deriv/original/2X/1/18225e73df6c7a81eb01a1e5662069cc255ea404.jpeg) From there, you can find the utility section and click on it. You will be able to see the variable and create your variable accordingly. [[Variable creation]](https://us1.discourse-cdn.com/flex020/uploads/deriv/original/2X/c/c76ab2cb4f502d67d5483f8b61df7a6b6a95eafe.jpeg) You can enter any name for your variable and cli…

You may set the parameters according to your preferences. The trade parameter block should look like the below attachment.

 ![Trade parameters](https://us1.discourse-cdn.com/flex020/uploads/deriv/original/2X/8/89c77902f5c92985b866ee0f288d510eb36f202b.png)

1. Use a logic block to check if **currentPL** exceeds **maximumLoss**. If it does, set **tradeAgain** to ‘false’ to prevent the bot from running another cycle.

 ![Purchase conditions block](https://us1.discourse-cdn.com/flex020/uploads/deriv/original/2X/c/c43a33dd565783f20d6f7853881e549e901e1cc4.png)

1. Update **currentPL** with the profit from the last purchased contract. If the last contract was lost, the value of **currentPL** will be negative.

 ![Restart trading conditions](https://us1.discourse-cdn.com/flex020/uploads/deriv/original/2X/6/69b20a151cd754e428546f1b3721b0c5730e9408.png)

**Please note that this example is for educational purposes and it’s created to demonstrate how to control losses in Dbot. You are advised to use your best judgment when trading.**

Should you need assistance to manage your trading activity, you may use the self-exclusion tool. You may further refer to our post here: [Self Exclusion Tool](https://community.deriv.com/t/self-exclusion-tool/31592)

We hope the above finds you well and if you would like to know more, please feel free to discover what other traders are discussing in the Dbot section of Deriv Community.

### [DBot](https://community.deriv.com/c/trading/dbot/14)

Automated trading at your fingertips. No coding needed.

If you have any questions, please visit our Help Centre or contact us via Live Chat and WhatsApp.

> **[Help Centre | Frequently Asked Questions | Deriv](https://deriv.com/help-centre)**
>
> Have questions on your trading account, how our trading platforms work or about trading? Read our FAQ’s or contact us through Deriv live chat.

---

<div class="post-metadata">

**Author:** ![Deriv\_adminN5](https://sea2.discourse-cdn.com/flex020/user_avatar/community.deriv.com/deriv_adminn5/32/5126_2.png) [@Deriv\_adminN5](https://community.deriv.com/u/Deriv_adminN5)\
**Post date:** [October 19, 2022, 6:06am UTC](https://community.deriv.com/t/controlling-losses-in-dbot/38095/2 "2022-10-19T06:06:19Z")

</div>


