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

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

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

Добавлено: evge » 07 фев 2017, 08:46

Тема: Re: MAngle - отношение соседних точек MA

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

Вариант с индикацией падения \ роста разным цветом значения осциллятора MAngle

MAngleColor.zip
(970 байт) 1097 скачиваний


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

function Initialize()
{
IndicatorName = "MAngle";
PriceStudy = true;
AddInput("Input", Inputs.Candle);
AddSeries("AB", DrawAs.Custom, Color.Black, AxisType.ZeroBased, false, Axes.New);
AddSeries("A", DrawAs.Custom, Color.Green, AxisType.ZeroBased, true, Axes.New);
AddSeries("B", DrawAs.Custom, Color.Red, AxisType.ZeroBased, true, Axes.New);
AddSeries("MA", DrawAs.Line, Color.Red, true, Axes.Parent);

AddParameter("Period", 10);
AddParameter("PeriodAngle", 5);
AddParameter("MAType", 0); // 0 - SMA, 1 - EMA, 2 - WMA

}

function Evaluate()
{

// evge 25.08.2016 http://alfadirect4.ru

if (CurrentIndex > Period)
{
var S = SMA(Input.Close, 1);
if (MAType == 2) S = WMA(Input.Close, Period);
else
if (MAType == 1) S = EMA(Input.Close, Period);
else
S = SMA(Input.Close, Period);

var sum = 0.0;

for (var x = 0; x < PeriodAngle; x++)
   {
   sum += S[x] / S[x+1] - 1;
   }

AB[0] = sum / PeriodAngle;
MA = S[0];
}
else
{
   AB[0] = 0;
   MA = Input.Close[0];
}

A[0] = 0; B[0] = 0;

if (AB[0] > AB[1])
{ A[0] = AB[0]; A.DrawHistogram(); }
else
{ B[0] = AB[0]; B.DrawHistogram(); }

}


Скачать исходный текст

MAngle-02.png
MAngle-02.png (42.96 КБ) 19024 просмотра