Profile Picture

Saving indicator values to database?

Posted By tbwerz 10 Years Ago
Message
Posted Sunday August 12 2007
Hi,

I am using a SQL Server database and would like to store some of the indicators in the database for analysis outside of the RightEdge environment.   For example, if I wanted to store the 50 day SMA for each bar, how would I go about doing that?   I am interested in trying to reuse the existing functions to compute these rather than calculating them myself using the data in the BarData and TickData tables since there are so many different indicators.  I want to calculate & store this for all of the historical data as well as new data going forward. 

Optionally, if it would be possible for me to use the indicator functions from outside of the RightEdge environment (from a stand alone C# program for instance),  I would not need to store anything in the database, but I'm not sure if that's possible..

Thanks,

Tom

Posted Sunday August 12 2007
Tom,

It sounds like you'll want a layer that will store and later retrieve the values from SQL Server.  In the case of storing, I'd take your indicator values in NewSymbol() and save them.  For example:

public override void NewSymbolBar(Symbol symbol, BarData bar)
{
    // Access my indicator values
    double myValue = SeriesUtil.GetCurrentValue(Indicators["MYSMA"][symbol]);

    SqlConnection connection = new SqlConnection(myConnectionString);
    SqlCommand command = new SqlCommand("INSERT INTO MyIndicatorValue (IndName, IndValue, TheDate) VALUES(PUT YOUR VALS HERE")
    connection.Open();
    command.ExecuteNonQuery();
    connection.Close();
}

The above is untested off the top of my head, but should give you a good idea.

You can use the indicators outside of RightEdge just like you would inside of RightEdge.  In Visual Studio, add references to Common and Indicators.  These are standard .NET assemblies, so then you're free to use them as such in other program.s

tbwerz (8/12/2007)
Hi,

I am using a SQL Server database and would like to store some of the indicators in the database for analysis outside of the RightEdge environment.   For example, if I wanted to store the 50 day SMA for each bar, how would I go about doing that?   I am interested in trying to reuse the existing functions to compute these rather than calculating them myself using the data in the BarData and TickData tables since there are so many different indicators.  I want to calculate & store this for all of the historical data as well as new data going forward. 

Optionally, if it would be possible for me to use the indicator functions from outside of the RightEdge environment (from a stand alone C# program for instance),  I would not need to store anything in the database, but I'm not sure if that's possible..

Thanks,

Tom

Posted Monday August 13 2007
Thanks Bill, that met my needs.


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems