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

AFL question



PureBytes Links

Trading Reference Links

I'm working on the following Bollinger Band AFL:

Lookback = 120;
bb_top = BBandTop(Close,20,2);
bb_bot = BBandBot(Close,20,2);
bb_middle = MA(Close,20);
bandwidth = (bb_top - bb_bot) / bb_middle;
Plot( Bb_top, "Top Band", IIf(bandwidth == LLV(bandwidth,Lookback), 
colorYellow , colorWhite ) );
Plot( Bb_bot, "Bottom Band", IIf(bandwidth == LLV
(bandwidth,Lookback), colorYellow , colorWhite));
Plot( Bb_middle, "Middle Band", IIf(bandwidth == LLV
(bandwidth,Lookback), colorYellow , colorRed ) );
Plot( Close, "Closing Price", IIf(bandwidth == LLV
(bandwidth,Lookback), colorYellow , colorBlack ), stylecandle);

The IIF statement colors the bands and candlesticks yellow if the 
bandwidth is equal to the lowest low of the last 120 bands. 

First, can I change it such that the bands are colored yellow if the 
bandwidth is equal to OR LESS THAN the lowest low of the last 120 
bands?

Second, I don't want the bands colored until 120 (or whatever number 
the lookback is set for) periods have gone by first--the way it's 
written now, the bands are colored yellow quite often during the 
first 120 periods if the bandwidth initially was quite wide.

Tomasz has helped me considerably thus far, but I don't want to keep 
peppering him with questions. I thought the group might be able to 
help with this one.

Thanks in advance.

Harold Harper
harold@xxxx