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

[amibroker] Re: OLE Quotations Retrieve with C#



PureBytes Links

Trading Reference Links

So I found the solution, hope my code helps someone else.

----- C# CODE -----

  public int Retrieve(int Count, 
            ref DateTime[] Date,
            ref float[] Open,
            ref float[] High,
            ref float[] Low,
            ref float[] Close,
            ref int[] Volume,
            ref int[] OpenInt)
        {
            object[] ParamArray = new object[8];
            ParamArray[0] = (long)Count;
            ParamArray[1] = new VariantWrapper(Date);
            ParamArray[2] = new VariantWrapper(Open);
            ParamArray[3] = new VariantWrapper(High);
            ParamArray[4] = new VariantWrapper(Low);
            ParamArray[5] = new VariantWrapper(Close);
            ParamArray[6] = new VariantWrapper(Volume);
            ParamArray[7] = new VariantWrapper(OpenInt);

            //throw new NotImplementedException();
            ParameterModifier p = new ParameterModifier(8);

            // Pass the first and third parameters by reference.
            p[0] = false;
            p[1] = true;
            p[2] = true;
            p[3] = true;
            p[4] = true;
            p[5] = true;
            p[6] = true;
            p[7] = true;
            ParameterModifier[] mods = { p };

            int cnt = (int)ComParent.GetType().InvokeMember("Retrieve", BindingFlags.Default | BindingFlags.InvokeMethod,
                        null,
                        ComParent,
                        ParamArray, mods, null, null);

            Date = (DateTime[])ParamArray[1];
            Open = (float[])ParamArray[2];
            High = (float[])ParamArray[3];
            Low = (float[])ParamArray[4];
            Close = (float[])ParamArray[5];
            Volume = (int[])ParamArray[6];
            OpenInt = (int[])ParamArray[7];

            return cnt;
        }

------ END CODE ----

--- In amibroker@xxxxxxxxxxxxxxx, "angeld_1985" <angeld@xxx> wrote:
>
> I'm trying to write Amibroker COM wrapper in .net, and i stuck in 
> implementation of Quotations.Retrieve method. 
> 




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

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

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

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/