Coding question
Posted: Nov 22 2015
Hello
I'm trying to build a simple indicator, which is plotting several horizontal lines , declared with
a hardcoded array,but what am I doing wrong here ?
I'm trying to build a simple indicator, which is plotting several horizontal lines , declared with
a hardcoded array,but what am I doing wrong here ?
Code: Select all
using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
namespace PowerLanguage.Indicator
{
[UpdateOnEveryTick(false), SameAsSymbol(true)]
public class Magnet_TrendLineCollection : IndicatorObject
{
public Magnet_TrendLineCollection(object _ctx) : base(_ctx){}
private bool plotLinesOnce = false;
int[]numbers = new int[] {11166,11142,11107,11055,10995,10954,10934,10920,10914,10900,10871};
protected override void CalcBar()
{
if (Bars.LastBarOnChart && !plotLinesOnce)
for (int i = 0; i < numbers.Length; i++)
{
ChartPoint beginPoint1 = new ChartPoint(Bars.Time[0],numbers[i]);
ChartPoint endPoint1 = new ChartPoint(Bars.Time[0],numbers[i]);
ITrendLineObject MagnetLines =
DrwTrendLine.Create(beginPoint1, endPoint1);
MagnetLines.ExtLeft = true;
MagnetLines.ExtRight = true;
MagnetLines.Color = Color.LimeGreen;
}
plotLinesOnce = true;
}
}
}