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

[amibroker] Re: static variables/arrays...ATC?



PureBytes Links

Trading Reference Links

Herman:

>AddToComposite(array,"~CompositeName");

I thought we have to add a 3rd argument specifying the field, as in:
AddToComposite(CompositeArray,"~CompositeName", "I");

>This array can be manipulated, bar-by-bar if you like.
>You load it up at the start of each Exploration
>cycle (begin of code)

Load it at the start of the code?  Do you mean:
TempArray = Foreign(~CompositeName, "I");

>and save it at the end of each exploration cyle (end of code).

Save it at the end of each Explore iteration?  The only way I can see to do 
that is:

//BEGINNING AREA OF CODE
//Load TempArray with values from ~CompositeName
TempArray = Foreign(~CompositeName, "I");
//reset CompositeName's "I" field to zero in preparation for ~CompositeName 
receiving a value assignment later in the middle area of the code
//  do this by adding back the negative of the value that's already in I, 
since I can't think of any other way to reset ~CompositeName's "I" field to 
zero
AddToComposite(-TempArray,"~CompositeName", "I");

//MIDDLE AREA OF CODE
//manipulate values of TempArray.  As a trivial example, let's divide them 
by 2.
TempArray = TempArray / 2;

//ENDING AREA OF CODE
//now the TempArray contains the newly manipulated values we want,
//  and ~CompositeName's "I" field contains zero.
//  let's add TempArray back into the I field of ~CompositeName, so that it 
will remain
//  static and available to repeat this entire procedure at the beginning 
of the subsequent Explore iteration
AddToComposite(TempArray,"~CompositeName", "I");

This is the best solution I can think of.  Obviously, it's pretty awkward.

>for(b=0; b<BarCount; b++)
>{
>CompositeArray[b] = b*si[b];//assign whatever value you like

But CompositeArray, as you defined it above, is not in any way statically 
connected with the ATC function, it's just a standalone array that you 
declared locally.

How do you get the values from the ~CompositeName's "I" field out to 
CompositeArray, and later on back into ~CompositeName?  Is there a more 
elegant way to  do it than the very laborious and awkward way I described 
above?

>arrays, when working in RT with 100,000 bars things tend to slow down and I
>would prefer an optimized afl function - I don't think anybody can match
>TJ's afl execution.

I can't see why you can't come close, if you're willing to write a compiled 
DLL.  I'm trying to avoid that, if possible.

>Disk read/writes do not always take up that much more time because Windows
>may keep copies in memory, having as much as possible Memory might help.

Good point.

Thanks, Herman.  I appreciate your help very much.  I've posted code this 
time, so perhaps you can better spot where I've gone wrong in my thinking.

     -Paul 

[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

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

<*> 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/