David Somogyi

GBPUSD REVERSION BARS

Category: Strategies By: David Somogyi Created: March 15, 2017, 9:23 AM
March 15, 2017, 9:23 AM
Strategies
13 Comments
GBPUSD REVERSION BARS

Good Morning,

I share my first code based on a well-known strategy.

I tried to make it as simple as possible and not fill with indicators and triggers. A simple strategy following a reversion pattern of bars and a mean exp of 40 periods.

I would like to improve it and are welcome any of your contributions and opinions of money management, stop loss optimization, etc.

I’ve placed it in ProOrder Autotrading in Demo to see how it behaves.

Regards,

Gbp usd in 4 hour timeframe


Buenos días,

Comparto mi primer código basado en una estrategia por demás conocida.

Traté de hacerlo lo más sencillo posible y no llenar de indicadores y triggers. Una estrategia sencilla siguiendo un patrón de reversion de barras y una media exp de 40 períodos.

Me gustaría mejorarlo y son bienvenidos cualquiera de sus aportes y opiniones de money management, optimización de stop loss, etc.

Lo he colocado en el ProOrder Autotrading en Demo a ver como se comporta.

Saludos,

gbp usd en timeframe de 4 horas

// Condiciones para entrada de posiciones largas

EMA40 = ExponentialAverage[40](close)
nbar = 4

//Filtro://

//FDI (fractal dimension index) de 30 //

N = 30

once fdi=undefined

if barindex >= n-1 then
 diff=0
 length = 0
 pdiff = 0
 hh=0
 ll=0
 FDI=0
 HH = highest[N](close)
 LL = lowest[N](close)

 for Period = 1 to N-1 do
  if (HH - LL) > 0 then
   diff = (customclose[Period] - LL) / (HH - LL)
   if Period > 1 then
    length = length + SQRT(SQUARE(diff - pdiff) + (1 / SQUARE(N)))
   endif
   pdiff = diff
  endif
 next

 if length > 0 then
  FDI = 1 + (LOG(length) + LOG(2)) / LOG(2 * (N))
 else
  FDI = 0
 endif
endif

//profit step of the strategy to increase lot
positionsize = 1

C4 = EMA40 CROSSES OVER CLOSE
C3 = BARINDEX - TRADEINDEX = NBAR
C5 = CLOSE CROSSES UNDER EMA40

IF not longonmarket and open > close[1] and C4 and FDI<1.5 THEN
 BUY positionsize LOT AT MARKET nextbaropen
ENDIF

//Condiciones de salida de posiciones largas
If LongOnMarket AND C3 THEN
 SELL AT MARKET
endif
//Condiciones de entrada de posiciones cortas

IF NOT ShortOnMarket AND open < close[1] and C5 and FDI<1.5 THEN
 SELLSHORT positionsize LOT AT MARKET nextbaropen
ENDIF

// Condiciones de salida de posiciones cortas
IF ShortOnMarket AND C3 THEN
 EXITSHORT AT MARKET
endif

//Stops y objetivos: introduzca aquí sus stops de protección y objetivos de beneficios
set stop ploss 60

 

Download
Filename: GBPUSD-reversion-bars.itf
Downloads: 379
David Somogyi
David Somogyi Average
Hi there, for more information visit my web page: https://www.pmptrading.com
Author’s Profile

Comments

David Somogyi
9 years ago
#

Hello, This is merely a filter indicator for measuring high fractality, which helps to avoid entering positions with lateral price movements. Find a topic below. There are lots of books and authors that explains how to use this indicator. http://www.x-trader.net/foro/viewtopic.php?t=18769 R.

lizmerrill
9 years ago
#

david, THANKS FOR THE REPLY, IN YOUR CODE BELOW: FDI=0 HH = highest[N](close) LL = lowest[N](close) for Period = 1 to N-1 do if (HH - LL) > 0 then diff = (customclose[Period] - LL) / (HH - LL) if Period > 1 then length = length + SQRT(SQUARE(diff - pdiff) + (1 / SQUARE(N))) endif pdiff = diff endif next if length > 0 then FDI = 1 + (LOG(length) + LOG(2)) / LOG(2 * (N)) else FDI = 0 endif endif WHERE DID YOU FIND FDI IN YOUR CODE? I HAVE NEVER SEEN THIS CALCULATED, IN THIS CASE BEING USED AS A FILTER FOR THE TRADES?

David Somogyi
9 years ago
#

Hello, 180º profit booster from Greg Secker. Regards,

lizmerrill
9 years ago
#

david, what is the well known strategy you are basing this code on?

David Somogyi
9 years ago
#

Hello, You should try a WF analysis to see its behavior during 5 periods. Still, don't understand what this multiplier factor means.

Pier
9 years ago
#

Very good strategy I try It with this target: SET TARGET PPROFIT AverageTrueRange[14](close)*4.8*10000 and this set: nbar = 5 It seem So It seems to get better performance

bertrandpinoy
7 years ago
#

bonjour ce code fonctionne toujours?

Nicolas
7 years ago
#

Faites un backtest, vous aurez des réponses.

David Somogyi
9 years ago
#

Hello Pier, thanks I'm working in an alternative version and running WF on it. What would be the meaning of the 4.8 ? Regards,

Pier
9 years ago
#

optimisation from 2 to 5 step 0.2 could be overfitting ? whats your opinion ?

David Somogyi
9 years ago
#

Hola Giovanni,

Solo lo he probado en libra vs USD, en demás divisas no funciona con esos parámetros, habría que optimizarlos y adaptarlos.  También podría limitarse un poco los horarios para evitar el overnight. Te recomiendo le hagas una optimización por capas para llegar al mejor setup.

Con respecto a las fórmulas, ese indicador FDI es el índice fractal y ayuda a detectar cuando hay poco movimiento y el mercado se lateraliza brevemente, funciona como filtro para NO abrir posiciones.

Saludos

David Somogyi
9 years ago
#

Hola Giovanni,

Solo lo he probado en libra dólar vs USD, en demás divisas no funciona con esos parámetros, habría que optimizarlos y adaptarlos.  También podría limitarse un poco los horarios para evitar el overnight. Te recomiendo le hagas una optimización por capas para llegar al mejor setup.

Con respecto a las fórmulas, ese indicador FDI es el índice fractal y ayuda a detectar cuando hay poco movimiento y el mercado se lateraliza brevemente, funciona como filtro para NO abrir posiciones.

Saludos

barbagio
9 years ago
#

 Hola David, estaba mirando tu trading system y me preguntaba si ya lo habias probado en un mercado que no sea solo bjista (me parece viendo a la imagen que has puesto que no hubo un mercado alcista en el periodo que lo miraste). 

De todas maneras voy ya he bajado tu codigo y lo voy a probar para ver como funciona en diferentes condiciones.

Ya hiciste un proceso de optimizacion? se sì, sobre cuales parametros? 

Otra pregunta: no entiendo las razones de las formula con raiz cuadrada, logaritmos, etc... me las podrias explicar un poco mas?

gracias! hasta pronto

Giovanni

ProRealCode ProRealCode
Loading...