Skip to main content

How to Create and Run a Custom Strategy in Gunbot

Creating a custom strategy in Gunbot allows for a tailored approach to automated trading. This guide provides a step-by-step process for setting up and running a custom strategy.

Preparation

To begin, create a file like awesomeStrategy.js for your custom strategy and save it in the ./customStrategies folder. You can use the built-in code editor in the Gunbot interface or any code editor of your choice.

Creating a Custom Strategy

Follow these steps to write and set up your custom strategy:

1. Writing the Strategy

Start by writing your custom strategy. You can leverage the built-in code editor in Gunbot for this purpose.

Custom Strategy Code Editor

2. Selecting the Strategy for a Trading Pair

When adding or modifying a trading pair, choose "Custom" as your strategy type.

Selecting Custom Strategy

3. Choosing the Strategy File

In the "Filename" field, select the file containing your custom strategy.

Choosing Strategy File

Setting Up Indicators

The "Indicators" tab in Gunbot allows you to control how pre-calculated indicator data is generated. These indicators are accessible in your strategy. Remember, you are not limited to these indicators alone.

Indicators Tab

tip

It's recommended to disable the global cancel orders option when running a custom strategy.

Running the Custom Strategy

After completing the above steps, your custom strategy is ready to be executed. Ensure all settings align with your trading objectives and enable the strategy for your selected trading pair.

Conclusion

Custom strategies offer a significant degree of flexibility and control in Gunbot. By following these steps, you can effectively create and implement a strategy that aligns with your specific trading goals.