//-------------------------------------------------------------------------
// Código principal : media movil 6
//-------------------------------------------------------------------------
DEFPARAM CumulateOrders = False
DEFPARAM FLATAFTER=215700
DEFPARAM PRELOADBARS=1000
F = (COUNTOFLONGSHARES = 0)
c0=(Dopen(0)-DClose(1))*100/DClose(1)
d=time>163000
z=c0>5
c11=MACD[24,52,18](close)>0
c3=Stochastic[10,6](close)
c4=WeightedAverage[10](close)
c5=Average[20](close)
c7=c4>c5
c6=RSI[14](close)>50
c8=ADX[14]>AVERAGE[2](ADX[14])
C10=Stochastic[10,6](close)>AVERAGE[2](Stochastic[10,6])
//c11=(Close > Close[1])
//c12=close>open
//=close>exponentialAverage[6](close)
IF NOT LongOnMarket and F and d and z and c11 and c3 and c7 and c6 and c8 and c10 THEN
BUY 2000 cash AT MARKET
ENDIF
z1=c0<5
IF NOT LongOnMarket and z1 and f and c11 and c3 and c7 and c6 and c8 and c10 THEN
BUY 2000 cash AT MARKET
ENDIF
// Condiciones de salida de posiciones largas
c12=MACD[24,52,18](close)<average[2](MACD[24,52,18])
//c5=Stochastic[14,3](close)<50
S=TIME>215400
s1=S OR C12
//c15=close[1]<exponentialAverage[4](close)
If LongOnMarket and s1 THEN
SELL AT MARKET
ENDIF
IF STRATEGYPROFIT < -100 THEN
QUIT
ENDIF
// Stops y objetivos: introduzca aquí sus stops de protección y objetivos de beneficios
set stop %trailing 5