break out max min gg precedente

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #186382 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior
    // Chiusura temporale alla chiusura cash
    DEFPARAM FlatAfter = 220000 //dax 173000
    DEFPARAM FlatBefore = 080000
    // Solo un ordine a mercato
    DEFPARAM CumulateOrders = False
    
    // Finestra oraria di trading
    //ONCE BuyTime = 93000
    //ONCE SellTime = 173000
    
    // Orario Chiusura trade
    ONCE CloseTime= 220000 //dax 173000
    
    // Orari limite per trade
    FIRSTIN=080000
    LASTIN=113000 //nasdaq 153000
    
    // Condizioni per entrare su posizioni long
    IF NOT LongOnMarket AND Close>(Dhigh(1)) AND Time<LASTIN AND Time >FIRSTIN THEN
    //entro LONG al break del massimo del giorno precedente
    BUY 1 CONTRACTS AT MARKET
    ENDIF
    
    // Condizioni per uscire da posizioni long
    If LongOnMarket AND Time = CloseTime THEN
    //chiudo il LONG a fine orario cash
    SELL AT MARKET
    ENDIF
    
    // Condizioni per entrare su posizioni short
    IF NOT ShortOnMarket AND Close<(Dlow(1)) AND Time<LASTIN AND Time >FIRSTIN THEN
    //entro SHORT al break del minimo del giorno precedente
    SELLSHORT 1 CONTRACTS AT MARKET
    ENDIF
    
    // Condizioni per uscire da posizioni short
    IF ShortOnMarket AND Time = CloseTime THEN
    //chiudo lo SHORT a fine orario cash
    EXITSHORT AT MARKET
    ENDIF
    
    // Stop e target: Inserisci qui i tuoi stop di protezione e profit target
    SET STOP pLOSS 3000
    SET TARGET pPROFIT 3000

    Ciao vorrei avere una sola operazione al giorno (ho ovviato mettendo stop e profit distantissimi ma non mi piace..) e soprattutto la chiusura alle 22:00 cosa sbaglio/cosa devo fare, grazie.

    Allego oltre al codice l’elenco delle posizioni in cui è evidente che la chiusura non è alle 22…

    1.png 1.png 11.png 11.png
    #186467 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Per la chiusura delle 22 va bene così. però deve esserci una candela che apre/chiude alle ore 22.

    Aggiungendo la variabile OTD alle condizioni d’entrata ottieni una sola operazione al giorno:

    // Chiusura temporale alla chiusura cash
    DEFPARAM FlatAfter = 220000 //dax 173000
    DEFPARAM FlatBefore = 080000
    // Solo un ordine a mercato
    DEFPARAM CumulateOrders = False
     
    // Finestra oraria di trading
    //ONCE BuyTime = 93000
    //ONCE SellTime = 173000
     
    // Orario Chiusura trade
    ONCE CloseTime= 220000 //dax 173000
    
    OTD = (Barindex - TradeIndex(1)) > IntradayBarIndex
    
    // Orari limite per trade
    FIRSTIN=080000
    LASTIN=113000 //nasdaq 153000
     
    // Condizioni per entrare su posizioni long
    IF NOT LongOnMarket AND Close>(Dhigh(1)) AND Time<LASTIN AND Time >FIRSTIN AND OTD THEN
    //entro LONG al break del massimo del giorno precedente
    BUY 1 CONTRACTS AT MARKET
    ENDIF
     
    // Condizioni per uscire da posizioni long
    If LongOnMarket AND Time = CloseTime THEN
    //chiudo il LONG a fine orario cash
    SELL AT MARKET
    ENDIF
     
    // Condizioni per entrare su posizioni short
    IF NOT ShortOnMarket AND Close<(Dlow(1)) AND Time<LASTIN AND Time >FIRSTIN AND OTD THEN
    //entro SHORT al break del minimo del giorno precedente
    SELLSHORT 1 CONTRACTS AT MARKET
    ENDIF
     
    // Condizioni per uscire da posizioni short
    IF ShortOnMarket AND Time = CloseTime THEN
    //chiudo lo SHORT a fine orario cash
    EXITSHORT AT MARKET
    ENDIF
     
    // Stop e target: Inserisci qui i tuoi stop di protezione e profit target
    SET STOP pLOSS 3000
    SET TARGET pPROFIT 3000
    Gabriele Battista thanked this post
    #186707 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior

    Ciao sto facendo un debug e non mi pare funzioni, il 3 gennaio dovrebbe entrare alle 9 ma entra alle 11, allego il grafico del back test. Cosa sbaglio? Grazie

    DAXXXXX-30-minuti.png DAXXXXX-30-minuti.png
    #186709 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior

    Dimenticavo, chiude il giorno successivo mentre vorrei la chiusura al close giornaliero

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

break out max min gg precedente


ProOrder: Trading Automatico & Backtesting

New Reply
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by Gabriele BattistaGabriele Battista
4 years, 8 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 01/23/2022
Status: Active
Attachments: 3 files
ProRealCode ProRealCode
Loading...