Using a csv file was the way I solved this problem.  The AB code is short and 
simple that way.

I took the recession/expansion dates from:

http://www.nber.org/cycles.html

...then created a csv file" named "^Recession Ribbon" (with the 
data,open,high,low,close,volume,open interest format) with "1"s and "0"s to 
denote expansions and recessions.

This AB code will give you a yellow ribbon from the top to the bottom of a 
price chart during recessions.

REC=Foreign("^Recession Ribbon","C")==0;
Plot(REC, "Recession", colorYellow,styleOwnScale|styleArea|styleNoLabel , 0,1);


Sebastian

--- In amibroker@yahoogroups.com, "bistrader" <bistra...@...> wrote:
>
> Paul,
> 
> Thanks.
> 
> Two items.  First, I would like the overlay to extend from the top to the 
> bottom of the chart.  Is there a way to do this?  I remember seeing a chart 
> someplace that did this but can not find it.  Second, I would like to place 
> the state date and end date for each recession in a csv, but is there a way 
> to read the start and end dates (from column A and B, respectively) into the 
> arrays that you have?
> 
> Thanks
> 
> Bert
> 
> --- In amibroker@yahoogroups.com, "notanaiqgenius" <notanaiqgenius@> wrote:
> >
> > Hi, I made this indicator for you. Try applying as an overlay. Let me
> > know if that works for you.
> > 
> > Paul
> > -------------
> > 
> > //RD stands for recession date
> > StartRD1 = 1050101;
> > EndRD1 = 1050631;
> > 
> > StartRD2 = 1000401;
> > EndRD2 = 1030101;
> > 
> > StartRD3 = 1070701;
> > EndRD3 = 1090301;
> > 
> > isRecession = (DateNum()>=StartRD1 AND DateNum()<=EndRD1) OR
> >                  (DateNum()>=StartRD2 AND DateNum()<=EndRD2) OR
> >                  (DateNum()>=StartRD3 AND DateNum()<=EndRD3);
> > 
> > myATR = ATR(50);
> > recBarColor = Param("RecessionColorNum", 25,16,55,1);
> > 
> > rOpen = IIf(isRecession,Open,Open);
> > rHigh = IIf(isRecession,High+5*myATR,High);
> > rLow = IIf(isRecession,Low-5*myATR,Low);
> > rClose = IIf(isRecession,Close,Close);
> > 
> > PlotOHLC( rOpen, rHigh, rLow, rClose, "RecessionOverlay",
> >              recBarColor, styleCandle);
> > 
> > --- In amibroker@yahoogroups.com, "bistrader" <bistrader@> wrote:
> > >
> > > I would like to create an overlay afl that has recession periods in a
> > color that can be selected via parameter with default of light gray.  I
> > can come up with the beginning and ending dates for each period, but am
> > not how to proceed.  Getting lost on how to best define (i.e., maybe 1
> > if in recession and 0 otherwise) and how to best plot.  Help
> > appreciated.
> > >
> >
>


Reply via email to