Code covered by the BSD License  

Highlights from
Candlesticks

Be the first to rate this file! 23 Downloads (last 30 days) File Size: 7.79 KB File ID: #33782
image thumbnail

Candlesticks

by Nate Jensen

 

15 Nov 2011

Calculates the end indices of 90 different candlestick patterns

| Watch this File

File Information
Description

Description
    Since the early days of the Japanese rice traders, candlestick charting has grown into a complex technical analysis tool based primarily on patterns. Candlestick charts are flexible, because candlestick charts can be used alone or in combination with other technical analysis techniques, not instead of other technical tools. As with all charting methods, candlestick chart patterns are subject to interpretation by the user. Currently, there are 90 patterns.

Syntax
    [bull bear neutral] = candlesticks(open,high,low,close)

Inputs
    open - open price
    high - high price
    low - low price
    close - close price

Outputs
    bear - bearish patterns
    bull - bullish patterns
    neutral - neutral patterns
    Outputs are formatted into cells. The index of each cell corresponds
    to the index of that pattern in the order listed under Candlesticks.
    Each cell holds all of the indices from the input for the end of a
    pattern.
    For example:
    bear{1} is the Abandoned Baby pattern
    [23; 78; 92] are the contents of that cell and are the indices of the
    end of that pattern

Notes
    - data must be column oriented
    - there are no argument checks
    - most patterns require a prior bullish or bearish trend; this code
    does not check for that
    - all patterns either require, recommend, or suggest confirmation;
    this code does not check for that

Example
    load disney.mat
    [bull bear neutral] = candlesticks(dis_OPEN,dis_HIGH,dis_LOW,dis_CLOSE);

Version : 1.0 (11/02/2011)
Author : Nate Jensen
Created : 10/25/2011
History :
 - v1.0 11/02/2011 : initial release

To Do
 - add more candlesticks

The full list of candlestick patterns is located in the help section.

MATLAB release MATLAB 7.13 (R2011b)
Tags for This File  
Everyone's Tags
analysis, candlestick, finance, modeling
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
27 Dec 2011 Nate Jensen

If you wish to use the code the way it is set up right now, the minimum requirements for the inputs are:
- 4 column oriented vectors (open, high, low, close)
- the length of each vector must be at least 11

Here is an example of the minimum size for inputs:

op = [20 20 20 20 20 20 20 20 20 20 20]';
hi = [30 30 30 30 30 30 30 30 30 30 30]';
lo = [10 10 10 10 10 10 10 10 10 10 10]';
cl = [20 20 20 20 20 20 20 20 20 20 20]';

candlesticks(op,hi,lo,cl)

HTH,
Nate

27 Dec 2011 Francois

could not get it to work...

candlesticks(100,102,95,90);
??? Attempted to access temp_var1(-8); index must be a positive integer or logical.

Error in ==> candlesticks>CRA at 1213
temp_var2 = ones(temp_var1(observ-def(1)+1)-1,1);

Error in ==> candlesticks at 219
BodyLong = CRA(Body,1,BodyLongDef,Body);

Contact us