// Definición de los parámetros del código
DEFPARAM CumulateOrders = False // Acumulación de posiciones desactivada
// El sistema anulará todas las órdenes pendientes y cerrará todas las posiciones a las 0:00. No se permitirá ninguna nueva orden ni posición después de la hora "FLATBEFORE".
DEFPARAM FLATBEFORE = 080000
// Anular todas las órdenes pendientes y cerrar todas las posiciones a la hora "FLATAFTER"
DEFPARAM FLATAFTER = 220000
// Impide al sistema operar en días precisos de la semana
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
// Condiciones para entrada de posiciones largas
indicator1 = CCI[29]
c1 = (indicator1 > 0)
indicator2 = DPO[15](close)
c2 = (indicator2 < 0)
IF (c1 AND c2) AND not daysForbiddenEntry THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Condiciones de salida de posiciones largas
indicator3 = CCI[29]
c3 = (indicator3 CROSSES OVER 100)
IF c3 THEN
SELL AT MARKET
ENDIF
// Condiciones de entrada de posiciones cortas
indicator4 = CCI[29]
c4 = (indicator4 < 0)
indicator5 = DPO[15](close)
c5 = (indicator5 > 0)
IF (c4 AND c5) AND not daysForbiddenEntry THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
// Condiciones de salida de posiciones cortas
indicator6 = CCI[29]
c6 = (indicator6 CROSSES UNDER 180)
IF c6 THEN
EXITSHORT AT MARKET
ENDIF
// Stops y objetivos
SET STOP pLOSS 20
SET TARGET pPROFIT 20
Hi osupero,
It seems that DPO is not accepted with proorder…Would be nice to replace it with its equivalent if it exists.
Hi,
I let your strategy running on demo today on several instruments from 8:00 to 16:40.
I then backtest them all for the day of day to double check the results.
It is not at all the same…
DPO might be part of the repaint indicators I suppose…
// Definición de los parámetros del código
DEFPARAM CumulateOrders = false
DEFPARAM FLATBEFORE = 080000
DEFPARAM FLATAFTER = 220000
// Impide al sistema operar en días precisos de la semana
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
x = 4
IF BarIndex - TradeIndex = x Then
Sell at Market
endif
IF BarIndex - TradeIndex = x Then
exitshort at Market
endif
// Condiciones para entrada de posiciones largas
indicator1 = CCI[30]//30
c1 = (indicator1 > 0)
indicator2 = DPO[15](close)//15
c2 = (indicator2 < 0)
IF (c1 AND c2) AND not daysForbiddenEntry THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Condiciones de salida de posiciones largas
indicator3 = CCI[30]//30
c3 = (indicator3 CROSSES OVER 100)//100
IF c3 THEN
SELL AT MARKET
ENDIF
// Condiciones de entrada de posiciones cortas
indicator4 = CCI[30]//30
c4 = (indicator4 < 0)
indicator5 = DPO[15](close)//15
c5 = (indicator5 > 0)
IF (c4 AND c5) AND not daysForbiddenEntry THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
// Condiciones de salida de posiciones cortas
indicator6 = CCI[30]//30
c6 = (indicator6 CROSSES UNDER 150)//180
IF c6 THEN
EXITSHORT AT MARKET
ENDIF
// Stops y objetivos
SET STOP %LOSS 0.2
SET TARGET %PROFIT 0.2
El problema es que repinta el backtesting. y coloca las mejores posiciones una vez actualizado al dia siguiente o simplemente cuando le haces de nuevo el backtesting .. no se porque repinta el indicador DPO