MotiveWave Docs
MotiveWave.com
  • User Guide
    • Welcome
    • Quick Start Guide
      • Getting Started
      • Installation
      • Customization Options
      • Advanced Features
      • Troubleshooting and Support
      • Next Steps
    • Console Overview
      • Preferences
      • Changing the Look and Feel
      • Desktops
      • Quote Sheets
      • Backup and Restore
      • Repository
      • Email Configuration
      • Docking Framework Guide
        • Introduction
        • Stations
        • Pages
        • Layouts
        • Customization
    • Accounts Panel
      • Simulated Account
      • Commissions
    • Alerts
    • Charts
      • Settings
      • Chart Spacing
      • Bar Sizes
      • Importing Data
      • Exporting Data
      • Birds Eye View
      • Cursor Data
      • Depth Of Market
      • Chart Labels
      • News
      • Watermark
      • Scaling
      • Analyses
      • Ratios
      • Time and Price Guides
      • Percent Change Charts
      • Software Development Kit
      • Lock Studies
      • Lock Scroll
      • Study Templates
      • Linking Charts
      • Working With Chart Windows
      • Ticker Tape
      • Chart Trading
      • Data Export Groups
      • Analyses Guide
        • Introduction
        • Managing Analyses
        • Sharing Analyses
    • Components
    • Depth Of Market
    • Elliott Wave
    • Hurst Cycles
      • Introduction
      • Study Overview
      • Using the Hurst Cycle Study
    • Instruments
      • Custom Instruments
    • Option Chain
    • Order Flow
      • Introduction
      • Time Price Opportunity (TPO) Study
      • Volume Imprint
      • Depth of Market
      • Time and Sales
      • Delta Volume
      • Cumulative Delta
      • Bid/Ask Volume
      • Speed of Tape
      • DOM Power
      • Order Heatmap
      • Big Trades
      • Speed Gauges
      • Components
    • Pages
    • Preferences
      • General
      • Theme
      • Chart
      • Toolbar
      • Sounds
      • Ratios
      • Elliott Wave
      • Harmonics
      • Historical Data
      • Orders
      • Alerts
      • Email
      • Trade History
      • Buy/Sell
    • Replay Mode
    • Scanner
      • Scanner
      • Creating a Scan
      • Executing a Scan
      • Editing a Scan
      • Elliott Wave Scanner
      • Harmonic Scanner
      • Study Scanner
    • SDK Programming Guide
      • Preface
      • Change History
      • Introduction
      • Fundamental Classes
      • Overlay Example
      • Study Plot Example
      • Drawing Figures
      • Signals
      • Tick Data
      • Strategies
      • Logging
      • Internationalization
      • Deployment
      • Environment Setup
    • Shortcuts
    • Strategies & Backtest
      • Strategy Back Testing
      • Creating a Strategy Analysis
      • Strategy Analysis
      • Strategies
    • Studies
    • Time and Sales
    • Tool Bar
    • Trade Report
    • Watch List
    • Workspaces
  • Release Notes
    • Release Notes
    • What's New In Version 6.5
    • What's New in Version 6.4
    • What's New in Version 6.3
    • What's New in Version 6.1
    • What's New in Version 6.0
  • Knowledge Base
    • Getting Started
      • Add a Symbol to a Watch List
      • Create a New Page
      • Create a New Workspace
      • Free Data Sources
      • Linux Installation
      • Resize Console Panels
      • Set Up a Simulated Account
      • Does MotiveWave Come With Data?
      • Can MotiveWave Be Used on Multiple Computers?
      • Futures Symbol Table
    • Connection
      • Connection Details
      • Add a Connection to a Workspace
      • Rithmic - Connection Issues and Troubleshooting
      • Connect MotiveWave to R|Trader Pro Gateway
      • GAIN Connection
      • Indian Market Connections
      • Interactive Brokers Connection
        • Troubleshooting Interactive Brokers Connection
        • Historical Data is Slow with Interactive Brokers
      • CQG Symbology
      • TD Ameritrade Search
      • Rithmic Eurex Symbology
      • Computer Sleep Mode
      • IQFeed Data
      • Another Instance of MotiveWave Is Using License Key
    • Workspace
      • Add a Connection to a Workspace
      • Create a New Workspace
      • Create a Workspace Backup
      • Restore a Workspace Backup
      • Switch Connections in a Workspace
      • Workspaces Not Showing Up
    • Charts
      • Adjust for a Stock Split
      • Assign Trading Hours to an Instrument
      • Component and Study Visibility
      • Different Charts for the Same Instrument
      • Make Studies Stick to a Chart
      • Trend Lines Don't Line up on Different Bar Sizes
      • Use a Display Mask
      • Create Tick, Range, PnF, or Renko Chart
      • Clicking on the Tab of One Chart Changes Tab of Other Charts
      • Charts Stopped Streaming Data
      • Charts Show Incorrect Historical Data
      • Time Range Measurements Are Incorrect
      • Limited Tick Data on Charts
      • Set Start Time for Chart Bars
      • View List of Studies and Components on Chart
      • Show ETH or Extended Data
    • Trading
      • Position Average Is Changing Overnight
      • Execute Trades on Another Account
    • General
      • Change Themes
      • Define Trading Hours
      • Futures Contract Backfill
      • Reset the Console Layout
      • Set a Default Account
      • Set Up a Repository
      • Set Up Gmail for Email Alerts
      • Set Up iCloud Mail for Email Alerts
      • MotiveWave Covers Windows Taskbar
      • Limit Instruments in Quick Search
      • Can’t See My Menu Anymore
      • Trade Report Is Incorrect
    • Study
      • Component and Study Visibility
      • Order Heatmap Study Not Showing
      • Forex With Volume Related Studies
      • Add a Custom Study
      • Volume Imprint or TPO Overlap
      • Use Real Values
    • Elliott Wave
      • Elliott Wave Data Window vs Start Date
      • Elliott Wave Functionality
      • Show Multiple Elliott Wave Ratios
      • Stacked Wave Labels
    • Scan
      • What Do the Scanner Results Fair, Good, Etc. Mean?
    • SDK
      • Create a Custom Study or Strategy
    • Optimize - Backtest
      • Backtesting Limitations
    • Support
      • Access Log Files
      • Active Session Exists
      • Create a Workspace Backup
      • Find My License Key and Edition
      • Minimum System Requirements
      • MotiveWave Extensions Directory
      • Uninstall MotiveWave
      • Data Loss
      • Trendlines Shift on Nonlinear Charts
      • Slow Application Performance
    • Error Messages
      • Forex.com - Error Placing Order: 75
      • Binance - Connection Failed: Invalid API Key
      • Binance Futures - Unable to load listen keys
      • IQFeed - Error: Index 1 out of bounds for length 1
      • IQFeed - Connection Failed
      • State Error
      • Error Placing Order(s)
    • Purchase
      • Upgrade from a Lease to a Purchased License
      • Upgrade from a Lower Edition Purchased License to a Higher Edition Purchased License
      • Recently Purchased Where Is My License Key?
      • PayPal Payments
      • How Do I Cancel My Lease?
      • Are Updates to the Software Free?
    • FAQ
      • Can I Add Commentary
      • Can I Have a Simulated and a Live Trading Account
      • Can I Have More Than One Broker Account
      • Can I Save My Analysis
      • Can I Trade from the Chart
      • Can I Use MotiveWave on Multiple Computers
      • Does MotiveWave Support macOS
      • Does MotiveWave Support Multiple Computer Screens
      • How Do I Log in to MotiveWave
      • How Do I Make Point & Figure and Hybrid Renko Charts
      • How Do I Position and Size the Chart Windows on a Specific Screen
      • How Do I Save My Charts
      • How Do I Sync MotiveWave Between Two Computers
      • What Instruments Does MotiveWave Support
      • What Is Compact Mode for Chart Windows
      • Where Are the Chart Tools
  • Video Tutorials
    • Product Demos
    • Startup and Installation
    • Workspaces
    • Broker and Data Feed Connections
    • Overviews
    • General Configuration
    • Configuring Preferences
    • Charts
    • Analyses vs Alternate Analyses
    • Studies and Strategies
    • Trading
    • Alerts
    • Replay Mode
    • Scanners
    • Fibonacci
    • Harmonics
    • Elliott Wave
    • Webinars
    • Third Party Webinars
  • Studies
    • A - B
    • C - D
    • E - F
    • G - H
    • I - J
    • K - L
    • M - N
    • O - P
    • Q - R
    • S - T
    • U - V
    • W - X
    • Y - Z
