MARTINGALA
Forums › ProRealTime foro Español › Soporte ProOrder › MARTINGALA
- This topic has 4 replies, 3 voices, and was last updated 5 years ago by CHUTI.
-
-
05/23/2019 at 10:16 PM #99288
He encontrado en ProRealCode este sistema de trading para operar con cortos:
1234567891011121314151617181920212223242526272829defparam cumulateorders = true// indicatorsEMA3 = exponentialaverage[3]EMA10 = exponentialaverage[10]if barindex>1 thenhaopen=(haopen[1]+haclose[1])/2haclose=(open+close+low+high)/4endif// first order (EMA cross)if not shortonmarket and EMA3 crosses under EMA10 thenSELLSHORT 1 SHARE AT MARKETendif// close position with bullish EMA cross only if we are in profit and we are not already averaging down (1 position only)if countofposition=-1 and haclose<tradeprice and EMA3 crosses over EMA10 thenEXITSHORT AT MARKETendif// averaging downif shortonmarket and haopen>haclose and haopen[1]<haclose[1] and haclose>tradeprice thenSELLSHORT 1 SHARE AT MARKETendif// monitor the average price of whole orders and close them accordinglyif shortonmarket and haclose<positionprice and countofposition<-1 thenEXITSHORT AT MARKETendifNecesito que el sistema de trading sea para operar con largos, necesito ayuda porque no lo he conseguido modificar.
Gracias de antemano.
05/23/2019 at 10:50 PM #99290>> Para claridad de los mensajes en los foros de ProRealCode, por favor utilice el botón “código de inserción PRT ( insert PRT code)” para separar el texto de la parte de código! ¡Gracias! <<
05/23/2019 at 11:13 PM #99293SISTEMA DE TRADING MARTINGALA1234567891011121314151617181920212223242526272829defparam cumulateorders = true// indicatorsEMA3 = exponentialaverage[3]EMA10 = exponentialaverage[10]if barindex>1 thenhaopen=(haopen[1]+haclose[1])/2haclose=(open+close+low+high)/4endif// first order (EMA cross)if not shortonmarket and EMA3 crosses under EMA10 thenSELLSHORT 1 SHARE AT MARKETendif// close position with bullish EMA cross only if we are in profit and we are not already averaging down (1 position only)if countofposition=-1 and haclose<tradeprice and EMA3 crosses over EMA10 thenEXITSHORT AT MARKETendif// averaging downif shortonmarket and haopen>haclose and haopen[1]<haclose[1] and haclose>tradeprice thenSELLSHORT 1 SHARE AT MARKETendif// monitor the average price of whole orders and close them accordinglyif shortonmarket and haclose<positionprice and countofposition<-1 thenEXITSHORT AT MARKETendif05/23/2019 at 11:42 PM #99294Hola Chuti,
En principio, este código es de PROMEDIO A LA BAJA, no de MARTINGALA. No es problema, la diferencia en este código reside en que el promedio a la baja, compra en corto (1 contrato), siempre que hay un cambio de “color” a cortos en la vela Heiken Ashi, y casi siempre logra recuperarse, aunque si te te pilla una tendencia alcista de semanas o meses, puede liquidar tu cuenta. La Martingala clásica, es una repetición binaria donde en cada entrada el numero de contratos se multiplica de forma exponencial (1, 2, 4, 8, 16, 32, 64…). También te liquida la cuenta en menos de nada.
En cuanto al cambio para entrar en largos, sin problema. Te adjunto el código:
1234567891011121314151617181920212223242526272829defparam cumulateorders = true// indicatorsEMA3 = exponentialaverage[3]EMA10 = exponentialaverage[10]if barindex>1 thenhaopen=(haopen[1]+haclose[1])/2haclose=(open+close+low+high)/4endif// first order (EMA cross)if not longonmarket and EMA3 crosses over EMA10 thenBUY 1 SHARE AT MARKETendif// close position with bearish EMA cross only if we are in profit and we are not already averaging UP (1 position only)if countofposition=1 and haclose>tradeprice and EMA3 crosses under EMA10 thenSELL AT MARKETendif// averaging UPif longonmarket and haopen<haclose and haopen[1]>haclose[1] and haclose<tradeprice thenBUY 1 SHARE AT MARKETendif// monitor the average price of whole orders and close them accordinglyif longonmarket and haclose>positionprice and countofposition>1 thenSELL AT MARKETendifPor favor, comprueba que funciona como debe, comprando al alza como dice el código. En caso contrario, dímelo y lo corregimos.
Un saludo y bienvenido a la comunidad.
Juan
05/24/2019 at 7:32 AM #99302 -
AuthorPosts