Skip to content
Dave Mabe
Close menu

Adding Data from Other Symbols into a Backtest

By Dave Mabe

The beauty of using the Strategy Cruncher is that there's no reason not to add more columns to your backtest.

The Cruncher will tell you which ones are important.

I have over 200 columns in my column library - some traders have over 300 - that get automatically added to every backtest I run.

One type of data point traders often overlook is data from other symbols.

For example, you have a strategy that trades gapping stocks.

One useful column might be the current SPY gap.

If SPY is gapping up, maybe a stock gapping up isn't that unusual.

Amibroker makes accessing this data easy using the SetForeign function:

       SetForeign("SPY");
      SPYOpen = Open;
      SPYHigh = High;
      SPYLow = Low;
      SPYClose = Close;
      TimeFrameRestore();

      // Open, High, Low, Close variables now back to "normal"
      // SPY* variables still accessible and contain SPY data
   

Now, any calculation can be made on SPY data and included as a column in your backtest.

Next time, I'll share the alternate data points I include in my backtest - stay tuned.

-Dave