disegno di linee tra due date

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #227904 quote
    luxrunluxrun
    Participant
    Master

    Buongiorno, vi chiedo se è possibile implementare questo indicatore che già in precedenza era stato richiesto al forum probuilder, aggiungendo una data finale e il dato di chiusura. In pratica, riferendosi all’anno passato, inserisco le due date di inizio e fine anno (o date a piacere) e l’indicatore mi disegna apertura, chiusura, minimo e massimo del periodo inserito. Di seguito il codice che sto utilizzando e che magari può essere di spunto per la modifica, grazie!

    // Esempio di indicatore di minimi e massimi
    
    //DataRiferimento = 20220712    //12 Luglio 2022
    
    nbarre = 0
    for i = 1 to BarIndex
    if OpenDate[i] = DataRiferimento then
    nbarre = barindex - barindex[i]// + 1
    break
    elsif OpenDate[i] < DataRiferimento then
    nbarre = barindex - barindex[i - 1]// + 1
    break
    endif
    next
    
    nbarre   = max(1,nbarre)
    massimo  = highest[nbarre](high)
    minimo   = lowest[nbarre](low)
    apertura = open[nbarre]
    
    
    IF OpenDate < DataRiferimento THEN
    massimo  = 0
    minimo   = 0
    apertura = 0
    
    ENDIF
    
    return massimo as "massimo", minimo as "minimo", apertura as "apertura"
    #227985 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Eccolo:

    // stampa dalla fine della data indicata, fino ad oggi
    // (le data predefinite sono dall' 11/05/2023  al  31/08/2023)
    //
    // colo0ri usati:
    //
    // massimo  = BLU
    // minimo   = ROSSO
    // apertura = ORO
    // chiusura = VERDE
    //
    //DEFPARAM CalculateOnLastBars = 1000
    ONCE apertura = open
    ONCE massimo  = high
    ONCE minimo   = low
    ONCE chiusura = close
    t             = 255
    FOR i = 0 TO BarIndex - 1
       IF OpenDate[i] < DaData THEN
          massimo  = high[max(1,i - 1)]
          minimo   = low[max(1,i - 1)]
          chiusura = close[max(1,i - 1)]
          apertura = open[max(1,i - 1)]
          FOR j = max(1,i - 1) DOWNTO 0
             IF OpenDate[j] > Adata THEN
                break
             ENDIF
             Massimo  = max(Massimo,high[j])
             Minimo   = min(Minimo,low[j])
             chiusura = close[j]
          NEXT
          break
       ENDIF
    NEXT
    IF OpenDate <= Adata THEN
       t = 0
    ENDIF
    return massimo as "massimo" coloured("Blue",t), minimo as "minimo" coloured("Red",t), apertura as "apertura" coloured("Gold",t), chiusura as "chiusura" coloured("lawngreen",t)
    luxrun thanked this post
    x-6.jpg x-6.jpg Il-Mio-Indicatore3.itf
Viewing 2 posts - 1 through 2 (of 2 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

disegno di linee tra due date


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
luxrun @luxrun Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzirobertogozzi
2 years, 7 months ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 02/11/2024
Status: Active
Attachments: 2 files
ProRealCode ProRealCode
Loading...