Skip to content

PlotType

Summary

The Plot type.

Signature

1
public enum PlotType

Namespace

cAlgo.API

Fields

Name Description
Line Plot Indicator result as a line.
Histogram Plot Indicator result as a histogram.
Points Plot Indicator result as a sequence of points.
DiscontinuousLine Plot Indicator result as a line with breaks where there are no values in the IndicatorDataSeries.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 using cAlgo.API;
 using cAlgo.API.Indicators;
 namespace cAlgo
 {
     // This sample shows how to use different types of plots for your indicator outputs
     [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class PlotTypeSample : Indicator
     {
         private StandardDeviation _standardDeviation;
         [Output("Discontinuous Line", LineColor = "Red", PlotType = PlotType.DiscontinuousLine)]
         public IndicatorDataSeries DiscontinuousLine { get; set; }
         [Output("Histogram", LineColor = "Green", PlotType = PlotType.Histogram)]
         public IndicatorDataSeries Histogram { get; set; }
         [Output("Line", LineColor = "Blue", PlotType = PlotType.Line)]
         public IndicatorDataSeries Line { get; set; }
         [Output("Points", LineColor = "Yellow", PlotType = PlotType.Points)]
         public IndicatorDataSeries Points { get; set; }
         protected override void Initialize()
         {
             _standardDeviation = Indicators.StandardDeviation(Bars.ClosePrices, 20, MovingAverageType.Simple);
         }
         public override void Calculate(int index)
         {
             DiscontinuousLine[index] = Bars.ClosePrices[index] + _standardDeviation.Result[index];
             Histogram[index] = Bars.ClosePrices[index] + (_standardDeviation.Result[index] * 1.5);
             Line[index] = Bars.ClosePrices[index] + (_standardDeviation.Result[index] * 2);
             Points[index] = Bars.ClosePrices[index] + (_standardDeviation.Result[index] * 2.5);
         }
     }
 }

Last update: June 26, 2022

Comments