Skip to content

Instantly share code, notes, and snippets.

@botany02
Created February 6, 2019 02:06
Show Gist options
  • Save botany02/9b67899c1928e956ca7c2cc53c28bf04 to your computer and use it in GitHub Desktop.
Save botany02/9b67899c1928e956ca7c2cc53c28bf04 to your computer and use it in GitHub Desktop.
Cumulative Volume for Intraday
_SECTION_BEGIN("Cumulative Volume");
/*
To get cumulative Volume for intraday, we need to Sum Volume from the beginning bar of the Day
Example :
9:15 - volume(9:15)
9:20 - volume(9:15+9:20)
9:25 -volume(9:15+9:20+9:25)
1. Get start bar of the day
2. Get cumulative number of bars from first bar of the day
3. Use sum function
*/
BarT = BarIndex() - Nz(ValueWhen(Day()!= Ref(Day(),-1) ,BarIndex()),0) + 1;
CumVol = Sum(V,BarT);
GfxSetBkMode(0);
GfxSelectFont( "Georgia", 12, 800, False );
GfxSetTextColor( colorYellow );
GfxTextOut( "CumVol: "+CumVol, 5, 100 );
_SECTION_END();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment