Sistema StochRSI-Bollinger

El espacio de los traders quant: sistemas de trading, gestión monetaria, automatización de sistemas.
Responder
Avatar de Usuario
Cuotes
Mensajes: 1033
Registrado: 09 Jul 2006 17:35
Ubicación: ya ni lo se

Sistema StochRSI-Bollinger

Mensaje por Cuotes »

Hola Corazones.

Tras haber superado la invasion que hemos sufrido de nicks interesados en el forex ( ? ) vuelvo a vosotros en los albores de la batalla que libramos a diario en el mercado.

Os habeis dado cuenta, mis queridos convecinos, que cuando hay un hilo tipo "sistema ganador de las patatas" o "como batir al indice leyendo los posos del te" casi siempre pasa lo mismo?

Pasa que tu lo abres ansioso por conocer el sistema de las patatas y lo unico que te encuentras es un menda que quiere informacion sobre ese sistema, o que quiere saber donde aprender a leer los posos del te.

Pues eso se da en cuarto curso, en Howarts.

He aqui un hilo que no pregunta nada.

Como ya sabeis siempre me gusta leer cositas por ahi, en mi afan por aprender. Y hace poco lei en 'stocks & commodities' un articulo de Dennis D. Peterson. (no se de que año será)


Sistema que combina un indicador estocastico con las bandas de Bollinger


Supongo q estamos de acuerdo en que a la hora de preparar un sistema necesitamos tres puntos clave: cuando entrar, con cuanto entrar y cuando salir.

Bien. Veamos el tema de cuando entrar ( solo vamos a ver entradas en largo).

Vamos a usar dos indicadores clásicos. Las bandas de Bollinger, de las que podeis leer mas en "Bollinger on Bollinger Bands" y el stochRSI definido en el libro de Tushar S. Chande y Stanley Kroll’s, "The New Technical Trader".

Los indicadores estocasticos nos dicen donde esta el precio respecto a donde ha estado hace dias.

is simply a way of measuring, for a given period
of time, where today’s close is relative to the lowest low, and
where within the range of the highest high and lowest low the
price falls over the same time period.


A veces queremos usar otro indicador para confirmar las señales de otro. Pero ojo que aqui viene la trampa.

NO podemos usar un indicador B para confirmar un indicador A si A y B no son independientes.


Por ejemplo el Williams%R no es independiente del estocastico. Es el mismo. Sin embargo, las bbands, aun saliendo del precio, aportan una informacion estadistica sin importar donde esta el precio. Podriamos decir que stochRSI y Bbands son independientes.

Hemos decidido usar el stochRSI que lo que hace es decirnos por donde anda el RSI respecto a donde andaba hace unos dias. Que ganamos con esto?

Pues que el stochRSI se mueve mas hacia los extremos y tiende a quedarse mas tiempo en esos extremos, lo que nos da un alectura mas estable del RSI.

Pero tiene el problema que a veces se dispara y nos da señales falsas.

Para evitar esto lo vamos a filtrar con las BBands, buscando un movimiento fuerte de estas. Y para suavizar mas, en vez del precio de cierre vamos a usar el weighted price, (2*close+high+low)/4, para construir las bands.

He aqui las reglas para entrar y salir:

Entry:
1 Look for prices tagging the lower Bollinger Band
2 Look for a closing price of an up day, that is (close>open), that is above the lower band after having prices follow (1)
3 Volume of this up day should be greater than the volume of the previous up day
4 StochRSI should be above a threshold to ensure some momentum is associated with the push up
5 The (close-open)/(highlow)>0.2, to avoid days thathave short candlestick bodies.

Exit:
1 StochRSI should be less than a threshold to assure loss of momentum
2 Look for prices to reach the upper band
3 Closing price should be near the top Bollinger Band.
-- ( ignoramus et ignorabimus ) --
Avatar de Usuario
Cuotes
Mensajes: 1033
Registrado: 09 Jul 2006 17:35
Ubicación: ya ni lo se

Mensaje por Cuotes »

Pensabais que no os iba a poner el codigo para WealthLab? :wink:


