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

Re: Как суммировать показания за день?

Добавлено: 20 окт 2017, 17:40
Den
да я увидел

Евгений , БОЛЬШУЩЕЕ ВАМ СПАСИБО !!!

Человек-Голова ! :)

Re: Как суммировать показания за день?

Добавлено: 20 окт 2017, 18:56
Den
Евгений , последний вопрос по нему - как правильно вывести сумму SUp SDown третьей серией ?

Re: Как суммировать показания за день?

Добавлено: 20 окт 2017, 19:19
evge

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

function Initialize()
{
IndicatorName = "A-DOWN_VIII";
AddInput("Input", Inputs.Candle);
AddSeries("D", DrawAs.Custom, Color.Green, false);
AddSeries("U", DrawAs.Custom, Color.Red, false);
AddSeries("Sum", DrawAs.Custom, Color.Blue);
AddSeries("SUp", DrawAs.Custom, Color.Green);
AddSeries("SDown", DrawAs.Custom, Color.Red);

AddGlobalVariable("SumUp", Types.Double, 0);
AddGlobalVariable("SumDown", Types.Double, 0);
AddGlobalVariable("LX", Types.Long, 0);
AddGlobalVariable("HX", Types.Long, 0);

PriceStudy = false;
AddParameter("P", 1000, 1);
}

function Evaluate()
{

var I = MY.индикатор(Input);
var Lx = 0;
var Hx = 0;
var Ly = 0.0;
var Hy = 0.0;

for (var x = 0; x < 999; x++)
{
   if (I["L"][x] > 0) { Lx = CurrentIndex - x; Ly = I["L"][x]; }
   if (I["H"][x] > 0) { Hx = CurrentIndex - x; Hy = I["H"][x]; }
   if (Lx != 0 && Hx != 0) break;
}

if (Lx == 0 && Hx == 0 ) return;

if (BarDate(0) != BarDate(1))
{
   SumUp = 0; SumDown = 0;
}

if ( Lx > Hx )
   D[1] = Hy - Ly;
else
   U[1] = Hy - Ly;

if (HX != Hx || LX != Lx)
{
   HX = Hx;
   LX = Lx;
   if (Hx > Lx) SumUp += Hy - Ly;
   if (Hx < Lx) SumDown += Hy - Ly;
}

SUp[0] = SumUp;
SDown[0] = SumDown;
Sum[0] = SumDown + SumUp;

D.DrawHistogram(Color.Red, Line.Solid, 1, Color.Red, 50);
U.DrawHistogram(Color.Green, Line.Solid, 1, Color.Green, 50);
SUp.DrawHistogram();
SDown.DrawHistogram();
Sum.DrawHistogram();

}

Re: Как суммировать показания за день?

Добавлено: 20 окт 2017, 19:36
Den
Спасибо !