Код: Выделить всё
AddSeries("DeltaOI", DrawAs.Custom, Color.Blue, AxisType.ZeroBased);
на
Код: Выделить всё
AddSeries("DeltaOI", DrawAs.Custom, Color.Blue, AxisType.Default);
Пример
Весь код на всякий случай (в нем изменена только одна строка)
Код: Выделить всё
function Initialize()
{
IndicatorName = "DeltaOI";
AddParameter("Period", 500);
AddInput("Input", Inputs.Candle);
PriceStudy = false;
AddSeries("Delta", DrawAs.Custom, Color.Green, AxisType.ZeroBased);
AddSeries("DeltaOI", DrawAs.Custom, Color.Blue, AxisType.Default);
AddGlobalVariable("MaxDelta", Types.Double, 0);
AddGlobalVariable("MinDelta", Types.Double, 0);
AddGlobalVariable("MaxOI", Types.Double, 0);
AddGlobalVariable("MinOI", Types.Double, 0);
}
function Evaluate()
{
if (MinOI == 0) MinOI = Double.MaxValue;
Delta = Input.VolumeAsk[0] - Input.VolumeBid[0];
if (MaxIndex - CurrentIndex < Period)
{
if (Delta > MaxDelta) MaxDelta = Delta;
if (Delta < MinDelta) MinDelta = Delta;
if (Input.OpenInterest[0] > MaxOI) MaxOI = Input.OpenInterest[0];
if (Input.OpenInterest[0] < MinOI) MinOI = Input.OpenInterest[0];
}
if (Delta > 0 )
Delta.DrawHistogram(Color.Green, Color.Green, 100);
else
Delta.DrawHistogram(Color.Red, Color.Red, 100);
if (CurrentIndex == MaxIndex)
{
var K = (MaxOI - MinOI) / (MaxDelta - MinDelta);
for (int x = 0; x < Period; x++)
DeltaOI[x] = (Input.OpenInterest[x] - (MinOI + MaxOI) * 0.5) / K;
}
DeltaOI.DrawHistogram(Color.Silver, Color.Silver, 50);
}