var Bar, StandardDev, Periods, ExitBar123, EntryBar1234:
integer;
var StochRSISer, VolSer, MyBBandLower, MyBBandUpper,
WPrice: integer;
var rdp1, rdp2, rdv1, adjust1, adjust2, BBpds: integer;
var deviations, x, xPrice, bbBottom, bbTop: float;
var HowCloseToBBot, HowCloseToBBTop: float;
var LongThresholdEntry, BotPercentage,
LongThresholdExit, TopPercentage: float;
var Entry1, Entry2, Entry3, Entry4: boolean;
var Exit1, Exit2, Exit3, Exit4, Exit5, Exit6, Exit7: boolean;
var y, Vol, LastUpVol: float;
procedure PlotEntryRule( b: boolean; s: string );
begin
if b then
begin
y := y * 0.995;
AnnotateChart( s, 0, Bar, y, #Gray, 7 );
end;
end;
procedure PlotExitRule( b: boolean; s: string );
begin
if b then
begin
y := y * 1.005;
AnnotateChart( s, 0, Bar, y, #Gray, 7 );
end;
end;
StandardDev := 60;
Periods := 14;
{ Set up base StochRSI Series }
StochRSISer := StochRSISeries( #Close, Periods );
{ Set up average Volume Series }
VolSer := SMASeries( #Volume, Periods );
VolSer := DivideSeriesValue( VolSer, 1000000 );
{ Create Price Series to Hold Custom BBands }
MyBBandLower := CreateSeries;
MyBBandUpper := CreateSeries;
{ Create and Populate Weighted Price Series }
WPrice := CreateSeries;
for Bar := 0 to BarCount - 1 do
begin
x := ( 2 * PriceClose( Bar ) + PriceHigh( Bar ) + PriceLow( Bar
) ) / 4;
SetSeriesValue( Bar, WPrice, x );
end;
{ Main Loop ... executes once for each bar on chart }
ExitBar123 := 0;
EntryBar1234 := 0;
for Bar := StandardDev to BarCount - 1 do
begin
rdp1 := Round( StdDev( Bar, StochRSISer, StandardDev ) /0.053 );
rdp2 := Round( StdDev( Bar, StochRSISer, StandardDev ) /
0.035 );
rdv1 := Round( StdDev( Bar, VolSer, StandardDev ) );
adjust1 := rdv1 - rdp1 + 11;
if adjust1 <8> 12 then
adjust1 := 12;
adjust2 := rdv1 - rdp2 + 14;
if adjust2 <12> 20 then
adjust2 := 20;
Periods := adjust1;
BBpds := adjust2;
deviations := 0.0625 * BBpds + 0.75;
bbBottom := BBandLower( Bar, WPrice, BBPds, deviations );
bbTop := BBandUpper( Bar, WPrice, BBPds, deviations );
SetSeriesValue( Bar, MyBBandLower, bbBottom );
SetSeriesValue( Bar, MyBBandUpper, bbTop );
HowCloseToBBot := 0.9;
LongThresholdEntry := 30;
xPrice := GetSeriesValue( Bar, WPrice );
botpercentage := Abs( ( xPrice - bbBottom ) / ( bbTop -
bbBottom ));
Entry1 := botpercentage - HowCloseToBBot <0> BBandLower( Bar,
WPrice, BBpds, deviations ) ) and
( StochRSI( Bar, #Close, Periods ) > LongThresholdEntry );
Entry3 := false;
if PriceClose( Bar ) > PriceClose( Bar - 1 ) then
begin
Vol := Volume( Bar );
if Vol > LastUpVol then
Entry3 := true;
LastUpVol := Vol;
end;
Entry4 := ( PriceClose( Bar ) - PriceOpen( Bar ) ) /
( PriceHigh( Bar ) - PriceLow( Bar ) ) > 0.2;
{ Position Entry Rules }
if not LastPositionActive then
begin
if Entry1 and Entry2 and Entry3 and Entry4 then
BuyAtMarket( Bar + 1, ‘’ );
{ See which Entry Conditions were met }
y := PriceLow( Bar );
PlotEntryRule( Entry1, ‘1’ );
PlotEntryRule( Entry2, ‘2’ );
PlotEntryRule( Entry3, ‘3’ );
PlotEntryRule( Entry4, ‘4’ );
end
else
{ Position Exit Rules }
begin
HowCloseToBBTop := 0.7;
LongThresholdExit := 70;
xPrice := GetSeriesValue( Bar, WPrice );
toppercentage := Abs( ( xPrice - bbTop ) / ( bbTop -
bbBottom ));
Exit1 := StochRSI( Bar, #Close, Periods ) < LongThresholdExit;
Exit2 := TopPercentage <HowCloseToBBTop> 0.95 * BBandUpper( Bar, #Close,
BBpds, deviations );
if Exit1 and Exit2 and Exit3 then
ExitBar123 := Bar;
Exit4 := PriceClose( Bar ) < BBandLower( Bar, #Close,
BBpds, deviations );
Exit5 := ( Bar - ExitBar123 < 4 );
Exit6 := PriceClose( Bar - 1 ) - PriceOpen( Bar - 1 ) < 0;
if Entry1 and Entry2 and Entry3 and Entry4 then
EntryBar1234 := Bar;
Exit7 := ( Bar - EntryBar1234 ) < 2;
if ( Exit5 and Exit4 ) then
SellAtMarket( Bar + 1, LastPosition, ‘4&5’ )
else if ( Exit6 and Exit7 ) then
SellAtMarket( Bar + 1, LastPosition, ‘6&7’ );
{ See which Exit Conditions were met }
y := PriceHigh( Bar );
PlotExitRule( Exit1, ‘1’ );
PlotExitRule( Exit2, ‘2’ );
PlotExitRule( Exit3, ‘3’ );
PlotExitRule( Exit4, ‘4’ );
PlotExitRule( Exit5, ‘5’ );
PlotExitRule( Exit6, ‘6’ );
PlotExitRule( Exit7, ‘7’ );
end;
end;
{ Plot Weighted Price }
PlotSeries( WPrice, 0, #Red, #Thin );
{ Plot Custom BBands }
PlotSeries( MyBBandUpper, 0, 337, #Thick );
PlotSeries( MyBBandLower, 0, 337, #Thick );
-- ( ignoramus et ignorabimus ) --
Dionisiooo
Mensajes: 270
Registrado: 24 Feb 2008 20:43
Ubicación: Valencia

Mensaje por Dionisiooo »

Hace tiempo utilize un sistema parecido pero con el canal keltner y rsibollinguer,bueno hacia cockteles de indicadores :D hasta que me metian la piña colada. :-D
Los hábitos de nuestros sentidos nos han enredado en el fraude y el engaño de la sensación: éstos son, una vez más, los fundamentos de todos nuestros juicios y nuestros conocimientos.
Avatar de Usuario
Cuotes
Mensajes: 1033
Registrado: 09 Jul 2006 17:35
Ubicación: ya ni lo se

Mensaje por Cuotes »

Si, me suena. Alguna borrachera de cocteles de indicadores he tenido tambien :lol:

Yo ahora prefiero personalmente no usar indicadores y guiarme exclusivamente por candlesticks que me funcionan mejor.

Pero bueno... ahi queda pa'quien le interese.
-- ( ignoramus et ignorabimus ) --
Avatar de Usuario
cls
Mensajes: 1336
Registrado: 24 May 2007 18:46
Contactar:

Mensaje por cls »

cuotes, tienes estadísticas del sistema ?

Avatar de Usuario
Cuotes
Mensajes: 1033
Registrado: 09 Jul 2006 17:35
Ubicación: ya ni lo se

Mensaje por Cuotes »

Nop

Lo he probado, pero no se adapta a mis necesidades por lo que no he trabajado mas en el.

Está ahi para quien quiera usarlo (no es mio, lo he sacado de una revista).
-- ( ignoramus et ignorabimus ) --
Si te ha gustado este hilo del Foro, ¡compártelo en redes!


Responder

Volver a “Sistemas de Trading”