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

[amibroker] Re: *** Average of UP



PureBytes Links

Trading Reference Links

Using RSI as an indicator this will sort of do what you want ...

The question is how to value the average of the indicator when it 
hasn't been above 80 in the last more than number of bars you want to 
average.

RSIx = RSIa(C, 2);

Plot(RSIx, "RSI2", colorRed);

Count = IIf(RSIx > 80, 1, 0);
Value = IIf(RSIx > 80, RSIx, 0);

avgRSIx = Sum(Value, 5) / Sum(Count, 5);

Plot(avgRSIx, "ARSIx", colorWhite);


--- In amibroker@xxxxxxxxxxxxxxx, "Rick Parsons" <RickParsons@xxxx>
 wrote:
> I have an indicator.  If the High of the indicator is > 80 for the 
day, I want to:
> 
> Calculate:  UP = High - Open;
> 
> Then I want to calculate a moving average of UP.  But I only want a 
moving average of UP data when my indicator is > 80.  If indicator 
for the day is not >80, UP should not be added to the moving average.
> 
> How do I do this?
> 
> Thanks,
> 
> 
> Rick


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges & Refill Kits for Your Epson at Myinks.com
Free shipping on orders $50 or more to the US and Canada.
http://www.c1tracking.com/l.asp?cid=5705&lp=home/epson.asp
http://us.click.yahoo.com/brYXfA/_xWGAA/ySSFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/