Fr7Participant
Master
DEFPARAM CumulateOrders = False // Acumulación de posiciones desactivada
DEFPARAM FLATBEFORE = 100000
// Cancel all pending orders and close all positions at the "FLATAFTER" time
DEFPARAM FLATAFTER = 173000
// Prevents the system from placing new orders on specified days of the week
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
c70=not daysForbiddenEntry
if intradaybarindex = 0 then
p=0
m=0
pp=0
mm=0
equitycurve = 0
endif
// Prevents the system from placing new orders on specified days of the week
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
//variables
//equitycurve = undefined
p=undefined
m=undefined
pp=undefined
mm=undefined
//indicators
i1 = average[p,m](close)
i2 = average[pp,mm](close)
//equitycurve = average[curveperiod](strategyprofit)
//trades conditions
long = i1 crosses over i2
short = i1 crosses under i2
//mydays variable incrementing to let the average curve build over time
//if date > olddate then
//mydays=mydays+1
//olddate = date
//endif
start=070000
end=100000
c69=(time>start and time<end)
//trades when the curve has built
if not onmarket then
mystrategyprofit=strategyprofit and c69
elsif long then
mystrategyprofit=strategyprofit+(close-tradeprice)/pointsize*pointvalue*countoflongshares
elsif short then
mystrategyprofit=strategyprofit+(tradeprice-close)/pointsize*pointvalue*countofshortshares
endif
//equitycurve = exponentialaverage[a](mystrategyprofit)
if strategyprofit>=equitycurve then
p=p
pp=pp
m=m
mm=mm
endif
GRAPH mystrategyprofit as "strategy profit"
GRAPH equitycurve coloured(255,0,0) as "profit curve"
IF long AND strategyprofit>=equitycurve and c70 THEN
BUY 1 CONTRACTS AT MARKET
ENDIF
//exit positions
IF short THEN
SELL AT MARKET
ENDIF
Hola Nicolás,
¿Es posible realizar un sistema intradía que calcule las variables óptimas en un cruce de medias cuando la ganancia flotante sea positiva?
El sistema consistiría en un cruce de medias que calcularía en la curva flotante las variables desde las 7:00 horas hasta las 10:00 horas y en caso de que la ganancia flotante fuera positiva establecería esas variables en el sistema a partir de las 10:00 horas a 22:00 horas.Al siguiente día se volvería a establecer nuevas variables.
He tratado de programarlo pero no he podido…. a ver si me puede ayudar a corregir el código .
Fr7Participant
Master
Hola Nicolás, sé que está muy ocupado. Pero me gustaría saber si es posible hacer el sistema.