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

Re: [amibroker] Loop without an array



PureBytes Links

Trading Reference Links


Dimitris,
 
Very cool.  Thanks for the code tip. Did you pick up these shortcuts coding in another language?  It hadn't even occurred to me, but my friend always points out that vector math is much faster than looping as I'm sure your code will demonstrate.
 
Kind Regards,
GaryDIMITRIS TSOKAKIS <TSOKAKIS@xxxxxxxxx> wrote:
Gary,If you want to avoid IIFs and ANDs, then multiply the conditions and add the colors.VAL1=RSI();Plot(VAL1," RSI",1,8);COLOR=(VAL1<30)*colorBlack+(VAL1>=30)*(VAL1<40)*colorRed+(VAL1>=40)*(VAL1<50)*colorOrange+(VAL1>=50)*(VAL1<60)*colorYellow+(VAL1>=60)*(VAL1<70)*colorBrightGreen+(VAL1>=70)*colorWhite;Plot( 10, "Ribbon", COLOR,styleOwnScale|styleArea|styleNoLabel,2, 100 ); Dimitris Tsokakis--- In amibroker@xxxxxxxxxxxxxxx, "Gary A. Serkhoshian" <serkhoshian777@xxxx> wrote:> Hi David,>  > You need to account for ranges in your IIFs as you never specified what happens if Trin < 0.60.>  > The code below should send you in the right direction:>  > //Trin Barometer// > Val1 = Foreign("$Trin","c");
 > > Plot( 100, "Ribbon", >    IIf( Val1< 0.80, colorDarkGreen, >    IIf( Val1>= 0.80 AND Val <= 0.95, colorBrightGreen, >    IIf( Val1 > 0.95 AND Val1 <= 1.05, colorYellow , >    IIf( Val1 > 1.05 AND Val1 < 1.10, colorOrange, colorRed)))), >    styleOwnScale|styleArea|styleNoLabel, -0.5, 100 ); > > Hope this Helps,> Gary>  >  >  > > wooziwog <xcitemint@xxxx> wrote:> I am new to AFL code and have failed at getting the following formula > to work.  I am trying to create a ribbon that will change colors > determined by the Trin reading.  I can get it to work with two colors > but am having problems with multi colors.  I appreciate any help you > can give.> > David K.> > //Trin
 Barometer//> Val1 = Foreign("$Trin","c");> > Plot( 100, Ribbon", > IIf( val1>.60, colorDarkGreen, > IIf( Val1>.80, colorBrightGreen, > IIf( Val1>.95, colorYellow , > IIf(val1>1.05,colorOrange, > IIf( Val1>1.10, colorRed, > ) ) ) ) )) ,> styleOwnScale|styleArea|styleNoLabel, -0.5, 100 ); > > > > Send BUG REPORTS to bugs@xxxx> Send SUGGESTIONS to suggest@xxxx> -----------------------------------------> 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 > > > Yahoo! Groups
 SponsorADVERTISEMENT> > > ---------------------------------> Yahoo! Groups Links> >    To visit your group on the web, go to:> http://groups.yahoo.com/group/amibroker/>   >    To unsubscribe from this group, send an email to:> amibroker-unsubscribe@xxxxxxxxxxxxxxx>   >    Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. > > > > ---------------------------------> Do you Yahoo!?> Yahoo! Finance Tax Center - File online. File on time.Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to suggest@xxxxxxxxxxxxx-----------------------------------------Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
 href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.


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








Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/ 
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.