limitar posiciones acumalacion

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

    Hola ,

    quiero limitar los contratos o posiciones en un robot que tiene acumulacion de posiciones. ( DEFPARAM cumulateOrders = true.

    que comando tengo que añadir a dicho y como lo tengo que añadir.

    Muchas gracias

    #237341 quote
    robertogozzi
    Moderator
    Master

    Ejemplo:

    DEFPARAM CumulateOrders = true
    IF MyLongConditions AND abs(CountOfPosition) < 10 THEN
       BUY 1 CONTRACT AT MARKET
    ENDIF

    utilice la instrucción abs(CountOfPosition) para abrir no más de 10 posiciones.

    Iván González thanked this post
    #237375 quote
    Jankarl
    Participant
    New

    Hola Roberto.

    He incluido el comendo pero me da un error. Te adjunto el robot para que me indiques como incluirlo exactamente.

    Muchas gracias por la rapidez.

    // Definición de los parámetros del código
    DEFPARAM CumulateOrders = true // Acumulación de posiciones activada

    // Condiciones de entrada de posiciones cortas
    indicator1 = RSI[2](close)
    c1 = (indicator1 CROSSES UNDER 66)

    IF c1 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF

    // Condiciones de salida de posiciones cortas
    indicator2 = RSI[2](close)
    c2 = (indicator2 CROSSES UNDER 2)

    IF c2 THEN
    EXITSHORT AT MARKET
    ENDIF

    // Stops y targets
    //SET STOP pTRAILING 25
    //SET TARGET pPROFIT 55

    #237413 quote
    robertogozzi
    Moderator
    Master

    Varié la línea 8, agregando abs(CountOfPosition) < 10:

    // Definición de los parámetros del código
    DEFPARAM CumulateOrders = true // Acumulación de posiciones activada
    
    // Condiciones de entrada de posiciones cortas
    indicator1 = RSI[2](close)
    c1 = (indicator1 CROSSES UNDER 66)
    
    IF c1 AND abs(CountOfPosition) < 10 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    // Condiciones de salida de posiciones cortas
    indicator2 = RSI[2](close)
    c2 = (indicator2 CROSSES UNDER 2)
    
    IF c2 THEN
    EXITSHORT AT MARKET
    ENDIF
    
    // Stops y targets
    //SET STOP pTRAILING 25
    //SET TARGET pPROFIT 55
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

limitar posiciones acumalacion


ProOrder: Trading Automático y Backtesting

New Reply
Author
author-avatar
Jankarl @jankarl Participant
Summary

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

Topic Details
Forum: ProOrder: Trading Automático y Backtesting
Language: Spanish
Started: 09/08/2024
Status: Active
Attachments: No files
Logo Logo
Loading...