Пример
Ссылка на индикатор TrendLines
Исходный текст индикатора EvgeBars с отображением в области цены
Код: Выделить всё
function Initialize()
{
IndicatorName = "EvgeBars";
AddInput("Input", Inputs.Candle);
AddSeries("Bear", DrawAs.Custom, Color.Red, AxisType.Default, true, Axes.Parent);
AddSeries("Bull", DrawAs.Custom, Color.Green, AxisType.Default, true, Axes.Parent);
AddGlobalVariable("Last", Types.Boolean, false);
}
function Evaluate()
{
//evge 12.02.2016 http://alfadirect4.ru
Bear = Input.Low[0];
Bull = Input.High[0];
if (Input.Close[0] > Input.High[1])
{
Bull.DrawHistogram(Bear);
Last = true;
}
else if (Input.Close[0] < Input.Low[1])
{
Bear.DrawHistogram(Bull);
Last = false;
}
else
{
if (Last)
Bull.DrawHistogram(Bear);
else
Bear.DrawHistogram(Bull);
}
}