NexusFi: Find Your Edge


Home Menu

 





Storing Backtest Reports in a Database


Discussion in Platforms and Indicators

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




 
Search this Thread

Storing Backtest Reports in a Database

  #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?
Better Renko Gaps
The Elite Circle
Footprint for strategy Builder
NinjaTrader
Cheap historycal L1 data for stocks
Stocks and ETFs
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Funded Trader platforms
51 thanks
Just another trading journal: PA, Wyckoff & Trends
21 thanks
Self sabotage reframed
15 thanks
Trading with Intuition
15 thanks
GFIs1 1 DAX trade per day journal
8 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 Twitter Reply With Quote




Last Updated on December 11, 2013


© 2024 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 - Privacy Policy - Downloads - Top
no new posts