Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 4

/////////////////////////////////////////////////////////

// //
// IND_STOP //
// //
/////////////////////////////////////////////////////////

var

lvlt_pos : float;
lvlt_neg : float;
lvlt_alta : float;
lvlt_baixa : float;
lvlt_stop : float;

begin
if time = 0900 then
begin;
lvlt_pos := 0;
lvlt_neg := 0;
lvlt_alta := 0;
lvlt_baixa := 0;
end;
if (open > close) then
begin;
if (maxima - open) > lvlt_pos then lvlt_pos := (maxima - open);
if (close-minima) > lvlt_neg then lvlt_neg := (close-minima);

end;

if (close > open) then


begin;
if (open-minima) > lvlt_pos then lvlt_pos := (open-minima);
if (maxima-close) > lvlt_neg then lvlt_neg := (maxima-close);
end;
if (close = open) then
begin;
if (open > close) then
begin;
if (maxima - open) > lvlt_pos then lvlt_pos := (maxima - open);
if (close-minima) > lvlt_neg then lvlt_neg := (close-minima);
end;
if (close > open) then
begin;
if (open-minima) > lvlt_pos then lvlt_pos := (open-minima);
if (maxima-close) > lvlt_neg then lvlt_neg := (maxima-close);
end;
end;
if lvlt_pos > lvlt_neg then lvlt_stop := lvlt_pos else lvlt_stop := lvlt_neg;

plot(lvlt_pos);
plot2(lvlt_neg);
plot3(close+lvlt_pos);
plot4(close-lvlt_neg);

end;

/////////////////////////////////////////////////////////
// //
// IND_STOP 02 //
// //
/////////////////////////////////////////////////////////
parâmetro

spread(20);

var

lvlt_pos : float;
lvlt_neg : float;
lvlt_alta : float;
lvlt_baixa : float;
lvlt_stop : float;
lvlt_stop2 : float;
lvlt_stop3 : float;

la : float;
lb : float;
lc : float;
ld : float;

begin

if time = 0900 then


begin;
lvlt_pos := 0;
lvlt_neg := 0;
lvlt_alta := 0;
lvlt_baixa := 0;
end;
if (open > close) then
begin;
if (maxima - open) > lvlt_pos then lvlt_pos := (maxima - open);
if (close-minima) > lvlt_neg then lvlt_neg := (close-minima);

end;

if (close > open) then


begin;
if (open-minima) > lvlt_pos then lvlt_pos := (open-minima);
if (maxima-close) > lvlt_neg then lvlt_neg := (maxima-close);
end;
if (close = open) then
begin;
if (open > close) then
begin;
if (maxima - open) > lvlt_pos then lvlt_pos := (maxima - open);
if (close-minima) > lvlt_neg then lvlt_neg := (close-minima);
end;
if (close > open) then
begin;
if (open-minima) > lvlt_pos then lvlt_pos := (open-minima);
if (maxima-close) > lvlt_neg then lvlt_neg := (maxima-close);
end;
end;
if lvlt_pos > lvlt_neg then lvlt_stop3 := lvlt_pos else lvlt_stop3 := lvlt_neg;
//PLOT(lvlt_pos);
//plot2(lvlt_neg);

la := close+lvlt_neg;
lb := close+lvlt_pos;
lc := close-lvlt_neg;
ld := close-lvlt_pos;

if (la>lb) and (la>lb) and (la>ld) then lvlt_stop := la;


if (lb>la) and (lb>lc) and (lb>ld) then lvlt_stop := lb;
if (lc>la) and (lc>lb) and (lc>ld) then lvlt_stop := lc;
if (ld>la) and (ld>lb) and (ld>lc) then lvlt_stop := ld;

if (la<lb) and (la<lb) and (la<ld) then lvlt_stop2 := la;


if (lb<la) and (lb<lc) and (lb<ld) then lvlt_stop2 := lb;
if (lc<la) and (lc<lb) and (lc<ld) then lvlt_stop2 := lc;
if (ld<la) and (ld<lb) and (ld<lc) then lvlt_stop2 := ld;

plot(lvlt_stop);
plot2(lvlt_stop2);
plot3((lvlt_stop+lvlt_stop2)/2);
plot4(lvlt_stop3);

if (open < close) and (minima <= lvlt_stop2) and (open > lvlt_stop2) then
begin;
paintbar(clblue);
if isbought and (close >= buyprice+spread) then sellshortatmarket;
//selltocoverlimit(buyprice+spread);
if issold and (close <=sellprice-spread) then buyatmarket;
//buytocoverlimit(sellprice-spread);
if isbought and (close <= buyprice-spread) then sellshortatmarket;
//selltocoverlimit(buyprice+spread);
if issold and (close >=sellprice+spread) then buyatmarket;
//buytocoverlimit(sellprice-spread);
if not isbought and not issold then buylimit(close);

end;
if (close < open) and (maxima >= lvlt_stop) and (open < lvlt_stop) then
begin;
paintbar(clred);
if isbought and (close >= buyprice+spread) then sellshortatmarket;
//selltocoverlimit(buyprice+spread);
if issold and (close <=sellprice-spread) then buyatmarket;
//buytocoverlimit(sellprice-spread);
if isbought and (close <= buyprice-spread) then sellshortatmarket;
//selltocoverlimit(buyprice+spread);
if issold and (close >=sellprice+spread) then buyatmarket;
//buytocoverlimit(sellprice-spread);
if not isbought and not issold then sellshortlimit(open);

end;
//plot3(close-lvlt_pos);
//plot4(close-lvlt_neg);

end;

You might also like