stop loss e take profit

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #146786 quote
    max1775max1775
    Participant
    Average

    buongiorno ho creato un trading sistem ma non riesco ad inserire correttamente il take profit e stop los

    mi servirebbe cosi:

    Stop los sulla linea centrale del canale di donchan settato a 10 periodi E un massimo del 20 %

    Quando la posizione va in guadagno del 15% entra in funzione il trailing stop del 15%

    #146814 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    20% e 15% di cosa?

    #146840 quote
    max1775max1775
    Participant
    Average

    Del prezzo dell’azione

    #146849 quote
    max1775max1775
    Participant
    Average

    supponendo di comprare un titolo azionazio che quota 10 euro il trailing stop deve entrare in funzione solo quando il titolo quota 11,50 e non prima

    #146908 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Per settare lo SL:

    p     = 10                  //10 periodi per  Canale Donchian
    Alto  = Highest[p](high[1]) //bordo superiore Canale Donchian
    Basso = Lowest[p](low[1])   //bordo inferiore Canale Donchian
    Mezzo = (Alto + Basso) / 2  //linea di mezzo  Canale Donchian
    SL    = min((Prezzo - Mezzo),(Prezzo * 0.20))   //Max. 20%
    SET STOP LOSS SL

    Per il trailing stop:

    ONCE LimiteTrailingStop = 15     //15% inizio e step del trailing stop
    IF Not OnMarket THEN
       Guadagno = LimiteTrailingStop
       MySL     = 0
       NewSL    = 0
    ENDIF
    IF LongOnMarket THEN
       IF (close - PositionPrice) >= (PositionPrice * Guadagno / 100) THEN
          NewSL    = PositionPrice + MySL
          MySL     = MySL + (PositionPrice * LimiteTrailingStop / 100)
          Guadagno = Guadagno + LimiteTrailingStop
       ENDIF
    ELSIF ShortOnMarket THEN
       IF (PositionPrice - close) >= (PositionPrice * Guadagno / 100) THEN
          NewSL    = PositionPrice - MySL
          MySL     = MySL + (PositionPrice * LimiteTrailingStop / 100)
          Guadagno = Guadagno + LimiteTrailingStop
       ENDIF
    ENDIF
    IF NewSL > 0 THEN
       SELL      AT NewSL STOP
       EXITSHORT AT NewSL STOP
    ENDIF

    non li ho provati.

    #147435 quote
    loris75loris75
    Participant
    Junior

    si possono inserire tutti e due insieme?  perche il trailing stop funxiona ma se inserisco anche lo top loss mi da errore  inserire valore prezzo bo

    #147437 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Certo, io ho mezzo Prezzo come esempio, tu dovrai mettere CLOSE, o TRADEPRICE, o un altro dato che corrisponda ad un prezzo. Forse CLOSE è il più appropriato, dipende dalla tua strategia.

    #147453 quote
    max1775max1775
    Participant
    Average

    non riesco a farli funzionare insieme  lo stop los mi da sempre errore.  potresti scrivermeli  messi tutti e due insieme?  grazie

    #147455 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Basta un copia e incolla:

    p     = 10                  //10 periodi per  Canale Donchian
    Alto  = Highest[p](high[1]) //bordo superiore Canale Donchian
    Basso = Lowest[p](low[1])   //bordo inferiore Canale Donchian
    Mezzo = (Alto + Basso) / 2  //linea di mezzo  Canale Donchian
    SL    = min((Prezzo - Mezzo),(Prezzo * 0.20))   //Max. 20%
    SET STOP LOSS SL
    //
    ONCE LimiteTrailingStop = 15     //15% inizio e step del trailing stop
    IF Not OnMarket THEN
       Guadagno = LimiteTrailingStop
       MySL     = 0
       NewSL    = 0
    ENDIF
    IF LongOnMarket THEN
       IF (close - PositionPrice) >= (PositionPrice * Guadagno / 100) THEN
          NewSL    = PositionPrice + MySL
          MySL     = MySL + (PositionPrice * LimiteTrailingStop / 100)
          Guadagno = Guadagno + LimiteTrailingStop
       ENDIF
    ELSIF ShortOnMarket THEN
       IF (PositionPrice - close) >= (PositionPrice * Guadagno / 100) THEN
          NewSL    = PositionPrice - MySL
          MySL     = MySL + (PositionPrice * LimiteTrailingStop / 100)
          Guadagno = Guadagno + LimiteTrailingStop
       ENDIF
    ENDIF
    IF NewSL > 0 THEN
       SELL      AT NewSL STOP
       EXITSHORT AT NewSL STOP
    ENDIF

    dovrai sostituire Prezzo, come ti ho detto, con il prezzo che desideri.

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

stop loss e take profit


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
max1775 @max1775 Participant
Summary

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

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