Inserimento filtro volatilità ATR

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #56080 quote
    Billy Ray Valentine
    Participant
    Senior

    Salve,

    avendo questo sistema che lavora sul Dow Jones:

    MMlungo= Average[200]
    MMcorto= Average[5]
    MyAdx = ADX[5]
    // posizione Long
    If close > mmlungo and close < mmcorto and myadx > 35 then
    buy at lowest[2](low) LIMIT
    endif
    if close > mmcorto then
    sell at market
    endif
    // posizione Short
    If close < mmlungo and close > mmcorto and myadx > 35 then
    sellshort at highest[2](high) LIMIT
    endif
    if close < mmcorto then
    exitshort at market
    endif

    sarebbe possibile aggiungere un filtro di volatilità tramite l’ATR?

    Nel dettaglio, si richiede che il filtro faccia attivare il sistema principale quando si caratterizza un valore dell’ATR a 5 periodi inferiore al valore dell’ATR a 10 periodi (valori ovviamente cambiabili a piacimento).

    Grazie in anticipo.

    #56162 quote
    robertogozzi
    Moderator
    Master

    Prova il TS con queste aggiunte:

    MMlungo= Average[200]
    MMcorto= Average[5]
    MyAdx = ADX[5]
    MyAtr5 = AverageTrueRange[5](close)
    MyAtr10 = AverageTrueRange[10](close)
    MyAtr = MyAtr5 < MyAtr10
    // posizione Long
    If close > mmlungo and close < mmcorto and myadx > 35 AND MyAtr then
       buy at lowest[2](low) LIMIT
    endif
    if close > mmcorto then
       sell at market
    endif
    // posizione Short
    If close < mmlungo and close > mmcorto and myadx > 35 AND MyAtr then
       sellshort at highest[2](high) LIMIT
    endif
    if close < mmcorto then
       exitshort at market
    endif

    Ho inserito i due ATR ed ho aggiunto un AND MyAtr alle righe dove entri Long e Short.

    Roberto

    #56174 quote
    Billy Ray Valentine
    Participant
    Senior

    Grazie Roberto, ti chiedo un’ultima cosa:

    è possibile inserire dei parametri orari, da poter modificare a piacimento, in cui far funzionare il ts?

    #56189 quote
    robertogozzi
    Moderator
    Master

    Si, vedi come l’ho modificato:

    IF time >= 090000 OR time <= 180000 THEN    //Attivo solo dalle 9 alle 18
       Operativita = 1
    ELSE
       Operativita = 0
    ENDIF
    MMlungo= Average[200]
    MMcorto= Average[5]
    MyAdx = ADX[5]
    MyAtr5 = AverageTrueRange[5](close)
    MyAtr10 = AverageTrueRange[10](close)
    MyAtr = MyAtr5 < MyAtr10
    // posizione Long
    If close > mmlungo and close < mmcorto and myadx > 35 AND MyAtr AND Operativita then
       buy at lowest[2](low) LIMIT
    endif
    if close > mmcorto then
       sell at market
    endif
    // posizione Short
    If close < mmlungo and close > mmcorto and myadx > 35 AND MyAtr AND Operativita then
       sellshort at highest[2](high) LIMIT
    endif
    if close < mmcorto then
       exitshort at market
    endif
    Billy Ray Valentine thanked this post
    #56241 quote
    Billy Ray Valentine
    Participant
    Senior

    Grazie mille 🙂

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

Inserimento filtro volatilità ATR


ProOrder: Trading Automatico & Backtesting

New Reply
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by Billy Ray Valentine
8 years, 1 month ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 12/19/2017
Status: Active
Attachments: No files
Logo Logo
Loading...