OHLC Plots in MATLAB®

How to make OHLC Plots in MATLAB® with Plotly.


Plotly is known for its graphing libraries, but it's also a broader ecosystem for building interactive data apps, AI data analysis tools, and deploying and hosting Dash apps. Explore the full set of tools and platforms designed to help turn data into action. Discover Plotly.

Note: We are retiring documentation for R, MATLAB, Julia, and F#. Learn more about this change here.

Generate a Line Break Chart for a Data Series for a Stock

Load the file SimulatedStock.mat, which provides a timetable (TMW) for financial data for TMW stock. This Linebreak chart is for closing prices of the stock TMW for the most recent 21 days. Note that the variable name of asset price is be renamed to 'Price' (case insensitive).

load SimulatedStock.mat;
TMW.Properties.VariableNames{'Close'} = 'Price';
linebreak(TMW(end-20:end,:));
title('Line Break Chart for TMW');

fig2plotly(gcf);

Generate a Highlow Chart for a Data Series for a Stock

Load the file SimulatedStock.mat, which provides a timetable (TMW) for financial data for TMW stock. The highlow chart plots the price data using blue lines.

load SimulatedStock.mat;
range = 1:25;
highlow(TMW(range,:),'b');
title('High, Low, Open, Close Chart for TMW');

fig2plotly(gcf);