Powered by GitBook
On this page
  • Figure Class
  • Box
  • ColorRange Class
  • Line Class
  • Polygon
  • ResizePoint
  • Resize Types
  • Absolute Positioning
  • SinglePointFigure
  • Marker Class
  • Label Class
  1. User Guide
  2. SDK Programming Guide

Drawing Figures

PreviousStudy Plot ExampleNextSignals

Last updated 12 months ago

The draw package (com.motivewave.platform.sdk.draw) contains classes for drawing figures (markers, lines etc) as part of the study. Additional classes will likely be added to this package as the SDK evolves.

All figures have one or more Coordinate values (see common package) that are used to specify the location of the figure. These coordinates are composed of a ‘real’ time and value that are translated to plot (x,y) points before they are drawn.

The following methods are available on the Study class for working with figures:

  • clearFigures() – clears all figures from the study

  • addFigure(Figure f) - adds a figure to the study

  • removeFigure(Figure f) – removes an existing figure

  • getFigures() – gets all of the figures added to the study

Figure Class

The Figure class is the base class for all figures that may be drawn as part of the study. You may derive from the class to create a custom figure to display as part of the study. This class consists of the following methods:

  • isVisible(DrawContext ctx) – returns true if this figure is currently visible in the given draw context. This is used by the study framework to improve performance by only working with figures that are currently visible.

  • contains(double x, double y, DrawContext ctx) – returns true if the figure contains the given (x,y) coordinates. This is used by the study framework to determine if the mouse pointer is currently above the study (and is selectable).

  • layout(DrawContext ctx) – This method is used to prepare the figure to be drawn. Typically coordinates are translated to plot values (x,y pixel locations) and any intermediate draw figures are created.

  • draw(Graphics2D gc, DrawContext ctx) – This method draws the figure on the plot.

  • getPopupMessage(double x, double y, DrawContext ctx) – Gets a popup message to display when the user hovers above the figure. The (x,y) parameters are the coordinates of the mouse on the chart.

  • setPopMessage(String msg) – Sets the message to display when the mouse is hovering over the figure. If this method is called there is no need to override the getPopupMessage(…) method above.

  • get/setBounds() – Use these methods to define the bounding rectangle for the figure. By default the contains(…) method will use this to test if the figure contains the given (x,y) parameters.

