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

[amibroker] Trying to figure minutes in code.



PureBytes Links

Trading Reference Links

I'm trying to figure the minutes in the Value Area in the code below:
Valua Area is area between VAHigh and VALow.

(1) Figure the minutes in Value Area and place results in Title.
(2) If out of the Value Area then 0


Thanks,

RichardF


_SECTION_BEGIN("RichardF - Value Area based of Price");
// Value Area Based On Price
// by Richard Foxworth

Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | 
ParamStyle("Style") | GetPriceStyle() ); 

VAinthearea2 = 0;

BI   = BarIndex();
LVBI = LastValue(BI);
TN   = TimeNum();

Bot = TimeFrameGetPrice("L", inDaily, -1);
Top = TimeFrameGetPrice("H", inDaily, -1);


percent1 = .70;
CL = (Top + Bot)/2;
StdDev = (Top - Bot)/2;
UValue = CL + StdDev * percent1;
LValue = CL - StdDev * percent1;
VAHigh = UValue;
VALow = LValue;

Plot(IIf(tn >= 83000 AND tn <= 145900, UValue, Null), "VA-H", 
colorBlue,styleLine|styleNoRescale);
Plot(IIf(tn >= 83000 AND tn <= 145900, LValue, Null), "VA-H", 
colorLightBlue,styleLine|styleNoRescale);


VAinthearea = IIf(C < VAHigh AND C > VALow, 1, 0);
VAinthearea2 = WriteIf(C < VAHigh AND C > VALow, "yes", "no");

// Figure Minutes in Value Area

x = VAinthearea; //Edit 
VAminutes = x; //Edit 


Title = Name ( ) + ", " + Date ( ) + " - " +
"\n " + "VA in the Area = " + VAinthearea +
"\n " + "VA in the Area = " + VAinthearea2 +
"\n " + "Minutes in Value Area = " + VAminutes ;
_SECTION_END();



Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.13.27/517 - Release Date: 11/3/2006