Clear Filters
Clear Filters

Need help understanding candle plots

2 views (last 30 days)
Daniel
Daniel on 18 Nov 2015
Edited: Daniel on 18 Nov 2015
I got the allords data from here Yahoo Finance for daily share data.
I save it as an XLSX and then load it up with:
%%Load Excel file
[num,txt,raw] = xlsread('Aords.xlsx');
%%Obtain data from arrays
Open=num(:,1); High=num(:,2); Low=num(:,3); Close=num(:,4); Volume=num(:,5); Date=txt(2:end,1);
%%inverse arrays if they are back to front (comment out if not so)
Open=flipud(Open); High=flipud(High); Low=flipud(Low); Close=flipud(Close); Volume=flipud(Volume); Date=flipud(Date);
%%convert date string into num
% datetime.setDefaultFormats('default','yyyy-MM-dd')
% Date=datenum(Date);
% Date = datetime(Date,'ConvertFrom','datenum');
%%Plot data highlow(High, Low, Close, Open,'b', Date) *LINE 34*
but I get this error:
Conversion to cell from double is not possible.
Error in highlow (line 96) dateset2(3:3:end) = NaN * ones(size(3:3:length(dateset1)));
Error in chart (line 34) highlow(High, Low, Close, Open,'b', Date)
If I uncomment the datenum conversion to datetime I get this error:
Error using highlow (line 96) You can not assign numeric values to a datetime array. Assign to the array's Year, Month, Day, Hour, Minute, or Second properties, or use datetime(x,'ConvertFrom',...) to create datetime values for assignment.
Error in chart (line 34) highlow(High, Low, Close, Open,'b', Date)
I assume I have a formatting error in the Date some how

Answers (0)

Categories

Find more on Data Type Conversion in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!