PureBytes Links
Trading Reference Links
|
Yuki,
to choose a colour if a given condition is true, in title You can use
WriteIf() function (commentary conditional text output).
Here is an example:
//--------------------------------------------------------------------------
Plot(C,"Close",ColorBlack,styleCandle);
PlotForeign("^NDX","ND100",colorRed,styleCandle|styleOwnScale);
Index_C = Foreign("^NDX","C",1);
Index_var = (Index_C - Ref(Index_C,-1))/Ref(Index_C,-1)*100;
// Titolo del grafico
Title = Name()+" - "
+WriteIf(Interval()==86400,"Daily ","")+Date()+" :"
+" Op "+WriteVal(O,1.4)
+", Hi "+WriteVal(H,1.4)
+", Lo "+WriteVal(L,1.4)
+", Cl "+WriteVal(C,1.4)
+", ("+WriteVal(( ((C-Ref(C,-1))*100) /Ref(C,-1)),1.2)+" %)"
+" - Vol "+WriteVal(V,1.0)
+" - ^NDX %var :
"+WriteIf(Index_var>0,"\\c27","\\c32")+WriteVal(Index_var,1.2)+"\\c16 %";
//--------------------------------------------------------------------------
Best Regards,
Antonio
-----Original Message-----
From: Yuki Taga [mailto:yukitaga@xxxxxxxxxxxxx]
Sent: Thursday, July 29, 2004 9:09 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Need some Title help
I would like to modify the following title in my built-in Px chart:
Title = EncodeColor(colorWhite)+ "Px.
[Built-in]"+EncodeColor(colorBlack)+" "+Name() +" on "+ WriteVal(
DateTime(), formatDateTime )+" "+EncodeColor(colorYellow)+"O
"+EncodeColor(colorBlack)+WriteVal(O,x)+"
"+EncodeColor(colorYellow)+" H
"+EncodeColor(colorBlack)+WriteVal(H,x)+"
"+EncodeColor(colorYellow)+" L
"+EncodeColor(colorBlack)+WriteVal(L,x)+"
"+EncodeColor(colorYellow)+" C
"+EncodeColor(colorBlack)+WriteVal(C,x)+EncodeColor(colorDarkRed)+"
Vol =
"+EncodeColor(colorBlack)+WriteVal(V,1)+EncodeColor(colorDarkGreen)+WriteIf(
Name()=="^IXJ"
OR Name()=="^225"," (+3 zeros for Index Vol)","");
This works fine above ("x" refers to a format choice in an if-else
statement that looks at what database I'm using: US or Japan, just so
you know where that's coming from). But I want to further complicate
this ^^_^^ and I'm having some trouble getting what I want done.
What I want to do is add one more entry at the end after volume *if*
I am looking at either Name()=="^IXJ" OR Name()=="^225". The entry
would be the percentage change of the index on that date, color coded
green if higher and red if lower, to two decimal places. I know how
to calculate percentage change of course. (^_-) But all this has to
be nested somehow (I think) inside an IFF(), and I am just not
getting the job done however I try it. Is there someone out there who
can give me a good example?
Yuki
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Sponsor
ADVERTISEMENT
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.
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
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:
http://docs.yahoo.com/info/terms/
|