OptimusFLOW
  • Welcome to OptimusFLOW Help
  • Getting started
    • First Time Users
    • Control center
    • Workspaces, Binds, Groups
    • Templates
    • Set as Default
    • Symbols lookup
    • Table management
    • Backup & restore manager
    • General settings
  • Connections
    • Connections manager
    • Connection to Optimus Futures
    • Connection to Paper to Trader dxFeed
    • Connection to Rithmic
    • Connection to Rithmic Prop
    • Connection to CQG
    • Connection to OANDA
  • Trading Journal
  • Analytics panels
    • Chart
      • Chart types
        • Renko
        • Heiken Ashi
        • Kagi
        • Points & Figures
        • Range bars
        • Line break
        • Volume Bars
      • Chart overlays
      • Technical indicators
        • Oscillators
          • Aroon Indicator
          • Moving Average Convergence/Divergence
          • Awesome Oscillator
          • Accelerator Oscillator
          • %R Larry Williams
          • Momentum
          • Rate of Change
          • Commodity Channel Index
        • Moving averages
          • Exponential Moving Average
          • Simple moving average
        • Volatility
          • Average True Range
          • Standard deviation
        • Trend
          • ZigZag
        • Volume
          • Delta Flow
      • Drawing tools
      • Volume Analysis Tools | Volume Profiles | Footprint chart | VWAP
        • Cluster chart
        • Volume profiles
        • Time statistics
        • Time histogram
        • Historical Time & Sales
      • Power Trades
      • VWAP | Volume Weighted Average Price
    • Watchlist
    • Time & Sales
    • Price Statistic
    • DOM Surface
    • Option Analytics
    • TPO Profile Chart
  • Trading panels
    • Order Entry
      • Order Types
    • DOM Trader
    • Market depth
    • Trading simulator
    • Market Replay (History Player)
    • FX Cell
  • Portfolio panels
    • Positions
    • Working Orders
    • Trades
    • Orders History
    • Synthetic Symbols
    • Historical Symbols
  • Information panels
    • Account info
    • Symbol Info
    • Event Log
    • RSS
    • Reports
  • Miscellaneous
    • History Exporter
    • Market heat map
    • Stat matrix
    • Exchange times
    • Quote Board
    • Excel and RTD function
  • Algo
    • Introduction
    • Install for Visual Studio
    • Simple Indicator
    • Input Parameters
    • Built-In indicators access
    • Indicator with custom painting (GDI)
    • Using markers with indicators
    • Adding a custom indicator to Watchlist
    • Downloading history
    • Simple strategy
    • Access to trading portfolio
    • Trading operations
    • Example: Simple Moving Average
Powered by GitBook
On this page

Was this helpful?

  1. Algo

Using markers with indicators

Mark some specific point or set of points on indicator's line

PreviousIndicator with custom painting (GDI)NextAdding a custom indicator to Watchlist

Last updated 5 years ago

Was this helpful?

During indicators development, you may need to mark some specific point or set of points on indicator's line. For example, you want to mark the place, where two lines are crossing or place, where your algorithm find some bar pattern. Yes, you can use GDI+ drawings and OnPaintChart method, as we've shown , but OptimusFLOW API provides a more simple way to accomplish this.

Each indicator line contains method SetMarker, which allows you to assign some special style for the particular element in your indicator's line buffer. The most simple way is marking it via a specified color. This is an example of usage:

// Mark the current bar of first indicator line with Yellow color
LinesSeries[0].SetMarker(0, Color.Yellow)

We colored in yellow each tenth bar:

Another way of marking is using icons. You can specify a type of icon, it's position and color. You can use the same overridden method SetMarker:

// Mark current bar with yellow color and flag icon in the top position
LinesSeries[0].SetMarker(0, new IndicatorLineMarker(Color.Yellow, IndicatorLineMarkerIconType.Flag));

Result is displayed on the chart:

Let's create a little more useful indicator. For example - we will mark with a green up arrow, places where we have more than 5 growing candles in a row and mark with a red bottom arrow, in the case of 5 falling bars. This is source code implementing this logic:

/// <summary>
/// Calculation entry point. This function is called when a price data updates. 
/// </summary>
protected override void OnUpdate(UpdateArgs args)
{
    // Use open price as a source for our indicator
    SetValue(Open());

    // We are looking for 5 bars with same direction
    int amountofBars = 5;

    // Not enough data yet - skip calculations
    if (Count < amountofBars)
        return;

    // Going though last 5 bars
    int trendValue = 0;
    for (int i = 0; i < amountofBars; i++)
    {
        // Is it growing bar?
        if (Close(i) > Open(i))
            trendValue += 1;

        // Is it falling bars?
        else if (Open(i) > Close(i))
            trendValue += -1;
    }

    // If all 5 bars were growing - mark with green up arrow on bottom
    if (trendValue == amountofBars)
        LinesSeries[0].SetMarker(0, new IndicatorLineMarker(Color.Green, bottomIcon: IndicatorLineMarkerIconType.UpArrow));

    // If all 5 bars were falling - mark with red down arrow on top
    else if (trendValue == -amountofBars)
        LinesSeries[0].SetMarker(0, new IndicatorLineMarker(Color.Red, upperIcon: IndicatorLineMarkerIconType.DownArrow));
}

And its visualization:

Using SetMarker functions you can simply mark important moments on your indicator. We are going to extend markers possibilities: add more new icons, add text and custom painting. And remember - you can always propose us your own ideas.

in our previous topic
An example of color marker
An example of marker with icon
An indicator that use markers for trends