matlab 股票分时图_matlab画股票走势图 急急急!

本文介绍了如何使用MATLAB的candle函数绘制股票分时图和K线图。通过示例代码展示了如何加载数据,并设置颜色、日期等参数,最后展示了一段运行结果的截图。
摘要由CSDN通过智能技术生成

在MATLAB命令行窗口输入help candle,查看该函数的使用格式,具体如下:

>> help candle

candle Candlestick chart.

candle(HI, LO, CL, OP)

candle(HI, LO, CL, OP, COLOR, DATES, DATEFORM)

Optional Inputs: COLOR, DATES, DATEFORM

Inputs:

HI - Column vector of high prices of a security.

LO - Column vector of low prices of a security.

CL - Column vector of closing prices of a security.

OP - Column vector of opening prices of a security.

Optional Inputs:

COLOR - Three element color vector, [R G B], or a string specifying the

color name. MATLAB supplies a default color if none is specified

or if it is empty. The default color differs depending on the

background color of the figure window. See COLORSPEC in the

MATLAB Reference Guide for color names.

DATES - Column vector of dates for user specified X-axis tick

labels.

DATEFORM - A scalar dictating the format of the date string tick labels.

See DATEAXIS for details on the date string formats.

See also bolling, highlow, movavg, pointfig.

candle 的参考页

名为 candle 的其他函数

candle函数使用有两种形式,具体如下:

(1)candle(HighPrices, LowPrices, ClosePrices, OpenPrices)

(2)candle(HighPrices, LowPrices, ClosePrices, OpenPrices,Color, Dates, Dateform)

candle函数使用主要输入介绍:第一个参数为输入数据的最高价;第二个参数为输入数据的最低价;第三个参数输入数据的收盘价;第四个参数输入数据的开盘价;第五个参数为绘图的颜色设置;第六个输入参数为绘图x轴的日期,第七个输入参数为输入日期的形式设置。

具体的candle函数使用如下:

clc,clear,close all  % 清理命令区、清理工作区、关闭显示图形

warning off       % 消除警告

feature jit off      % 加速代码运行

load('data000001.mat')

openprice = data000001(1:40,1); % 开盘价

highprice = data000001(1:40,2); % 最高价

lowprice = data000001(1:40,3);  % 最低价

closeprice = data000001(1:40,4); % 收盘价

Color = 'blue';  % 颜色

figure(1)

candle(highprice, lowprice, closeprice, openprice, Color);

grid on

axis tight

运行程序输出结果如图1-12所示。

sfd .jpg

(23.3 KB, 下载次数: 1)

2016-9-10 20:14 上传

442a53943febe9465fc072b4fbe10813.gif

b2a5a3e0dcc7d508e00275fe42fce1b5.gif

d248b81fcc831750bf92a96157b1eef6.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值