Money management visivo

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #157097 quote
    MauroPro
    Participant
    Veteran

    In questo trailing profit (idea ripresa dal blog: “Trailing stop with the Max Favorable Excursion – Mfe”), che riporto con insertPrtCode, vorrei, dato che non conosco ancora le formule “visive” di PRT, sapere se è possibile tracciare sul grafico ( dopo che un TS è entrato) con una leggera linea orizzontale colorata, il livello di attivazione del trailing (chiamato nel mio caso: trailingActivation), per VEDERE quando appunto si attiva il trailing (ma possono essere anche livelli di stoploss …) . GRAZIE

    trailingActivation = (close * 0.8 / 100) / pointsize     //livello di attivazione del trailiing profit
    trailingDelta = (close * 0.4 / 100) / pointsize          // livello del massimo ritraccimento consentito
    
    If not onmarket then
    maxPrice=0
    minPrice=close
    priceExit=0
    endif
    
    If longonmarket then
    maxPrice=Max(maxPrice,high)                            // ritracciamento dal massimo raggiunto
    if maxPrice-tradePrice[1]>trailingActivation*pointSize then
    priceExit=maxPrice-trailingDelta*pointSize
    endif
    endif
    
    if shortonmarket then
    minPrice=Min(minPrice,low)
    if tradePrice[1]-minPrice>trailingActivation*pointSize then
    priceExit=minPrice+trailingDelta*pointSize
    endif
    endif
    
    if onmarket and priceExit>0 then
    sell at priceExit STOP
    exitshort at priceExit STOP
    endif
    #157101 quote
    MauroPro
    Participant
    Veteran

    La linea orizzontale dovrebbe chiaramente iniziare quando un TS entra e terminare quando un TS esce (al di là del fatto che il trailing venga attivato o meno, questo dipende dal mercato)

    #157104 quote
    robertogozzi
    Moderator
    Master

    Non è possibile, solo gli indicatori possono tacciare linee.

    #157105 quote
    MauroPro
    Participant
    Veteran

    Nemmeno nessun tipo di simbolo visivo (da plottare sopra l’entrata ad altezza del livello di attivazione del trailing profit)?

    #157111 quote
    robertogozzi
    Moderator
    Master

    Solo gli indicatori possono farlo.

    #157115 quote
    MauroPro
    Participant
    Veteran

    Un ultima domanda-tentativo: ho visto nei vari esempi che vengono plottati punti, rettangoli, cerchi …. (anche se ancora non saprei replicarli). Sarebbe possibile con un segnale fatto da soli indicatori, che, come scrivi, sono gli unici che permettono di plottare qualcosa, stampare qualcosa sul grafico all’altezza del trailing?

    In ogni caso, mi puoi fare un qualsiasi esempio didattico (per imparare) di come un indicatore plotta, ad esempio, un punto sul grafico?

    Ciao e grazie

    #157117 quote
    robertogozzi
    Moderator
    Master

    Questa è una semplice strategia che puoi lanciare in autotrading (SL e TP elevati perché fatta sul Dax Daily):

    DEFPARAM CumulateOrders = FALSE
    IF close CROSSES OVER  Average[100,0](close) AND Not LongOnMarket  THEN
       BUY       1 Contract at Market
       SET TARGET pPROFIT 1000
       SET STOP   pLOSS   300
    ENDIF
    IF close CROSSES UNDER Average[100,0](close) AND Not ShortOnMarket THEN
       SELLSHORT 1 Contract at Market
       SET TARGET pPROFIT 1000
       SET STOP   pLOSS   300
    ENDIF

    questa è la stessa, sotto forma d’indicatore da mettere sul prezzo. Stampa una linea blu al livello di entrata a mercato quando è Long, rossa quando è Short (niente quando non è a mercato):

    r = 0
    g = 0
    b = 255
    t = 255
    // LONG
    IF close CROSSES OVER  Average[100,0](close) AND Not IamLong  THEN
       IamLong  = 1
       IamShort = 0
       EntryPrice = close
    ENDIF
    // SHORT
    IF close CROSSES UNDER Average[100,0](close) AND Not IamShort THEN
       IamLong  = 0
       IamShort = 1
       EntryPrice = close
    ENDIF
    // Tp o Sl LONG
    IF IamLong THEN
       IF ((close - EntryPrice)  >= 1000) OR ((EntryPrice - close) >= 300) THEN
          IamLong  = 0
       ENDIF
    ENDIF
    // Tp o Sl SHORT
    IF IamShort THEN
       IF ((close - EntryPrice)  >= 300) OR ((EntryPrice - close) >= 1000) THEN
          IamShort = 0
       ENDIF
    ENDIF
    //
    IamOnMarket = IamLong OR IamShort
    IF IamShort THEN
       r = 255
       b = 0
    ENDIF
    //
    IF Not IamOnMarket THEN
       EntryPrice = close
       t = 0
    ENDIF
    RETURN EntryPrice COLOURED(r,g,b,t) STYLE(line,2) AS "EntryPrice"
    x-4.jpg x-4.jpg
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Money management visivo


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
MauroPro @mauropro Participant
Summary

This topic contains 6 replies,
has 2 voices, and was last updated by robertogozzi
5 years, 1 month ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 01/09/2021
Status: Active
Attachments: 1 files
Logo Logo
Loading...