operazione aperta ma non in backtest

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #142211 quote
    contecfcontecf
    Participant
    New

    Buongiorno , qualche giorno fa mi ha aperto una operazione sul mini argento in automatico che è finita in perdita (una perdita in percentuale maggiore di quella che ho indicato nel programma), ma se vado a fare backtest dello stesso sistema questa operazione non l’avrebbe eseguita. Cosa potrebbe essere successo? Grazie!

    #142214 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Occorre il codice (preferibilmente quello copiato dalla finestra dell’autotrading), lo strumento, il TF, la data e l’ora della candela.

    Ma il problema non sarà facile da ricostruire.

    #142216 quote
    contecfcontecf
    Participant
    New

    si in effetti non è facile qui ti giro il codice:

    //————————————————————————-
    // Codice principale : argentoh15
    //————————————————————————-
    DEFPARAM CUMULATEORDERS=TRUE
    // definizione indicatori
    resistenza = Highest[65](High)
    supporto = Lowest[65](Low)
    stoploss= supertrend[4,28]
    // definizione condizioni
    C1=close>stoploss
    C2=close<stoploss
    
    C3=resistenza[1]=resistenza[6]
    
    C4=supporto[1]=supporto[6]
    
    C5=Highest[5](High)<resistenza[1]
    
    C6=Lowest[5](low)>supporto[1]
    
    C7=stoploss>=tradeprice(1)
    
    C8=stoploss<=tradeprice(1)
    C9=close-open > averagetruerange[10]*2
    C10=-(close-open) > averagetruerange[10]*2
    // apertura long prima posizione
    IF not longonmarket and resistenza and C1 and C9 then
    BUY 0.5 SHARES AT resistenza STOP
    ENDIF
    
    // long posizioni successive
    IF longonmarket and resistenza and C1 and C3 and C5 and C7 and C9 then
    buy 0.5 SHARES AT resistenza STOP
    endif
    // chiusura long
    If C2 or stoploss and LONGONMARKET THEN
    SELL AT STOPLOSS STOP
    
    ENDIF
    // apertura short prima posizione
    if not shortonmarket and supporto and C2 and C10 THEN
    SELLSHORT 0.5 SHARES AT supporto STOP
    ENDIF
    
    // short posizioni successive
    
    if shortonmarket and supporto and C2 and C4 and C6 and C8 and C10 THEN
    SELLSHORT 0.5 SHARES AT supporto STOP
    ENDIF
    // chiusura short
    If C1 or stoploss and SHORTONMARKET THEN
    EXITSHORT AT STOPLOSS STOP
    ENDIF

     

    l’operazione è uno short del 18 agosto 16:30 chiuso alle 18:33 in perdita tf 15 min

    #142221 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Per favore usa sempre il pulsante “Insert PRT code” quando inserisci il codice nei tuoi post per facilitare la lettura degli altri. Grazie 🙂

    #142227 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Quella operazione, stando ai grafici, NON doveva essere aperta, perché la condizione C10 è falsa.

    Rilevo una strana codifica (anche se va bene in pratica), ed è alle linee 24 e 25, basta un’unica condizione, ad esempio:

    C9=abs(close-open) > averagetruerange[10]*2

    e puoi togliere la linea 25, usando C9 anche per lo short. ABS() restituisce il valore assoluto di un numero, in pratica toglie il segno “-“. Tanto ATR non può andare sotto 0.

    Alle linee 27, 32, 41 e 47 usi RESISTENZA e SUPPORTO in modo errato, in quanto non sono valori logici (sono logicamente sempre veri in quanto diversi da zero) ma contengono dei prezzi.

    #142240 quote
    contecfcontecf
    Participant
    New

    Grazie Roberto, rivedrò il codice di programmazione secondo i tuoi dettami ; resta il mistero sull’apertura di questa posizione…

Viewing 6 posts - 1 through 6 (of 6 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

operazione aperta ma non in backtest


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
contecf @contecf Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by contecfcontecf
6 years, 1 month ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 08/21/2020
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...