|
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 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)
);
|