Aiuto Strategia Rottura Oraria

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

    Buongiorno a tutti,

    vorrei automatizzare la strategia che ho in mente grazie ad un trading system.. e spero che voi possiate aiutarmi.

    La strategia si sviluppa su timeframe 5 minuti.

    Ad ogni fine ora, appena si chiude l’ultima candela dell’ora (quindi quella delle :55) si prende il massimo e il minimo di questa candela appena chiusa (che non deve essere maggiore di 15 pips).

    All’inizio dell’ora nuova, se rompe il massimo della candela delle :55, si apre una posizione long con stop di 15 punti e profit di 15 punti. Rischio Rendimento 1:1

    Se rompe il minimo, si apre una posizione short con stop di 15 punti e profit di 15 punti. Rischio Rendimento 1:1

    Se ad esempio rompesse prima il massimo facendo una falsa rottura e chiudendo in stop, appena rompe il minimo si aprirà lo stesso l’operazione inversa.

     

    Riuscite ad aiutarmi a sviluppare questo sistema?

    Anche pagando.. non so dove cercare!

     

    Grazie in anticipo e buona giornata

    #195075 quote
    robertogozzi
    Moderator
    Master

    Questa è la strategia:

    DEFPARAM CumulateOrders = False
    ONCE Massimo = 15 * PipSize
    ONCE SL      = Massimo
    ONCE TP      = SL
    IF LongOnMarket THEN
       EntryLong  = 0
    ENDIF
    IF ShortOnMarket THEN
       EntryShort = 0
    ENDIF
    IF OpenMinute = 55 THEN
       IF Range <= Massimo THEN
          EntryLong  = high
          EntryShort = low
          EntryL     = EntryLong
          EntryS     = EntryShort
       ELSE
          EntryLong  = 0
          EntryShort = 0
       ENDIF
    ELSE
       IF Not LongOnMarket  AND (EntryLong  > 0) THEN
          BUY       1 CONTRACT AT EntryLong  STOP
       ENDIF
       IF Not ShortOnMarket AND (EntryShort > 0) THEN
          SELLSHORT 1 CONTRACT AT EntryShort STOP
       ENDIF
    ENDIF
    SET TARGET PROFIT TP
    SET STOP   LOSS   SL
    graphonprice EntryL coloured(0,128,0,115) //prezzo d'entrata LONG
    graphonprice EntryS coloured(255,0,0,255) //prezzo d'entrata SHORT

    questa entra quando il prezzo TOCCA i minimi e massimi registrati al minuto 55. Non so bene cosa intendi con “se rompe“, vuoi dire che la verifica va fatta alla chiusura, oppure che deve entrare al massimo/minimo +- X pips?
    Occorrerebbe anche prevedere la distanza minima d’ingresso per gli ordini pendenti, come prevista da IG (ogni strumento ha limiti diversi, da verificare sul loro sito).

    figu92 thanked this post
    #195136 quote
    figu92
    Participant
    New

    Grazie mille Roberto.

    Si, esatto.. per “rompe” intendo che il prezzo supera il massimo/minimo almeno di 2 punti, si può impostare? Io uso IG e mi sembra che, come dici te, la minima distanza per l’ordine pendente è di 5 punti quindi al limite posso poi cambiare i parametri.. oppure si può impostare ingresso a mercato appena supera di 2 punti il massimo/minimo?

    Grazie ancora

    #195151 quote
    robertogozzi
    Moderator
    Master

    Ecco fatto, ho aggiunto PUNTI e DISTANZA:

    DEFPARAM CumulateOrders = False
    ONCE Massimo  = 15 * PipSize     //Range massimo
    ONCE Punti    = 2  * PipSize     //Punti per rottura Massimo/Minimo
    ONCE SL       = Massimo          //Stop Loss
    ONCE TP       = SL               //Take Profit
    ONCE Distanza = 5  * PipSize     //Distanza richiesta dal broker per gli ordini pendenti
    IF LongOnMarket THEN
    EntryLong  = 0
    ENDIF
    IF ShortOnMarket THEN
    EntryShort = 0
    ENDIF
    IF OpenMinute = 55 THEN
    IF Range <= Massimo THEN
    EntryLong  = high + Punti
    EntryShort = low  - Punti
    EntryL     = EntryLong
    EntryS     = EntryShort
    ELSE
    EntryLong  = 0
    EntryShort = 0
    ENDIF
    ELSE
    IF Not LongOnMarket  AND (EntryLong  > 0) THEN
    IF close < (EntryLong - Distanza) THEN
    BUY       1 CONTRACT AT EntryLong  STOP
    ELSIF close > (EntryLong + Distanza) THEN
    BUY       1 CONTRACT AT EntryLong LIMIT
    ELSE
    BUY       1 CONTRACT AT Market
    ENDIF
    ENDIF
    IF Not ShortOnMarket AND (EntryShort > 0) THEN
    IF close > (EntryShort + Distanza) THEN
    SELLSHORT 1 CONTRACT AT EntryShort STOP
    ELSIF close < (EntryShort - Distanza) THEN
    SELLSHORT 1 CONTRACT AT EntryShort LIMIT
    ELSE
    SELLSHORT 1 CONTRACT AT Market
    ENDIF
    ENDIF
    ENDIF
    SET TARGET PROFIT TP
    SET STOP   LOSS   SL
    graphonprice EntryL coloured(0,128,0,115) //prezzo d'entrata LONG
    graphonprice EntryS coloured(255,0,0,255) //prezzo d'entrata SHORT
    #195165 quote
    figu92
    Participant
    New

    Grazie mille Roberto, sei gentile. L’ho provata ma mi sembra ci siano errori.

    Ecco alcuni miglioramenti:

    • Vorrei impostare come orario di operatività che parta dalla candela delle 7:55 fino alle 20.
    • Vorrei che aprisse max solo 2 operazioni ogni ora e solo entro i primi 15 minuti, quindi per ogni ora solo fino alle “:15” se possibile  . Quindi prendendo in considerazione la candela delle :55, se rompe sopra di 2 punti entra long (max 1 operazione long per quest’ora) e viceversa se rompe sotto entra short (max 1 operazione short per quest’ora).
    • Guardando il backtest ho notato che apre operazioni anche se non tocca mai 2 punti sopra/sotto il minimo, come mai?

    Ricapitolando:

    Vorrei che ad ogni fascia oraria, dalle 7:55 alle 20, prendendo in considerazione il massimo e il minimo della candela delle :55 di ogni ora conclusa, andasse long se rompe di 2 punti il massimo e short se rompe di 2 punti il minimo. Solo 1 operazione per direzione e solo nei primi 20 minuti dell’ora.

    Grazie mille della disponibilità Roberto!

    #195233 quote
    robertogozzi
    Moderator
    Master

    Ti ho fatto lemodifiche relative al numero di candela entro le quali entrare, sul numero massimno di 2 operazioni (1 Long ed 1 Short)  e sull’orario di trading:

    DEFPARAM CumulateOrders = False
    ONCE Massimo  = 15 * PipSize     //Range massimo
    ONCE Punti    = 2  * PipSize     //Punti per rottura Massimo/Minimo
    ONCE SL       = Massimo          //Stop Loss
    ONCE TP       = SL               //Take Profit
    ONCE Distanza = 5  * PipSize     //Distanza richiesta dal broker per gli ordini pendenti
    TradingTime = (time >= 075500) AND (time <= 200000)
    IF LongOnMarket AND Not LongOnMarket[1] THEN
    LonkOK  = 0
    ENDIF
    IF ShortOnMarket AND Not ShortOnMarket[1] THEN
    ShortOK = 0
    ENDIF
    IF LongOnMarket THEN
    EntryLong  = 0
    ENDIF
    IF ShortOnMarket THEN
    EntryShort = 0
    ENDIF
    IF OpenMinute = 55 THEN
    IF Range <= Massimo THEN
    EntryLong  = high + Punti
    EntryShort = low  - Punti
    EntryL     = EntryLong
    EntryS     = EntryShort
    Conto      = 0
    LongOK     = 1
    ShortOK    = 1
    ELSE
    EntryLong  = 0
    EntryShort = 0
    LongOK     = 0
    ShortOK    = 0
    ENDIF
    ELSE
    Conto = Conto + 1
    IF Conto > 4 THEN
    EntryLong  = 0
    EntryShort = 0
    LongOK     = 0
    ShortOK    = 0
    ENDIF
    IF Not LongOnMarket  AND (EntryLong  > 0) AND TradingTime AND LongOK  THEN
    IF close < (EntryLong - Distanza) THEN
    BUY       1 CONTRACT AT EntryLong  STOP
    ELSIF close > (EntryLong + Distanza) THEN
    BUY       1 CONTRACT AT EntryLong LIMIT
    ELSE
    BUY       1 CONTRACT AT Market
    LongOK  = 0
    ENDIF
    ENDIF
    IF Not ShortOnMarket AND (EntryShort > 0) AND TradingTime AND ShortOK THEN
    IF close > (EntryShort + Distanza) THEN
    SELLSHORT 1 CONTRACT AT EntryShort STOP
    ELSIF close < (EntryShort - Distanza) THEN
    SELLSHORT 1 CONTRACT AT EntryShort LIMIT
    ELSE
    SELLSHORT 1 CONTRACT AT Market
    ShortOK  = 0
    ENDIF
    ENDIF
    ENDIF
    SET TARGET PROFIT TP
    SET STOP   LOSS   SL
    graphonprice EntryL coloured(0,128,0,115) //prezzo d'entrata LONG
    graphonprice EntryS coloured(255,0,0,255) //prezzo d'entrata SHOR

    A volte può capitare che l’entrata non sia esattamente al prezzo desiderato, è dovuto allo slippage. Non è possibile farci niente.

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

Aiuto Strategia Rottura Oraria


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
figu92 @figu92 Participant
Summary

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

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