Skip to content

LineStyle

enum cAlgo.API

DesktopCLICloud

An enumeration of different stroke styles used to render lines.

Definition

public enum LineStyle

Namespace: cAlgo.API · Group: Chart

Examples

using cAlgo.API;

namespace cAlgo
{
    // This sample indicator shows how to use different line styles
    public partial class LineStyleSample : Indicator
    {
        protected override void Initialize()
        {
            Chart.DrawVerticalLine("Dots", Chart.LastVisibleBarIndex, Color.Red, 3, LineStyle.Dots);
            Chart.DrawVerticalLine("DotsRare", Chart.LastVisibleBarIndex - 2, Color.Yellow, 3, LineStyle.DotsRare);
            Chart.DrawVerticalLine("DotsVeryRare", Chart.LastVisibleBarIndex - 4, Color.Green, 3, LineStyle.DotsVeryRare);
            Chart.DrawVerticalLine("Lines", Chart.LastVisibleBarIndex - 6, Color.Blue, 3, LineStyle.Lines);
            Chart.DrawVerticalLine("LinesDots", Chart.LastVisibleBarIndex - 8, Color.Magenta, 3, LineStyle.LinesDots);
            Chart.DrawVerticalLine("Solid", Chart.LastVisibleBarIndex - 10, Color.Brown, 3, LineStyle.Solid);
        }

        public override void Calculate(int index)
        {
            Result[index] = Bars.ClosePrices[index];
        }
    }
}
class LineStyleSample():
    def initialize(self):
        api.Chart.DrawVerticalLine("Dots", api.Chart.LastVisibleBarIndex, Color.Red, 3, LineStyle.Dots)
        api.Chart.DrawVerticalLine("DotsRare", api.Chart.LastVisibleBarIndex - 2, Color.Yellow, 3, LineStyle.DotsRare)
        api.Chart.DrawVerticalLine("DotsVeryRare", api.Chart.LastVisibleBarIndex - 4, Color.Green, 3, LineStyle.DotsVeryRare)
        api.Chart.DrawVerticalLine("Lines", api.Chart.LastVisibleBarIndex - 6, Color.Blue, 3, LineStyle.Lines)
        api.Chart.DrawVerticalLine("LinesDots", api.Chart.LastVisibleBarIndex - 8, Color.Magenta, 3, LineStyle.LinesDots)
        api.Chart.DrawVerticalLine("Solid", api.Chart.LastVisibleBarIndex - 10, Color.Brown, 3, LineStyle.Solid)

    def calculate(self, index):
        api.Result[index] = api.Bars.ClosePrices[index]
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true,
  "LineOutputs": [
    {
      "Name": "Result",
      "DisplayName": "Main",
      "Color": "Red",
      "Style": "Dots"
    }
  ]
}

Values

Name Value Description
Solid 0 A solid line: -----
Dots 1 A dotted line: .....
DotsRare 2 A dotted line, large gap between dots: . . . .
DotsVeryRare 3 A dotted line, extra large gap between dots: . . . .
LinesDots 4 A mixed line / dot style is used to render the line: - . - . - .
Lines 5 Lines with gaps are used to render the line: - - - -