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

[amibroker] Re: ValueWhen() function



PureBytes Links

Trading Reference Links


Thanks Herman, 
this works fine for me. Is it also possible to overlay this average 
chart with the recent years data to be able to compare if the actual 
year behaves like the average? I have to excuse my poor programming 
skills, but i can't figure this out myself.

regards

dj


--- In amibroker@xxxxxxxxxxxxxxx, "Herman van den Bergen" <psytek@xxxx
> wrote:
> This is NOT complete and tested code but it may give you a looping 
idea to
> start with. This code sums the Close prices for consequtive years 
and
> divides the by the number of times the Close was summed. This 
doesn't do any
> normalization, year synchronization, etc. The result displays at the 
start
> of you X-axis; zoom in to the left-begin of your chart. As an 
Indicator you
> may have to turn Off QuickAFL for this to work - or you can run it 
from your
> AA.
> 
> Herman
> 
> BI = BarIndex();
> SumArray = 0;
> NewYear = Year() != Ref(Year(),-1);
> OffSet = 0;
> Count = 0;
> Array = C;
> for(b=0; b<BarCount;b++)
> {
> if( NewYear[b] ) OffSet = BI[b];
> SumArray[b-OffSet] = SumArray[b-OffSet] + Array[b];
> Count[b-OffSet]++;
> }
> Average = SumArray/Count;
> Plot(Average,"Average",1,1);
> 
>   -----Original Message-----
>   From: yps_trader [mailto:yps_trader@x...]
>   Sent: Monday, October 04, 2004 1:14 PM
>   To: amibroker@xxxxxxxxxxxxxxx
>   Subject: [amibroker] ValueWhen() function
> 
> 
> 
>   Hello,
> 
>   my aim is to create an array with the closing price on the same 
day
>   of the year but one year ago.
>   I figured I could use the ValueWhen function for this:
> 
>   x=valuewhen(Dayofyear()==???,C,1);
> 
>   However I am having problems with the expression. The expression
>   should be true on every dayofyear() in the past with the same 
value
>   as the actual dayofyear().
>   The larger background is that I would like to create Seasonal 
Charts
>   with Amibroker.
>   I wanted to do this, by averaging the Closing price of each 
specific
>   dayofyear() of e.g. the last 10 years and then chart this array.
> 
>   I hope someone can help me.
> 
>   Regards
> 
>   dj
> 
> 
> 
> 
> 
>   Check AmiBroker web page at:
>   http://www.amibroker.com/
> 
>   Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> 
> 
>         Yahoo! Groups Sponsor
>               ADVERTISEMENT
> 
> 
> 
> 
> 
> --------------------------------------------------------------------
--------
> --
>   Yahoo! Groups Links
> 
>     a.. To visit your group on the web, go to:
>     http://groups.yahoo.com/group/amibroker/
> 
>     b.. To unsubscribe from this group, send an email to:
>     amibroker-unsubscribe@xxxxxxxxxxxxxxx
> 
>     c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.
> 
> 
> 
> [Non-text portions of this message have been removed]





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/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/