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

[amibroker] Re: if function



PureBytes Links

Trading Reference Links

Two alternatives:
1. Plot MACD() when StochD()>80 and 0 when not
Cond=StochD()>80;
Plot(Cond*MACD(),"Conditional MACD",1,1);
2. Plot MACD() when StochD()>80 and nothing when not
Cond=StochD()>80;
Plot(IIf(Cond,MACD(),-1e10),"Conditional MACD",4,8);

Perhaps it is better to paint your MACD with different colours
Cond=StochD()>80;
Plot(MACD(),"Conditional MACD",Cond+4,1);
With this version you watch the whole MACD curve and its colour 
changes when your condition is true.
DT
--- In amibroker@xxxxxxxxxxxxxxx, "Ara Kaloustian" <ara1@xxxx> wrote:
> I am trying to plot a shape based on certain conditions
> 
> Example
> 
> x               = stochD(14);
> CurrentBar  = BarsSince(Cum(1) == 1);
> 
> If (x[CurrentBar] > 80)
> {
> (PlotShapes(....
> }
> 
> The problem I have is that x is an array ... need to use a single 
number or single array element ... and its subscript has to be a 
numeric value (can not use CurrentBar).
> 
> Anyone with a workaround for this?
> 
> Thanks
> 
> Ara


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading!
Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/cjB9SD/od7FAA/AG3JAA/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/