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

Re: [amibroker] Re: Candel Color



PureBytes Links

Trading Reference Links

Hi George,
 
If the color of the candle body is all that you want to change, set the Tools --> Preferences --> Charting, Candlesticks radio button to Body outline only and use the code you have.
 
Alternatively, set the color of up and down bars to whatever you like via Preferences --> Colors and define the outline distinctively leave radio button set to Body outline and shadows, e.g.:
 

SetChartOptions(0);

x = Param("Space", 10, 0, 25, 1);

GraphXSpace = x;

Days = Param("Days in Bar", 1,1,21,1); // select multiday timeframe

Periods = Param("MA Periods", 21, 1, 200, 1, 10 );

TimeFrameSet( inDaily*Days ); // set multiday timeframe

info = "\\c45 # of Days/bar = "+ WriteVal(Days,3.0) + " \\c07 " + Date() + "\\c01 Close " ;

outlinecolor = IIf( C>MA(C, Periods), colorWhite, colorBlack);

Plot( C, info ,outlinecolor, styleCandle );

 

the foregoing will plot candles with the body colored as you define in Preferences, the outline will be white if C > the period of the SMA, otherwise Black and the code also allows you to set whether each candle represents a 1 thru 21 day chart (i.e., daily = 1, weekly = 5, monthly = 21 and whatever in between -- some TC2005 users like to see 2 or 3 day candles).

Enjoy

Peace and Justice   ---   Patrick

PS -- Dave, I thought I sent you code for changing the outline already. 

PPS -- If you want to add the MA to the chart, here's some code for that (leave the Preference set to :

//  Multi-Day Candles outline coded to MA

//  by Patrick Hargus 12-29-05

SetChartOptions(0);

x = Param("Space", 10, 0, 25, 1);

GraphXSpace = x;

Days = Param("Days in Bar", 1,1,21,1);                     // select multiday timeframe

TimeFrameSet( inDaily*Days );                                 // set multiday timeframe

Periods = Param("MA Periods", 9, 1, 200, 1, 10 );

x = Param ( "SMA[1] or EMA[2] " , 1 , 1 , 2 , 1 ) ;       // set 1 for SMA, 2 for EMA

info = "\\c45 # of Days/bar = "+ WriteVal(Days,2.0) + " \\c07   " + Date() + "\\c01     Close " ;

outlinecolor = IIf( C>MA(C, Periods), colorWhite, colorBlack);

Plot( C, info ,outlinecolor, styleCandle );

P = ParamField("Price field",-1);

S = MA( P, Periods );

E = EMA(P, Periods);

Average = IIf(x==1, S, E);

Plot( Average, WriteIf(x==1, "   SMA ("+ WriteVal(Periods,2.0)+" )", "   EMA ("+ WriteVal(Periods,2.0)+" )" ) , ParamColor( "MA Color", colorGold ), ParamStyle(" MA Style", styleDashed) );

----- Original Message -----

Sent: Thursday, December 29, 2005 6:24 PM
Subject: [amibroker] Re: Candel Color

Great! that is what I needed - the only thing I seem to be able to
change on the candels is the outline color using this type of code - I
will switch to bars and hopefully move on with my project.

Again - thanks,

George

--- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@x...> wrote:
>
> Just define the colours you want with a variable
> barcolour = iif( c>ma(c,20), colorgreen, colorred);
> plot( c, "", barcolour, stylebar );
>
> With candles you need to check the infill of the candle as selected in
> peferences.
> You can have solid, hollow up ordown etc. Sometimes only the tails and
> outline chanes colour from the AFL, you will need to experiment. I
> find bars easier to modify colours from AFL.
>
> --
> Cheers
> Graham
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
> http://e-wire.net.au/~eb_kavan/ab_write.htm
>
>
>
> On 12/30/05, gnader_2000 <zepplin@xxxx> wrote:
> > Great - thanks. I should have been said that I want to have the
> > candels color change once it is above or below an MA and as long as it
> > is say below the MA I want it to stay that color.
> >
> > Thanks again - appreciate it
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, K Lalchand <klal25@xxxx> wrote:
> > >
> > > Click on "Preferences"  --> "Colors"
> > >
> > > gnader_2000 <zepplin@xxxx> wrote:          Anyone know how I can
> > change the default candel stick colors?
> > >
> > >   Thanks,
> > >
> > >   George
>






Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS