Professional Documents
Culture Documents
Aula 5 - Estruturando Um Setup Na Compra e Venda
Aula 5 - Estruturando Um Setup Na Compra e Venda
MODALIDADE: Swing-Trade
CÓDIGO:
var
candle : integer;
begin
//
//
//
//
begin
candle:=0;
//Condições de compra
if (low[1]<low[2])
and (low[1]<low[3])
and (close[1]>media(21,close))
then
BuyStop(high[1]+0.02, high[1]+0.02);
// condições de venda
if (high[1]>high[2])
and (high[1]>high[3])
and (close[1]<media(21,close))
then
SellShortStop(low[1], low[1]);
end;
if (BuyPosition=1)
begin
candle:=candle+1;
//Alvo da compra
SellToCoverStop(((((high[candle]-low[candle])*2)+high[candle]))+100,
(((high[candle]-low[candle])*2)+high[candle])+0.02);
// stop da compra
SellToCoverStop(abs(((high[candle]-low[candle])*2)-
low[candle]),abs(((high[candle]-low[candle])*2)-low[candle])-10);
end;
if (SellPosition=1)
begin
candle:=candle+1;
// Alvo da venda
BuyToCoverStop(abs(((high[candle]-low[candle])*2)-low[candle])-
10,abs(((high[candle]-low[candle])*2)-low[candle]));
// stop da venda
BuyToCoverStop((((high[candle]-low[candle])*2)+high[candle]),(((high[candle]-
low[candle])*2)+high[candle])+10);
end;
//
//
//
//
begin
candle:=0;
//Condições de compra
if (low<low[1])
and (low<low[2])
and (close>media(21,close))
then
BuyStop(high+0.02, high+0.02);
// condições de venda
if (high>high[1])
and (high>high[2])
and (close<media(21,close))
then
SellShortStop(low, low);
end;
if (BuyPosition=1)
and (BarType=1)then
begin
candle:=candle+1;
//Alvo da compra
SellToCoverStop(((((high[candle]-low[candle])*2)+high[candle]))+10,
(((high[candle]-low[candle])*2)+high[candle])+0.02);
// stop da compra
SellToCoverStop(abs(((high[candle]-low[candle])*2)-
low[candle]),abs(((high[candle]-low[candle])*2)-low[candle])-10);
end;
if (SellPosition=1)
and (BarType=1)then
begin
candle:=candle+1;
// Alvo da venda
BuyToCoverStop(abs(((high[candle]-low[candle])*2)-low[candle])-
10,abs(((high[candle]-low[candle])*2)-low[candle]));
// stop da venda
BuyToCoverStop((((high[candle]-low[candle])*2)+high[candle]),(((high[candle]-
low[candle])*2)+high[candle])+10);
end;
end;