Strategia trovata in PRT

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #192234 quote
    Ciccarelli Franco
    Participant
    Junior

    Ho trovato una strategia in libreria (di seguito riportato) che sembra funzionare, ma vorrei qualche commento. Inoltre esso prevede di decidere il numero max di ordini, ma qualsiasi numero metto il test da sempre da 1 a 5.

    Grazie

    /
    Defparam CUMULATEORDERS = TRUE
    //Defparam NOCASHUPDATE = TRUE
    defparam flatbefore=151000
    defparam flatafter=215000
    //
    //
    //
    Filtro =180
    Sloss = sl // %
    SProfit = tp // %
    X = 0
    Y = 1
    Z = 2
    //
    //
    //==== CONTRATOS A NEGOCIAR =========
    //
    Xhares = 1
    //
    // ====== Numero Maximo de contratos a negociar ============
    //
    Nshares = c
    //

    //
    // ========== CODIGO ===================
    //

    HULL = weightedaverage[filtro](close)

    IF close[x] crosses over highest[h1](high[1]) and hull[y] > hull[z] and COUNTOFLONGSHARES < Nshares THEN
    buy Xhares CONTRACTS AT MARKET
    ENDIF

    IF close[x] crosses over highest[h2](high[1]) and hull[y] > hull[z] and COUNTOFLONGSHARES < Nshares THEN
    buy Xhares CONTRACTS AT MARKET
    ENDIF

    IF close[x] crosses over highest[h3](high[1]) and hull[y] > hull[z] and COUNTOFLONGSHARES < Nshares THEN
    buy Xhares CONTRACTS AT MARKET
    ENDIF

    IF close[x] crosses over highest[h4](high[1]) and hull[y] > hull[z] and COUNTOFLONGSHARES < Nshares THEN
    buy Xhares CONTRACTS AT MARKET
    ENDIF

    IF close[x] crosses over highest[h5](high[1]) and hull[y] > hull[z] and COUNTOFLONGSHARES < Nshares THEN
    buy Xhares CONTRACTS AT MARKET
    ENDIF
    SET STOP %LOSS sloss
    SET TARGET %PROFITsprofit

    #192240 quote
    robertogozzi
    Moderator
    Master

    Mancano delle variabili.

    Allega il file ITF.

    #192241 quote
    Ciccarelli Franco
    Participant
    Junior

    Nshares = 5

    h1 h2 ecc. sono 5 , 20, 50, 100, 200

    Grazie

    #192242 quote
    robertogozzi
    Moderator
    Master

    Devi solo variare Nshares, così è 5, puoi aumentarlo o diminuirlo come preferisci.

    #192244 quote
    robertogozzi
    Moderator
    Master

    In effetti entra spesso più volte all’interno della stessa candela, puoi provare questa versione modificata:

    Defparam CUMULATEORDERS = TRUE
    //Defparam NOCASHUPDATE = TRUE
    defparam flatbefore=151000
    defparam flatafter=215000
    //
    //
    //
    Filtro =180
    Sloss = 5
    SProfit = 5
    X = 0
    Y = 1
    Z = 2
    //
    //
    //==== CONTRATOS A NEGOCIAR =========
    //
    Xhares = 1
    //
    // ====== Numero Maximo de contratos a negociar ============
    //
    h1 = 5
    h2 = 20
    h3 = 50
    h4 = 100
    h5 = 200
    Nshares = 5
    //
    
    //
    // ========== CODIGO ===================
    //
    
    HULL = weightedaverage[filtro](close)
    
    IF close[x] crosses over highest[h1](high[1]) and hull[y] > hull[z] and abs(CountOfPosition) < Nshares THEN
    buy Xhares CONTRACTS AT MARKET
    ELSIF close[x] crosses over highest[h2](high[1]) and hull[y] > hull[z] and abs(CountOfPosition) < Nshares THEN
    buy Xhares CONTRACTS AT MARKET
    ELSIF close[x] crosses over highest[h3](high[1]) and hull[y] > hull[z] and abs(CountOfPosition) < Nshares THEN
    buy Xhares CONTRACTS AT MARKET
    ELSIF close[x] crosses over highest[h4](high[1]) and hull[y] > hull[z] and abs(CountOfPosition) < Nshares THEN
    buy Xhares CONTRACTS AT MARKET
    ELSIF close[x] crosses over highest[h5](high[1]) and hull[y] > hull[z] and abs(CountOfPosition) < Nshares THEN
    buy Xhares CONTRACTS AT MARKET
    ENDIF
    SET STOP %LOSS sloss
    SET TARGET %PROFITsprofit
    //graph abs(CountOfPosition)
    #192248 quote
    Ciccarelli Franco
    Participant
    Junior

    Grazie, comunque se modifico il 5  e per esempio ci metto 1, va comunque a mercato da 1 a 5.

    #192251 quote
    robertogozzi
    Moderator
    Master

    Si, per questo ho fatto la modifica ai blocchi IF…ENDIF delle entrate.

    #193300 quote
    Ciccarelli Franco
    Participant
    Junior

    Dal 26/4  uso questo codice , in demo,  ma non è mai entrato a mercato. Coincidenza ?

    Grazie

    #193645 quote
    robertogozzi
    Moderator
    Master

    L’ho appena messo in demo anch’io. Vediamo nei prossimi giorni cosa fa.

    #193853 quote
    robertogozzi
    Moderator
    Master

    Ad oggi state fatte due operazioni (sul DAX a 5 minuti), con varie entrate ciascuno.

    La prima è stata perdente e la seconda vincente.

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

Strategia trovata in PRT


ProOrder: Trading Automatico & Backtesting

New Reply
Summary

This topic contains 9 replies,
has 2 voices, and was last updated by robertogozzi
3 years, 8 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 04/26/2022
Status: Active
Attachments: 1 files
Logo Logo
Loading...