Skip to content Skip to sidebar Skip to footer

In the world of cryptocurrency trading, automation has become a game-changer. Freqtrade, an open-source cryptocurrency trading bot, stands out for its versatility and ease of use. When paired with the NostalgiaForInfinity strategy, it becomes a powerful tool for traders. This guide takes you through a deep dive into setting up, running, and fine-tuning your trading bot for optimal performance.

A closer look into Freqtrade and NostalgiaForInfinity

Freqtrade is a powerful and open-source trading bot built on Python. It has been engineered to democratize algorithmic trading, offering a user-centric platform that is accessible to traders with varying levels of expertise. The bot is designed with modularity in mind, allowing for extensive customization and scalability. Users can craft their strategies, backtest them against historical data, and deploy them in live markets.

Key Features of Freqtrade

  • Open Source: Freqtrade’s transparent and modifiable codebase encourages collaboration and innovation. Users are free to inspect, modify, and enhance the software.
  • Strategy Optimization: The platform includes advanced tools that allow traders to fine-tune their strategies for maximum performance. Users can adjust their strategies based on historical data and market conditions, optimizing their approach to suit various trading scenarios.
  • Extensive Documentation: Freqtrade provides comprehensive guides that cover everything from basic setup to advanced strategy configuration.
  • Modularity: Designed with flexibility in mind, Freqtrade allows users to add custom functionalities to meet their specific trading needs. Whether it’s integrating new indicators, risk management tools, or data analysis features, the platform’s modular structure makes it adaptable to a wide range of trading styles.
  • Backtesting: One of the key strengths of Freqtrade is its ability to simulate trading strategies against historical data. This backtesting capability enables traders to assess the effectiveness of their strategies without risking actual funds. It also allows for the refinement of strategy parameters to improve potential outcomes.
  • Performance Tracking: With built-in performance tracking features, traders can monitor their bot’s success over time. This includes generating detailed reports and visualizing trade data, which is crucial for understanding the bot’s behavior and making informed adjustments.
  • Customizable Risk Management: Traders can implement their own risk management rules within Freqtrade, setting stop losses, take profits, and other parameters to manage trades according to their risk appetite.
  • Integration with Major Exchanges: Freqtrade offers seamless integration with many of the major cryptocurrency exchanges, allowing traders to connect to their preferred platforms and trade a wide range of cryptocurrencies.

NostalgiaForInfinity

NostalgiaForInfinity is not just a strategy; it’s a comprehensive trading philosophy encoded into an algorithm. It stands out in the Freqtrade community for its intricate use of technical analysis indicators and complex pattern recognition. This strategy is built to identify the most opportune moments to enter and exit the market, aiming to maximize gains and minimize losses.

Core Components of NostalgiaForInfinity

  • Technical Indicators: NostalgiaForInfinity leverages a diverse array of technical indicators, including but not limited to the Relative Strength Index (RSI), Exponential Moving Averages (EMA), and Moving Average Convergence Divergence (MACD).
  • Pattern Recognition: The strategy employs sophisticated algorithms capable of recognizing patterns and trends in the market. This feature aids in predicting potential market movements and assists in making decisions based on the likelihood of certain outcomes.
  • Risk Management: NostalgiaForInfinity integrates a robust set of risk management tools designed to safeguard capital and manage drawdowns effectively. This includes setting stop-loss orders, take-profit levels, and other mechanisms to ensure that the trading strategy adheres to predefined risk parameters.
  • Volume Analysis: The strategy also looks at trading volumes as a sign of how the market feels, which gives information about how strong market moves are and whether price trends will change or continue.
  • Timeframe Diversity: NostalgiaForInfinity analyzes multiple timeframes to gain a more comprehensive view of the market, allowing for the consideration of both short-term fluctuations and long-term trends in its trading decisions.
  • Strategic Entry and Exit Points: The strategy is engineered to identify strategic entry and exit points that aim to maximize gains and minimize losses, based on a combination of technical analysis and proprietary algorithms.
  • Continuous Development: NostalgiaForInfinity is subject to ongoing development and refinement by its creators and the community, ensuring that the strategy stays relevant and effective in the dynamic cryptocurrency market.

Setting Up Your Automated Trading Bot

Before embarking on the journey of automated trading with Freqtrade and NostalgiaForInfinity, it’s essential to establish a solid foundation. This begins with ensuring you have the right tools and knowledge at your disposal.

Prerequisites for Automated Trading Mastery

Foundational Knowledge and Tools:

  • Python Proficiency: Familiarity with Python programming is crucial as Freqtrade is Python-based. Understanding basic concepts like functions, classes, and virtual environments will significantly streamline the setup process.
  • Command-Line Comfort: Comfort with using command-line interfaces (CLI) is necessary for installing and running the bot.
  • Exchange API Keys: Secure API keys from your chosen cryptocurrency exchange. These keys allow Freqtrade to interact with your exchange account to execute trades.
  • Secure Internet Connection: A reliable and secure connection is vital to ensure that your trading bot remains online and operational.

