Fecha = 20161004
//-------------------------------------------------------------------------------------------------------
If Date = Fecha then
InicioPeriodo = 1
Else
If Date > Fecha and InicioPeriodo[1]=1 then
Control = 1
Periodo = Periodo[1]+1
Endif
endif
//-------------------------------------------------------------------------------------------------------
c1 = SAR[0.02,0.02,0.2]
//-------------------------------------------------------------------------------------------------------
// CONTADOR Barras de 5 minutos INTRADIA
I2 = day = day[1]
Count2 = 1
while I2[count2] do
count2 = count2+1
wend
//-------------------------------------------------------------------------------------------------------
// Volatilidad
c2 = (high-low)
c3 = summation[Periodo+1](c2)/(Periodo+1)
//c33 =(dhigh(1)/dlow(1)-1)*100
PEntradaC = low-(c3+(c3/2))
PEntradaL = high+(c3+(c3/2))
//-------------------------------------------------------------------------------------------------------
// Control de Numeros de SAR
//Precio Alcista
if close > c1 and close[1]<c1[1] then
PrecioCanalAlto = c1[1]
PrecioCanalBajo = c1
PrecioCanalAlto2 = PrecioCanalAlto[1]
PrecioCanalBajo2 = PrecioCanalBajo[1]
else
if close < c1 and close[1]>c1[1] then
PrecioCanalAlto = c1
PrecioCanalBajo = c1[1]
PrecioCanalAlto2 = PrecioCanalAlto[1]
PrecioCanalBajo2 = PrecioCanalBajo[1]
else
PrecioCanalAlto = PrecioCanalAlto[1]
PrecioCanalBajo = PrecioCanalBajo[1]
PrecioCanalAlto2 = PrecioCanalAlto2[1]
PrecioCanalBajo2 = PrecioCanalBajo2[1]
endif
endif
//-------------------------------------------------------------------------------------------------------
// Especulación desde Extremos.
if c1 < PrecioCanalBajo and c1[1] > PrecioCanalBajo[1] and close < c1 and ((highest[Periodo+1](high))/PentradaC-1)*100 < 1 and PrecioCanalAlto >= (highest[Periodo+1](high)) and control = 1 then //and (dhigh(1)-dclose(1))>(dclose(1)-dlow(1)) and control = 1 then
Ri= -(highest[Periodo+1](high)/PEntradaC-1)*100
Direccion = -1
PEntrada = PEntradaC
else
if C1 > PrecioCanalAlto and c1[1]<PrecioCanalAlto[1] and close > c1 and (PentradaL/lowest[Periodo+1](low)-1)*100 < 1 and PrecioCanalBajo <= (lowest[Periodo+1](low)) and control = 1 then //and (dhigh(1)-dclose(1))<(dclose(1)-dlow(1)) and control = 1 then
Ri = (PEntradaL/lowest[Periodo+1](low)-1)*100
Direccion = 1
PEntrada = PEntradaL
else
RI = 0
endif
endif
//--------------------------------------------------------------------------------------------------------
// Estrategias Secundarias
if direccion = -1 and close < PEntrada and close[1]>PEntrada[1] and (highest[count2+104](high)/(low)-1)*100 <0.7 and highest[count2+104](high) >= highest[Periodo+1](high) and c1<c1[1] and summation[count2+104](RI) <> 0 then
Ri= -(highest[count2+104](high)/(low)-1)*100
else
if direccion = 1 and close > PEntrada and close[1]<PEntrada[1] and (high/(lowest[count2+104](low))-1)*100 < 0.7 and lowest[count2+104](low) <= lowest[periodo+1](low) and c1 > c1[1] and summation[count2+104](RI) <> 0 then
Ri= (high/(lowest[count2+104](low))-1)*100
endif
endif
ABSRI=abs(RI)
if summation[count2](ABSRI) > 0 then
Resultado = 1
else
Resultado = resultado[1]
endif
screener [Resultado] sort by (Resultado) as "Señal"