Different Colour for Candle

2 ビュー (過去 30 日間)
Vinu Sagar
Vinu Sagar 2017 年 5 月 15 日
編集済み: dpb 2017 年 5 月 16 日
is it possible to have green colour when the close is greater than open and a red colour when the close is less than the open while using candle
  4 件のコメント
Image Analyst
Image Analyst 2017 年 5 月 15 日
Oh, that's funny. Thanks for clearing it up. I thought it was an actual real candle. Now I understand.
dpb
dpb 2017 年 5 月 15 日
Yeah, I could tell you were thinking "Image processing! My baliwick!", IA... :)
I do enough econometrics stuffs that have run across it; it's similar to box plot idea excepting for stock prices...

サインインしてコメントする。

回答 (1 件)

dpb
dpb 2017 年 5 月 15 日
編集済み: dpb 2017 年 5 月 16 日
Well, the doc says "(Optional) Candlestick color is specified as a character vector." which would indicate you can with just a little effort...
clrs=char('r','g'); % the two-vector from which to choose
Color=clrs((ClosePrices>=OpenPrices)+1); % select based on condition
candle(HighPrices,LowPrices,ClosePrices,OpenPrices,Color)
Make tri-state if want "no change" to show up as other than G as will here.
As noted, "air code", can't test as don't have requisite TB.
ADDENDUM
"Tri-state" is just a little different since a single logic comparison is only binary...
clrs=char('r','b','g');
Color=clrs(sign(ClosePrices-OpenPrices)+2);
-1,0,1 --> [1,2,3] ~ 1*sign(deltaPrice) + 2

カテゴリ

Help Center および File ExchangeTime Series Events についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by