Volume on Bid/Offer

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

    Hi, I have tried to modify existing code written by @nicholas… what I would like is for the chart to display all volume data for the current date since open at 09.00 until close at 17.30… and not a fixed number of bars back. Grateful for any help!!

     

     

    //PRC_Bull&Bear Volume on Price | indicator
    //05.07.2018
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    
    defparam drawonlastbaronly=true
    StartTime = 083000
    
    
    // --- settings
    ScaleFactor = 6
    NbrBars=40
    lookback= 120
    // --- end of settings
    
    hh=highest[lookback](high)
    ll=lowest[lookback](low)
    div = (hh-ll)/NbrBars
    i=0
    volsum=summation[lookback](volume)
    startbar = barindex[lookback]
    while i<NbrBars do
    lrange=ll+div*i
    hrange=lrange+div
    volbull=0
    volbear=0
    for j = 1 to lookback do
    if close[j]>=lrange and close[j]<=hrange then
    if close[j]>open[j] then
    volbull=volbull+volume[j]
    else
    volbear=volbear+volume[j]
    endif
    endif
    next
    bullbar = round((volbull*lookback)/volsum)*scalefactor
    bearbar = round((volbear*lookback)/volsum)*scalefactor
    
    drawrectangle(startbar,lrange,startbar+bullbar,hrange) coloured(46,139,87)
    drawrectangle(startbar,lrange,startbar+bearbar,hrange) coloured(255,0,0)
    
    if bullbar>bearbar then
    drawtext("■",startbar+bullbar,(lrange+hrange)/2,Dialog,Bold,22) coloured(46,139,87)
    else
    drawtext("■",startbar+bearbar,(lrange+hrange)/2,Dialog,Bold,22) coloured(255,0,0)
    endif
    i=i+1
    wend
    drawvline(barindex[lookback])
    
    return
    
    #175765 quote
    keks
    Participant
    Average

    I assume in the settings I need to change lookback from 120 bars to a fixed time? I would also if possible like to define an endtime. Purpose is to only see for a given trading session. If possible I would like to also see what previous trading session looked like etc… but that is secondary importance for now… Thanks again!

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

Volume on Bid/Offer


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
keks @keks Participant
Summary

This topic contains 1 reply,
has 1 voice, and was last updated by keks
4 years, 5 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 08/20/2021
Status: Active
Attachments: No files
Logo Logo
Loading...