A little help for this strategy that works very well …
Forums › ProRealTime English forum › ProOrder support › A little help for this strategy that works very well …
- This topic has 24 replies, 2 voices, and was last updated 1 year ago by robertogozzi.
-
-
02/23/2017 at 5:47 PM #26196
hi all
i have this code that works very well but i don’t like the system of accumulation
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667//-------------------------------------------------------------------------// Code principal : MonSystème(196)//-------------------------------------------------------------------------// Definición de los parámetros del códigoDEFPARAM CumulateOrders = false // Acumulación de posiciones desactivadaDEFPARAM FlatAfter =173000capital=strategyprofit+10000n=capital/1000if n>100 thenn=100endifif n<10 thenn=10endifHoraEntradaLimite = 090600HoraInicio = 090500HoraEntradaLimite1 = 091600HoraInicio1 = 091500HoraEntradaLimite2 = 093100HoraInicio2 = 093000if dayofweek=1 then //Mondaydaytrading=1endifif dayofweek=2 then // Tuesdaydaytrading=1endifif dayofweek=3 then // Wednesdaydaytrading=1endifif dayofweek=4 then //Thursdaydaytrading=1endifif dayofweek=5 then // Frifaydaytrading=1endifif Time >= HoraInicio and time <= HoraEntradaLimite and daytrading= 1 or Time >= HoraInicio1 and time <= HoraEntradaLimite1 and daytrading= 1 or Time >= HoraInicio2 and time <= HoraEntradaLimite2 and daytrading= 1 thenc1 = open < close-2if not onmarket thenIF c1 THENbuy n contract AT close+2 stopendifc2= open > close-1IF c2 THENsellshort n contract AT close-1 stopendifendifendifSET STOP ptrailing 502/23/2017 at 5:50 PM #26197i would like to put in the accumulation of this system , i ve tried to code it but it seems to not work…. it give no results
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263//-------------------------------------------------------------------------// Code principal : MonSystème(197)//-------------------------------------------------------------------------// Definición de los parámetros del códigoDEFPARAM CumulateOrders = false // Acumulación de posiciones desactivada// La posición se cierra a las 17:29 p.m. si no toca ni stop ni take.DEFPARAM FlatAfter =173000once ordersize=1// No se abren nuevas posiciones después de la vela que se cierra a las 09:06HoraEntradaLimite = 090600// El análisis de mercado empieza en la vela de 5 minutos que cierra a las 09:05HoraInicio = 090500// Órdenes máximasif Ordersize>18 thenOrdersize=18endif// Riesgo, multiplicador de contratos.n=6// Condiciones para el analisis.if Time >= HoraInicio and time <= HoraEntradaLimite then// Condiciones de entrada de posiciones largas.c1 = open < close-1IF c1 THENIF PositionPerf(1) < 0 THENOrderSize = OrderSize/2//+1if ordersize<1 thenordersize=1ENDIFELSIF PositionPerf(1) > 0 THENOrderSize =OrderSize+2endif// Si la primera barra del día de 5 min es positiva, compramos.buy ordersize*n shares at marketendif// Condiciones de entrada de posiciones cortas.c2= open > close-1IF c2 THENiF PositionPerf(1) < 0 THENOrderSize = OrderSize/2//+1if ordersize<1 thenordersize=1ENDIFELSIF PositionPerf(1) > 0 THENOrderSize =OrderSize+2ENDIF// Si la primera barra del día de 5 min es negativa, vendemos.sellshort ordersize*n shares at marketendifendifSET STOP ploss 5SET TARGET pPROFIT 1002/23/2017 at 5:55 PM #2619902/23/2017 at 6:00 PM #2620502/23/2017 at 6:06 PM #2620802/23/2017 at 9:36 PM #26230Hello Paris,
maybe like this?
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374DEFPARAM CumulateOrders = trueDEFPARAM FlatAfter =173000once ordersize=1// Órdenes máximasif Ordersize>18 thenOrdersize=18endif// Riesgo, multiplicador de contratos.n=6HoraEntradaLimite = 090600HoraInicio = 090500HoraEntradaLimite1 = 091600HoraInicio1 = 091500HoraEntradaLimite2 = 093100HoraInicio2 = 093000if dayofweek=1 then //Mondaydaytrading=1endifif dayofweek=2 then // Tuesdaydaytrading=1endifif dayofweek=3 then // Wednesdaydaytrading=1endifif dayofweek=4 then //Thursdaydaytrading=1endifif dayofweek=5 then // Frifaydaytrading=1endifif Time >= HoraInicio and time <= HoraEntradaLimite and daytrading= 1 or Time >= HoraInicio1 and time <= HoraEntradaLimite1 and daytrading= 1 or Time >= HoraInicio2 and time <= HoraEntradaLimite2 and daytrading= 1 thenc1 = open < close-2if not onmarket thenIF c1 THENIF PositionPerf(1) < 0 THENOrderSize = OrderSize/2//+1if ordersize<1 thenordersize=1ENDIFELSIF PositionPerf(1) > 0 THENOrderSize =OrderSize+2endifbuy ordersize*n contract AT close+2 stopendifc2= open > close-1IF c2 THENiF PositionPerf(1) < 0 THENOrderSize = OrderSize/2//+1if ordersize<1 thenordersize=1ENDIFELSIF PositionPerf(1) > 0 THENOrderSize =OrderSize+2ENDIFsellshort ordersize*n contract AT close-1 stopendifendifendifSET STOP ptrailing 502/23/2017 at 9:49 PM #2623302/23/2017 at 10:11 PM #26236ok thanks derek thanks for your code , it works perfectly , i put it on my collection .
but it is not exctly what i wanted to do .
The basis of the new strategy is the first code , so it only go long no shorts , and i want to replace in it , the accumulation , wich is in the second code
12345678910111213141516once ordersize=1// No se abren nuevas posiciones después de la vela que se cierra a las 09:06HoraEntradaLimite = 090600// El análisis de mercado empieza en la vela de 5 minutos que cierra a las 09:05HoraInicio = 090500// Órdenes máximasif Ordersize>18 thenOrdersize=18endif// Riesgo, multiplicador de contratos.n=6// Condiciones para el analisis.102/23/2017 at 10:13 PM #2623702/23/2017 at 10:33 PM #2624102/23/2017 at 10:45 PM #2624502/23/2017 at 10:48 PM #26246yes i understand why it only trade 10 , but i want that trades like the second ….
for example :
123456789101112131415c1 = open < close-2if not onmarket thenIF c1 THENbuy n*ordersize contract AT close+2 stopendifc2= open > close-1IF c2 THENsellshort n*ordersize contract AT close-1 stopendifendifendif102/23/2017 at 10:49 PM #26247@Paris You say you want to gear the orders … is below of any help?
https://www.prorealcode.com/topic/grid-orders-with-one-combined-stop-loss-and-limit-can-it-be-done/
02/23/2017 at 10:51 PM #2624902/23/2017 at 10:57 PM #26250 -
AuthorPosts