How to add time information to candlestick chart?
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello,
I have below code to chart candlesticks for financial data, I created a timetable, TT, and tried to skecth candle sticks but output figure is not correct, I cannot see sticks, only candle appears. Instead of timetable, if I tried to plot with a matrix without time information, results look good but without time. How to add time information to candlestick chart?
[a,b,c]=xlsread('202001.csv');
load('priceM1_2020.mat');
time=datetime(c(:,1));
Open=priceM1_2020(1:31652,1);
High=priceM1_2020(1:31652,2);
Low=priceM1_2020(1:31652,3),
Close=priceM1_2020(1:31652,4);
TT=timetable(time,Open,High,Low,Close);
candle(TT(end-50:end,:))
Result with timetable input;
Results with matrix(double) input;
댓글 수: 3
Siddharth Bhutiya
2021년 2월 8일
I tried plotting both the data as timetable and as a double and I am getting the same plot for both the cases. Can you share the double matrix that is generating the candlesticks graph you showed above.
candle(TT(end-50:end,:)) % Plot using timetable input
mat = TT{end-50:end,:}; % Extract the data from the timetable into a matrix
candle(mat) % Plot using matrix input
On a side note, it would be better to use readtable instead of xlsread to read your csv file into MATLAB.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Preprocessing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!