codice VWAP BANDE

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #238862 quote
    Edisone
    Participant
    Average

    Salve è possibile avere il codice del VWAP Bande ? (lo script non è modficabile)

    Ho la necessità di calcolare il VWAP con il settaggio (dati storici del grafico = Medio: (H+L)/2) e succesivamente modificare le diviazioni standard.

    Grazie

    Saluti

    #238871 quote
    Iván González
    Moderator
    Master

    Ciao! Qui hai un codice che puoi utilizzare per calcolare il VWAP. L'unica cosa che dovrai regolare è la variabile minBarsInput in base al periodo di tempo che utilizzi. Ad esempio, se hai EURUSD a 1H il valore dovrebbe essere minBarsInput=23

    //PRC Rolling VWAP
    //version = 0
    //06.03.24
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    ///inputs
    src = customclose
    minBarsInput = 10
    stdevMult1 = 1
    stdevMult2 = 1.5
    stdevMult3 = 2.5
    showbands = 1
    
    //////BARS TO CALCULATE VWAP/////////
    if gettimeframe < 86400 then
    bars = minbarsinput
    elsif gettimeframe >= 86400 and gettimeframe < 604800 then
    bars = MAX(22,minbarsinput)
    elsif gettimeframe = 604800 then
    bars = MAX(round(90/5),minbarsinput)
    else
    bars = MAX(round(252/22),minbarsinput)
    endif
    //////////////////////////////////////
    if dayofweek>=dayofweek[1] then
    barsweek=barsweek+1
    sumSrcVol = summation[min(bars,barsweek)](src*volume)
    sumVol = summation[min(bars,barsweek)](volume)
    sumSrcSrcVol = summation[min(bars,barsweek)](pow(src,2)*volume)
    else
    barsweek=0
    sumSrcVol = (src*volume)
    sumVol = (volume)
    sumSrcSrcVol = (pow(src,2)*volume)
    endif
    
    
    
    rollingvwap = sumSrcVol / SumVol
    
    variance = sumSrcSrcVol / SumVol - pow(rollingvwap,2)
    variance = max(0,variance)
    
    stDev = sqrt(variance)
    
    if showbands then
    upperband1 = rollingVwap + stDev*stdevMult1
    lowerband1 = rollingVwap - stDev*stdevMult1
    
    upperband2 = rollingVwap + stDev*stdevMult2
    lowerband2 = rollingVwap - stDev*stdevMult2
    
    upperband3 = rollingVwap + stDev*stdevMult3
    lowerband3 = rollingVwap - stDev*stdevMult3
    else
    upperband1 = undefined
    lowerband1 = undefined
    upperband2 = undefined
    lowerband2 = undefined
    upperband3 = undefined
    lowerband3 = undefined
    endif
    
    return rollingvwap as "rollingVwap" coloured("orange"),upperband1 as "upperband1"coloured("red"),lowerband1 as "lowerband1"coloured("red"),upperband2 as "upperband2"coloured("yellow"),lowerband2 as "lowerband2"coloured("yellow"),upperband3 as "upperband3"coloured("green"),lowerband3 as "lowerband3"coloured("green")
    
    Edisone thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

codice VWAP BANDE


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
Edisone @edisone Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Iván González
1 year, 3 months ago.

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