Input
Periodo2MV(20);
Alvo(250);
Stop(200);
var
MediaMax, MediaMin :Float;
Inicio
MediaMAx := MediaExp(Periodo2MV, Maxima);
MediaMin := MediaExp(Periodo2MV, Minima);
Se (IsBought) entao
Inicio
SellToCoverLimit(BuyPrice + Alvo, 1);//Alvo
SellToCoverStop(BuyPrice-Alvo, BuyPrice-Alvo-250, 1);//Stop
Fim;
Se (IsSold) entao
Inicio
BuyToCoverLimit(SellPrice - Alvo, 1);//Alvo
BuyToCoverStop(SellPrice+Alvo, SellPrice+Alvo+250, 1);//Stop
Fim;
Se (HasPosition = False) entao
Inicio
Se (Fechamento > MediaMax) e (Fechamento > Abertura) entao
BuyAtMarket(1);
Se (Fechamento < MediaMin) e (Fechamento < Abertura) entao
SellShortAtMarket(1);
Fim;
Fim;
VAR
Compra, venda, compra2, venda2 : booleano;
Inicio
Compra:= (Fechamento > Fechamento[1]) e (lowest(Low,2) < lowest(Low,2)[1]);
Venda:= (Fechamento < Fechamento[1]) e (highest(High,2) > highest(High,2)[1]);
compra2:= (fechamento[2]<abertura [2]) e (fechamento[1]>abertura [1]) e
(fechamento>abertura);
venda2:= (fechamento[2]>abertura [2]) e (fechamento[1]<abertura [1]) e
(fechamento<abertura);
se (compra) entao
paintbar (clazulclaro);
se (venda) entao
paintbar (clfucsia);
se (compra2) entao
paintbar (clblue);
se (venda2) entao
paintbar (255);
fim;
Input
Alvo(250);
Stop(200);
var
Compra, venda, compra2, venda2 : booleano;
Inicio
Compra:= (Fechamento > Fechamento[1]) e (lowest(Low,2) < lowest(Low,2)[1]);
Venda:= (Fechamento < Fechamento[1]) e (highest(High,2) > highest(High,2)[1]);
compra2:= (fechamento[2]<abertura [2]) e (fechamento[1]>abertura [1]) e
(fechamento>abertura);
venda2:= (fechamento[2]>abertura [2]) e (fechamento[1]<abertura [1]) e
(fechamento<abertura);
se (compra) entao
paintbar (clazulclaro);
se (venda) entao
paintbar (clfucsia);
se (compra2) entao
paintbar (clblue);
se (venda2) entao
paintbar (255);
fim;
Se (IsBought) entao
Inicio
SellToCoverLimit(BuyPrice + Alvo, 1);//Alvo
SellToCoverStop(BuyPrice-Alvo, BuyPrice-Alvo-250, 1);//Stop
Fim;
Se (IsSold) entao
Inicio
BuyToCoverLimit(SellPrice - Alvo, 1);//Alvo
BuyToCoverStop(SellPrice+Alvo, SellPrice+Alvo+250, 1);//Stop
Fim;
Se (HasPosition = False) entao
Inicio
Se (Fechamento > MediaMax) e (Fechamento > Abertura) entao
BuyAtMarket(1);
Se (Fechamento < MediaMin) e (Fechamento < Abertura) entao
SellShortAtMarket(1);
Fim;
Fim;