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

[amibroker] Re: Colored Bars?



PureBytes Links

Trading Reference Links

One solution
Y=C; //Data array
T1=14;
LR=LinearReg(Y,T1);
 
bc=Cross(y,Lr)*colorGreen+Cross(Lr,y)*colorRed;
bc=IIf(bc!=colorRed AND bc!=colorGreen,colorBlack,bc);
 
GraphXSpace=2;
Plot(Y,"Prices",BC,128);
Plot(LR,"LinReg Line",colorBlue,1);
Dimitris Tsokakis
--- In amibroker@xxxxxxxxxxxxxxx, "CS" <res1wgwl@xxxx> wrote:
> I have to be missing something simple here but would appreciate 
your help.
> 
> I want to simply plot a green bar if the close crosses from below 
the LinReg line to above and plot a red bar if the close falls below 
the line from above.
> 
> I use:
> Y=C; //Data array
> T1=14;
> LR=LinearReg(Y,T1);
> 
> BC=IIf(Ref(Y,-1) < LR AND Y > LR ,colorGreen , IIf(Ref(Y,-1) > LR 
AND Y < LR ,colorRed,colorBlue));
> 
> GraphXSpace=2;
> Plot(Y,"Prices",BC,128);
> Plot(LR,"LinReg Line",colorLightBlue,1);
> 
> However, I get lots of green bars together, when it is obvious (to 
me) that the second and third green bar violates the rule for color 
selection.
> 
> 
> 
> It is interesting that BC=IIf(Cross(Y,LR) ,colorGreen , IIf(Cross
(LR,Y) ,colorRed,colorBlue)); works but the first example of BC 
doesn't.
> Makes me leery of decisions made by AB.
> Any ideas why?
> 
> Thanks,
> -CS


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/sO0ANB/LIdGAA/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/