Hi Yves,
An addendum:
Iif you have looked up the construction of IIf statements, you will realize
that what I supplied was not correct. I do not know what you want to do if
result is not true, i.e., the false array you want to display. So what
follows is a completed IIf statement which simply makes the color change
depending on what you wanted for result. Of course I do not know how you define
Result, so until you define that, this will not work either (for my continued
example, I assume result is RSI(9) greater than 50).
Plot(RSI(9),"RSI", IIf(Result, colorRed,colorBlue), styleThick|styleDashed ) ;
A suggestion for construction: if you see what is needed in a
plot statement (e.g., color, make it a separate statement if you want the result
to change based on some condition and use that in your plot statement
--
ColorRSI
= IIf(RSI(9) >= 50, colorRed, colorBlue);
Plot(RSI(9),"RSI", ColorRSI ,
styleThick|styleDashed ) ;
Again, as has been suggested by myself and Mubashar Virk, read the
manual.
Peace and Justice --- Patrick
----- Original Message -----
Sent: Sunday, November 08, 2009 11:46
AM
Subject: Re: [amibroker] Problem with
PLOT and IIF
Hi Yves,
If you insist on writing code, it is time for you to get out the manual
and learn the language (construction, reserved words, arguments and syntax) of
AFL. You ask questions which are at the heart of how to write even the
simplest of code. I solve this one for you:
Plot(RSI(9),"RSI", IIf(Result,colorRed,styleThick|styleDashed)
;
Note the different placement of the | symbol. Try looking up what "|"
means and it will make sense.
Here's a general hint: When you type a reserved word in the formula
editor (such as "IIf" ) and you then add the "(" , you will get the arguments
which you must supply and their order { i.e. type without the "
": "IIf(" and IIf(Condition, TrueArray,
FalseArray will display }. Try it with "Plot(" ,
"ParamColor"and "ParamStyle(".
Another hint - can't remember a reserved word? Start to type the
first letter, or several letters, and press <CTRL><Space> {press
both the CTRL and Space keys at the same time}. You will get a drop down
menu of all the possible ways to complete the word and you can select the one
you wish. Of course there is always "F1" available as well.
Take some time and read the manual and pay attention to the
requirements of AFL before calling something a problem. Lots of folks will
help you with coding, but few will be willing to teach you to
read.
Peace and Justice ---
Patrick
----- Original Message -----
Sent: Friday, November 06, 2009 10:41
PM
Subject: [amibroker] Problem with PLOT
and IIF
I'm would have:
IIF(Result, Plot RSI in colorRed and
styleThick, colorRed and
styleDashed)
I'm try with that, but is NO GOOD:
Plot(RSI(9),"RSI", IIf(Result,colorRed,|styleThick,styleDashed)
;
Thank You
Merci YLTech ( Yves L.
) Le présent message et les documents qui y sont joints sont
réservés exclusivement au destinataire indiqué. Il est strictement interdit
d'en utiliser ou d'en divulguer le contenu. Si vous recevez le présent
message par erreur, veuillez le détruire S.V.P. et nous en aviser
immédiatement afin que nous puissions corriger nos dossiers.
Merci. This message and the attached documents may contain
privileged or confidential information that are intended to the addressee
only. Any unauthorized disclosure is strictly prohibited. If you happen to
receive this message by error, please delete it and notify us immediately so
that we may correct our internal records. Thank you. yltech@xxxxxxxxxxxx
__._,_.___
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
__,_._,___
|