Hi. I made a pretty solid strategy based on ADX, momentum and ema8.
I would like to share it with you guys to see what you think and I’m open to new improvements that you might think of.
The strategy is currently running in DAX 15 min, but I think it might be also good in other times and products.
Would be good to know how it works with 200k units backtest instead of 100k…
Hope you like it!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 |
// Definición de los parámetros del código DEFPARAM Preloadbars = 50000 DEFPARAM CumulateOrders = false // Acumulación de posiciones desactivada // Horario semanal noEntryBeforeTime = 100000 // No abrir ordenes antes de las 08:30h. Las que estuvieran abiertas continuan abiertas. hora1 = TIME >= noEntryBeforeTime noEntryAfterTime = 180000 // No abrir ordenes despues de las 21:30h. Las que estuvieran abiertas continuan abiertas. hora2 = TIME < noEntryAfterTime // Position Size positionsize=1 //opentime= 080000 //Pa=open //sololargos= close > Pa //solocortos= close < Pa // Condiciones para entrada de posiciones largas EMA8= ExponentialAverage[8](close) EMAL= (EMA8 < close) EMAS= (EMA8 > close) ponderada34 = weightedaverage[34](close) EMALW= (ponderada34 < close) EMASW= (ponderada34 > close) ponderada150 = weightedaverage[150](close) tema15 = tema[15](close) EMA200= ExponentialAverage[200](close) EMA200L= (EMA200 < close) EMA200S= (EMA200 > close) green = ponderada150>ponderada150[1] red=ponderada150<ponderada150[1] azul = tema15>tema15[1] violeta = tema15<tema15[1] TEMAL= (tema15 < close) TEMAC= (tema15 > close) //PONDERADAL= (ponderada150 <close) //PONDERADAC= (ponderada150 >close) OT=Momentum[6] MF = ADX[6] plus=DIplus[10](close) minus=DIminus[10](close) ad=ADX[10] limadx = 18// minval=1, title="ADX MA Active" willy=Williams[40](close) toro= willy >-50 oso=willy<-50 STO8=stochastic[8,3] STOL= STO8 > STO8[3] STOS= STO8 < STO8[3] sto8=stochastic[8,3] //c25 = (indicator7 < close) indicador4 = ADX[10] plus=DIplus[10](close) minus=DIminus[10](close) ad=ADX[10] limadx = 18// minval=1, title="ADX MA Active") SET STOP pLOSS 30 SET TARGET pPROFIT 120 //c45=(indicador4 crosses over 15 and sto8 > sto8[3])//Saluci c4= (indicador4 crosses over 17 and sto8 > sto8[3])// Buen camino c8= (indicador4 crosses over 20 and sto8 > sto8[3])//Trade c9= (indicador4 crosses over 22 and sto8 > sto8[3])//F2 c10= (indicador4 crosses over 24 and sto8 > sto8[3])//F4 c11= (indicador4 crosses over 26 and sto8 > sto8[3])//F6 c12= (indicador4 crosses over 28 and sto8 > sto8[3])//F8 c13= (indicador4 crosses over 30 and sto8 > sto8[3])//F30 //c14= (indicador4 crosses over 35 and sto8 > sto8[3])//F30 //c15= (indicador4 crosses over 40 and sto8 > sto8[3])//F30 c6 = (summation[2](EMAL[1]) = 2)// 2 cierres por encima de la ema8 c7 = high > high[1] // Maximo a la vela anterior IF NOT LONGONMARKET and EMAL AND EMALW AND STOL AND EMA200L AND ad> limadx and plus> minus AND MF>=MF[1] and OT>OT[1] and toro and TEMAL and green and azul and C6 AND c7 and ( c4 or c8 or c9 or c10 or c11 or c12 or c13 ) AND hora1 AND hora2 THEN BUY positionsize CONTRACT AT MARKET ENDIF // Condiciones para entrada de posiciones cortas //c16 = (summation[2](EMAS[1]) = 2) //c17 = low < low[1] //c46=(indicador4 crosses over 15 and sto8 < sto8[3]) //c18= (indicador4 crosses over 17 and sto8 < sto8[3]) //c19= (indicador4 crosses over 20 and sto8 < sto8[3]) c20= (indicador4 crosses over 22 and sto8 < sto8[3]) c21= (indicador4 crosses over 24 and sto8 < sto8[3]) c22= (indicador4 crosses over 26 and sto8 < sto8[3]) //c23= (indicador4 crosses over 28 and sto8 < sto8[3]) //c24= (indicador4 crosses over 30 and sto8 < sto8[3]) //c25= (indicador4 crosses over 35 and sto8 < sto8[3]) //c26= (indicador4 crosses over 40 and sto8 < sto8[3]) IF NOT SHORTONMARKET AND EMAS AND EMASW AND STOS AND ad>limadx and EMA200S AND plus < minus AND MF>=MF[1] and OT<OT[1] and oso AND VIOLETA AND red AND TEMAC AND ( c20 or c21 or c22 ) AND hora1 AND hora2 THEN SELLSHORT positionsize CONTRACT AT MARKET ENDIF // TRAILING ////////////////////////////////////////////////////////////////////////////////////////////////////////// startBreakeven1 =10 startBreakeven2 =15 startBreakeven3 =25 startBreakeven4 =35 startBreakeven5 =45 startBreakeven6 =55 startBreakeven7 =65 startBreakeven8 =75 startBreakeven9 =85 startBreakeven10 =95 startBreakeven11 =105 startBreakeven12 =115 startBreakeven13 =125 startBreakeven14 =135 startBreakeven15 =145 startBreakeven16 =155 startBreakeven17 =165 startBreakeven18 =175 startBreakeven19 =185 startBreakeven20 =195 startBreakeven21 =205 startBreakeven22 =215 startBreakeven23 =225 startBreakeven24 =235 startBreakeven25 =245 PointsToKeep1 =5 PointsToKeep2 =10 PointsToKeep3 =15 PointsToKeep4 =25 PointsToKeep5 =35 PointsTokeep6 =45 PointsTokeep7 =55 PointsTokeep8 =65 PointsTokeep9 =75 PointsTokeep10 =85 PointsTokeep11 =95 PointsTokeep12 =105 PointsTokeep13 =115 PointsTokeep14 =125 PointsTokeep15 =135 PointsTokeep16 =145 PointsTokeep17 =155 PointsTokeep18 =165 PointsTokeep19 =175 PointsTokeep20 =185 PointsTokeep21 =195 PointsTokeep22 =205 PointsTokeep23 =215 PointsTokeep24 =225 PointsTokeep25 =235 //reset the breakevenLevel when no trade are on market IF NOT ONMARKET THEN breakevenLevel=0 ENDIF // LARGOS // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven1*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep1*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven2*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep2*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven3*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep3*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven4*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep4*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven5*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep5*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven6*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep6*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven7*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep7*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven8*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep8*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven9*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep9*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven10*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep10*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven11*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep11*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven12*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep12*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven13*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep13*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven14*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep14*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven15*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep15*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven16*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep16*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven17*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep17*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven18*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep18*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven19*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep19*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven20*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep20*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven21*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep21*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven22*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep22*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven23*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep23*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven24*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep24*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven25*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)+PointsToKeep25*pipsize ENDIF // CORTOS // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven1*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep1*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven2*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep2*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven3*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep3*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven4*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep4*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven5*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep5*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven6*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep6*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven7*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep7*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven8*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep8*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven9*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep9*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven10*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep10*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven11*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep11*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven12*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep12*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven13*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep13*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven14*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep14*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven15*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep15*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven16*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep16*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven17*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep17*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven18*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep18*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven19*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep19*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven20*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep20*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven21*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep21*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven22*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep22*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven23*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep23*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven24*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep24*pipsize ENDIF // test if the price have moved favourably of "startBreakeven" points already IF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven25*pipsize THEN //calculate the breakevenLevel breakevenLevel = tradeprice(1)-PointsToKeep25*pipsize ENDIF //place the new stop orders on market at breakevenLevel IF breakevenLevel>0 THEN SELL AT breakevenLevel STOP EXITSHORT AT breakevenLevel STOP ENDIF |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Hi xpiga,
I can see there is a lot of work in your code, thanks for sharing.
Unfortunetly the results before 2017 are not good. I don´t know how to add here images of the backtest with 200.000 for you to see. Is it possible?
I don’t know I suppose you can attach the picture…
Any new ideas to improve the code are more than welcome.
I think the system has a lot of potential in the long term.
Thanks
Sorry but I don´t see any option to attach the picture here… not sure but I think that´s only possible in the normal forum.
About ideas to improve the only thing I can think is about the trailing stop you use, maybe you like it that way but you can also use the trailing stop function that Nicolas has published here:
https://www.prorealcode.com/blog/trading/complete-trailing-stop-code-function/
I don´t really know about the logic of the system so I can´t talk properly but when I see so many indicators in the code I tend to think the backtest probably is curvefitted. But that only time will tell 😉
Good luck!
Trailing stop wont work, will keep moving with price
Very good strategy, still works good in demo today ! 🙂
Hello is there an update about this strategy. New code, results, Anyone tried it live?
Hello,
currently, I don’t have the same result as above
and don’t no if it works good in real…
i changed some parameters and profit factor has been increased (1.68)
but it’s an optimisation…
Hola. Me gustaría contactar contigo para ver la estrategia..
Has someone already tested in real ?
Hola. estoy buscando un programador en proorder, para hacer un programa basado en el Q-trend de Nicolas, que haga las compras y ventas automáticamente. si conoces a alguien es español. Graciasss