Created
July 1, 2017 10:39
-
-
Save marketcalls/93131e1e3dafddadcf7f871cef290bee to your computer and use it in GitHub Desktop.
Intraday Volume Profile Distribution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Coded by Rajandran R | |
//Author - Marketcalls | |
//Date : 01st Jan 2017 | |
_SECTION_BEGIN("Intraday Volume Profile Distribution"); | |
SetChartOptions(0,chartShowArrows|chartShowDates); | |
// Implementation of Intraday Volume Ladder Distribution overlay using PriceVolDistribution and low-level graphics | |
bi = BarIndex(); | |
//Bars_so_far_today = 1 + BarsSince( Day() != Ref(Day(), -1)); | |
StartBar = ValueWhen(Day() != Ref(Day(),-1), BarIndex(),1); | |
TPOSize = Param("TPO Size",1,0.01,1000,0.01); //Set TPO Size | |
LotSize = Param("Lot Size",75,1,50000,1); // Set LotSize | |
sdvb = LastValue(Startbar); | |
fvb = FirstVisibleValue( bi ); | |
lvb = LastVisibleValue( bi ); | |
TH = TimeFrameGetPrice( "H", inDaily, 0 ); | |
TL = TimeFrameGetPrice( "L", inDaily, 0 ); | |
tbin = LastValue(ceil(TH-TL))/TPOSize; | |
mx = PriceVolDistribution( H, L, V, tbin, true, sdvb, lvb ); | |
GfxSetCoordsMode( 1 ); | |
GfxSelectPen( colorRed ); | |
bins = MxGetSize( mx, 0 ); | |
largest = mx[0][1]; | |
lbar = Null; | |
for( i = 0; i < bins; i++ ) | |
{ | |
if (largest < mx[i][1]) | |
{ | |
largest = mx[i][1]; | |
lbar = i; | |
} | |
} | |
for( i = 0; i < bins; i++ ) | |
{ | |
price = mx[ i ][ 0 ]; // price level | |
relvolume = mx[ i ][ 1 ]; // relative volume 0..1 | |
relbar = relvolume/LotSize; | |
GfxMoveTo( fvb, price ); | |
//GfxLineTo( fvb + relbar, price ); | |
GfxSelectFont("Tahoma", 8, 300 ); | |
if(i==lbar) | |
{ | |
GfxSetBkColor( colorred ); | |
} | |
else | |
{ | |
GfxSetBkColor( colorblue ); | |
} | |
GfxSetTextColor( colorwhite ); | |
str = NumToStr(ceil(relbar),1); | |
len = StrLen(str); | |
if(len == 3) | |
{ | |
str = str +" "; | |
} | |
if(len == 4) | |
{ | |
str = str +" "; | |
} | |
if(len == 5) | |
{ | |
str = str +" "; | |
} | |
GfxTextOut(str, fvb, price ); | |
} | |
Plot( C, "Price", colorDefault, stylecandle ); | |
_SECTION_END(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment