Bars
public BarHistory BarsThe BarHistory instance associated with this drawing object.
API documentation, members, signatures, and C# examples.
Find classes, members, and documentation.
The ManuallyDrawnObject class represents a drawing object, such as a trend line, Fibonacci retracement, or text note, that was manually placed on a WL9 chart. WL9 associates manually drawn chart objects with a symbol and HistoryScale.
public BarHistory BarsThe BarHistory instance associated with this drawing object.
public string DrawingObjectTypeThe type of drawing object, for example "Line", "Fibonacci Retracement", or "Text Note".
public double ExtendLine(int pt1, int pt2, int idx)Projects a linear line through two points in the drawing object's Points collection and returns the y-axis value where that line intersects the BarHistory index specified in idx. The pt1 and pt2 parameters are indices into the Points List. If either point index is outside the bounds of the Points List, the method throws an ArgumentException.
public double ExtendLineLog(int pt1, int pt2, int idx)Projects a logarithmic line through two points in the drawing object's Points collection and returns the y-axis value where that line intersects the BarHistory index specified in idx. The pt1 and pt2 parameters are indices into the Points List. If either point index is outside the bounds of the Points List, the method throws an ArgumentException.
public string NameFromUserThe name assigned to the drawing object by the user, if any.
public string PaneThe name of the chart pane occupied by the drawing object. Typical values include "Price", "Volume", or the pane tag of an indicator such as "RSI" or "CMO".
public List<HistoricalDataPoint> PointsContains the HistoricalDataPoint instances that define the drawing object. Different drawing object types use different numbers of points. For example, a Line or Fibonacci Retracement typically uses two points, while a Text Note uses one.
using WealthLab.Backtest;
using WealthLab.Core;
using System.Collections.Generic;
namespace WealthScript1
{
public class MyStrategy : UserStrategyBase
{
public override void Initialize(BarHistory bars)
{
List<ManuallyDrawnObject> mdos = GetChartDrawings(bars, null, null);
WriteToDebugLog("Number of Drawing Objects found: " + mdos.Count);
foreach (ManuallyDrawnObject mdo in mdos)
{
WriteToDebugLog("---------");
WriteToDebugLog("Type=" + mdo.DrawingObjectType);
WriteToDebugLog("Name=" + mdo.NameFromUser);
for (int p = 0; p < mdo.Points.Count; p++)
{
WriteToDebugLog(
"Point" + p +
": Index=" + mdo.Points[p].Index +
",Value=" + mdo.Points[p].Value);
}
if (mdo.DrawingObjectType == "Line")
{
double lastVal =
mdo.ExtendLineLog(0, 1, bars.Count - 1);
WriteToDebugLog("Line ends at: " + lastVal);
}
}
}
public override void Execute(BarHistory bars, int idx)
{
}
}
}
Ask the community or explore custom development services.