Disegnare Box relativo al Supertrend

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #218556 quote
    Stanko
    Participant
    Senior

    Buonasera a tutti,

    vorrei chiedere cortesemente un aiuto per risolvere un problema che non riesco a risolvere:

    creare un Box prendendo in esame il Supertrend.

    In particolare se il Supertrend si “stabilizza” per almeno 5 candele vorrei disegnare un Box che abbia come base (o tetto) la linea del Supertend e come tetto (o base) il massimo (o minimo) della serie di candele in esame.

    Grazie.

     

    Allego esempio

    #218558 quote
    robertogozzi
    Moderator
    Master

    Questo mi sembra vada bene:

    myST = SuperTrend[2,10]
    IF summation[5](myST = myST[1]) = 5 THEN
       Upper = max(myST,highest[5](high))
       Lower = min(myST,lowest[5](low))
       DrawRectangle(BarIndex-4,Upper,BarIndex,Lower) coloured("Cyan",90) bordercolor("Red",0)
    ENDIF
    RETURN
    Stanko thanked this post
    #218560 quote
    Stanko
    Participant
    Senior

    Molte grazie Roberto.

    Se possibile vorrei chiederTi se puoi aggiornare il codice:

    se il Supertrend rimane “stabile” per più di 5 candele il Box dovrebbe proseguire fino a quando il Supertrend non cambia inclinazione.

    Il mio problema era questo cioè creare un ciclo che controllasse il Supertrend ad ogni candela.

    Grazie

    #218561 quote
    Stanko
    Participant
    Senior

    Scusa Roberto, ho provato a modificare il tuo codice ma non riesco a visualizzare il Box.

    Per cortesia riesci a correggerlo?

    Grazie.

     

    Allego il codice

    myST = SuperTrend[2,10]
    ONCE CONT = 1
    IF summation[CONT](myST = myST[CONT]) THEN
    IF CONT >= 5 then
    Upper = max(myST,highest[CONT](high))
    Lower = min(myST,lowest[CONT](low))
    DrawRectangle(barindex-CONT,Upper,BarIndex,Lower) coloured("Cyan",90) bordercolor("Red",0)
    CONT = CONT + 1
    ELSE
    CONT = CONT + 1
    ENDIF
    ENDIF
    RETURN
    #218933 quote
    robertogozzi
    Moderator
    Master

    Ho riscritto il codice così:

    myST = SuperTrend[2,10]
    ONCE CONT = 1
    IF summation[CONT](myST = myST[CONT]) THEN
       IF CONT >= 5 then
          Upper = max(myST,highest[CONT](high))
          Lower = min(myST,lowest[CONT](low))
          DrawRectangle(barindex-CONT,Upper,BarIndex,Lower) coloured("Cyan",90) bordercolor("Red",0)
          CONT = 0
       ENDIF
       CONT = CONT + 1
    ENDIF
    RETURN

    prova se così va bene.

    Stanko thanked this post
    #218956 quote
    Stanko
    Participant
    Senior

    Ok grazie.

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

Disegnare Box relativo al Supertrend


Supporto ProBuilder

New Reply
Author
author-avatar
Stanko @stanko Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by Stanko
2 years, 5 months ago.

Topic Details
Forum: Supporto ProBuilder
Language: Italian
Started: 08/03/2023
Status: Active
Attachments: 2 files
Logo Logo
Loading...