Uscita da una strategia di reversal

Viewing 15 posts - 16 through 30 (of 33 total)
  • Author
    Posts
  • #171920 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    La chiusura di ieri alle 17:30 è 15712,3 (candela che ha aperto alle 17:27). In effetti a me non è mai entrato ieri, l’unica entrata era dopo la mezzanotte (quindi oggi). Aggiungi queste righe alla fine del tuo codice, così potrai vedere i vari prezzi sul grafico:
    graphonprice Chiusura   coloured(255,0,0,255)
    graphonprice PrevClose  coloured(0,128,0,155)
    graphonprice MinPrice   coloured(0,0,255,255)
    graphonprice MaxPrice   coloured(0,0,255,105)
    #171923 quote
    MauroProMauroPro
    Participant
    Veteran
    Quando il TS entra long alle 00:36, non si è mai creato un minimo inferiore a 50 punti (dalla chiusura a 15715.3) che attivasse il flag. Dal codice (righe 8-12) mi sembrava che prevClose,  fosse il prezzo di chiusura di ieri (o meglio il prezzo alle 17:30). Da questo prezzo si sommano-sottraggono 50 punti per attivare il flag. Tuttavia da graphOnPrice vedo che non è così: la riga rossa dovrebbe essere quella di prevClose. Forse il codice che identifica il close di ieri con prevClose non è corretto?
    #171924 quote
    MauroProMauroPro
    Participant
    Veteran
    chiusura a 15712.3, la stessa che indichi alle 17:30
    #171926 quote
    MauroProMauroPro
    Participant
    Veteran
    Per semplicità: puoi modificare il mio codice in modo che prevClose sia 15712.3 e rimanga tale fino alla chiusura di oggi alle 17:30 (che diventerà il nuovo prevClose per domani)?
    #171950 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    Alle 17:30 la chiusura di ieri viene assegnata a PrevClose e ci resta fino alle 17:30 successive. È quello che fa adesso. Se vedi adesso, PrevClose (quella stabilita come precdente ieri alle 17:30) è 15733,9, perché quella attuale (stabilita ieri alle 17:30) è 15712,3 fino alle 17:30 odierne, quando cambieranno. Cambia una volta al giorno.
    #171972 quote
    MauroProMauroPro
    Participant
    Veteran
    Ho fatto diverse prove ed è come dici: in pratica con prevClose ho la chiusura del 16 giugno (oggi è il 18). Per vedere bene il range con i graph conviene addirittura plottare il range:

    graphonprice PrevClose coloured(30,144,255)

    graphonprice (PrevClose-50*pointSize) coloured(0,250,154)

    graphonprice (PrevClose+50*pointSize) coloured(0,250,154)

    Ciao

    robertogozzi thanked this post
    #172066 quote
    MauroProMauroPro
    Participant
    Veteran
    Ciao Roberto, è possibile far partire i flags che ho creato (crossOver-UnderSt) ogni giorno dalle 173000, ossia da: Chiusura = close  ( riga 9 codice)? (Senza questa modifica, a volte come si vede dal graph, il codice (che è corretto) non funziona come dovrebbe  in quanto parte molto prima l’attivazione dei flags). Strumendo Dax  3 minuti.
    DEFPARAM CumulateOrders=False
    DEFPARAM Flatafter = 083000
    //————————————————
    cTime = time > 010000
    oneTrade = (barIndex-tradeIndex(1)>intradayBarIndex)
    myST= superTrend[3,10]
    //————————————————–
    IF Time = 173000 THEN
    Chiusura = close
    ENDIF
    //———————————————-
    //ONCE PrevClose = 9999999
    //ONCE Chiusura = 9999999
    //IF Time = 173000 THEN
    //PrevClose = Chiusura //utilizzare prevClose per la chiusura-1
    //Chiusura = close
    //ENDIF
    //——————————————
    If not onmarket and time> 173000 then
    maxPrice=0
    minPrice=close
    highReached=0
    lowReached=0
    endif
    //—————————————-
    If not onMarket then
    minPrice=Min(minPrice,low)
    if chiusura-minPrice>60*pointSize then
    lowReached=1
    else
    lowReached=0
    endif
    endif
    If not onMarket then
    maxPrice=Max(maxPrice,high)
    if maxPrice-chiusura>60*pointSize then
    highReached=1
    else
    highReached=0
    endif
    endif
    //————————————————-
    if close crosses over myST and lowReached=1 then
    crossOverST=1
    endif
    if close crosses under myST and highReached=1 then
    crossUnderST=1
    endif
    //————————————————————————————————–
    if not onMarket and crossOverST = 1 and Ctime and oneTrade then
    buy 1 contracts at market
    endif
    if longOnMarket and close>chiusura then
    sell 1 contracts at market
    crossOverST=0
    lowReached=0
    endif
    if not onMarket and crossUnderST=1 and Ctime and oneTrade then
    sellShort 1 contracts at market
    endif
    if shortOnMarket and close<chiusura then
    exitShort 1 contracts at market
    crossUnderST=0
    highReached=0
    endif
    //——————————————————–
    set stop %Loss 0.4
    graphonprice chiusura coloured(30,144,255)
    graphonprice (chiusura-60*pointSize) coloured(0,250,154)
    graphonprice (chiusura+60*pointSize) coloured(0,250,154)
    
    graph crossOverSt=1 coloured (34,139,34)
    graph crossUnderSt=1 coloured(255,0,0)
    #172078 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    Devi modificare le righe 43-48 così:
    //————————————————-
    If time> 173000 then
    if close crosses over myST and lowReached=1 then
    crossOverST=1
    endif
    if close crosses under myST and highReached=1 then
    crossUnderST=1
    endif
    endif
    //————————————————————————————————-
    #172079 quote
    MauroProMauroPro
    Participant
    Veteran
    Ho provato, ma non funziona più il TS con quella modifica.
    #172086 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    A me funzionava con 200K unità.
    #172093 quote
    MauroProMauroPro
    Participant
    Veteran
    Ho modificato il tempo di uscita nella riga 2 (dalle 8:30 alle 10:00), per dare più tempo al sistema di chiudere il gap della notte (ma ciò non riguarda il problema segnalato). Con la modifica delle righe 43-48 su 200k gira, ma non funziona bene: non prende molte operazioni che dovrebbe come quella di oggi. (nell’immagine allegata il TS con la modifica delle righe è quello in alto  – il cui codice è riportato con insert – quello sotto è quello senza modifica delle righe 43-48, che oggi funziona bene, come si vede, ma spesso attiva troppo presto i flags) Riallego il TS modificato per praticità.
    //TS nightGap – Dax – 3 minuti
    DEFPARAM CumulateOrders=False
    DEFPARAM Flatafter = 100000
    //————————————————
    cTime = time > 010000
    oneTrade = (barIndex-tradeIndex(1)>intradayBarIndex)
    myST= superTrend[3,10]
    //————————————————–
    IF Time = 173000 THEN
    Chiusura = close
    ENDIF
    //———————————————-
    //ONCE PrevClose = 9999999
    //ONCE Chiusura = 9999999
    //IF Time = 173000 THEN
    //PrevClose = Chiusura //utilizzare prevClose per la chiusura-1
    //Chiusura = close
    //ENDIF
    //——————————————
    If not onmarket then
    maxPrice=0
    minPrice=close
    highReached=0
    lowReached=0
    endif
    //—————————————-
    If not onMarket then
    minPrice=Min(minPrice,low)
    if chiusura-minPrice>60*pointSize then
    lowReached=1
    else
    lowReached=0
    endif
    endif
    If not onMarket then
    maxPrice=Max(maxPrice,high)
    if maxPrice-chiusura>60*pointSize then
    highReached=1
    else
    highReached=0
    endif
    endif
    //————————————————-
    If time> 173000 then
    if close crosses over myST and lowReached=1 then
    crossOverST=1
    endif
    if close crosses under myST and highReached=1 then
    crossUnderST=1
    endif
    endif
    //————————————————————————————————–
    if not onMarket and crossOverST = 1 and Ctime and oneTrade then
    buy 1 contracts at market
    endif
    if longOnMarket and close>chiusura then
    sell 1 contracts at market
    crossOverST=0
    lowReached=0
    endif
    if not onMarket and crossUnderST=1 and Ctime and oneTrade then
    sellShort 1 contracts at market
    endif
    if shortOnMarket and close<chiusura then
    exitShort 1 contracts at market
    crossUnderST=0
    highReached=0
    endif
    //——————————————————–
    set stop %Loss 0.4
    graphonprice chiusura coloured(30,144,255)
    graphonprice (chiusura-60*pointSize) coloured(255,165,0)
    graphonprice (chiusura+60*pointSize) coloured(255,165,0)
    graph crossOverSt=1 coloured (34,139,34)
    graph crossUnderSt=1 coloured(255,0,0)
    #172094 quote
    MauroProMauroPro
    Participant
    Veteran
    #172125 quote
    MauroProMauroPro
    Participant
    Veteran
    Ciao Roberto, ho risolto sistemando i flags (posto il codice corretto). Una cosa: puoi provare se quando applichi il TS in un piano di lavoro e lo salvi, poi quando lo riapri rimane il TS? Non so per quale motivo quando lo riapro (questo da giorni e solo in questo TS) rimane aperta, ma vuota la finestra di proBackTest e sotto nel grafico compaiono delle frecce nere.  Ho provato a salvare tutto in un altro piano e rinominare il Ts ma sempre uguale. Può essere un bug di PRT secondo te? Grazie
    TS-nightGap-Dax-3m.itf Image-001-3.jpg Image-001-3.jpg
    #172128 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    Le frecce nere sono relative ad un backtest, per toglierle devi andare nelle impostazioni del prezzo e toglierle da li. Se salvi il piano di lavoro dopo un backtest, poi esci e quando rientri te lo carica nuovamente (ma non il codice). Se salvi il piano di lavoro mentre stai scrivendo o modificando il codice senza avere fatto il backtest ti salva il grafico, ma non abbinato al TS su cui stavi lavorando, per cui quando rientri ricarica solo il grafico.
    #172129 quote
    MauroProMauroPro
    Participant
    Veteran
    Allora ho cancellato come mi hai detto da prezzo le frecce nere, tolto il proBacktest, salvato il piano di lavoro e chiuso Prt. Riavviato Prt con il piano di lavoro salvato senza probacktest, applicato il TS con proBacktest e salvato. Tutto ok fino a qui. (foto 1) Salvo ed esco nuovamente da Prt. Rientro in Prt e mi si apre come da problema. (foto 2). Da cosa può dipendere?
    Image-001-4.jpg Image-001-4.jpg Image-002.jpg Image-002.jpg
Viewing 15 posts - 16 through 30 (of 33 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

Uscita da una strategia di reversal


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
MauroPro @mauropro Participant
Summary

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

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 06/16/2021
Status: Active
Attachments: 6 files
ProRealCode ProRealCode
Loading...