Code: Select all
if ( curClose > prevOpen) [Remove down arrow at top from previous bar.]
Code: Select all
if ( curClose > prevOpen) [Remove down arrow at top from previous bar.]
Code: Select all
using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
namespace PowerLanguage.Indicator{
public class my_drawing : IndicatorObject {
public my_drawing(object _ctx):base(_ctx){}
private VariableObject<IArrowObject> m_arrw;
protected override void Create() {
m_arrw = new VariableObject<IArrowObject>(this);
}
protected override void StartCalc() {}
protected override void CalcBar()
{
if (Bars.CurrentBar == 10)
{
ChartPoint top = new ChartPoint(Bars.TimeValue, Bars.HighValue);
ChartPoint bottom = new ChartPoint(Bars.TimeValue, Bars.LowValue);
DrwTrendLine.Create(bottom, top);
m_arrw.Value = DrwArrow.Create(bottom, false);
ITextObject textObj = DrwText.Create(top, "1");
textObj.VStyle = ETextStyleV.Above;
}
if (Bars.CurrentBar == 15) m_arrw.Value.Delete();
}
}
}
Example code you have provided is correct. Are you unable to make it work?Noob Question, but how would I check that m_arrw has a value before deleting it, e.g. something like....
if (m_arrw.Value.Exist) m_arrw.Value.Delete();
AntiMatter, you are working with a variable that has not been initialized.Oh yes, seems to work, but if I don't do some sanity checks myself, it throws this: