Comando Drawline

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #46956 quote
    mdaneri
    Participant
    New

    Buongiorno a tutti,

    avrei bisogno di qualche chiarimento relativo al comando drawline: se ho capito bene funziona in questo modo:

    drawline(x1, y1, x2, y2), dove x1 ed x2 sono le ascisse dei punti di inizio e fine del segmento e y1 ed y2 le relative ordinate.

    Domanda: x1 ed x2 sono sempre dei riferimenti tipo “barindex”? E’ possibile in qualche modo renderli assoluti, ossia invariabili nel tempo? (vorrei scrivere il codice equivalente ad un segmento disegnato a mano dall’utente).

    Se utilizzo numeri assoluti, fanno sempre riferimento al numero di candele caricate dal sistema; ad esempio su TF giornaliero, vorrei dar disegnare il segmento da un determinato giorno ad un altro.

    Grazie a tutti e complimenti per l’ottimo lavoro.

    Saluti

    Marco

    #46965 quote
    Nicolas
    Keymaster
    Legend

    E ‘giusto, le coordinate X sono barindex, mentre quelle Y sono nel prezzo.
    Per ottenere le stesse coordinate in molti tempi differenti, dovrai cercare e trovare l’esatto barindex, non c’è altra possibilità.

    #46967 quote
    mdaneri
    Participant
    New

    Hi All,

    I’d need some advice on DRAWLINE command; if I correctly understood it works as follows:

    DRAWLINE(x1, y1, x2, y2), with x1 and x2 abscissas of starting and end point of segment, while y1 and y2 are the relevant ordinates.

    Question: x1 and x2 are always barindex-type references? Can they be made absolute, i. e. non varying with time? (I’d like to write the code equivalent to manually drawing a segment on a price chart).

    If I use absolute numbers, they always refer to the number of loaded candlesticks; for instance, on daily TF, I’d like to write the code to draw a segment from one specific day to another.

    Thank you all and compliments for the excellent job done here.

    Kind regards,

    Marco

    #46968 quote
    mdaneri
    Participant
    New

    barindex of a specific candlestick changes with time, therefore it does not seem possible to draw a static segment; is it correct?

    #46969 quote
    mdaneri
    Participant
    New

    by the way, thanks a lot Nicolas for your prompt answer.

    your code is always extremely interesting

    marco

    #47392 quote
    AVT
    Participant
    Senior

    IT: Solo un’idea: puoi rendere il valore assoluto entro il tempo (significa che il venerdì 6 00 rimarrà sempre allo stesso punto, non importa quale sia il barindex). Quindi fare qualcosa come ‘se venerdì 6 00 startpoint’ e ‘se venerdì 9 00 enpdoint’.

    EN: Just an idea: you can make the value absolute by time (means: Friday 6:00 will always stay at the same point, no matter what barindex that is). Then do something like ‘if Friday 6:00 startpoint’ and ‘if Friday 9:00 enpdoint’.

    #47461 quote
    mdaneri
    Participant
    New

    Excellent idea! Can you help me a bit more? Drawlie foresses 2 barindex values as input, therefore how can they be changed in dates?

    Thanks a lot,

    Marco

    #47660 quote
    AVT
    Participant
    Senior

    IT: Una costruzione come questo dovrebbe funzionare (per il punto di partenza)
    EN: A construction like this should work (for the starting point)

    AbsoluteHigh=0                 // initially set to zero
    FOR i=0 TO 20 DO               // look back 20 bars to find the highest
      IF High[i]>AbsoluteHigh THEN // greater than previous AbsoluteHigh
        AbsoluteHigh=High[i]       // aggiornare il valore di [update value of] AbsoluteHigh
        AbsoluteTime=Time[i]       // fissare il tempo quando si è verificato [fix time of occurrence]
      ELSE
        AbsoluteHigh=AbsoluteHigh  // mantenere il valore già trovato [keep the value found]
        AbsoluteTime=AbsoluteTime  // e il tempo [and the time]
      ENDIF
    NEXT

    IT: Ora sappiamo quando è accaduto e quale prezzo abbiamo avuto, fissato nelle nostre AbsoluteVariables.
    Durante il disegno usiamo un secondo IF a seconda del tempo che abbiamo trovato

    EN: Now we know when it occurred and what price we had, fixed in our AbsoluteVariables.
    When drawing we use a second IF depending on the time we found

    IF AbsoluteTime THEN           // al momento trovato [at the time we found]
      // iniziare a disegnare a quei momenti corrispondente barindex e l'alta
      // start to draw at that moments corresponding barindex and the High
      DRAWLINE(barindex,AbsoluteHigh, ... qualunque sia il tuo secondo punto è [to whatever your second point is]

    IT: non testato EN: untested 🙂

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

Comando Drawline


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
mdaneri @mdaneri Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 09/22/2017
Status: Active
Attachments: No files
Logo Logo
Loading...