adding stock data to amibroker using c#

Posted by femi on Stack Overflow See other posts from Stack Overflow or by femi
Published on 2010-05-30T21:19:33Z Indexed on 2010/05/30 21:22 UTC
Read the original article Hit count: 434

Filed under:
|
|
|

hello, I have had a hard time getting and answer to this and i would really , really appreciate some help on this.

i have been on this for over 2 weeks without headway.

i want to use c# to add a line of stock data to amibroker but i just cant find a CLEAR response on how to instantiate it in C#.

In VB , I would do it something like;

Dim AmiBroker = CreateObject("Broker.Application")                
sSymbol = ArrayRow(0).ToUpper
                Stock = AmiBroker.Stocks.Add(sSymbol)
                iDate = ArrayRow(1).ToLower
                quote = Stock.Quotations.Add(iDate)
                quote.Open = CSng(ArrayRow(2))
                quote.High = CSng(ArrayRow(3))
                quote.Low = CSng(ArrayRow(4))
                quote.Close = CSng(ArrayRow(5))
                quote.Volume = CLng(ArrayRow(6))

The problem is that CreateObject will not work in C# in this instance.

I found the code below somewhere online but i cant seem to understand how to achieve the above.

Type objClassType; 
            objClassType = Type.GetTypeFromProgID("Broker.Application");
            // Instantiate AmiBroker
            objApp = Activator.CreateInstance(objClassType);
            objStocks = objApp.GetType().InvokeMember("Stocks", BindingFlags.GetProperty,null, objApp, null); 

Can anyone help me here?

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about createobject