Escolar Documentos
Profissional Documentos
Cultura Documentos
input
FastAverage(2);
SlowAverage(6);
MajorAverage(9);
Break(30);
Stoploss(80);
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
//stoploss
BuyToCoverStop (SellPrice-Stoploss,SellPrice-Stoploss);
//Breakeven
if (SellPrice <= Break) then
BuyToCoverStop(SellPrice,SellPrice);
//stoploss
SellToCoverStop (BuyPrice-Stoploss,BuyPrice-Stoploss);
//Breakeven
if (SellPrice <= Break) then
SellToCoverStop(BuyPrice,BuyPrice);
//saida no cruzamento das 2 medias curtas
else
if (close < media(SlowAverage,close))
and (sAvgFast < sAvgSlow)
and (sAvgSlow < sAvgMajor)
then SellShortAtMarket;
end;
end;
begin
end;