Here is another code. The graph has different colour above and below "zero" 
line. Just put in your own tickers and set the multipliers as needed. Right now 
you have: US2YY and (TNX x 0.1). I had to use TNX instead of US10YY because the 
latter symbol is available from my data provider only in RT but not in Eod.

Later you can add "param" functions so that you can change tickers and 
multipliers on-the-fly using "parameters" functionality from the right click 
menu.

http://www.amibroker.com/guide/afl/afl_index.php?m=1

The chart will like this:

http://img216.imageshack.us/img216/4086/12282006193656nz4.png

And the formula is here:

// Treasury Yield Curve

t1  = Foreign("US2YY", "C"); // ticker #1
t1m = t1 * 1;               // multiplier

t2  = Foreign("TNX", "C");  // ticker #2
t2m = t2 * 0.1;            // multiplier

yc = t2m - t1m;

dyn_col = IIf(yc>0, colorLime, IIf(yc<0, colorRed, colorLightBlue));

Title = Interval(2) + "  " + Date() + EncodeColor(SelectedValue(dyn_col)) + "  
Yield Curve = " + yc;

Plot(yc, "", dyn_col, styleStaircase);
PlotGrid(0, colorDarkYellow);

SetChartOptions(0, chartShowDates);

/**** END ****/

--- In [email protected], "sebastiandanconia" <[EMAIL PROTECTED]> wrote:
>
> Yes, it's possible to get a variation of the yield curve (a spread, more
> precisely), using the FOREIGN() function, as in:
> 
> Plot(Foreign( "^TNX", "C" )-Foreign( "^IRX", "C" ), _DEFAULT_NAME(),
> ParamColor( "Color", colorCycle ), ParamStyle("Style")  );
> 
> Using Yahoo! data this subtracts the 13-week Treasury Index from the
> 10-Year Treasury Index, but any spread can be created for which you have
> data.
> 
> --- In [email protected], "Gregory G. Serevetas"
> <gserevetas@> wrote:
> >
> > I'm using the free trial of AmiBroker and would like to find out if it
> > is possible to plot the YIELD CURVE, the FITE, and the NOB.
> >
> > If anyone knows how I might do this in AMIBROKER (or if it is even
> > possible), please post your message here.
> >
> > Thanks a lot.  Appreciate it...


Reply via email to