Building the exit logic

How will we know when to exit?

Our exit point will be the exact opposite our entry logic.

If our open position is long:

  1. When SMA10 is less than than SMA50

  2. When SMA10 (PREVIOUS) is greater than SMA50 (PREVIOUS)

And if our open position is short:

  1. When SMA10 is greater than than SMA50

  2. When SMA10 (PREVIOUS) is less than SMA50 (PREVIOUS)

Let's start!

1. Navigate to the Exit strategy tab within the strategy page.

2. Click on the start node to bring up the menu then click on Connect Gateway.

3. Next thing we want to check is if we already have a position open

4. If we do, then we can proceed to checking if our position is long or short.

5. If it's long, then we can define our conditions above. Let's create a couple of gateways to capture our logic.

6. If all gateways are truthy, then we can exit. Let's add an activity to exit out of the market.

7. Alright, now let's go back to our gateway that checks if our position is long. Let's add a truthy action pointing to another gateway to check if the position is short. We're going to be explicit for the purpose of this tutorial.

8. Let's define the necessary gateways for the conditions we declared above.

9. And finally, let's connect that to the exit position node as well.

10. Alright! All that remains is to end the logic for every other falsy gateway action. Our final strategy should look like this:

11. Remember to click on save to update our strategy.