Strategia trovata in PRT

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

    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
    robertogozzirobertogozzi
    Moderator
    Legend

    Mancano delle variabili.

    Allega il file ITF.

    #192241 quote
    Ciccarelli FrancoCiccarelli Franco
    Participant
    Senior

    Nshares = 5

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

    Grazie

    #192242 quote
    robertogozzirobertogozzi
    Moderator
    Legend

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

    #192244 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    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 FrancoCiccarelli Franco
    Participant
    Senior

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

    #192251 quote
    robertogozzirobertogozzi
    Moderator
    Legend

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

    #193300 quote
    Ciccarelli FrancoCiccarelli Franco
    Participant
    Senior

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

    Grazie

    #193645 quote
    robertogozzirobertogozzi
    Moderator
    Legend

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

    #193853 quote
    robertogozzirobertogozzi
    Moderator
    Legend

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

    La prima è stata perdente e la seconda vincente.

    x-6.jpg x-6.jpg
Viewing 10 posts - 1 through 10 (of 10 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

Strategia trovata in PRT


ProOrder: Trading Automatico & Backtesting

New Reply
Summary

This topic contains 9 replies,
has 2 voices, and was last updated by robertogozzirobertogozzi
4 years, 4 months ago.

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