Ayuda, No entiendo como ejecuta este código

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #159937 quote
    Alturron
    Participant
    New

    Hola a todos.

    En el siguiente código, se me ejecuta una orden sell de 3 contratos

    EMPEZARCICLO = 1
    VALORPROFIT = 50
    VALORDELSTOP = 40
    
    if barindex > 1 then
       IF NOT ONMARKET AND EMPEZARCICLO[1] = 1 THEN
          SELLSHORT 3 CONTRACTS at market
          //EMPEZARCICLO = 0 
       ELSIF NOT ONMARKET AND EMPEZARCICLO[1] = 2 THEN
          EMPEZARCICLO = EMPEZARCICLO[1]
       ELSIF NOT ONMARKET AND EMPEZARCICLO[1] = 0  THEN
          EMPEZARCICLO = 2
       ENDIF
    ENDIF
    SET TARGET PROFIT(VALORPROFIT)
    SET STOP LOSS(VALORDELSTOP)

    Pero ahora descomento la linea donde digo empezarciclo=0, y no ejecuta ninguna orden sell.

    EMPEZARCICLO = 1
    VALORPROFIT = 50
    VALORDELSTOP = 40
    
    if barindex > 1 then
       IF NOT ONMARKET AND EMPEZARCICLO[1] = 1 THEN
          SELLSHORT 3 CONTRACTS at market
          EMPEZARCICLO = 0 
       ELSIF NOT ONMARKET AND EMPEZARCICLO[1] = 2 THEN
          EMPEZARCICLO = EMPEZARCICLO[1]
       ELSIF NOT ONMARKET AND EMPEZARCICLO[1] = 0  THEN
          EMPEZARCICLO = 2
       ENDIF
    ENDIF
    SET TARGET PROFIT(VALORPROFIT)
    SET STOP LOSS(VALORDELSTOP)

    NO LO ENTIENDO, SI EN EL PRIMER CASO, EL PROGRAMA EJECUTA LA ORDEN SELL, PORQUE EN EL SEGUNDO CASO NO, CUANDO LA INFORMACIÓN DE LA VARIABLE ESTÁ DESPUÉS DE LA ORDEN SELL….

    ALGUIEN ME PUEDE AYUDAR???? MUCHAS GRACIAS.

    #159940 quote
    robertogozzi
    Moderator
    Master

    Intente poner, al principio:

    DEFPARAM PreLoadBars = 0
    #159942 quote
    Alturron
    Participant
    New

    Pues muchisimas gracias Roberto, FUNCIONA…

    Lo que no entiendo es el porque….

    #159948 quote
    robertogozzi
    Moderator
    Master

    Debido a que ProOrder carga por defecto 2000 barras ANTES de la barra inicial, lo que usted piensa que es el número 0 es en realidad el número 2000, entonces> 1.

    Como ha descomentado, esa variable se convertirá en 0 antes de que la estrategia comience a venderse.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Ayuda, No entiendo como ejecuta este código


ProOrder: Trading Automático y Backtesting

New Reply
Author
author-avatar
Alturron @alturron Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by robertogozzi
5 years, 1 month ago.

Topic Details
Forum: ProOrder: Trading Automático y Backtesting
Language: Spanish
Started: 01/30/2021
Status: Active
Attachments: No files
Logo Logo
Loading...