Fiabilidad backtest proreal

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #203079 quote
    dosqui
    Participant
    New

    Buenos dias.

    Estoy intentando programar algo muy sencillo, y cuando corro el backtest, los resultados en cuanto al numero de operaciones son diferentes solo con cambiar el numero de contratos (marcar/desmarcar filas 23/24), lo cual no tiene mucho sentido.

    Con el numero de contratos “fijo”, salen 35 operaciones. Con el numero de contratos “calculado”, salen 2 operaciones.

    Instrumento LCO (Brent 1€), TF 5 minutos y 10k unidades.

    Alguien sabe porque??? Porque no tiene ninguna logica.

    
    DEFPARAM CumulateOrders = False
    
    DEFPARAM FLATBEFORE = 000500
    DEFPARAM FLATAFTER = 230000
    
    //Variables
    Capital=20000+STRATEGYPROFIT
    Riesgo=0.005
    
    //Incializar variables
    If intradaybarindex = 0 then
    Largo = 1
    Corto = 1
    AbrirLargos = 1
    AbrirCortos = 1
    operar = 1
    endif
    
    
    TIMEFRAME(daily, default)
    c0=Close
    ATR0=averagetruerange[1]
    Contratos=(Capital*Riesgo)/(ATR0)*pointsize
    //Contratos = 2
    TIMEFRAME(default)
    
    
    If longonmarket then
    AbrirCortos = 0
    endif
    If shortonmarket then
    AbrirLargos = 0
    endif
    
    If Operar and AbrirLargos then
    BUY Contratos CONTRACTS AT c0+50 stop
    endif
    
    If Operar and AbrirCortos then
    SELLSHORT Contratos CONTRACTS at c0-50 stop
    endif
    
    
    IF onmarket and time>225930 then
    SELL AT MARKET
    EXITSHORT AT MARKET
    endif
    
    #203108 quote
    GraHal
    Participant
    Master

    Con el número de contratos “calculados”, salen 2 operaciones.

    ¿Será quizás que con el tamaño del contrato ‘calculado’, a veces el tamaño calculado es menor que el mínimo para Brent?

    Intente usar a continuación en la Línea 23 …

    Contratos=min(2, (Capital*Riesgo)/(ATR0))*pointsize

    dosqui thanked this post
    #203387 quote
    robertogozzi
    Moderator
    Master

    Se debe al uso de decimales en el número de contratos.
    Reemplace la línea 23 con:

    Contratos=ceil((Capital*Riesgo)/(ATR0)*pointsize)
    GraHal thanked this post
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Fiabilidad backtest proreal


ProOrder: Trading Automático y Backtesting

New Reply
Author
author-avatar
dosqui @dosqui Participant
Summary

This topic contains 2 replies,
has 3 voices, and was last updated by robertogozzi
3 years, 4 months ago.

Topic Details
Forum: ProOrder: Trading Automático y Backtesting
Language: Spanish
Started: 10/26/2022
Status: Active
Attachments: No files
Logo Logo
Loading...