Ayuda con promedios compre y venda según unos niveles fijos.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #74106 quote
    cgccgc
    Participant
    New

    Hola, leer el foro me está ayudando mucho a mejorar.

    Sin embargo, estoy tratando de hacer un código que compre y venda según unos niveles fijos.

    Mi idea es que en la vela que da lugar a la primera entrada de la operación, esos niveles se calculen y permanezcan fijos en el resto de operación, ejecutándose nuevas compras o cierre de posición según esas condiciones calculadas, como digo en base a la vela de la primera entrada y no se modifiquen en cada nueva compra.

    Pongo un código en el que he tratado de hacer lo explicado, he intentado hacerlo paso a paso, pero no es correcto ya que no realiza nuevas compras. Si pudierais ayudarme estaría muy agradecido.

    //ACTIVADO
    defparam cumulateorders=true
    
    //INDICADOR
    indicador= rsi[3](close)
    
    //CONDICION ENTRADA
    c4= indicador < 30
    c1= tradeprice+30
    c2= low-40
    c3= low-80
    
    
    //CONDICIONES DE COMPRA Y VENTA
    if not onmarket and c4 then
    buy 1 share at market
    endif
    if countofposition = 1 and close > c1 then
    sell at market
    endif
    if countofposition = 1 and close < c2 then
    buy 1 share at market
    endif
    if countofposition = 2 and close < c3 then
    buy 1 share at market
    endif
    if countofposition = 2 and close > c2 then
    sell at market
    endif
    if countofposition = 3 and close < c4 then
    buy 1 share at market
    endif
    if countofposition = 3 and close > c3 then
    sell at market
    endif
    #74285 quote
    NicolasNicolas
    Keymaster
    Legend

    ¿Cuál es el instrumento que hizo la prueba?
    Creo que su problema es que no adapta el tamaño de sus pasos al instrumento, debe hacerlo así:

    //CONDICION ENTRADA
    c4= indicador < 30
    c1= tradeprice+30*pointsize
    c2= low-40*pointsize
    c3= low-80*pointsize
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Ayuda con promedios compre y venda según unos niveles fijos.


ProOrder: Trading Automático y Backtesting

New Reply
Author
author-avatar
cgc @cgc Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by NicolasNicolas
8 years, 3 months ago.

Topic Details
Forum: ProOrder: Trading Automático y Backtesting
Language: Spanish
Started: 06/22/2018
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...