This is a simple idea I read about in internet. It seems to get moderate good results in most of indexes. It entries only long on tuesday if monday has been negative. I added the posibility to entry wednesday with both monday and tuesday negatives.
Please take into consideration:
- *****VERY IMPORTANT****: It goes WITHOUT STOPLOSS, you can define it with the variable STOPPERCENT that probably dependes of each index. As the system exit always at the end of day so it´s not so dangerous but still….
- Without defined spread as it depends also of the index
- The position size is determined by the varible “Capital”, that is the amount you want in each operation. This PositionSize can be modified by other parameters.
- My timezone is UTC+0 so it can be differences with my results depending of yor TZ
I think this system benefits from the last years index uptrends and maybe this is not so good moment to operate but anyway I think is interesting to consider
// ***********PARAMETROS SISTEMA***************
DEFPARAM CUMULATEORDERS= false
DEFPARAM PRELOADBARS = 10000
// ***************VARIABLES*******************
CAPITAL = 10000 //Valor en euros de cada operación
STOPPERCENT = 999999
PROFITPERCENT = 4
TRAILINGPERCENT = 4
//***********TAMAÑO POSICION*******************
Rate = 1 //Cambio de 1€ en la moneda del activo. En Forex es la segunda divisa
PositionSize = (Capital*Rate*pointsize)/(close*pointvalue)
POSITIONSIZE2 = POSITIONSIZE
////PASARLO A REDUCCION?
XPREVDAY1 = 1.4
XPREVDAY2 = 1.2
XBOLL1 = 1.2
XBOLL2 = 1.1
IF DCLOSE(1)-DOPEN(1)<-1*CLOSE/100 THEN
POSITIONSIZE = POSITIONSIZE*XPREVDAY1
POSITIONSIZE2 = POSITIONSIZE2*XPREVDAY2
ELSIF DCLOSE(1)-DOPEN(1)<-0.5*CLOSE/100 THEN
POSITIONSIZE = POSITIONSIZE*XPREVDAY2
ENDIF
IF BollingerBandWidth[20](close)>0.024 THEN
POSITIONSIZE = POSITIONSIZE*XBOLL1
POSITIONSIZE2 = POSITIONSIZE2*XBOLL1
ELSIF BollingerBandWidth[20](close)>0.012 THEN
POSITIONSIZE = POSITIONSIZE*XBOLL2
POSITIONSIZE2 = POSITIONSIZE2*XBOLL2
ENDIF
//************ENTRADAS Y SALIDAS***************
LONGENTRY = DAYOFWEEK=2
LONGENTRY = LONGENTRY AND HOUR=1
LONGENTRY = LONGENTRY AND DCLOSE(1)-DOPEN(1)<-0.1*CLOSE/100// AND DCLOSE(2)-DOPEN(2)<0
//LONGENTRY = LONGENTRY AND BARINDEX-TRADEINDEX>20
LONGENTRY2 = DAYOFWEEK=3
LONGENTRY2 = LONGENTRY2 AND HOUR=1
LONGENTRY2 = LONGENTRY2 AND DCLOSE(1)-DOPEN(1)<-0.5*CLOSE/100 AND DCLOSE(2)-DOPEN(2)<-0.1*CLOSE/100
//LONGENTRY = LONGENTRY AND BARINDEX-TRADEINDEX>20
IF LONGENTRY THEN
BUY PositionSize CONTRACTS AT MARKET
ELSIF LONGENTRY2 THEN
BUY PositionSize2 CONTRACTS AT MARKET
ENDIF
IF ONMARKET AND HOUR>=20 THEN
SELL AT MARKET
ENDIF
SET STOP %LOSS STOPPERCENT
SET TARGET %PROFIT PROFITPERCENT
////*****************TRAILING STOP FUNCTION**************************
trailingstartLONG = TRAILINGPERCENT*CLOSE/100//Si se ponen puntos poner *pointsize
//When the trailing stop starts and the distance the stop keeps from the last higher/lower close
//reset the stoploss value
IF NOT ONMARKET THEN
newSL=0
ENDIF
//manage long positions
IF LONGONMARKET THEN
//first move (breakeven)
IF newSL=0 AND close-tradeprice(1)>=trailingstartLONG THEN
newSL = tradeprice(1)
ELSIF newSL>0 AND close-newSL>=trailingstartLONG THEN
newSL = close-trailingstartLONG
ENDIF
ENDIF
//stop order to exit the positions
IF newSL>0 THEN
SELL AT newSL STOP
ENDIF
////************************************************************************
good week to test your idea – big Monday losses!
Yes, I thought the same 🙂