You are on page 1of 1

input

FastAverage(1);
SlowAverage(5);
MajorAverage(17);
var
sAvgFast : Float;
sAvgSlow : Float;
sAvgMajor : Float;

begin
///////////////////////////////////////////////////////
// Armazena os valores das m�dias em vari�veis de apoio
sAvgFast := MediaExp(FastAverage, Close);
sAvgSlow := Media(SlowAverage, Close);
sAvgMajor := Media(MajorAverage, Close);

///////////////////////////////////////////////////////
// Verifica se as condi��es de disparos de alarmes
// foram satisfeitas

if (IsSold) then
begin
if (sAvgFast > sAvgSlow) then
BuyToCoverAtMarket;
end
else if (IsBought) then
begin
if (sAvgFast < sAvgSlow) then
SellToCoverAtMarket;
end
else
begin
if (sAvgFast > sAvgSlow) and (sAvgSlow > sAvgMajor) then
BuyAtMarket
else if (sAvgFast < sAvgSlow) and (sAvgSlow < sAvgMajor) then
SellShortAtMarket;
end;
end;

You might also like