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?
More Than Capable: Hegseths War Warning Validates $114M …
Prediction Markets & Event Contracts
Fed Hike Odds at 57% After Warsh: England Surges 12.9%, …
Prediction Markets & Event Contracts
Kalshi Sets $4.13B All-Time Weekly Record as Polymarket …
Prediction Markets & Event Contracts
After $87M Settles NO: Irans Nuclear Redline Sets Up the …
Prediction Markets & Event Contracts
I Have a Thing Called Iran -- Trump Stays in DC as Airsp …
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