STRATEGIA LONG SHORT

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #176552 quote
    GaspareGaspare
    Participant
    Veteran

    Ciao Roberto

    strategia su TF h1 che apre e chiude posizioni cosi’:

    LONG sopra il massimo della candela precedente piu’ il 75% dell’intero range della candela precedente

    SHORT sotto il minimo della candela precedente piu’ il 75% dell’intero range della candela precedente

    STOP LOSS uguale a quel 75% dell’intero range della candela precedente

    TARGET minimo 2 volte lo stop loss

    Grazie per la tua disponibilita’

    P.S. è possibile avere un target dinamico che segua la posizione in profit?

    #176584 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Eccola:

    sl = range * 0.75
    HH = high
    LL = low
    //
    // entrata con ordini pendenti
    //
    IF Not OnMarket THEN
       EntryL = HH + sl
       EntryS = LL - sl
       BUY       1 Contract at EntryL Stop
       SELLSHORT 1 Contract at EntryS Stop
       SET STOP   LOSS   sl
       SET TARGET PROFIT sl* 2
       StopLossL = HH
       StopLossS = LL
    ENDIF
    //
    // Stop Loss dinamico sul massimo o minimo tra apertura e chiusura della candela precedente (quella appena chiusa)
    //
    IF LongOnMarket  THEN
       StopLossL = max(StopLossL,min(open,close))
       SELL      AT StopLossL Stop
    ENDIF
    IF ShortOnMarket THEN
       StopLossS = min(StopLossL,max(open,close))
       SELLSHORT AT StopLossS Stop
    ENDIF
    //graphonprice PositionPrice coloured(0,0,255,255)
    //graphonprice StopLossL     coloured(0,128,0,160)
    //graphonprice StopLossS     coloured(255,0,0,255)

    Se vuoi vedere i prezzi d’entrata e gli stop loss sul grafico, alla fine del backtest, togli i commenti dalle ultime 3 righe.

    #176657 quote
    GraHalGraHal
    Participant
    Legend

    La riga 26 dovrebbe leggere ExitShort?

    #176665 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Si GraHal, hai ragione. alla riga 26 occorre mettere ExitShort al posto di Sellshort,

    Grazie 🙂

    GraHal thanked this post
    #176796 quote
    GaspareGaspare
    Participant
    Veteran

    Grazie Roberto e grazie GraHal

    il sistema va, ma esegue un mare di trades e non permette di eseguire in modalita’ tick per tick.

    per es. SP500 h1   k5   mi compare il messaggio, tick per tick limite raggiunto, e devo scegliere

    senza i dati tick per tick con un risultato falso.

    inoltre chiedo se è possibile eliminare il target profit oppure renderlo dinamico come lo stop loss

    Grazie

    se hai tempo puoi provarlo sul dax?

    #176803 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Per togliere il TP basta che commenti o rimuovi  la riga 13, però poi esce solo in stop loss.

    Lo SL dinamico è un trailing stop, che si avvicina al pareggio e poi va eventualmente in profitto man mano che il profitto cresce, però il TP dinamico cosa dovrebbe fare, incrementarsi o diminuire?

    Anche sul DAX non va bene.

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

STRATEGIA LONG SHORT


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Gaspare @gaspare Participant
Summary

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

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 08/31/2021
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...