MTF para sistema trading

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #146391 quote
    Santi
    Participant
    Junior

    Buenos días,

    Soy totalmente nuevo en programación, estoy intentando aprender poco a poco y quería plantear una duda a ver si alguien me puede ayudar

    ¿Cómo debe hacerse en el código para emplear condiciones en diferentes time-frame?

    Por ejemplo, digamos que el sistema dice comprar cuando la línea MACD cruce al alza su nivel de 0 y se produzca un cierre por encima de la EMA10, todo en ello en un time-frame de 5 minutos, pero queremos poner un filtro a las compras, diciéndole que solo se compre en el caso que el Close del mes anterior hubiese sido por encima de la SMA10.

    La primera parte del código creo que sería así:

    DEFPARAM CumulateOrders=False
    
    //Compra:
    //Si la línea MACD está por encima de 0
    
    EMA10 = ExponentialAverage[10](close)
    Condicion1 = MACD > 0
    Condicion2 = EMA10 < (close)
    
    if Condicion1 and Condicion2 then
    buy 1 contract at high + 2*pointsize STOP
    ENDIF
    
    if DI < 0 then
    sell 1 contract at close stop
    endif

    Pero no sé como se le puede poner el filtro del time-frame mensual. A ver si alguien puede ayudarme.

    Muchas gracias

    #146404 quote
    robertogozzi
    Moderator
    Master

    ahi esta:

    DEFPARAM CumulateOrders=False
    
    Timeframe(Monthly,UpdateOnClose)
    Sma10 = close > average [10,0](close)
    //
    Timeframe(5 minute,UpdateOnClose)
    //Compra:
    //Si la línea MACD está por encima de 0
     
    EMA10 = ExponentialAverage[10](close)
    Condicion1 = MACD > 0
    Condicion2 = EMA10 < (close)
     
    if Condicion1 and Condicion2 and Sma10 then
       buy 1 contract at high + 2*pointsize STOP
    ENDIF
     
    if DI < 0 then
       sell 1 contract at close stop
    endif
    Santi thanked this post
    #146415 quote
    Santi
    Participant
    Junior

    Muchas gracias sr. robertogozzi

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

MTF para sistema trading


ProOrder: Trading Automático y Backtesting

New Reply
Author
author-avatar
Santi @santi Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Santi
5 years, 5 months ago.

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