Код: Выделить всё
function Initialize()
{
IndicatorName = "DeltaCumOfDaySignals";
AddInput("Input", Inputs.Candle);
PriceStudy = false;
AddSeries("DeltaCumDay", DrawAs.Custom, Color.Gray, AxisType.ZeroBased);
AddSeries("Buy", DrawAs.Custom, Color.Green, true, Axes.Parent);
AddSeries("Sell", DrawAs.Custom, Color.Red, true, Axes.Parent);
}
function Evaluate()
{
// AlfaDirect 2014. OX
// Кумулятивная Дельта Дневная - интеграл разниц между объемами покупателей и продавцов за день
//
// evge 22.12.2016 http://alfadirect4.ru
// добавлены сигналы на график
if ( CurrentIndex < 1 || BarTime() == AsTime(10, 0, 0) )
{
DeltaCumDay = Input.VolumeAsk[0] - Input.VolumeBid[0];
}
else
{
DeltaCumDay = DeltaCumDay[-1] + Input.VolumeAsk[0] - Input.VolumeBid[0];
if (DeltaCumDay > DeltaCumDay[-1] )
DeltaCumDay.DrawHistogram(Color.Green, 100);
else
DeltaCumDay.DrawHistogram(Color.Red, 100);
}
if (DeltaCumDay[0] > 0 && DeltaCumDay[1] < 0)
{
Buy = Input.Low[0];
Buy.DrawArrowUp();
}
if (DeltaCumDay[0] < 0 && DeltaCumDay[1] > 0)
{
Sell = Input.High[0];
Sell.DrawArrowDown();
}
}