range giornaliero ad ogni candela confrontato con quello dei gg precedenti

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #239290 quote
    Gabriele Battista
    Participant
    Senior

    Vorrei costruire un indicatore che ad ogni candela mi fornisca il valore del range giornaliero fino a quel momento e lo confronti con il valor medio alla stessa candela dei 5 e 22 gg precedenti. Grazie

    Carburo thanked this post
    #239297 quote
    Iván González
    Moderator
    Master

    Hola. Aquí tienes un indicador que calcula el rango diario.

    timeframe(daily)
    rangeToday=range
    rangeAvg5=average[5](rangeToday)
    rangeAvg22=average[22](rangeToday)
    
    return rangeToday as "Current Range", rangeAvg5 as "Average Range 5d",rangeAvg22 as "Average Range 22d"
    robertogozzi thanked this post
    #239300 quote
    Gabriele Battista
    Participant
    Senior

    grazie ma non funziona, allego il grafico del dax future 8:00-22:00. il range medio a 5 e 22 giorni ha subito un valore molto alto alla prima candela …

    #239325 quote
    robertogozzi
    Moderator
    Master

    Quello è il range giornaliero e funziona perfettamente.

    Se lo desideri per un periodo specifico il codice cambia, questo è dalle 08:00 alle 22:00:

    ONCE P1           = 22
    ONCE P2           = 5
    ONCE RangeDaily   = 0
    ONCE RangeOdierno = 0
    IF BarIndex = 0 THEN
       FOR i = 1 TO max(P1,P2)
          $myRange[i] = 0
       NEXT
    ENDIF
    IF OpenTime = 080000 THEN
       Massimo     = high
       Minimo      = low
       $myRange[0] = 1
    ENDIF
    Massimo      = max(Massimo,high)
    Minimo       = min(Minimo,low)
    RangeOdierno = Massimo - Minimo
    IF (OpenTime = 220000) AND (OpenTime <> OpenTime[1]) AND ($myRange[0] = 1) THEN
       $myRange[0] = 0
       Media22     = 0
       Media5      = 0
       FOR i = max(P1,P2) DOWNTO 2
          $myRange[i] = $myRange[i - 1]
          Media22     = Media22 + $myRange[i]
          IF i <= min(P1,P2) then
             Media5   = Media5  + $myRange[i]
          ENDIF
       NEXT
       $myRange[1]  = RangeOdierno
       Media22      = round((Media22 + $myRange[1]) / max(P1,P2),1)
       Media5       = round((Media5  + $myRange[1]) / min(P1,P2),1)
    ENDIF
    return RangeOdierno AS "Range oggi",Media5 AS "Range 5gg",Media22 AS "Range 22gg"
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

range giornaliero ad ogni candela confrontato con quello dei gg precedenti


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by robertogozzi
1 year, 3 months ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 10/21/2024
Status: Active
Attachments: 1 files
Logo Logo
Loading...