You are on page 1of 3

var

candle, chave : integer;


stopquesobe, stopquedesce : float;

begin

// serve como estratégia de execução e regra de coloração

// Bloco de entrada

if (BuyPosition = 0 ) and (SellPosition = 0)

and (time<1600)

then

begin

candle:=0;

chave:=0;

// Condições de compra

if (low<VWAP(1))

and (close>VWAP(1))

and (C_Hammer_HangingMan(100,100,100,100)=1)

and (close>mediaExp(20,close))

or (low<mediaExp(20,close))

and (close>mediaExp(20,close))

and (close[1]>mediaExp(20,close))

and (close[2]>mediaExp(20,close))

then

begin

paintBar(clLime);

BuyStop(high,high);

end;

// Condições de venda

if (high>VWAP(1))

and (close<VWAP(1))

and (C_Hammer_HangingMan(100,100,100,100)=1)
and (close<mediaExp(20,close))

or (high>mediaExp(20,close))

and (close<mediaExp(20,close))

and (close[1]<mediaExp(20,close))

and (close[2]<mediaExp(20,close))

then

begin

paintBar(clRed);

SellShortStop(low,low);

end;

end;

//Bloco de saídas

if (BuyPosition =1) then

begin

// o momento em que começa a subir

if (close>BuyPrice+200) and (close>hiloActivator(7)) then

begin

stopquesobe:=hiloActivator(7);

chave:=1;

end;

// Stop Hilo

if (chave=1) then

SellToCoverStop(stopquesobe,stopquesobe);

// Stop original

if (chave=0) then

SellToCoverStop(BuyPrice-400,(BuyPrice-400));

end;

if (SellPosition = 1) then

begin

// o momento em que começa a subir


if (close<SellPrice-200) and (close<hiloActivator(7)) then

begin

stopquedesce:=hiloActivator(7);

chave:=1;

end;

// Stop Hilo

if (chave=1) then

BuyToCoverStop(stopquedesce,stopquedesce);

// Stop original

if (chave=0) then

BuyToCoverStop(SellPrice+400,(SellPrice+400));

end;

if (time>=1655) then ClosePosition;

end;

REGRA DE COLORAÇÃO DA MÉDIA DE 20:

begin

if (close<media(20,close)) then PaintBar(clvermelho);

if (close>media(20,close)) then PaintBar(cllime);

end;

You might also like