Custom Strategies
Gunbot includes pre-built strategies, but you can also run your own JavaScript code with custom strategies. This is useful for developers who want to customize algorithms while using Gunbot's exchange connectivity and market data.
Custom strategies let you define the bot's logic in JavaScript, from simple rule-based bots to more complex models.
JavaScript is a versatile scripting language commonly used for web development. In Gunbot, it allows for detailed customization of trading logic.
Prototyping new strategy code can be done in seconds with our specialized GPT: Gunbot Custom Strategy Guru
๐๏ธ Code examples for custom strategies
Explore various JavaScript code examples for Gunbot custom strategies, ranging from basic to advanced, to help you learn and build your own.
Key Features of Custom Strategiesโ
Full JavaScript Controlโ
Custom strategies let you write JavaScript to control bot behavior, from unique buy/sell conditions to tracking indicators or automating portfolio management. You can define the logic you need.
Seamless Exchange Connectivityโ
Gunbot provides built-in exchange connectivity. Custom strategies can use this to execute trades across supported exchanges without handling low-level API integrations.
Easy Trading Methodsโ
Gunbot provides methods for common tasks like placing orders and requesting additional candle data. Collected market data is accessible so you can focus on strategy logic.
You can place orders, retrieve historical data, and manage open positions using predefined methods, which reduces low-level exchange work.
๐๏ธ Trading methods
Explore the available methods and modules in Gunbot for custom strategies, including order placement, data fetching, and using external JavaScript modules.
๐๏ธ Readily available data
Explore the market and position data available for custom Gunbot strategies, including pre-calculated indicators and pair-specific information.
No Artificial Constraintsโ
Custom strategies run your JavaScript code without artificial constraints on execution time or other limitations. You can implement complex strategies and use external modules or libraries.
Want to implement a neural network, access external financial data, or run long-running calculations? Custom strategies support those approaches.
Visualization Optionsโ
Custom strategies can use visualization options to display additional data in the Gunbot interface.
You can visualize market conditions and strategy performance in real time. Add custom charts, trend lines, or statisticsโfor example, plot moving averages or Bollinger Bands and track custom KPIs.

Connect to Third Partiesโ
Custom strategies can connect to third-party services. For example, you could call a weather API to incorporate weather data into your logic.
You might integrate sentiment analysis, economic indicators, or technical data from other platforms to inform decisions.
๐๏ธ Visual strategy targets
Learn how to visualize custom strategy trading targets as lines on the Gunbot chart for easy monitoring and real-time performance tracking.
๐๏ธ Show custom statistics
Learn how to display custom metrics in the Gunbot chart sidebar and send real-time GUI notifications from your custom trading strategies.