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

Re: [amibroker] MS database editing



PureBytes Links

Trading Reference Links

I came up with this, it might not be what you wanted but perhaps 
you'll find something of use in it. It probably needs a bit of 
debugging, I was very tired when I coded it.

Regards,
Johan

Col=Param("col",0,0,15);
bx=BarIndex();
CurYear=LastValue(Year());
newYear=Cross(DayOfYear(),LastValue(DayOfYear()));
numY=LastValue(Cum(newYear));
BarsInLastYear=LastValue(BarsSince(newYear));
plt=bx>LastValue(bx)-BarsInLastYear;

GraphXSpace=1;
Plot(C,"Close",colorDefault,styleNoDraw);
for(i=numY;i>=0;i--)
{
a=IIf(plt,Ref(C,-Min(i*BarsInLastYear,LastValue(bx))),Null);
Plot(a,"\nyear "+(CurYear-i-1)+"/"+(CurYear-i),25+2*i-Col,styleLine);
PlotShapes(shapeSmallCircle*IsEmpty(Ref(a,-1)),25+2*i-Col,0,a,0);
}



--- In amibroker@xxxxxxxxxxxxxxx, "Anthony Faragasso" <ajf1111@xxxx> 
wrote:
> Here is what  I am trying to do:
> 
> Lets say that I have TickerX and tickerX has 10 years of data....I 
would
> like to display a line chart of every year that is in the data in 
the same
> Window....
> 
> I can currently do it with the following code:
> 
> Year1 = BarIndex() - ValueWhen(LastValue(DateNum() )-10002 ==
> DateNum(),BarIndex() );
> 
> Year1 = LastValue( Year1);
> 
> Year2 = BarIndex() - ValueWhen(LastValue(DateNum() )-20002 ==
> DateNum(),BarIndex() );
> 
> Year2 = LastValue( Year2);
> 
> Plot( Close,"present year",colorBlue);
> 
> Plot( Ref(Close,-Year1),"previous year", colorRed);
> 
> Plot( Ref(Close,-Year2),"2 years ago", colorGreen,styleLine);
> 
> Would it be possible to do it with a loop, therefore every year 
that is in
> the database will be displayed ?
> 
> 
> 
> Thanks in advance
> 
> Anthony



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