[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] OLE Quotations Retrieve with C#



PureBytes Links

Trading Reference Links

I'm trying to write Amibroker COM wrapper in .net, and i stuck in 
implementation of Quotations.Retrieve method. 

I'm trying to use SafeArrays, as Tomasz said, but com exception fired.
Here is Quotations.Retrieve snippet:
int Retrieve(int Count, 
            [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = 
VarEnum.VT_VARIANT)]  ref Array Date,
            [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = 
VarEnum.VT_VARIANT)]  ref Array Open,
            [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = 
VarEnum.VT_VARIANT)]  ref Array High,
            [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = 
VarEnum.VT_VARIANT)]  ref Array Low,
            [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = 
VarEnum.VT_VARIANT)]  ref Array Close,
            [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = 
VarEnum.VT_VARIANT)]  ref Array Volume,
            [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = 
VarEnum.VT_VARIANT)]  ref Array OpenInt);
===========
That's retrieve call:
Array D =  Array.CreateInstance(typeof(DateTime), z);
               Array O =  Array.CreateInstance(typeof(object), z);
               Array H =  Array.CreateInstance(typeof(object), z);
               Array L =  Array.CreateInstance(typeof(object), z);
               Array C =  Array.CreateInstance(typeof(object), z);
               Array V =  Array.CreateInstance(typeof(object), z);
               Array OI = Array.CreateInstance(typeof(object), z);
               int i = q.Retrieve(z, ref D, ref O, ref H, ref L, ref C, 
ref V, ref OI);
============
After invoking method, i have an exception: "Exception has been thrown by 
the target of an invocation."
============
Questions:
1. What type O,H,L,C,V,OI var should be?
2. What array size I should define, size == retrieve count or NULL size?
3. Tomasz can you send me VB 6.0 samples (Retrieve.zip)?

Best regards.





------------------------------------

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/