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

Re: [amibroker] Re: AmiBroker 5.24.0 BETA released



PureBytes Links

Trading Reference Links

It is not about global or local (i.e. scope), but about lifetime of variables.

Static variables as far as scope is considered are global,
 however that is not the most important thing.

The lifetime is where the main difference is.

The lifetime of static variable is as long as program is running, i.e. they keep values
between subsequent AFL execution, and you can read/write to them
from to/from different formulas within same AmiBroker instance, while regular variables
live only during single formula execution.
Static variables do not however survive restart of application or do not work across
different instances.

AddToComposite is different because it actually stores values to the database
so values do persist between reset and between instances.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "vlanschot" <vlanschot@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, March 09, 2009 1:10 PM
Subject: [amibroker] Re: AmiBroker 5.24.0 BETA released


> Tomasz,
>
> To clarify my understanding (and perhaps help others as well):
>
> 1) The upgrade of StaticVarSet/Get now allows arrays, previously only numbers and strings.
> 2) StaticVarSet allows one to store an array and then retrieve this via StaticVarGet similar to
> a) Foreign (ATC), EXCEPT that this works globally,
> b) VarGet (VarSet), EXCEPT that this works locally only
>
> If this is correct, how "semi-global" are they stored: not only "in view" for indicators, but also "once viewed" (i.e. updated) 
> per session?
>
> PS
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx> wrote:
>>
>> Hello,
>>
>> Yes calculation of complex formula in one pane and passing to other panes
>> is the simplest application.
>>
>> Similar thing is making "complex" indicator re-calculate not with every refresh,
>> but say only once a minute. The following example shows how to calculate
>> not more often than 5 seconds
>>
>> t = GetPerformanceCounter()/1000;
>>
>> diff = t - Nz( StaticVarGet("lastt") );
>>
>> RecalcInterval = 5; // re-calculate ONLY every 5 seconds
>>
>> if( diff < RecalcInterval
>>     AND Name() == StaticVarGetText("lastname") )
>> {
>>    Plot( StaticVarGet("precomputedarray"), "PreComputedArray", colorRed );
>> }
>> else
>> {
>>    something = MA( C, 10 );
>>    Plot( something, "FreshCalc", colorBlue );
>>
>>    StaticVarSet( "lastt", t );
>>    StaticVarSet( "precomputedarray", something );
>>    StaticVarSetText( "lastname", Name() );
>>
>> }
>>
>>
>> Different way of using it is for example, storing "best" portfolio equity and other
>> array metrics in the custom backtester and dynamically displaying them during
>> optimization (to watch "evolution" of best result)
>>
>> Another possibility is creation of composite indicators in a similar way
>> as AddToComposite, but faster.
>>
>>
>> Best regards,
>> Tomasz Janeczko
>> amibroker.com
>> ----- Original Message ----- 
>> From: "Dennis Brown" <see3d@xxx>
>> To: <amibroker@xxxxxxxxxxxxxxx>
>> Sent: Saturday, March 07, 2009 4:14 AM
>> Subject: Re: [amibroker] Re: AmiBroker 5.24.0 BETA released
>>
>>
>> > There had been a lot of discussions in past posts about how static
>> > array variables could be used.  However, I think the one that is most
>> > easily understood would be where you have two panes in a chart and you
>> > calculate a complex AFL to get some array in the top chart.  However,
>> > you want to display an indicator in the lower pane that is derived
>> > from that complex calculation.  Instead of duplicating the AFL from
>> > the top pane again in the lower pane, now the results from the top
>> > pane can be saved in a static variable, and the AFL in the lower pane
>> > can just use the array value in the same static variable.
>> >
>> > We have had the ability to pass single values between charts (or AFL
>> > passes), but now we can do that with complete arrays.  I am sure
>> > others will find interesting things to do with static array variables
>> > over time.
>> >
>> > Best regards,
>> > Dennis
>> >
>> >
>> > On Mar 6, 2009, at 8:06 PM, droskill wrote:
>> >
>> >> Very interesting - I'm wondering if someone could provide an simple
>> >> example of how one might use the feature - I realize this is
>> >> probably obvious to all of you - but I'd be curious to see what
>> >> people are using them for.
>> >>
>> >> --- In amibroker@xxxxxxxxxxxxxxx, "brian_z111" <brian_z111@> wrote:
>> >>>
>> >>> Thankyou very much Tomasz.
>> >>>
>> >>> Another small addition that leverages a lot of possibilities.
>> >>>
>> >>> Again it was the end result of very good communication between you
>> >>> and the forum.
>> >>>
>> >>> Thanks for looking after Natasha too.
>> >>>
>> >>>
>> >>> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@> wrote:
>> >>>>
>> >>>> Hello,
>> >>>>
>> >>>> AmiBroker 5.24.0 BETA is released now:
>> >>>> http://www.amibroker.com/devlog/2009/03/06/amibroker-5240-beta-released/
>> >>>>
>> >>>> This is somewhat special beta because it contains only one fix and
>> >>>> introduces only one new feature: array static variables.
>> >>>> I decided to release this feature "alone" because the static
>> >>>> variable code
>> >>>> has been completely rewritten, so in case of any issues, it would
>> >>>> be easy
>> >>>> to revert to 5.23.
>> >>>>
>> >>>> Best regards,
>> >>>> Tomasz Janeczko
>> >>>> amibroker.com
>> >>>>
>> >>>
>> >>
>> >>
>> >>
>> >>
>> >> ------------------------------------
>> >>
>> >> **** 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
>> >>
>> >>
>> >>
>> >
>> >
>> >
>> > ------------------------------------
>> >
>> > **** 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
>> >
>> >
>> >
>>
>
>
>
>
> ------------------------------------
>
> **** 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
>
>
>



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

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