LogoLogo
Back to HaasOnline.comSwitch to Developer API
4.x
4.x
  • Welcome
  • TradeServer Cloud
    • Overview
    • Security
    • Troubleshooting
  • TradeServer Enterprise
    • Overview
    • Updates
    • Security
    • Installation
      • Windows
      • MacOS
      • Linux
    • Configuration
      • License Key
      • Login credentials
      • Hosting
        • Linux VPS Hosting
    • Special features
      • Price history
      • Backups
      • Machine Learning
        • Built-in Machine Learning
        • Custom Machine Learning
      • Scripted Exchange API (Coming Soon)
      • Local API (Coming Soon)
    • Troubleshooting
  • Interface
    • General Interface
      • Left Menu
      • Upper Right Items
        • Account data
        • Execute trade
        • AI Chatbots
          • Chatbot Julia
          • Chatbot David
          • Chatbot Thomas
        • Notifications
        • Menu
          • Exchange accounts
          • Settings
          • License information
          • Change Logs
          • Logout
      • Status bar
        • Price tickers
    • Dashboard
    • Bots
      • Bot management
      • Bot templates
    • HaasScript
      • Web Editor
      • Backtest Lab
        • Lab test setup
      • Backtest History
      • Manage Scripts
      • Manage Signals
    • Tools
      • Marketview
      • Market intelligence
      • Exchange profiler
      • Markets explorer
      • News
    • Finance
      • Portfolio
      • External Wallet
  • Haasscript
    • About
      • Change Log
    • Tutorials
      • Bot building
        • Trade-bot building
        • Visual bot building
        • Scripted bot building
      • Usage
        • HaasScript
          • Interval
          • Markets
          • Input Fields
          • Memory Management
          • Signal Handling
          • Position Information
          • Positions Handling
            • Fee correction
          • Order Handling
          • Trading
          • Charting
          • Optimizations
        • Visual Editor
          • Blocks
          • Parameters
          • Flow Control
          • Interaction
        • Script Editor
          • Classes
        • Managed Trading
        • Unmanaged Trading
    • Commands
      • Trade Bots
        • TradeBot Containers
        • Easy Indicators
        • Easy Safeties
        • Easy Insurances
      • Helpers
        • Array Helpers
        • Custom Command Helpers
        • Enumerations
        • Equations
        • Mathematical
        • Memory Helpers
        • Signal Helpers
        • String Helpers
        • Miscellaneous
        • Technical Analysis Helpers
      • Input data
        • Bot Settings
        • Input fields
        • Price Market Information
        • Script Settings
        • Time Information
        • Trade Market Information
      • Prices
      • Technical Analysis
      • Charting
      • Trading
        • Managed Trade Commands
        • Unmanaged Trade Commands
        • Order Information
        • Order Handeling
        • Position Information
        • Position Price Information
        • Profit Information
        • Wallet Information
      • Social Media
    • Built-in Bots
      • Version 3 bots
        • C# Scripted Bot
        • Email bot
        • Trendline Bot
        • Triangle Arbitrage Bot
      • Accumulation Bot
      • Enhanced RSI bot
      • FlashCrash (Grid) Bot
      • Crypto Index Bot
      • Intellibot Alice
      • Inter Exchange Arbitrage Bot
      • MadHatter Bot
      • Market Making Bot
      • Order Bot
      • PingPong Bot
      • Scalper bot
      • Zone-Recovery Bot
    • Community Bots
      • Simple Grid Bot (SPOT)
      • Simple Grid Bot (FUTURES)
      • Simple Market Maker (SPOT)
      • Simple Market Maker (FUTURES)
  • Usage
    • First Usage
    • Setup Exchange
      • Adding an API to the Platform
      • Binance
      • Binance US
      • Bit2me
      • Bitfinex
      • Bitget
      • BitMEX
      • ❌Bitpanda
      • Bitstamp
      • ❌Bittrex
      • Bybit
      • ❌Cex.IO (Legacy API)
      • ❌Coinbase
      • ❌Crypto.com
      • Deribit
      • Gemini
      • Gleec
      • ❌HitBTC
      • Huobi
      • ❌Ionomy
      • Kraken
      • Kraken Futures
      • KuCoin
      • KuCoin Futures
      • LBank
      • ❌OKCoin
      • OKX
      • OKX-Futures
      • OKX-Swap
      • Phemex
      • Poloniex
      • Poloniex Futures
      • WooX
    • Setup Telegram Notification Bot
    • Setup Discord Notification Bot
    • Use Signals
  • Other Resources
    • YouTube
    • Guides & Tutorials
    • Questions & Answers
    • Community Projects
  • Need Help?
    • Ask on Discord
    • Submit Support Ticket
Powered by GitBook
On this page
  • Creating your first trade-bot
  • Step 1: Creating a trade-bot
  • Step 2: Add an easy indicator
  • Step 3: Setup the Easy Indicator
  • Step 4: Connecting the dots
  • Easy Indicator Settings
  • Adding more easy indicators
  • Adding insurances
  • Adding safeties
  • Notes

