ottimizzazione only long giorni settimana

Viewing 15 posts - 1 through 15 (of 38 total)
  • Author
    Posts
  • #253416 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior

    Non capisco perchè non funziona come mi aspetto il codice con ottimizzazione.

    #253417 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    L’unico che può darti una risposta sei tu stesso, a meno che non posti il codice completo e funzionante (sia testo che il file ITF, se possibile)  dicendo che ottimizzazioni vuoi fare e dove, secondo te, non funzionano.

    Gabriele Battista thanked this post
    #253419 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior

    hai perfettamente ragione, non riuscivo ad allegare un file ne ad inserire il codice

    DEFPARAM CumulateOrders=False

    //OTTIMIZZAZIONE:
    //DOE da 1 a 5
    //Step 1

    // Si compra il giorno
    // 1=lunedì 2=martedì 3=mercoledì 4=giovedì

    IF NOT ONMARKET and DayOfWeek=DOE then
    BUY 1 CONTRACT AT MARKET
    ENDIF

    // Si vende il gg successivo

    IF LONGONMARKET and (DayOfWeek >=DOE+1) and (Day>Day[1]) then
    SELL 1 CONTRACT AT MARKET
    ENDIF

     

     

     

    #253421 quote
    JSJS
    Participant
    Master

    Ciao,

    Quando ottimizzi il codice con la variabile DOE, ottieni (solo) quattro risultati:

    uno per quando hai comprato di lunedì e gli altri per quando hai comprato di martedì, mercoledì o giovedì…

    Ora puoi vedere qual è il giorno ottimale, nel periodo considerato, per comprare…

    Gabriele Battista and Iván González thanked this post
    Scherm­afbeelding-2025-11-09-om-15.01.28.png Scherm­afbeelding-2025-11-09-om-15.01.28.png
    #253428 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior

    e per avere il 5° risultato, comprando il venerdì come si può fare?

    #253429 quote
    JSJS
    Participant
    Master

    Per includere anche il venerdì nei risultati, puoi ottimizzare “DOE” da 1 a 5 (invece di da 1 a 4)…

    Scherm­afbeelding-2025-11-09-om-16.56.58.png Scherm­afbeelding-2025-11-09-om-16.56.58.png Scherm­afbeelding-2025-11-09-om-16.57.28.png Scherm­afbeelding-2025-11-09-om-16.57.28.png
    #253433 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior

    se guardi il mio codice ottimizza già come scrivi tu. l’errore è un altro

    #253434 quote
    JSJS
    Participant
    Master

    Qual è il “non vato”, cosa non va bene…?

    #253436 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior

    Nel tuo screen, che non avevo visto, l’ottimizzazione per il valore 5 è vuoto.

    qqq.jpg qqq.jpg
    #253438 quote
    JSJS
    Participant
    Master

    Il fatto che la posizione aperta il venerdì non venga venduta non dipende dall’ottimizzazione, ma dal codice…

    Nel codice è indicato che una posizione aperta il venerdì deve essere chiusa il giorno successivo, ma il giorno successivo è sabato (mercato chiuso), quindi la posizione non può essere chiusa…

    Puoi modificare facilmente il codice in questo modo:

    DEFPARAM CumulateOrders=False
    
    //OPTIMIZATION:
    //DOE 1 to 5
    //Step 1
    
    // You buy on the day
    // 1=Monday 2=Tuesday 3=Wednesday 4=Thursday
    
    IF NOT ONMARKET and DayOfWeek=DOE then
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    // It will be sold the following day
    If LongOnMarket and DOE=5 and DayOfWeek=1 then
    Sell 1 contract at Market
    ElsIf LONGONMARKET and (DayOfWeek >=DOE+1) and (Day>Day[1]) then
    SELL 1 CONTRACT AT MARKET
    ENDIF
    
    robertogozzi and Gabriele Battista thanked this post
    Scherm­afbeelding-2025-11-09-om-19.56.38.png Scherm­afbeelding-2025-11-09-om-19.56.38.png
    #253449 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior

    Su che TIME FRAME lo fai girare? A me su TF giornaliero continua a dare 0 il lunedì.

    aaaa.jpg aaaa.jpg
    #253458 quote
    JSJS
    Participant
    Master

    Puoi utilizzare qualsiasi timeframe “intraday”…

    Gabriele Battista thanked this post
    #253464 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior

    OK ma vorrei capire qual è il motivo che non lo fa funzionare sul daily. Ho uno storico ridotto se scendo in intraday senza versione premium.

    #253467 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior

    tra l’altro c’è qualcosa che non funziona neanche in intraday se guardo il numero di trade che dovrebbe essere più o meno simile nei gg della settimana

    aaaa-1.jpg aaaa-1.jpg
    #253476 quote
    JSJS
    Participant
    Master

    Ottengo questo risultato per il DAX…

    Scherm­afbeelding-2025-11-10-om-11.42.26.png Scherm­afbeelding-2025-11-10-om-11.42.26.png
Viewing 15 posts - 1 through 15 (of 38 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

ottimizzazione only long giorni settimana


ProOrder: Trading Automatico & Backtesting

New Reply
Summary

This topic contains 37 replies,
has 5 voices, and was last updated by phoentzsphoentzs
10 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 11/08/2025
Status: Active
Attachments: 20 files
ProRealCode ProRealCode
Loading...