PROBLEMI IN BACKTEST DI UN SISTEMA CON UN NUOVO INDICATORE

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #162369 quote
    bahl
    Participant
    Average

    Salve,  ho cambiato un po la sintassi di un indicatore che avevo trovato, per aggiustarlo ai miei bisogni, l’ho chiamato “nuovo keltner” e lo allego.

    quando sono andato a controllare dei sistemi in cui lo utilizzavo mi è occorsa un’anomalia di cui non vengo a capo.

    Per esempio, in un sistema banale che allego, vorrei che si operasse solo quando il canale del “nuovo keltner” si trova allinterno del canale di donchian, invece, come da ripetuti test, p. esmpio sul dax a tf 1 minuto, il sistema opera anche quando non si verifica al premessa.

    Allego entrambi

    DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate
    
    // Condizioni per entrare su posizioni long
    ignored, indicator1, ignored = CALL "NUOVO KELTNER"//SUPERIORE
    ignored, ignored, indicator2 = CALL "NUOVO KELTNER"//INFERIORE
    indicator3 = DonchianChannelUp[10]
    indicator4 = KeltnerBandDown[21]
    
    
    A = INDICATOR1 < INDICATOR3 AND INDICATOR2>INDICATOR4// IL CANALE DI KELTNER SCORRE DENTRO QUELLO DI DONCHIAN
    
    //CONDIZIONI PER ENTRARE LONG
    
    IF A AND LOW>INDICATOR2 THEN
    BUY AT INDICATOR2 LIMIT
    ENDIF
    //SE IL PREZZO SCNDE A TOCCARE IL CANALE DI KELTNER, COMPRESO DENTRO IL CANALE DI DONCHIAN, COMPRA
    
    // CONDIZIONI PER USCIRE DA POSIZIONI LONG
    IF LONGONMARKET THEN
    SELL AT ((INDICATOR1+INDICATOR2)/2) LIMIT
    ENDIF
    
    // CONDIZIONI PER ENTRATE SHORT
    IF A AND HIGH<INDICATOR1 THEN
    SELLSHORT AT INDICATOR1 LIMIT
    ENDIF
    // PER USCIRE DA SHORT
    IF SHORTONMARKET THEN
    EXITSHORT AT ((INDICATOR1+INDICATOR2)/2) LIMIT
    ENDIF
    
    REM Moving Average
    MA = ExponentialAverage[21](CLOSE)
    REM Upper Keltner Band
    UpperBand = MA + (AverageTrueRange[21](close)/10000*ExponentialAverage[21](20000))
    REM Lower Keltner Band
    LowerBand = MA - (AverageTrueRange[21](close)/10000*ExponentialAverage[21](20000))
    RETURN MA AS "Keltner MA" , UpperBand AS "Banda Sup Keltner" , LowerBand as "Banda Inf Keltner"
    

    se si fa correre sul dax a un minuto entra anche quando il cabale di keltner modificato non è compreso in quello di donchian, p.es lun 22-feb-2021 0re 17.14.

    #162370 quote
    robertogozzi
    Moderator
    Master

    Cosa c’entra KeltnerBandDown[21], non hai già il tuo Keltner modificato, perché mischiarli?

    Non riesco a capire cosa tu voglia fare.

    #162380 quote
    bahl
    Participant
    Average

    Scusami, era un errore di trascrizione, doveva essere ovviamente “donchianchanneldown”. Ho comunque risolto il problema (un pezzo di codice era rimasto nell’ultima riga e non lo vedevo, mannaggia sono diventato scemo). Mi potresti comunque dare un codice piu pulito per l’indicatore che ho scritto, che poi per richiamarlo mi viene fuori sempre

    ignored, indicator1, ignored = CALL "NUOVO KELTNER"//superiore
    indicator2, ignored, ignored = CALL "NUOVO KELTNER"//centrale
    ignored, ignored, indicator3 = CALL "NUOVO KELTNER"//inferiore

    con tutti quegli ignored che non so cosa siano.

    Grazie.

    #162381 quote
    robertogozzi
    Moderator
    Master

    IGNORED si usa per quei dati restituiti dall’indicatore che non interessano.

    È molto usato dalla creazione automatica. In questo caso interessano tutti e tre, ma ne viene preso uno per volta.

    Conviene accorparli così:

    indicator2, indicator1, indicator3 = CALL "NUOVO KELTNER"
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

PROBLEMI IN BACKTEST DI UN SISTEMA CON UN NUOVO INDICATORE


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
bahl @bahl Participant
Summary

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

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 02/22/2021
Status: Active
Attachments: No files
Logo Logo
Loading...