Каталог файлов форума

Список вложений в сообщениях, оставленных на этой конференции.

Все файлы форума: 1233

Добавлено: Balalayka » 06 ноя 2018, 11:09

Тема: Re: Учусь писать индикатор. JapanCandles Patterns

Текст сообщения:

Вариант со свечным паттерном "Поглощение"

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

function Initialize()
{
 IndicatorName = "JapanCandles";                     
 AddInput("Input", Inputs.Candle);     
 AddSeries("Hammer", DrawAs.Custom, Color.Green, true, Axes.Parent);
 AddSeries("Hanged", DrawAs.Custom, Color.Black, true, Axes.Parent);   //произв.метод рисования, ряд отображается в области входного ряда
 PriceStudy = true;
 AddParameter("pips", 2, 0);
 AddSeries("BullEngulfing", DrawAs.Custom, Color.Green, true, Axes.Parent);
 AddSeries("BearEngulfing", DrawAs.Custom, Color.Black, true, Axes.Parent);
 ///AddParameter("PriceStep", 0);
 ///                            
 ///AddParameter("", , 0);          
 ///AddGlobalVariable("GetPriceStep", Types.Double, 0.0);
}

function Evaluate()
{
  var O = Input.Open[0];
  var C = Input.Close[0];
  var H = Input.High[0];
  var L = Input.Low[0];
 
 
  Hammer = Input.Low - pips;
  Hanged = Input.High + pips;
 
  if ( (C>O) && (O-L)>(C-O)*2.1 && ((C==H) || (H-C) < (C-O)) )     
  {
    Hammer.DrawCircle();
  }
  if ((C<O) && (C-L)>(O-C)*2.1 && ((O==H) || (H-O) < (O-C))  )   
  {
    Hanged.DrawCircle();
  }

  BullEngulfing=Input.Low-pips;
  BearEngulfing=Input.High+pips;

  if (Input.Close[1] < Input.Open[1]) // определение типа свечи
  if ( (C > O) && (C > Input.Open[1]) && (O < Input.Close[1]) )
  if ( ((Input.Open[1] - Input.Close[1])*3) > (Input.High[1] - Input.Low[1]) )
  {
    BullEngulfing.DrawArrowUp();
  }
 
  if (Input.Close[1] > Input.Open[1])
  if ( (C < O) && (O > Input.Close[1]) && (C < Input.Open[1]) )
  if ( ((Input.Close[1] - Input.Open[1])*3) > (Input.High[1] - Input.Low[1]) ) 
  {
    BearEngulfing.DrawArrowDown();
  }
}


Вложения
Скриншот 2018-11-06 14.43.58.png