[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Adding Upper and Lower Horizonal Line to Market Volume Profile



PureBytes Links

Trading Reference Links

Hi,

Does anyone know how to add Upper and Lower Horizonal lines that 
would stop and start each day?  

Also does anyone know how to figure the value areas of the trading 
volume on the following code?

This would be for the next days market values, value settings are 
based on a 70% daily trading volume level.

First find the upper and lower value areas then begin and end the 
horizonal lines in the next days trading. 


Thanks in advance....

Richard



//Market Profile & Market Volume Profile

Formula:
//Market Profile
GraphXSpace = 5;
SetChartOptions(0, chartShowDates);

//===========================

Den = Param("Density", 40, 10, 100, 10);
ShowMP = ParamToggle("Show MP", "No|Yes");
ShowVP = ParamToggle("Show VP", "No|Yes");
StyleMP = ParamStyle("style MP", styleLine, maskAll);
StyleVP = ParamStyle("style VP", styleLine, maskAll);

//===========================
BarsInDay = BarsSince(Day() != Ref(Day(), -1)) + 1;

//===========================
NewDay = Day() != Ref(Day(), 1) OR Cum(1) == BarCount;

//===========================
Bot = TimeFrameGetPrice("L", inDaily, 0);
Top = TimeFrameGetPrice("H", inDaily, 0);
Vol = TimeFrameGetPrice("V", inDaily, 0);

//===========================

Range = Highest(Top-Bot);
Box = Range/Den;
VolumeUnit = Vol/BarsInDay;

for (k = 0; k < Den; k++)            // loop through each line 
(price) starting
at the Lowest price
{
	Line = Bot + k*Box;
	detect = Line >= L & Line <= H;

	if(ShowMP == True)
	{
		CountMPString = IIf(NewDay, Sum(detect, BarsInDay), 
0);
		CountMPString = Ref(ValueWhen(NewDay, CountMPString, 
0), -1);
		MpLine = IIf(CountMPString >= BarsInDay, Line, Null);

		Plot(MPLine, "", colorRed, styleMP);
	}

if(ShowVP == True)
	{
		CountVPString = IIf(NewDay, Sum(detect*V, 
BarsInDay)/VolumeUnit, 0);
		CountVPString = Ref(ValueWhen(NewDay, CountVPString, 
0), -1);
		VpLine = IIf(CountVPString >= BarsInDay, Line + 
Box/4, Null);
//		Plot()
		Plot(VPLine, "", colorBlue, styleVP);
	}
}

Title = "{{NAME}} - {{INTERVAL}} {{DATE}} {{VALUES}} - \\c04 Market 
Profile 
\\c06 Volume Profile";