The system looks for breaking candles to join the trend.
For the calculation of the candles [276] There are 5m candles in a session of 12 candles x 12 hours x 23 hours per day.
To find out if Oil is in a trend, it uses 3 Wilder’s moving average.
The Stop and Target profit are defined by the average range in which the price moves in 6 hours of session.
Finally it takes a small multiplier to reinvest the profits without exposing too much.
Right now I have it working on Oil Crude US E1 contract.
DEFPARAM CumulateOrders = True
//Buscamos velas relevantes
// Tamaño de la vela
MediaRango = Average[276](Range)
VelaSenal1 = MediaRango*3
Ran=0
IF (Range > VelaSenal1) THEN
IF close < open THEN
Ran = 1
ELSE
Ran = 0
ENDIF
ENDIF
// Volumen Vela
MediaVolumen = Average[276](Volume)
VelaSenal2 = MediaVolumen*3
Vol=0
IF (Volume > VelaSenal2) THEN
IF close < open THEN
Vol = 1
ELSE
Vol = 0
ENDIF
ENDIF
Senal=0
IF (Vol=1) THEN
IF Ran=1 THEN
Senal=1
ENDIF
ENDIF
//Tamaño de la posicion. La aumentamos si la anterior fue negativa
posicion = (300 + STRATEGYPROFIT)/900
//Condiciones de entrada para cortos
Apertura1 = Senal >0
Apertura2 = WilderAverage[24](Low) < WilderAverage[96](Low)
Apertura3 = WilderAverage[24](Low) < WilderAverage[48](Low)
Apertura4 = WilderAverage[48](Low) < WilderAverage[96](Low)
IF Apertura1 and Apertura2 and Apertura3 and Apertura4 THEN
SELLSHORT posicion SHARES ROUNDEDUP AT MARKET
ENDIF
//Condiciones de salida para cortos
SET STOP pLOSS 60
SET TARGET pPROFIT 30