# Strategy Designer

CryptoHero's latest revolutionary Strategy Designer allows a trader to create complex strategy easily. A complex strategy can also be loosely called a MultiStrat in the hedge fund world. Multiple strategies are combined to create an overarching strategy. For example, a long-short strategy is considered MultiStrat as it consists of a long followed by a short strategy, with each executing consecutively.

CryptoHero's Strategy Designer offers advanced traders the ability to create complex strategies that capture a greater part of the market movement. For example, a trader can create a long-short strategy using our Strategy Designer.

The actual implementation is via Daisy-Chain in CryptoHero. The Strategy Designer is only available for Advanced bot type.

Let us illustrate with an example on how to implement a Long-Short MultiStrat strategy.

* User creates Bot X (Advanced Bot) for Long strategy
* User creates Bot Y for Short strategy
* User configures Bot X to activate Daisy-Chain and also the "First in Daisy-Chain" option. When enabled, bot X will start to run after it is created. See picture below.

<figure><img src="https://490807899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M5LiMstpewrLGU6auaX%2Fuploads%2Fqm5toHwkXX9lDYJdozII%2FScreenshot%202023-03-08%20at%206.44.21%20PM.png?alt=media&#x26;token=61cb1bb1-2b0b-4202-a135-4cab2067c546" alt=""><figcaption><p>(Advanced Bot X settings)</p></figcaption></figure>

* User sets Bot Y to activate Daisy-Chain but "First in Daisy-Chain" is NOT enabled. When bot Y is created, bot Y will NOT run. Its trigger is from Bot X as we will see below
* User sets bot X exit condition to trigger bot Y after X completes a deal. Similarly, Bot Y's exit condition has been set to trigger Bot X after Y completes a deal
* After X and Y are created, only X will run and monitor the market
* Bot X completes a deal and X sends trigger to Bot Y. X will NOT auto-restart. X will be deactivated
* Bot Y activates and monitors the market
* Bot Y completes a deal and triggers Bot X
* Bot X "wakes up" from its deactivated state and start to run. The whole cycle repeats.

As shown in the example above, a user has successfully created a Long-Short strategy.&#x20;

A user can link two or more bots in a daisy-chain as well.

\[Bot A]  > \[Bot B] > \[Bot C] > ….. > \[Bot Z]

If the LAST bot Z has NO trigger condition in the EXIT condition, the whole strategy (Bot A to Z) will only run once. But, if Bot Z Exit Condition has a trigger to Bot A, then the whole strategy repeats. I.e. Bot A will “wake up” and start to monitor the market.

CryptoHero Strategy Designer is like a 4GL programming language for automated trading. A trader can create multiple bots, each with its own condition in order to create a single wholistic strategy. It is really up to the trader's expertise and imagination on what complex strategy to setup using the Strategy Designer.

### Example 1

Three bots MultiStrat

| <p><br></p>     | Bot A                                                 | Bot B                                                  | Bot C                                                  |
| --------------- | ----------------------------------------------------- | ------------------------------------------------------ | ------------------------------------------------------ |
| Entry Condition | <p>Activate Daisy Chain = True</p><p>First = True</p> | <p>Activate Daisy Chain = True</p><p>First = False</p> | <p>Activate Daisy Chain = True</p><p>First = False</p> |
| Exit Condition  | Trigger B                                             | Trigger C                                              | Trigger A                                              |

Above strategy will cause the following sequence: A > B > C > A > B > C > (repeats)

Bot A will activate on creating/updating since Activate Daisy-Chain = True AND First=True

### Example 2

| <p><br></p>     | Bot A                                                 | Bot B                                                  | Bot C                                                  |
| --------------- | ----------------------------------------------------- | ------------------------------------------------------ | ------------------------------------------------------ |
| Entry Condition | <p>Activate Daisy Chain = True</p><p>First = True</p> | <p>Activate Daisy Chain = True</p><p>First = False</p> | <p>Activate Daisy Chain = True</p><p>First = False</p> |
| Exit Condition  | Trigger B                                             | Trigger C                                              | Trigger B                                              |

Above strategy will cause the following sequence: A > B > C > B > C > (repeats)

You can see that Bot A is only run once as no other bot triggers Bot A.

### Example 3

<table data-header-hidden><thead><tr><th></th><th width="206"></th><th></th><th></th><th></th></tr></thead><tbody><tr><td><br></td><td>Bot A</td><td>Bot B</td><td>Bot C</td><td>Bot D</td></tr><tr><td>Entry Condition</td><td><p>Activate Daisy Chain = True</p><p>First = True</p></td><td><p>Activate Daisy Chain = True</p><p>First = False</p></td><td><p>Activate Daisy Chain = True</p><p>First = False</p></td><td><p>Activate Daisy Chain = True</p><p>First = False</p></td></tr><tr><td>Exit Condition</td><td>Trigger B</td><td>Trigger C</td><td>Trigger D</td><td>Trigger A</td></tr></tbody></table>

Above strategy will cause the following sequence A > B > C > D > A > (repeats)

### Example 4

<table data-header-hidden><thead><tr><th width="103"></th><th width="146"></th><th width="147"></th><th width="139"></th><th></th></tr></thead><tbody><tr><td><br></td><td>Bot A</td><td>Bot B</td><td>Bot C</td><td>Bot D</td></tr><tr><td>Entry Condition</td><td><p>Activate Daisy Chain = True</p><p>First = True</p></td><td><p>Activate Daisy Chain = True</p><p>First = False</p></td><td><p>Activate Daisy Chain = True</p><p>First = True</p></td><td><p>Activate Daisy Chain = True</p><p>First = False</p></td></tr><tr><td>Exit Condition</td><td>Trigger B</td><td>Trigger C</td><td>Trigger D</td><td>Trigger A</td></tr></tbody></table>

Above strategy will cause bots A and C to be activated together.

Sequence: A > B > C > D > A > (repeats)

What if Bot C activates BO first?, then, it will look like

C > D > A > B > C > D > A > (repeats)

Hence, there is a danger of “race condition” (in computer science where two resources compete for the same resource X) if a user sets two bots as First=True in a single daisy-chain.

So if a Bot X calls another bot Y to activate and Y is already active, X will become deactivated (as per normal like a daisy-chain bot) but an error message will appear “Attempt to call an active bot in the daisy-chain”. HOWEVER, X can still be activated again if another bot triggers X as part of the daisy-chain.

{% hint style="info" %}
Multiple daisy-chains can be created as well such that each chain of bots are mutually exclusive.&#x20;
{% endhint %}

### Strategy Designer for TradingView

Daisy-Chain linking can also be activated for TradingView signals.&#x20;

Whenever a signal is received and if the bot has daisy-chain enabled, CryptoHero will check if the bot is "First in Daisy-Chain". If yes, the bot will execute a trade. If not, the bot will check prior linked bot to see if it has already completed a deal. If yes, the bot will execute a trade, else it will do nothing.
