TS Dax Bias 30Min – Entrata chiusura mercato

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #200468 quote
    Simon
    Participant
    New

    Buongiorno a tutti, non sono sicuro sia l’area giusta del forum per  questa richiesta.

    Posto questo T.S. che lavora sul Dax sfruttando la tendenza rialzista dopo la chiusura del mercato. Il sistema lavora su più timeframe ed  è stato ottimizzato escludendo alcuni giorni del  mese che statisticamente hanno una tendenza opposta. Il backtest è su timeframe a 30min ma dovrebbe poi girare su TF 5minuti per la miglior gestione del trailing stop.

    Chiedo cortesemente se avete qualche suggerimento per filtrare/migliorare  le entrate e se ritenete che il sistema è overfitted .

    //-------------------------------------------------------------------------
    // Codice principale : 2022 Bias Dax 30M - 5M Chiusura
    //-------------------------------------------------------------------------
    // Definizione dei parametri del codice
    DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate
    //-------------------------------------------------------------------------//-------------------------------------------------------------------------
     
    TIMEFRAME (5 hours, UPDATEONCLOSE)
    //FILTRO
    ONCE TORO   = close[1] > open[1]
    Body      = abs(close - open)
    LongCond  = TORO AND (Body > (Range * bd))
     
    timeframe (30 minutes, updateonclose)
    //-------------------------------------------------------------------------------------------------------------------------------------------------
    // Condizioni per entrare su posizioni long
    if not onmarket and currenttime=173000 and day <> 5 and day <> 17 and day <> 18 and day <> 21 and day <> 23 and day <> 25 and day <> 26  and LongCond THEN
     
    BUY 2 CONTRACT AT MARKET
    SET STOP $LOSS sl
     
    ENDIF
    //-------------------------------------------------------------------------------------------------------------------------------------------------
    timeframe (default)
    // Condizioni per uscire da posizioni long
     
    if currenthour=end THEN
    SELL AT MARKET
    ENDIF
     
    //trailing stop function
    IF NOT ONMARKET THEN
    TrailingStart = st  //20 trailing will start @trailinstart points profit
    TrailingStep  = 5   //5  trailing step to move the "stoploss"
    Distance      = 5   //7  pips Distance from caurrent price (if required by the broker)
    PointsToKeep  = ptk   //1  pips to be gained when breakeven is set
    //reset the stoploss value
    newSL=0
    ENDIF
    IF (BarIndex - TradeIndex) >= 0 THEN                                 //0
    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND close-TradePrice(1)>=(TrailingStart*PipSize+PointsToKeep*PipSize) THEN
    newSL = TradePrice(1)+TrailingStep*PipSize+PointsToKeep*PipSize
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>=TrailingStep*PipSize THEN
    newSL = newSL+TrailingStep*PipSize
    ENDIF
    ENDIF
     
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND TradePrice(1)-close>=(TrailingStart*PipSize+PointsToKeep*PipSize) THEN
    newSL = TradePrice(1)-TrailingStep*PipSize+PointsToKeep*PipSize
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>=TrailingStep*PipSize THEN
    newSL = newSL-TrailingStep*PipSize
    ENDIF
    ENDIF
     
    //stop order to exit the positions
    IF newSL>0 THEN
    IF LongOnMarket THEN
    IF (close + Distance) > newSL THEN
    SELL AT newSL STOP
    ELSIF (close - Distance) < newSL THEN
    SELL AT newSL LIMIT
    ELSE
    SELL AT Market
    ENDIF
    ELSIF ShortOnmarket THEN
    IF (close + Distance) < newSL THEN
    EXITSHORT AT newSL STOP
    ELSIF (close - Distance) > newSL THEN
    EXITSHORT AT newSL LIMIT
    ELSE
    EXITSHORT AT Market
    ENDIF
    ENDIF
    ENDIF
    endif
     
    sET TARGET PPROFIT sp
    #200470 quote
    Simon
    Participant
    New

    Altra foto.

    #200599 quote
    Nicolas
    Keymaster
    Master

    Grazie mille Simone, non ho testato ma penso che manchino alcune variabili come stoploss e takeprofit giusto?

    #200615 quote
    Simon
    Participant
    New
    //-------------------------------------------------------------------------
    // Codice principale : 2022 Bias Dax 30-5M Chiusura
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    // Codice principale : 2022 Bias Dax 30M - 5M Chiusura
    //-------------------------------------------------------------------------
    // Definizione dei parametri del codice
    DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate
    //-------------------------------------------------------------------------//-------------------------------------------------------------------------
     
    ONCE bd = 0.16
    ONCE end = 8.0
    ONCE ptk = 95.0
    ONCE sl = 330.0
    ONCE sp = 335.0
    ONCE st = 25.0
    TIMEFRAME (4 hours, UPDATEONCLOSE)
    //FILTRO
    ONCE TORO   = close[1] > open[1]
    Body      = abs(close - open)
    LongCond  = TORO AND (Body > (Range * bd))
     
    timeframe (30 minutes, updateonclose)
    //-------------------------------------------------------------------------------------------------------------------------------------------------
    // Condizioni per entrare su posizioni long
    if not onmarket and currenttime=173000 and day <> 5 and day <> 17 and day <> 18 and day <> 21 and day <> 23 and day <> 25 and day <> 26  THEN
     
    BUY 2 CONTRACT AT MARKET
    SET STOP $LOSS sl
     
    ENDIF
    //-------------------------------------------------------------------------------------------------------------------------------------------------
    timeframe (default)
    // Condizioni per uscire da posizioni long
     
    if currenthour=end THEN
    SELL AT MARKET
    ENDIF
     
    //trailing stop function
    IF NOT ONMARKET THEN
    TrailingStart = st  //20 trailing will start @trailinstart points profit
    TrailingStep  = 5   //5  trailing step to move the "stoploss"
    Distance      = 5   //7  pips Distance from caurrent price (if required by the broker)
    PointsToKeep  = ptk   //1  pips to be gained when breakeven is set
    //reset the stoploss value
    newSL=0
    ENDIF
    IF (BarIndex - TradeIndex) >= 0 THEN                                 //0
    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND close-TradePrice(1)>=(TrailingStart*PipSize+PointsToKeep*PipSize) THEN
    newSL = TradePrice(1)+TrailingStep*PipSize+PointsToKeep*PipSize
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>=TrailingStep*PipSize THEN
    newSL = newSL+TrailingStep*PipSize
    ENDIF
    ENDIF
     
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND TradePrice(1)-close>=(TrailingStart*PipSize+PointsToKeep*PipSize) THEN
    newSL = TradePrice(1)-TrailingStep*PipSize+PointsToKeep*PipSize
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>=TrailingStep*PipSize THEN
    newSL = newSL-TrailingStep*PipSize
    ENDIF
    ENDIF
     
    //stop order to exit the positions
    IF newSL>0 THEN
    IF LongOnMarket THEN
    IF (close + Distance) > newSL THEN
    SELL AT newSL STOP
    ELSIF (close - Distance) < newSL THEN
    SELL AT newSL LIMIT
    ELSE
    SELL AT Market
    ENDIF
    ELSIF ShortOnmarket THEN
    IF (close + Distance) < newSL THEN
    EXITSHORT AT newSL STOP
    ELSIF (close - Distance) > newSL THEN
    EXITSHORT AT newSL LIMIT
    ELSE
    EXITSHORT AT Market
    ENDIF
    ENDIF
    ENDIF
    endif
     
    sET TARGET PPROFIT sp
    

    Ciao Nicolas, ho ripostato il codice escludendo il filtro perchè non funziona. Riposto risultati backtest senza filtro e attendo suggerimenti. Grazie

    robertogozzi thanked this post
    #200675 quote
    Nicolas
    Keymaster
    Master

    Grazie mille per il codice completo. Come hai ottenuto le impostazioni per ciascuna delle tue variabili, per favore? Hai fatto un'ottimizzazione per tutto il periodo e per quante unità? Qual è lo spread utilizzato per favore?

    #200804 quote
    Simon
    Participant
    New

    ottimizzazione su 200k barre 30min (max dati IG)

    commissione per ordine E 2.32

    no spread

    #200816 quote
    fifi743
    Participant
    Master

    modifica

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

TS Dax Bias 30Min – Entrata chiusura mercato


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Simon @simontemp Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by fifi743
3 years, 4 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 09/10/2022
Status: Active
Attachments: 6 files
Logo Logo
Loading...