Você está na página 1de 2

input

FastAverage(2);
SlowAverage(5);
Stoploss(70);
Break(60);
var
sAvgFast : Float;
sAvgSlow : Float;

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

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

if (IsSold) then
begin

//stoploss
BuyToCoverStop (SellPrice-Stoploss);

//Breakeven
if (SellPrice <= Break) then
BuyToCoverStop(SellPrice,SellPrice);

//saida no cruzamento das 2 medias curtas


if (sAvgFast > sAvgSlow) then
BuyToCoverAtMarket;

end

else if (IsBought) then


begin

//stoploss
SellToCoverStop (BuyPrice-Stoploss);

//Breakeven
if (SellPrice <= Break) then
SellToCoverStop(BuyPrice,BuyPrice);

//saida no cruzamento da medias


if (sAvgFast < sAvgSlow) then
SellToCoverAtMarket;
end

else
begin
if (close > media(SlowAverage , close))
and (sAvgFast > sAvgSlow)
then BuyAtMarket

else
if (close < media(SlowAverage,close))
and(sAvgFast < sAvgSlow) then
SellShortAtMarket;
end;

end;

Você também pode gostar