Sliding VWAP code

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #220333 quote
    KumoNoJuzza
    Participant
    New

    Hi,

    I have found code of VWAP for intraday with a starting time, but I am unable to amend it to get a sliding VWAP as per the attached snapshot.

    Is it possible to compute something like?

    // VWAP Computation
    Timestart=Time-010000
    if time=Timestart then
    d=0
    
    else
    d=d+1
    if volume >0 then
    VWAP = SUMMATION[d](volume*typicalprice)/SUMMATION[d](volume)
    endif
    endif
    
    

    Thanks for your help

    VWAP-configuration.png VWAP-configuration.png
    #220346 quote
    JS
    Participant
    Senior

    Hi @KumoNoJuzza

    Try this one:

     

    SlidingPeriod = 120 //in minutes
    GTF = GetTimeFrame
    N = Round(SlidingPeriod / (GTF/60))
    
    VW = Close * Volume
    VolumeSum = Summation[N](Volume)
    VolumeWeightedSum = Summation[N](VW)
    
    VWAP = VolumeWeightedSum / VolumeSum
    
    Return VWAP Coloured("Red")
    KumoNoJuzza and Nicolas thanked this post
    Scherm­afbeelding-2023-09-05-om-08.03.35.png Scherm­afbeelding-2023-09-05-om-08.03.35.png
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Sliding VWAP code


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by JS
2 years, 5 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 09/04/2023
Status: Active
Attachments: 2 files
Logo Logo
Loading...