Страница 1 из 1

Last3D (Last Price) – уровень последней цены за 3 дня

Добавлено: 07 фев 2016, 16:36
evge
Уровень последней цены за 3 дня – индикатор отображает уровень последних цен за 3 дня.

Пример:

Last3D-00.png
Last3D-00.png (24.58 КБ) 19967 просмотров


Исходный текст:

Код: Выделить всё

function Initialize()
{
  IndicatorName = "Last3D";   
  AddInput("Input", Inputs.Price);
  PriceStudy = true;   
  AddParameter("NeedBars", 520, 1);
  AddGlobalVariable("ListClose", Types.DoubleList);
  AddSeries("Last", DrawAs.Line, Color.Red);      
  AddLevel(0, Color.Red, LineStyles.Solid, 1, "Last");
  AddLevel(0, Color.Blue, LineStyles.DashBig, 1, "Last");
  AddLevel(0, Color.Gray, LineStyles.DashSmall, 1, "Last");
}

function Evaluate()
{
// AlfaDirect. 2015

// Запоминаем список закрытий дня
if ( BarTime() == AsTime(10,0,0) && CurrentIndex != 0 )
{
     ListClose.Add(Input[-1]);
}
if (CurrentIndex == MaxIndex)
{
    for (var i = 0; i < 3; i++)
    {
         Levels[i].Level = ListClose[ListClose.Count - i - 1];
         if ( i >= 2 )
            break;
     }
}
}