Backtest candela impulsiva – sequenza di fibonacci

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

    Buongiorno a tutti.

    Sto valutando l’idea di automatizzare il mio sistema di trading e ho provato a creare una serie di codici, con scarsi risultati direi… perciò chiedo aiuto qui.

    Vorrei cominciare con il backtest. Vorrei testare nel passato questo sistema:

    Devo applicare la sequenza di fibonacci su una candela impulsiva (come in foto allegata)

    L’ingresso deve avvenire sul ritracciamento al 50% della candela. Stop loss sullo 0% e take profit sullo 161.80%

    Il problema più grosso è come fargli riconoscere la candela impulsiva. Poichè deve avere:

    corspo più lungo di almeno 10 candele precedenti, deve essere un impulso di continuazione o inversione di un trend come si vede chiaramente dalla foto.

    Grazie per l’ascolto, Giovanni.

    #62088 quote
    robertogozzi
    Moderator
    Master

    Ci darò un’occhiata appena posso.

    #62147 quote
    Playground
    Participant
    New

    Grazie 1000 Roberto.

    #62550 quote
    robertogozzi
    Moderator
    Master

    Prova questo codice, per il momento non stare a vedere se è profittevole o meno, piuttosto se entra al 50% del ritracciamento.

    DEFPARAM CumulateOrders = false
    
    // inizializzazione delle variabili utilizzate nella strategia
    ONCE NumeroCandele      = 10
    ONCE EntryPrice         = 0
    ONCE Rialzista          = 0
    ONCE Ribassista         = 0
    
    // resettare tutto una volta a mercato
    IF OnMarket THEN
       EntryPrice = 0
       Rialzista  = 0
       Ribassista = 0
    ENDIF
    
    // determinare se il coprpo della candela è il più grande delle ultime "n" candele
    CorpoCandela  = abs(open - close)
    CorpoMaggiore = (CorpoCandela = highest[NumeroCandele](CorpoCandela))
    IF CorpoMaggiore THEN
       Rialzista  = close > open
       Ribassista = close < open
       EntryPrice = low + (range / 2)              //se il corpo è il più grande determinare il prezzo d'entrata
    ENDIF
    
    //  LONG
    IF CorpoMaggiore AND EntryPrice AND Rialzista  THEN
       BUY       1 CONTRACTS AT EntryPrice LIMIT
    ENDIF
    
    //  SHORT
    IF CorpoMaggiore AND EntryPrice AND Ribassista THEN
       SELLSHORT 1 CONTRACTS AT EntryPrice LIMIT
    ENDIF
    
    // Target & Stop Loss
    SET STOP   pLOSS   20
    SET TARGET pPROFIT 40
    Nicolas thanked this post
    #63412 quote
    Playground
    Participant
    New

    Si. Entra al 50%. Quello che non è preciso, è la candela impulsiva che viene considerata. Qual’è la parte del codice che regola questo? Deve avere un ampio corpo e shadow quasi inesistenti.

    #63436 quote
    robertogozzi
    Moderator
    Master

    Le righe sono le 17 e 18, ma non c’è nessun riferimento alle ombre.

    A te interessava solo che avesse un “corpo più lungo di almeno 10 candele precedenti“. Per verificare le ombre occorre che tu dica quanto devono essere grandi tali ombre, superiore ed inferiore (e se devono esserci oppure no), dopodiché occorre predisporre il codice necessario.

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

Backtest candela impulsiva – sequenza di fibonacci


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Playground @playground Participant
Summary

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

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 02/08/2018
Status: Active
Attachments: 1 files
Logo Logo
Loading...