Box

Use this class to draw a rectangular box with an optional fill color.

ColorRange Class

This class is convenient for creating ‘Heat Map’ studies. A good example of this is the Swami Stochastics study. Each ColorRange object is essentially a bar that has a series of colors regions defined for a range of values. The following screen shot illustrates what this looks like:

Line Class

The Line class is useful for drawing trend lines or vertical/horizontal lines. There are several convenience options in this class for extending the line, setting the color and line style. You can even have the line draw a different color above and below a given value.

Polygon

Draws a shape with 3 or more points.

ResizePoint

This is a special type of figure that enables users to interact with a study using the mouse. Users can drag a resize point to a specific location. The study will receive the following resize events:

  1. onBeginResize(ResizePoint rp, DrawContext ctx) – This is called when the user begins a drag operation on the resize point

  2. onResize(ResizePoint rp, DrawContext ctx) – This is called as the user drags the resize point. It gives the study an opportunity to provide visual feedback as the user moves the mouse.

  3. onEndResize(ResizePoint rp, DrawContext ctx) – This is called when the drag operation is completed. Override this method to store changes in the settings. The study will be recalculated after this method is called.

The follow excerpt from the TrendLine example study (see Study Examples project) shows an example of using the onResize() and onEndResize() methods:

Resize Types

There are 3 types of resize points supported to constrain how they can be adjusted by the user. These types are defined in the enumeration ResizeType (found in the Enums interface):

  1. Horizontal – This type of resize point can only be moved left or right. Its vertical position will remain constant. By default, these resize points will be colored yellow.

  2. Vertical – Only up and down movement is allowed. Its horizontal (x) position will remain constant . By default, these resize points will be colored yellow.

  3. All – Unrestricted. The user can move these types of points anywhere on the screen. By default these types of resize points will be colored green.

The screen shot below shows an example of using resize points that have a type of ‘All’. This is from the example TrendLine study:

The screen shot below illustrates the use of a ‘Horizontal’ resize point to position the cycles in the Hurst Cycles study:

Absolute Positioning

The location of a resize point can be relative or absolute. If a resize point is absolute (see ‘absolute’ property on the ResizePoint class) then its position is defined by a specific time and value (usually price). If relative positioning is used then the resize point is specified using the (x,y) screen coordinates on the chart.

SinglePointFigure

A SinglePointFigure is a special type of Figure that defines figures that are located on the chart by a single point (coordinate). For convenience, multiple figures that are located at the same coordinate may be may be “stacked” above or below each other to improve readability.

This class currently has two subclasses:

  • Marker

  • Label

Marker Class

The Marker class makes it convenient to highlight points of interest on the plot. Often this class is used in conjunction with signals. There are several different types of markers (triangle, arrow, circle etc). These types are defined in the enumeration MarkerType (found in the Enums interface).

Label Class

This class makes it easy to draw text labels at specific points on the study.

Figure 35 - draw classes
Figure 36 - Color Range Example
Figure 37 Resize Points of Type ‘All’
Figure 38 Horizontal Resize Points