NexusFi: Find Your Edge


Home Menu

 





Storing Backtest Reports in a Database


Discussion in Platforms and Indicators

Updated
    1. trending_up 1,771 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 quantarb 
Wayne, NJ USA
 
Experience: Intermediate
Platform: Multicharts, Deltix DCS
Broker: Interactive Brokers/IQ Feed
Trading: ETF Options
Posts: 41 since Oct 2012
Thanks Given: 7
Thanks Received: 38

Hello, does anyone know of a good way to store backtest reports in some type of database. I am thinking about using Microsoft Access to store my backtest reports.


Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
S&P 500 Holds the Line: No Fast Track for SpaceX, Op …
Stocks and ETFs
Warsh Drops Easing Bias, December Hike Now Above 50% -- …
Prediction Markets & Event Contracts
April 2026 Jobs Report: +115k vs +65k Expected
Traders Hideout
Without Pulisic, USA 61.5% Live vs. Australia -- France …
Prediction Markets & Event Contracts
UCL Final Kicks Off at Noon ET: PSG at 56.5% as Iran May …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
8 thanks
Darmok and Jalad at Tanagra
1 thanks
  #3 (permalink)
 tickleboy 
Seattle, Washington
 
Experience: Advanced
Platform: NinjaTrader, TradeStation
Broker: Kinetick
Trading: ES
Posts: 18 since Oct 2011
Thanks Given: 16
Thanks Received: 10



quantarb View Post
Hello, does anyone know of a good way to store backtest reports in some type of database. I am thinking about using Microsoft Access to store my backtest reports.

I've done it with SQL Server, but am sure you can use Access as well. You will need to be able to use ADO.Net code. Here's some sample code to at least get you started:

 
Code
        protected override String GetDatabaseInsertString()
        {
            switch (databaseTableName)
            {
                case "MinuteDatas":
                    return (@"INSERT INTO " + databaseTableName +
                        "(Instrument_ID, DateTime, [Open], High, Low, [Close], Volume) VALUES ('" +
                        instrumentId + "','" +
                        Time[0] + "','" +
                        Open[0] + "','" +
                        High[0] + "','" +
                        Low[0] + "','" +
                        Close[0] + "','" +
                        Volume[0] + "');");
                case "TickDatas":
                    return (@"INSERT INTO " + databaseTableName +
                        "(Instrument_ID, DateTime, Price, Volume) VALUES('" +
                        instrumentId + "','" +
                        Time[0] + "','" +
                        Close[0] + "','" +
                        Volume[0] + "');");
               case "DayDatas":
                  return(@"INSERT INTO " + databaseTableName +
                        "(Instrument_ID, Date, [Open], High, Low, [Close], Volume) VALUES ('" +
                        instrumentId + "','" +
                        Time[0] + "','" +
                        Open[0] + "','" +
                        High[0] + "','" +
                        Low[0] + "','" +
                        Close[0] + "','" +
                        Volume[0] + "');");
                default:
                    return ("");
            }
        }   

     protected void InsertIntoDatabase(string s)
     {
         SqlCommand cmd = new SqlCommand(s, conn);
         cmd.ExecuteNonQuery();
      }

     conn = new SqlConnection("Data Source=" + databaseServer + ";Initial Catalog=" + initialCatalog + 
               ";Integrated Security=No; User ID=" + userId + ";Password=" + userPassword);
            try
            {
               conn.Open();
               SetDatabaseName();
               GetInstrumentPrimaryKey();
             }
            catch ....
I personally would rewrite the code differently if I did it again though and use a SQLCommand object parameters... but that's just me!

Hope that helps.....


Follow me on X Reply With Quote




Last Updated on December 11, 2013


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts