Good afternoon,
I share this robot so that we try to improve it among all, to add screenshots and more files, this is the thread in the forum to do it:
Automatic trading strategy for S&P500 forum topic
It is a robot that only enters long operations, with a spread of 0.4 pts, in the mini 1 € SPRTD 500.
It consists of 4 indicators: MACD, Stochastic, moving average, and an indicator that makes the time of ichimoku.
The robot, buy when the price is below the “clouds” of Miindicador (3) (ichimoku), but should be in turn above the moving average and the MACD and Stochastic be positive. (Example of thread operation in the forum) and closes with the take profit or stop loss or when the price falls below the “cloud”.
INDICADOR
// Ichimoku Pr-K Bin Better
p1 = 9
p2 = 26
p3 = 52
// aa es decimal para multiplicar el ATR, mayor que cero
aa = 1
n = 14
//REM Tenkan-Sen
Upper1 = HIGHEST[p1](HIGH)
Lower1 = LOWEST[p1](LOW)
Tenkan = (Upper1 + Lower1) / 2
//REM Kijun-Sen
Upper2 = HIGHEST[p2](HIGH)
Lower2 = LOWEST[p2](LOW)
Kijun = (Upper2 + Lower2) / 2
//REM Senkou Span A
SpanA = (Tenkan[p2] + Kijun[p2]) / 2
//REM Senkou Span B
SpanB = ((HIGHEST[p3](HIGH[p2])) + LOWEST[p3](LOW[p2])) / 2
//prix = choix du prix
prix=customclose
if prix >= spana and prix >= spanb then
vv=1
else
vv=0
endif
if prix <= spana and prix <= spanb then
rr=1
else
rr=0
endif
if vv[1] = 1 and vv = 0 and rr = 0 then
vv = 1
elsif rr[1] = 1 and rr = 0 and vv = 0 then
rr = 1
endif
if vv = 1 then
c=1
else
c=-1
endif
cambioarojo = (c[1] = 1 AND c = -1)
cambioaverde = (c[1] = -1 AND c = 1)
KumoRosa = (SpanA < SpanB)
KumoAzul = (SpanA > SpanB)
IF cambioarojo THEN
IF KumoRosa THEN
BetterKumo = SpanA
ELSIF KumoAzul THEN
BetterKumo = SpanB
ENDIF
ELSIF cambioaverde then
IF KumoRosa THEN
BetterKumo = SpanB
ELSIF KumoAzul THEN
BetterKumo = SpanA
ENDIF
ELSE
BetterKumo = BetterKumo[1]
ENDIF
//// myatr, myemaatr, mycero, mysup = CALL "EDJ ATR"[14 ,26]
//myatr, ignored, ignored, ignored = CALL "EDJ ATR"[14 ,26]
myatr = AverageTrueRange[n](close)
atrmas = BetterKumo + (aa*myatr)
atrmenos = BetterKumo - (aa*myatr)
//atrmasint = BetterKumo + (aa*mysup)
//atrmenosint = BetterKumo - (aa*mysup)
return BetterKumo COLOURED BY c as "Pr-K Bin Better", atrmas as "ATR mas", atrmenos as "ATR menos"
ROBOT
// Definición de los parámetros del código
DEFPARAM CumulateOrders = true // Acumulación de posiciones desactivada
// Condiciones para entrada de posiciones largas
indicator1 = ExponentialAverage[24](MACDline[21,44,24](close))
indicator2 = MACDline[21,44,24](close)
c1 = (indicator1 <= indicator2)
indicator3 = Stochastic[28,8](close)
indicator4 = Average[22](Stochastic[28,8](close))
c2 = (indicator3 >= indicator4)
indicator8 = close + 5
ignored, ignored, indicator9 = CALL "MiIndicador(3)"(close)
c6 = (indicator8 <= indicator9)
indicator11 = close
indicator21 = ExponentialAverage[43](close)
c11 = (indicator11 >= indicator21)
IF c1 AND c2 AND c6 and c11 THEN
BUY 5 CONTRACT AT MARKET
ENDIF
// Condiciones de salida de posiciones largas
ignored, indicator10, ignored = CALL "MiIndicador(3)"(close)
c7 = (close CROSSES under indicator10)
IF c7 THEN
SELL AT MARKET
ENDIF
SET STOP pLOSS 100
SET TARGET pPROFIT 60