Working with automated strategy


Read Automation Concepts first if you haven’t already.

Once the strategy is defined, you will use the strategy details page to work with the strategy ( update, run backtest, deploy etc)

Access Strategy Detail Page

  1. Access strategy list table
  2. Click on the strategy name

Updating strategy

You can update any part of the automated trading strategy definition (entry condition, exit condition etc). To update,

  1. Access strategy detail page as described above
  2. Click on the pencil icon in the section that you want to update
  3. A dialog (the same screen that you used to define) will appear
  4. Modify as needed
  5. Click on Save on the dialog to close the dialog.
  6. The strategy is still not saved on the server yet. This allows you to modify multiple sections and finally click the Save.
  7. Click on the Save button on the top.
Affiliate Programs

Backtesting Trading Strategy

Investfly allows you to backtest automated trading strategy with historical data. When you backtest, Investfly will step through historical data and evaluate your entry and exit conditions and submit trades on simulated account. Backtest is only supported for stock trading strategy (not supported on option trading strategy)

  • Duration of backtest

    The time frame for backtest depends on what bar size parameters is used to define your entry and exit conditions. If the strategy only has DAILY bars, then backtest will be run with last 5 years of data. This means backtest will step through 5 years x 252 trading days per year = 1260 data points. However, when the strategy has MINUTE bars, then going through minute-by-minute data for the last 5years will take very long time. So, it will only run it with the last 5 days of minute-bars. This means backtest will step through 5 days x 390 minutes per day = 1950 data points. In both cases, backtest should finish in less than 5 minutes.

  • Reliability of backtest results

    The results of backtest will provide some hints as to whether the strategy might work, but they should not be interpreted as a guarantee that the strategy will work. This is mainly becomes

    1. Historical performance does not guarantee future result
    2. Difference in the granularity of data. In live trading, we have real-time quotes stream. Whereas in backtest, its running against 1-MINUTE bars.
    3. Non deterministic nature of the strategy as described in Automation Concepts . If set of 100 stocks match open conditions and you can only buy 10 of them, which of the matching stocks are bought is indeterministic due to parallel processing.

    Repeating the same backtest on same strategy could yield different result. This is good because if executions yield favorable result, it is a strong indication that your strategy works.

  • Starting and Stopping Backtest
    1. Access strategy detail as specified above
    2. Click on Start button in the backtest section
    3. The backtest will go through following states:
      1. QUEUED: This means the backtest is queued for execution by one of our backtest servers
      2. INITIALIZING: It is preparing environment to start backtest
      3. RUNNING: Backtest is running
    4. When the backtest is started, you can stop it any time by clicking the STOP button.
  • Backtest Results

    The results section displays standard metrics used to evaluate backtest results such as drawdown, profitable trade percent etc. It also displays all trades that were made during backtest run in a table.

    Affiliate Programs

Deploying Strategy

The final step is to deploy automated strategy to a trading account so it can start making trades in your account. We recommend to deploy to a virtual account first for some time and eventually deploy to a real broker account.

  1. Click on Deploy button
  2. Pick the trading account to which you want to deploy
  3. Click ‘Confirm Deploy’

Once deployed, the strategy will start evaluating your entry and exit criteria in real time and generating trade signals. You can get deeper insights on how the strategy is working by monitoring automation logs as described in Portfolio Dashboard