public BackTestFileWriter(Strategy strategy) throws JArbitragerException {
    decimalFormat = NumberFormatterFactory.getNumberFormatter(5);
    dateFormat = new SimpleDateFormat("MMddyy,HHmmss");
    dateFormat.setTimeZone(strategy.getTradingSchedule().getTimeZone());

    File marketDataDir = new File(MARKET_DATA_DIR);
    if (!marketDataDir.exists()) {
      marketDataDir.mkdir();
    }

    String fullFileName = MARKET_DATA_DIR + FILE_SEP + strategy.getName() + ".txt";
    try {
      boolean fileExisted = new File(fullFileName).exists();
      writer = new PrintWriter(new BufferedWriter(new FileWriter(fullFileName, true)));
      if (!fileExisted) {
        StringBuilder header =
            getHeader(
                strategy.getInstrument1().getContract().m_symbol,
                strategy.getInstrument2().getContract().m_symbol);
        writer.println(header);
      }
    } catch (IOException ioe) {
      throw new JArbitragerException("Could not write to file " + strategy.getName());
    }
  }