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

Re: [amibroker] Re: Help to convert afl statement to a loop



PureBytes Links

Trading Reference Links

Hi - I wrote one DLL a few years ago and I am *definitely* very rusty but I 
just took a quick look at my source code to confirm this....

If it will work for your purposes, you don't necessarily need to calculate 
all that in the DLL, you can use the site interface to import your arrays 
into the DLL - here are a couple of examples  from my DLL..

AmiVar VsjdAutoOptInd(int NumArgs, AmiVar *ArgsTable)
{
 // user-defined params
 AmiVar TestBars = gSite.GetVariable("TestBars");
 AmiVar StartDate = gSite.GetVariable("StartDate");
 AmiVar EndDate  = gSite.GetVariable("EndDate");
}

If that won't give you what you want, then you will need to to start with 
the innermost arrays and work your way out, walking the arrays on a 
bar-by-bar basis. Here is another example from the DLL showing how to do 
it...

for (Bar = FirstTestBar; Bar <= LastTestBar; ++Bar)
{
     ePosition.array[Bar] = eShares.array[Bar];
     eAdjToCash.array[Bar] = 0 - eValOfShares.array[Bar] - eComm.array[Bar];
     eRemainCash.array[Bar] = eCash.array[Bar] - eValOfShares.array[Bar] - 
eComm.array[Bar];
     eTheorCash.array[Bar] = eCash.array[Bar] - eValOfShares.array[Bar] - 
eComm.array[Bar];
}

Good Luck - Man, this stuff *really* makes you appreciate what TJ has given 
us with the AFL language!!   8 - )

Steve

----- Original Message ----- 
From: "iceboundbug" <iceboundbug@xxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, July 02, 2008 3:31 AM
Subject: [amibroker] Re: Help to convert afl statement to a loop


>
> Hello Steve,
>
> The reason why I want a loop is to write a DLL -  I got few books
> including Howards book to complete the DLL but I cannot get my head
> around with a loop.   You said it is a quite a job but please tell me at
> least about how many lines of coading that would be?  Thanks
>
>
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Steve Dugas" <sjdugas@xxx> wrote:
>>
>> That looks like it would be quite a job. None of my business of course
> but now that you got my curiousity up....why would you want to write it
> as a loop? Thanks!
>>
>> Steve
>> ----- Original Message -----
>> From: iceboundbug
>> To: amibroker@xxxxxxxxxxxxxxx
>> Sent: Tuesday, July 01, 2008 8:45 PM
>> Subject: [amibroker] Help to convert afl statement to a loop
>>
>>
>> Hello all,
>>
>> Could someone help me to write the following two afl statements using
> two separate loops please.
>>
>> Thanks in advance.
>>
>>
>>
>> x = Sum( MA(C-O,3) ,3) - Ref( Sum( MA(C-O,3) ,3) , -1) >0 ;
>>
>>
>>
>> y = MA(C-O, 5) > (-1)*MA(C-O, 7) ;
>>
>
>
>
>
> ------------------------------------
>
> 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
>
>
>
> 



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

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/