VWAP Date anchored + ORARIO

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #240381 quote
    EdisoneEdisone
    Participant
    Average

    Salve.

    Per un uso su time frame intraday (es.-1H) è possibile aggiungere l’ora/minuti al seguente codice ?

    esempio che il vwap sia ancorato sulla barra del giorno es. 202141018 alle ore es. 15.00.

    Grazie

    Saluti

     

    startDate=20141018
    
    VWAP=undefined
    SDup1 = undefined
    SDlw1 = undefined
    SDup2 = undefined
    SDlw2 = undefined
    SDup3 = undefined
    SDlw3 = undefined
    
    if opendate=startDate then
    startbar=barindex
    endif
    if opendate>=startDate then
    barcount=barindex-startbar
    
    d = max(1, barcount)
    
    src = customclose
    
    if volume > 0 THEN
    VWAP = summation[d](Volume * src)/summation[d](Volume)
    ENDIF
    
    if(barcount=0) then
    sd = 0
    else
    p1 = summation[d](Volume * src)
    p2 = summation[d](Volume)
    p3 = summation[d](Volume * src * src)
    ma = p1/p2
    ma2 = p3/p2
    sd = SQRT(ABS(ma2 - ma * ma) )
    endif
    
    if viewSD then
    SDup1 = vwap+sd
    SDlw1 = vwap-sd
    SDup2 = vwap+sd*2
    SDlw2 = vwap-sd*2
    SDup3 = vwap+sd*3
    SDlw3 = vwap-sd*3
    endif
    
    SDup1 = vwap+sd*1
    SDlw1 = vwap-sd*1
    SDup2 = vwap+sd*2
    SDlw2 = vwap-sd*2
    SDup3 = vwap+sd*3
    SDlw3 = vwap-sd*3
    
    endif
    
    R=1
    G=1
    B=1
    
    RETURN VWAP coloured(R,G,B) as "VWAP", SDup1 coloured(R,G,B) as "upper 1 STD", SDlw1 coloured(R,G,B) as "lower 1 STD", SDup2 coloured(R,G,B) as "upper 2 STD", SDlw2 coloured(R,G,B) as "lower 2 STD", SDup3 coloured(R,G,B) as "upper 3 STD", SDlw3 coloured(R,G,B) as "lower 3 STD"
    #240383 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Cosa intendi per “ancorato“?

    #240386 quote
    EdisoneEdisone
    Participant
    Average

    Ancorato nel senso che decidi tu da quale giorno deve inziare il vwap (per semplicità nel codice ho impostato il 18 ottobre 2024).

    Vorrei aggiungere la possibilità di decidere anche l’orario per poterlo usare in un time frame intrday.

    #240431 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Ecco, ho aggiunto anche l’orara d’inizio (starttime):

    once startDate=20240108
    once starttime=090000
    
    once VWAP  = undefined
    once SDup1 = undefined
    once SDlw1 = undefined
    once SDup2 = undefined
    once SDlw2 = undefined
    once SDup3 = undefined
    once SDlw3 = undefined
    
    if (opendate=startDate) AND (opentime=starttime) then
    startbar=barindex
    endif
    if (opendate>startDate) or (opendate=startDate) and (opentime>=starttime) then
    barcount=barindex-startbar
    
    d = max(1, barcount)
    
    src = customclose
    
    if volume > 0 THEN
    VWAP = summation[d](Volume * src)/summation[d](Volume)
    ENDIF
    
    if(barcount=0) then
    sd = 0
    else
    p1 = summation[d](Volume * src)
    p2 = summation[d](Volume)
    p3 = summation[d](Volume * src * src)
    ma = p1/p2
    ma2 = p3/p2
    sd = SQRT(ABS(ma2 - ma * ma) )
    endif
    
    if viewSD then
    SDup1 = vwap+sd
    SDlw1 = vwap-sd
    SDup2 = vwap+sd*2
    SDlw2 = vwap-sd*2
    SDup3 = vwap+sd*3
    SDlw3 = vwap-sd*3
    endif
    
    SDup1 = vwap+sd*1
    SDlw1 = vwap-sd*1
    SDup2 = vwap+sd*2
    SDlw2 = vwap-sd*2
    SDup3 = vwap+sd*3
    SDlw3 = vwap-sd*3
    
    endif
    
    R=1
    G=1
    B=1
    
    RETURN VWAP coloured(R,G,B) as "VWAP", SDup1 coloured(R,G,B) as "upper 1 STD", SDlw1 coloured(R,G,B) as "lower 1 STD", SDup2 coloured(R,G,B) as "upper 2 STD", SDlw2 coloured(R,G,B) as "lower 2 STD", SDup3 coloured(R,G,B) as "upper 3 STD", SDlw3 coloured(R,G,B) as "lower 3 STD"
    Edisone and Razz thanked this post
Viewing 4 posts - 1 through 4 (of 4 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

VWAP Date anchored + ORARIO


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
Edisone @edisone Participant
Summary

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

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