Stampa sul pannello del prezzo

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #256893 quote
    smsdp
    Participant
    Junior

    salve, avrei l’esigenza di stampare (in alto a destra) un piccolo riquadro con il valore di un indicatore da me codificato, ma mentre funziona in un nuovo pannello, nel pannello del prezzo è sempre 0


    L’indicatore dovrebbe visualizzare la percentuale del range dei prezzi odierno (anche su tmeframe intraday) rispetto alla media dell’ATR a 14 periodi giornalieri


    //DEFPARAM CALCULATEONLASTBARS = 1
    
    TimeFrame(Daily)
    ATR = AverageTrueRange[14](Close)
    
    TimeFrame(Default)
    RangeOdierno = DHigh(0) - DLow(0)
    
    // Calcolo del rapporto percentuale
    If ATR > 0 Then
      RapportoPercentuale = (RangeOdierno / ATR) * 100
    Else
      RapportoPercentuale = 0
    EndIf
      
    //drawtext("ATRNow: #RapportoPercentuale#%", -80, -40, Dialog, Bold, 16) anchor(TOPRIGHT)
    //drawtext("ATRNow: #ATR#%", -80, -40, Dialog, Bold, 16) anchor(TOPRIGHT)
    
    return RapportoPercentuale
    
    #256897 quote
    Iván González
    Moderator
    Master

    Forse questo può aiutarti a inserirlo nel prezzo


    // --- Configuración de Parámetros ---
    // ----------------------------------
    // ATR Calculation (Daily TF)
    // ----------------------------------
    TIMEFRAME(Daily)
    pPeriod = 5
    dailyATR = AverageTrueRange[pPeriod](close)
    dailyATR = ROUND(dailyATR, 2)
    
    // ----------------------------------
    // Main Logic (Default TF)
    // ----------------------------------
    TIMEFRAME(DEFAULT)
    
    // Selección de ATR según el timeframe actual
    IF GETTIMEFRAME < 86400 THEN
       currentATR = dailyATR[1]
    ELSE
       currentATR = dailyATR
    ENDIF
    
    // Cálculo del Rango de hoy
    todayRange = DHigh(0) - DLow(0)
    
    // Cálculo de porcentajes solicitados
    IF currentATR > 0 THEN
       ratioPercentage = ROUND((todayRange / currentATR) * 100, 2)
    ELSE
       ratioPercentage = 0
    ENDIF
    
    // ----------------------------------
    // Comandos de Dibujo
    // ----------------------------------
    IF ISLASTBARUPDATE THEN
       DRAWRECTANGLE(-280, -80, -80, -150) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT) STYLE(LINE, 2)
       DRAWTEXT("ATR(#pPeriod#) = #currentATR#", -185, -100) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT)
       DRAWTEXT("Daily Range %: #ratioPercentage#%", -185, -120) ANCHOR(TOPRIGHT, XSHIFT, YSHIFT)
       
    ENDIF
    
    RETURN
    


    #256898 quote
    smsdp
    Participant
    Junior

    Perfetto, grazie mille!

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

Stampa sul pannello del prezzo


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
smsdp @smsdp Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by smsdp
1 week, 1 day ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 01/25/2026
Status: Active
Attachments: No files
Logo Logo
Loading...