When a chart closed at a new high in the last X bars and setComputeOnClose(true), the last bar does not appear to be counted towards the high. Problem does not occur on llv.
I dont see anything wrong with the code.
I have an image of the issue but am not sure where to upload it.
ick ... cant get rid of the html formating in the php/code ..
best I can do.
-Terry
I dont see anything wrong with the code.
I have an image of the issue but am not sure where to upload it.
PHP Code:
var bInit = false;
var xATR = null;
function preMain() {
setPriceStudy(true);
setStudyTitle("Off by 1 ?");
setShowCursorLabel(false);
setComputeOnClose(true);
//END preMain
}
function main( ) {
var Length = 8 ;
// misc Local vars
var nHHigh;
var nLLow;
// appears to be an off by 1 error in hhv&llv that exlude last bar at EOD?
nHHigh = hhv( Length, high() );
nLLow = llv( Length, low() );
clearLines();
clearText();
debugPrint("nHHigh = " + nHHigh + " : nLLow = " + nLLow + "\n" );
drawLineAbsolute( -(2 * Length), nHHigh, 2, nHHigh, PS_SOLID, 3, Color.green, 10 );
drawLineAbsolute( -(2 * Length), nLLow, 2, nLLow, PS_SOLID, 3, Color.maroon, 20 );
drawTextAbsolute( +2, nHHigh, "High: " + nHHigh, Color.aqua, null, Text.ONTOP, null, 15, 11 );
drawTextAbsolute( +2, nLLow, "Low: " + nLLow, Color.aqua, null, Text.ONTOP, null,15, 21 );
return ;
//END main
}
best I can do.
-Terry
Comment