Код: Выделить всё
function Initialize()
{
IndicatorName = "HLOC_Histogram";
AddInput("Inp", Inputs.Candle);
AddParameter("Period_HL", 1,1);
AddParameter("Period_CO", 1,1);
PriceStudy = false;
AddSeries("Hi", DrawAs.Line, Color.Red,false);
AddSeries("Lo", DrawAs.Line, Color.Red,false);
AddSeries("HL",DrawAs.Histogram ,Color.Blue ,AxisType.ZeroBased);
AddSeries("Op", DrawAs.Line , Color.Blue,false);
AddSeries("Cl", DrawAs.Line , Color.Blue,false);
AddSeries("CO", DrawAs.Histogram , Color.Red,AxisType.ZeroBased);
}
function Evaluate()
{
var open = Input.Open[0];
var close = Input.Close[0];
var high = Input.High[0];
var low = Input.Low[0];
if ( CurrentIndex >= 0 )
{
int i = 0;
for (i = 1; i < Period_HL; i++)
high = Math.Max(Input.High[i], high);
for (i = 1; i < Period_HL; i++)
low =Math.Min(Input.Low[i], low) ;
for (i = 1; i < Period_CO; i++)
open = Math.Max(Input.Open[i], open);
for (i = 1; i < Period_CO; i++)
close = Math.Min(Input.Close[i], close);
Hi = high;
Lo = low;
HL=(high-low);
Cl=close;
Op=open ;
CO = Math.Abs(close - open);
}
}