Was this helpful?

  1. Haasscript
  2. Tutorials
  3. Bot building

Trade-bot building

PreviousBot buildingNextVisual bot building

Last updated 1 year ago

Was this helpful?

Creating your first trade-bot

In this small tutorial, we are going to show you have you can create a very basic trade bot.

Step 1: Creating a trade-bot

To create a trade bot, you need to go to the left menu and select the "Web-editor". Once selected a new page will show up. On top of this page you will find a toolbar, click on the most left icon which display icon to create a new script. If all goes well then you will get a windows on your screen, asking you whats sort of script you like to create. Select a visual script and give the trade-bot a name.

Step 2: Add an easy indicator

Go to the left and select the "Commands" tab. In the commands tab, scroll down untill you see the "Easy indicators". Click on it to open the pane. Once open click on, for example, the RSI easy indicator and add it to your drawing planel.

Step 3: Setup the Easy Indicator

When you add a easy indicator, you will see a few fields which requires your input. In the context of a easy RSI indicator, you will see the fields "chartIndex" and optionally the "name".

Chart index 0 is used for the price candles and we want to display the RSI below it, lets setup chart number 1 here. This will show the RSI chart below the price chart.

The "name" field is optional, however, lets give it the name "RSI".

When you got these fields setup click on the "Run" button in the toolbar. If everything is configured properly then you will see your the RSI chart displayed.

Step 4: Connecting the dots

Just adding the easy indicator, are just the first steps. The next step is to create the tradebot itself. Go to the "Commands" tab again and scroll down till you see the "Trade Bot" pane and click on it to open it. Select the "IndicatorContainer" and add it to your drawing. Do the same for the "TradeBotContainer".

Once you got the "RSI", "IndicatorContainer", and the "TradeBotContainer" all properly added, then you need to start connecting the dots.

Go to your RSI Easy Indicator and click on the green dot, draw a lin to your "IndicatorContainer" and connect it to the "Signals".

Go to your "IndicatorContainer", select the green dot saying "unanimousSignal" and draw a line to your "TradeBotContainer", connect your line to the "indicatorSignal" in the "TradeBotContainer".

Once you have made connections, click on the Run button in the toolbar again and look at the chart which has been generated. If all went good then you will see buying and selling moments shown on your chart now. Congratulations, you have made your first tradebot now!

Easy Indicator Settings

Each time you add a easy indicator, the inputs fields will be added as well. For example, if the Easy Indicator RSI is added, the setting fields "Period Length", "Buy Level", and "Sell Level" get added. You can see the script its settings if you open the left tab named "Settings".

Adding more easy indicators

You can decide to add more easy indicators. If you want to do so then go to the "Commands" tab, scroll till you see the "Easy Indicators", and select the indicator you like to add. Add it, and connect the green dot of it to the "IndicatorContainer".

Adding insurances

You can add Easy Insurances to a trade-bot to have a way to check the indicator signals. For example, suppose you never want to sell at a loss. Always overcoming the fee costs. Then you need to go to the "Commands" tab and open the "Easy Insurances" pane. Select the "OvercomeFeeCosts" and add this to your drawing. Go to the "Trade Pane" and add a "InsuranceContainer". Connect the orange dot of the "OvercomeFeeCosts" to the "InsuranceContainer" and connect the "InsuranceContainer" again to the "insuranceSignal" in the "TradeBotContainer".

Once added the insurance will check the indicator signal and approve the trade of the indicator or dismiss the signals. Again, easy insurances check the easy indicator signals.

Adding safeties

You can add Easy Safeties to a trade-bot to have a way signal to something in the worst-case situation. With easy safeties you need to think about a stoploss. To add a safety like a stop-loss you need to go to the "Commands" tab and open the "Easy Safeties" pane. Select the "StopLoss" and add this to your drawing. Go to the "Trade Pane" and add a "SafetyContainer". Connect the orange dot of the "StopLoss" to the "SafetyContainer" and connect the "SafetyContainer" again to the "safetySignal" in the "TradeBotContainer".

To make the "StopLoss" easy safety work, we need to make 1 extra step. This safety requires us to give a "percentage". To make that work, we need to add an input field for it. To do so, you need to go tot the "Commands" tab and open the "Input fields" pane. Select "Input" and add this to the drawing. Connect the ugly green dot of this input field to the blue percentage dot of the StopLoss. And, setup the input field with a "name" and "default value".

Once added the safety will use your bot its details and execute their checks. If needed, they will produce a trade signals which the trade-bot will execute directly. So this safety signal is NOT checked by the insurances and overrules the indicator its signals.

Notes

Creating trade-bots using this method makes it incredibly simple to build one. However, there may be cases where you need to create a bot that cannot be achieved through this process. In such instances, you'll need to adopt a different approach - one where you can create a more sophisticated bot on your own. This can be done by using visual bot building or by scripting a bot yourself.