You are on page 1of 2

///////////////////////////////////////////////////////////////////

// MediaExp60 //

///////////////////////////////////////////////////////////////////

input

Periodo(20);

Dados(Close);

FimPregao(1745);

var

nIndex : Integer;

sSum : Float;

sResult : Float;

sResult2 : Float;

sFactor : Float;

sHora : Integer;

sHoraFrac : Float;

begin

//////////////////

// Primeiro valor

if (CurrentBar = 240) then

begin

sResult := MediaExp(240,Close);

end

//////////////////

// Demais valores

else if (CurrentBar > 240) then

begin

sHora := Time;

sHoraFrac := FracPortion((sHora) / 100);

if (sHoraFrac = 0) or (sHora = FimPregao) then

begin
sResult := sResult[1] + (2 / (Periodo + 1)) * (Close - sResult[1]);

sResult2 := sResult;

sFactor := sResult;

///////////////////////////////////////

// Retorna o resultado da posição atual

Plot(sResult);

end

else

begin

sResult2 := sFactor + (2 / (Periodo + 1)) * (Close - sResult[1]);

Plot(sResult2);

end;

end;

end;

You might also like