Selecting the Optimal Cloud Service Provider

Why Vultr’s Japan Servers?

Vultr’s Japan-based servers offer strategic advantages for crypto trading bots. The proximity to major Crypto exchanges results in reduced latency, which is critical for the timely execution of trades. Additionally, Vultr’s reputation for stability and performance ensures that your trading bot runs in an optimal environment.

Step-by-Step Installation on Vultr

Launching Your VPS on Vultr

  1. Vultr Account Creation: Navigate to Vultr’s website and sign up for an account. Once logged in, access your dashboard to manage your servers.
  2. Server Deployment: Select “Deploy New Server” and choose Japan as your server location. Opt for a high-performance server type that can comfortably run your trading bot. For the operating system, Ubuntu or Debian are recommended due to their widespread support and ease of use.

Installing Freqtrade on Your Server

  1. Secure Server Connection: Utilize an SSH client (example: Termius or Muon) to remotely connect to your newly deployed server.
  2. System Update and Dependency Installation: Update your server’s package list and install the necessary dependencies:
    • update repository: sudo apt-get update
    • install packages: sudo apt install -y python3-pip python3-venv python3-dev python3-pandas git curl nginx-full
  3. Freqtrade Repository Cloning: Use Git to clone the latest version of Freqtrade into a directory on your server:
    • Navigate to /var/www/html: cd /var/www/html
    • Download the `Freqtrade repository: git clone https://github.com/freqtrade/freqtrade.git
    • Enter the downloaded directory: cd freqtrade
    • Switch to the checkout branch: git checkout stable
  4. Freqtrade Installation: If you are on Debian, Ubuntu or MacOS, Freqtrade provides a script to automatically install all the requirements:
    • ./setup.sh -i
  5. NodeJS and PM2 Installation:
    • Download NodeJS version 20: curl -sL https://deb.nodesource.com/setup_20.x | bash -
    • Install NodeJS: apt-get install -y nodejs
    • Install PM2 process manager: npm install pm2 -g
  6. Python Virtual Environment Setup: To avoid any conflicts between dependencies, activate the Python virtual environment:
    • source ./.venv/bin/activate
  7. PM2 Configuration
    • In order to run Freqtrade through the PM2 process manager, save and run the following bash script: nano /var/www/html/freqtrade/start.sh
#!/bin/bash

cd /var/www/html/freqtrade/
source ./.venv/bin/activate
freqtrade trade --config user_data/config.json --strategy NostalgiaForInfinityX4

In order for Freqtrade to work, you will need to update your configuration file located at /var/www/html/freqtrade/user_data/config.json. This is just an example; you will need to add your own Binance API keys and tune the other parameters according to your needs.

{
    "max_open_trades": 7,
    "stake_currency": "USDT",
    "stake_amount": "unlimited",
    "tradable_balance_ratio": 0.99,
    "fiat_display_currency": "USD",
    "dry_run": false,
    "dry_run_wallet": 1000,
    "cancel_open_orders_on_exit": false,
    "trading_mode": "futures",
    "margin_mode": "isolated",
    "unfilledtimeout": {
        "entry": 10,
        "exit": 10,
        "exit_timeout_count": 0,
        "unit": "minutes"
    },
    "entry_pricing": {
        "price_side": "same",
        "use_order_book": true,
        "order_book_top": 1,
        "price_last_balance": 0.0,
        "check_depth_of_market": {
            "enabled": false,
            "bids_to_ask_delta": 1
        }
    },
    "exit_pricing":{
        "price_side": "same",
        "use_order_book": true,
        "order_book_top": 1
    },
    "exchange": {
        "name": "binance",
        "key": "",
        "secret": "",
        "ccxt_config": {},
        "ccxt_async_config": {},
        "pair_whitelist": [
        ],
        "pair_blacklist": [
            "BNB/.*",
            "BUSD/.*",
            "USDC/.*"
        ]
    },
    "pairlists": [
        {
            "method": "VolumePairList",
            "number_assets": 60,
            "sort_key": "quoteVolume",
            "min_value": 0,
            "refresh_period": 1800
        }
    ],
    "telegram": {
        "enabled": false,
        "token": "",
        "chat_id": ""
    },
    "api_server": {
        "enabled": false,
        "listen_ip_address": "127.0.0.1",
        "listen_port": 8080,
        "verbosity": "error",
        "enable_openapi": false,
        "jwt_secret_key": "",
        "ws_token": "",
        "CORS_origins": [],
        "username": "",
        "password": ""
    },
    "bot_name": "freqtrade",
    "initial_state": "running",
    "force_entry_enable": false,
    "internals": {
        "process_throttle_secs": 5
    }
}

Configuring NostalgiaForInfinity for Freqtrade

  1. Strategy Download: Download the NostalgiaForInfinity repository:
    • Navigate to /var/www/html: cd /var/www/html
    • Clone the repository: git clone https://github.com/iterativv/NostalgiaForInfinity.git
  2. Update Automatically the Strategy: The script below will automatically check every hour if the NostalgiaForInfinity repository is updated; if yes, it will reload the Freqtrade bot and apply the changes.
    • Add a new cron job:
      • Open cron: crontab -e
      • Add the following line: 0 * * * * /bin/bash /var/www/html/sync.sh
      • Save, exit cron and reload: /etc/init.d/cron reload
    • Create a bash script: nano /var/www/html/sync.sh
    • Paste the following code, save, and exit the file. Adjust the variables in the script if needed.
#!/bin/bash

# Define paths
REPO_PATH="/var/www/html/NostalgiaForInfinity"
STRATEGY_FILE="NostalgiaForInfinityX4.py"
FREQTRADE_STRATEGY_PATH="/var/www/html/freqtrade/user_data/strategies"
FREQTRADE_PROCESS_NAME="freq2" # Change this if your freqtrade process has a different name in pm2

# Create a symlink for the strategy file
ln -sf $REPO_PATH/$STRATEGY_FILE $FREQTRADE_STRATEGY_PATH/$STRATEGY_FILE

# Function to check if the file has been updated
is_file_updated() {
    local file=$1
    local last_mod_time=$(stat -c %Y "$file")
    git -C $REPO_PATH pull
    local new_mod_time=$(stat -c %Y "$file")

    if [ $new_mod_time -gt $last_mod_time ]; then
        return 0 # File updated
    else
        return 1 # File not updated
    fi
}

update_and_maybe_reload() {
    if is_file_updated $REPO_PATH/$STRATEGY_FILE; then
        echo "Strategy file updated, reloading freqtrade..."
        pm2 reload $FREQTRADE_PROCESS_NAME
    else
        echo "Strategy file not updated, no need to reload."
    fi
}

update_and_maybe_reload

Starting the Trading Bot

With Freqtrade and the NostalgiaForInfinity strategy installed and configured on your Vultr VPS, the next phase involves activating the bot and ensuring it operates smoothly.

Bot Activation

Launch the Bot: Use PM2 to start your trading bot. The --name flag assigns a name to the process for easy identification: pm2 start start.sh --name freqtrade

This command will execute the start.sh script which contains the necessary command to run Freqtrade, such as activating the virtual environment and running the Freqtrade process with NostalgiaForInfinity strategy.

To check the logs for your Freqtrade bot, which can provide real-time insight into the bot’s activity and any errors or messages being output, run: pm2 logs freqtrade

Managing Processes: PM2 provides a suite of commands to manage your processes. Here are a few useful ones:

  • pm2 stop freqtrade: Stops the Freqtrade process.
  • pm2 restart freqtrade: Restarts the Freqtrade process, which can be useful for applying updates or changes to your strategy or configuration.
  • pm2 delete freqtrade: Removes the Freqtrade process from PM2’s process list.
  • pm2 status: Provides a dashboard view of all processes being managed by PM2, including their names, statuses, CPU, and memory usage.

Bot Optimization and Strategy Enhancement

Strategy Fine-Tuning

  1. Continuous Backtesting: Regularly backtest the strategy with new market data to refine its parameters and adapt to changing market conditions.
  2. Hyperparameter Optimization: Use Freqtrade’s hyperopt feature to automatically search for the best combination of parameters that could improve strategy performance.

Security Best Practices

  1. Server Security: Keep your server secure by regularly applying system updates, using strong passwords, and implementing firewall rules.
  2. API Key Protection: Ensure that your exchange API keys have the minimum required permissions (trade only, no withdrawal) and are stored securely.

Utilize Freqtrade’s extensive documentation and the community support offered in forums and chat groups to further enhance your knowledge.

Final words

As you embark on this journey of automated crypto trading, remember that continuous learning and adaptation are key to success. The cryptocurrency market is dynamic, and staying informed about market changes, strategy updates, and technological advancements can provide you with a competitive edge.

If you encounter any issues or have questions about the process, please do not hesitate to reach out. Whether you need support with unexpected errors or simply want to discuss potential enhancements , I’m here to help.

Best of luck with your automated trading endeavors, and remember, the path to mastery is a continuous process of learning, testing, and optimizing.

Disclaimer: Please note that this article contains affiliate links to Binance and Vultr, which means I may receive a commission if you decide to sign up and trade with these platforms through the links provided. However, the editorial content, including the advice I provide and the opinions I express, are not influenced by these partnerships.

This article is for informational purposes only and should not be construed as financial advice. The world of cryptocurrency trading is highly volatile and risky; therefore, it is crucial to do your own research and consider seeking advice from a financial professional before making any investment decisions. The strategies and tools discussed in this article are not guaranteed to result in profits, and users should trade at their own risk. The use of Freqtrade and the NostalgiaForInfinity strategy does not assure success and may involve significant risks. By using the information provided herein, you acknowledge and agree that I am not responsible for any decisions you make based on the content of this article.

Leave a comment

> Newsletter <
Interested in Tech News and more?

Subscribe