ingressi e uscite ad orari stabiliti in gg successivi

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #212324 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior

    Vorrei un sistema che entri a mercato long il martedì alle 15 ed esca il mercoledì alle 9. Grazie

    Carburo thanked this post
    #212325 quote
    MauroProMauroPro
    Participant
    Veteran

    defParam cumulateOrders = false

    entrataGiornoSettimana = dayOfWeek = 2            // 1 = lunedi, 2 = martedi ….
    orarioEntrata = time = 150000

    uscitaGiornoSettimana = dayOfWeek = 3
    orarioUscita = time = 090000
    //———————————————————-

    if entrataGiornoSettimana and orarioEntrata then
    buy 1 contract at market
    endif
    if uscitaGiornoSettimana and orarioUscita then
    sell 1 contract at market
    endif

    Gabriele Battista and Carburo thanked this post
    #212525 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior

    Grazie. Se volessi farlo ogni giorno l’entrata alle 15 e la chiusura alle 9 del gg successivo il codice allegato (ottenuto dal tuo togliendo le giornate) mi apre e resta sempre aperto senza mai chiudere

    Cosa non va?

    DEFPARAM CumulateOrders = False
     
    orarioEntrata = time = 215000
    orarioUscita = time = 080000
    
    if orarioEntrata then
    buy 1 contract at market
    endif
    
    if orarioUscita then
    sell 1 contract at market
    endif
    #212538 quote
    MauroProMauroPro
    Participant
    Veteran

    Hai scritto male gli orari, Cambia le righe 3 e 4 con queste ed entra ogni giorno alle 15 ed esce il giorno dopo alle 9:

    orarioEntrata = time = 150000

    orarioUscita = time = 090000

    Gabriele Battista thanked this post
    #212543 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior

    scusa hai ragione ho scritto male, ma non nel codice ma sopra.. volevo provare un ingresso long alle 2150 e una chiusura delll’operazione il gg successivo alle 8

    #212544 quote
    MauroProMauroPro
    Participant
    Veteran

    Ho provato il codice è funziona. Devi chiaramente usare un timeframe da 10 minuti (oppure : 5m -2m – 1m) in quanto usi come orario 2150.

    Gabriele Battista thanked this post
    #212558 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior

    Non mi funzionava perchè usavo il grafico 8-22, che ti allego mi sai dire perchè?

    DAXXXXX_8-5-minuti.png DAXXXXX_8-5-minuti.png
    #212561 quote
    MauroProMauroPro
    Participant
    Veteran

    Uso i cfd quindi non sono sicuro, ma:

    1) o perchè devi usare il formato Full del Dax 40 (che include tutti i dati, anche quello dopo le 22)

    2) oppure, devi provare, a mettere al posto dell’uscita alle 8 (dove iniziano i tuoi dati del formato 8-22) l’uscita alle 9 e vedere se funziona.

    Questo perchè time = 080000 si riferisce (prendiamo come esempio un timeframe a 10 minuti) NON all’apertura della candela delle 08000 (in tal caso devi usare OPENTIME  = 080000), ma alla chiusura  della candela precedente, ossia quella delle 7:50 (dove non hai ancora i dati).

    Può sembrare controintuitivo, ma time = 080000 viene (per una frazione di tempo) prima di openTime = 080000, in quanto, come detto, si riferisce alla chiusara della candela delle 7:50 mentre openTime all’apertura della candela delle 8.

    Gabriele Battista thanked this post
    #212568 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Esatto, usa 080500.

    Gabriele Battista thanked this post
Viewing 9 posts - 1 through 9 (of 9 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

ingressi e uscite ad orari stabiliti in gg successivi


ProOrder: Trading Automatico & Backtesting

New Reply
Summary

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

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 03/28/2023
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...