Код: Выделить всё
function Initialize()
{
IndicatorName = "HL";
AddInput("Input", Inputs.Candle);
AddParameter("Period", 1, 1);
PriceStudy = false;
AddSeries("Upper", DrawAs.Line, Color.Blue, false);
AddSeries("Lower", DrawAs.Line, Color.Red, false);
AddSeries("HLP", DrawAs.Histogram , Color.Red);
}
function Evaluate()
{
var high = Input.High[0];
var low = Input.Low[0];
if ( CurrentIndex >= Period )
{
int i = 0;
for (i = 1; i < Period; i++)
high = Math.Max(Input.High[i], high);
for (i = 1; i < Period; i++)
low = Math.Min(Input.Low[i], low);
}
HLP=high-low;
Upper = high;
Lower = low;
}