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

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

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

Добавлено: naum » 09 авг 2016, 11:03

Тема: Re: CO c средней скользящей

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

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

function Initialize()
{
    IndicatorName = "CO+MA";         
         
  AddInput("Inp", Inputs.Candle);   
               
  AddParameter("Period_CO", 1,1);     
 AddParameter("Period_SMA", 10,1);                 
               
  PriceStudy = false;         
                       
  AddSeries("Op", DrawAs.Line , Color.Blue,false);   //
 AddSeries("Cl", DrawAs.Line , Color.Red,false);    // 
  AddSeries("CO", DrawAs.Histogram , Color. Red);
 AddSeries("SMAseries",  DrawAs.Line , Color.Green);                         
}
function Evaluate()
{
   var open = Input.Open[0];
   var close = Input.Close[0];
   if ( CurrentIndex >= Period_CO )
   {                   
         int i = 0;
        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);
                Cl=close;
                Op=open;                           
                CO= Math.Abs(close - open);;
if ( CurrentIndex >= Period_CO + Period_SMA )
 {
  double sma = 0;
 for (i = 0; i < Period_SMA;++ i)
 sma = sma + CO[i];
sma = sma /Period_SMA ;
SMAseries = sma;
 } 
 }
}

Вложения
2016-08-09_15-58-26.png