Trading Software
    Menu Close

    Accumulative Swing Index (ASI) cBot

    Product Support Available

    This basic starter kit for algo developers uses an open-source cTrader Accumulative Swing Index (ASI) indicator to automatically open and close trades. The ASI is a technical analysis indicator used primarily to evaluate the long-term trend and to assess the strength of a trend in financial markets.

    *This product is for educational purposes only *
    (OS) Type: Windows & Mac OS Compatible
    Current version: 1.0
    Updated: Saturday, 12 August 2023
    Author: ClickAlgo Team

    Need a broker?  Open a demo account

    Educational content: Read our disclaimer

    £0.00 Incl. VAT.
    cTrader Software

    The main idea behind the Accumulative Swing Index indicator is to take into account the opening, closing, and high, and low prices of a financial instrument over a given period. It incorporates the concepts of price range and price open-close relationship to calculate its values.  It was developed by Welles Wilder, the same person who created popular indicators like the Average True Range (ATR) and the Relative Strength Index (RSI). 

    The Accumulative Swing Index is known as a trendline indicator.

    Details discussing the ASI indicator can be found in the book "New Concepts in Technical Trading Systems."

    * It is worth finding out who is Welles Wilder and how he contributed to both institutional and retail trading.


    Here's how the Accumulative Swing Index indicator is calculated:

    The formula for calculating the Accumulative Swing Index is a bit complex compared to the other indicators.

    1. Calculate the R (Swing) value for each bar:

      • R = (Close - Prior Close) - 0.5 * (Prior High - Prior Low) + 0.25 * (Close - Prior Open)
    2. Calculate the Swing Index (SI) for each bar:

      • SI = 50 * R / ATR (where ATR stands for Average True Range, another Wilder's indicator)
    3. Calculate the Accumulative Swing Index (ASI) for each bar:

      • ASI = Prior ASI + SI


    The ASI typically fluctuates around a zero line and when it moves above the zero line, it suggests a positive price trend, and when it moves below the zero line, it indicates a negative price trend. Traders tend to use the ASI indicator to confirm trend changes, identify potential reversals, and gauge the strength of the current trend.


    Word of Warning

    Like any technical indicator, the Accumulative Swing Index is not perfect and may produce false signals, therefore, it's often used together with other indicators and analysis methods to confirm trading decisions.


    How Does the cBot Open & Close Trades?

    This strategy will open a buy trade when the ASI last value is greater than zero and also when the two bars back ASI value is less than zero. A sell trade opens when the ASI last value is less than zero and also when the two bars back ASI value is greater than zero.

    All trades close on an opposite signal, so when a buy opens as sell closes and visa versa. Trades can also close with a stop loss and take profit.

    We recommend that you add additional risk features and other indicators to create the perfect strategy.

    The indicator values are hard coded but can be easily adapted to a cBot parameter.


    Stop Loss & Take Profit Calculation

    A standard stop loss and take profit as well as position size can be set from the cBots parameter settings. 

    You can add additional risk management and other trade rules yourself or by contacting our development team.


    Accumulative Swing Index cBot is provided with full source code by

    cTrader Accumulative Swing Index cBot


    How To View The Source Code

    To view the source code for this cBot, you will first need to make sure you have downloaded and installed cTrader Desktop, you can also scroll to the bottom of this page for instructions on how to install the cBot. Once installed you will have the cTrader application open, next you need to navigate to the Automate application and click on the name of the cBot, the source should show in the right-hand window.

    If you need more help watch a video tutorial on how to use cTrader Automate.


    How to Attach Indicator to Chart

    You do not need to attach the Supertrend indicator to your chart when you run the cBot, but it is a good idea to visually see the indicator to check your trade rules for opening and closing trades and any risk management.


    Learn Algorithmic Trading

    In this instructional guide, we aim to assist you in acquiring the necessary skills to engage in market trading through automated trading strategies (cBots) using the cTrader Desktop trading platform. By the conclusion of this tutorial, you will gain the confidence to employ a cTrader cBot alongside the Algo application of cTrader, enabling you to automatically execute and handle your market orders. This course is designed to familiarize novice traders with the fundamental principles of algorithmic trading utilizing the cTrader platform.


    Learn Microsoft C# for Algo Trading

    If you are new to coding your cTrader cBot for automated trading the following Microsoft C# course will help you modify the starter kit cBot in this download to add new features for your own personal trading strategy.


    Algorithmic Trading Facts

    A significant number of traders venture into algorithmic trading with the misconception that they have discovered a foolproof strategy that guarantees effortless wealth. However, this notion is far from reality. It is crucial to read this article, as it can save you valuable time and money. 


    How To Install & Remove

    First, make sure you have the cTrader trading platform installed and then simply unzip the file and double-click on it to automatically install it onto the platform.

    cBot Starter Kit Training

    Any Questions?

    If you have any questions, please first search our coding help forum for the answer, if you cannot find it, post a new question.


    Need Coding Help?

    We can help you modify this cBot for your own personal trading strategy, contact our team for a quote.


    Need a Broker

    If you are still looking for a broker you can trust, take a look at our best cTrader broker site.