Reverse con passo

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #227587 quote
    Laufre
    Participant
    New

    Buonasera a tutti, un grazie anticipato a chi vorrà aiutarmi…

    Stavo cercando di effettuare una strategia di questo tipo:

     

    Ingresso   a mercato casuale

    Stop loss a 50 pip (se toccato,  reverse)

    Stop loss diventa 100 (se toccato reverse… e stop loss ritorna a 50)

     

    Se superiamo i 50 pip di profit, lo stop loss si porta sul pareggio … ( se viene toccato reverse e stop loss si posiziona sui 50 pip e si ricomincia)

    Se superiamo i 200 ( stop loss si posiziona sui 50 pip e se toccato si  ricomincia)

    Se superiamo i 500 ( stop loss si posiziona sui 50 pip e se toccato si  ricomincia)

     

    ho provato a farlo ma è troppo per il mio livello di competenze… (mi sono reso conto..molto basso)

    Grazie

    #227601 quote
    robertogozzi
    Moderator
    Master

    Provala e dimmi se fa quello che desideri oppure no.

    Se qualcosa non funziona, fammi sapere su quale strumento l’hai proivata, il timeframe ed indicami il problema, meglio ancora se midici la data e l’ora in cui un’operazione errata è iniziata.

    ONCE DoppioSL = 0
    ONCE Profitto = 0
    ONCE Guadagno = 0
    SET TARGET PROFIT 0
    //
    IF OnMarket THEN
    Guadagno = max(Guadagno,PositionPerf * PositionPrice / PipSize)   //in punti (pips)
    ELSE
    Guadagno = 0
    ENDIF
    //
    IF ((StrategyProfit <> StrategyProfit[1]) OR ((StrategyProfit = StrategyProfit[1]) AND (Not OnMarket AND OnMarket[1]))) AND Profitto THEN
    Profitto = 0
    Guadagno = 0
    DoppioSL = 0
    ENDIF
    //
    IF StrategyProfit < StrategyProfit[1] THEN
    IF DoppioSL THEN
    DoppioSL = 0
    IF LongOnMarket AND ShortOnMarket[1] THEN
    prezzoSTOP = close - 50*PipSize
    SET STOP pLOSS 50
    SELLSHORT 1 CONTRACT AT prezzoSTOP STOP
    Profitto = 0
    Guadagno = 0
    ELSIF ShortOnMarket AND LongOnMarket[1] THEN
    prezzoSTOP = close + 50*PipSize
    SET STOP pLOSS 50
    BUY 1 CONTRACT AT prezzoSTOP STOP
    Profitto = 0
    Guadagno = 0
    ENDIF
    ENDIF
    ELSIF StrategyProfit = StrategyProfit[1] THEN
    IF Guadagno >= 500*PipSize THEN
    prezzoSTOP = TradePrice - 50*PipSize
    IF ShortOnMarket THEN
    prezzoSTOP = TradePrice + 50*PipSize
    ENDIF
    Profitto = 1
    ELSIF Guadagno >= 200*PipSize THEN
    prezzoSTOP = TradePrice - 50*PipSize
    IF ShortOnMarket THEN
    prezzoSTOP = TradePrice + 50*PipSize
    ENDIF
    Profitto = 1
    ELSIF Guadagno >= 50*PipSize THEN
    prezzoSTOP = TradePrice - 50*PipSize
    IF ShortOnMarket THEN
    prezzoSTOP = TradePrice + 50*PipSize
    ENDIF
    Profitto = 1
    ENDIF
    ENDIF
    //
    IF OnMarket AND Profitto THEN
    SET STOP PRICE prezzoSTOP
    ENDIF
    //
    IF LongOnMarket AND ShortOnMarket[1] AND DoppioSL[1] = 0 THEN
    prezzoSTOP = TradePrice - 100*PipSize
    SET STOP pLOSS 100
    SELLSHORT 1 CONTRACT AT prezzoSTOP STOP
    DoppioSL = 1
    Profitto = 0
    Guadagno = 0
    ELSIF ShortOnMarket AND LongOnMarket[1] AND DoppioSL[1] = 0 THEN
    prezzoSTOP = TradePrice + 100*PipSize
    SET STOP pLOSS 100
    BUY 1 CONTRACT AT prezzoSTOP STOP
    DoppioSL = 1
    Profitto = 0
    Guadagno = 0
    ENDIF
    //
    IF Not OnMarket THEN
    IF close > close[1] THEN
    BUY 1 CONTRACT AT MARKET
    SET STOP pLOSS 50
    prezzoSTOP = close - 50*PipSize
    SELLSHORT 1 CONTRACT AT prezzoSTOP STOP
    DoppioSL = 0
    Profitto = 0
    Guadagno = 0
    ELSE
    SELLSHORT 1 CONTRACT AT MARKET
    SET STOP pLOSS 50
    prezzoSTOP = close + 50*PipSize
    BUY 1 CONTRACT AT prezzoSTOP STOP
    DoppioSL = 0
    Profitto = 0
    Guadagno = 0
    ENDIF
    prezzoSTOP = close 
    ENDIF
    graph Guadagno
    Il-Mio-Sistema.itf
    #227605 quote
    Laufre
    Participant
    New

    okk … lo provo subito

    #227609 quote
    Laufre
    Participant
    New

    provato su wall street , timeframe 1min

    non vorrei sbagliarmi

    ma non effettua inversione su pareggio

    non passa mai al -100

    #227646 quote
    robertogozzi
    Moderator
    Master

    Ok, appena ho un pò di tempo lo verifico.

    #227655 quote
    Laufre
    Participant
    New

    grazie, gentilissimo come sempre

    #227753 quote
    Laufre
    Participant
    New

    buonasera Roberto,

    ho fatto anche io qualche prova,

    ma accumula gli ordini!!

    reverse.itf
    #227766 quote
    robertogozzi
    Moderator
    Master

    Basta che aggiungi DEFPARAM CumulateOrders = False come prima riga.

    Nel mio codice non ce n’era bisogno perché non utilizzavo ordini pendenti.

    #227771 quote
    Laufre
    Participant
    New

    Niente… il mio non va comunque … è sballato

    #227906 quote
    Laufre
    Participant
    New

    Buongiorno signor Roberto,

    con l’ultima modifica ci sono quasi…..

    il problema e che non  effettua il reverse in caso di pareggio.

    Quando il “newsl” diventa tradeprice,

    non la considera una” strategyprofit”.

    Sempre se  non la disturbo, quando ha un pò di tempo ,

    se può dare un’occhiata..

    Grazie

    reverse-da-verificare.itf
    #228011 quote
    robertogozzi
    Moderator
    Master

    STRATEGYPROFIT cambia solo alla chiusura di un’operazione, quando il guadagno o la perdita sono certi.

    Per sapere se un’operazione in corso è in guadagno o in perdita occorre usare POSITIONPERF, che si aggiorna ad ogni barra in cui la strategia è a mercato (quando non è a mercato ha valore 0).

    POSITIONPERF è un moltiplicatore, se positivo è in guadagno, se negativo è in perdita.

    IF PositionPerf > 0 THEN //verifica se c'è un guadagno temporaneo
    
    ELSE                     //oppure se c'è una perdita temporanea
    
    ENDIF

    per conoscere la percentuale di profitto o perdita basta moltiplicarlo per 100:

    PerCent = PositionPerf * 100

    per conoscere di quanti pip (punti) è in guadagno/perdita occorre la seguente formula:

    Punti = PositionPerf * PositionPrice / PipSize

    per conoscere a quanto ammonta il guadagno/perdita, in denaro, usare la formula:

    Cifra = PositionPerf * PositionPrice / PipSize * PipValue
    #228014 quote
    Laufre
    Participant
    New

    grazie…. gentilissimo come sempre

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

Reverse con passo


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
Laufre @laufre Participant
Summary

This topic contains 11 replies,
has 2 voices, and was last updated by Laufre
2 years, 1 month ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 02/07/2024
Status: Active
Attachments: 3 files
Logo Logo
Loading...