I've modified one of the previous day OHLC studies so that it just gets the High & Low successfully.
The question I have is how do I get it to just return the highest high and lowest low of the last 3 days? Right now it just gets the High/Low from 3 days ago.
Thanks,
jphillips
Here is the code -
The question I have is how do I get it to just return the highest high and lowest low of the last 3 days? Right now it just gets the High/Low from 3 days ago.
Thanks,
jphillips
Here is the code -
PHP Code:
function preMain() {
setPriceStudy(true);
setStudyTitle("3DayH-L");
setCursorLabelName("3D-H", 0); // High
setCursorLabelName("3D-L", 1); // Low
setDefaultBarStyle(PS_SOLID, 0); // High
setDefaultBarStyle(PS_SOLID, 1); // Low
setDefaultBarFgColor(Color.grey, 1); // High
setDefaultBarFgColor(Color.maroon, 2); // Low
setDefaultBarThickness(3, 0); // High
setDefaultBarThickness(3, 1); // Low
setPlotType(PLOTTYPE_FLATLINES, 0); // High
setPlotType(PLOTTYPE_FLATLINES, 1); // Low
}
var bInit = false;
var xHigh = null;
var xLow = null;
function main() {
if(isMonthly() || isWeekly() || isDaily())
return;
if(bInit == false){
xHigh = high(inv("D"));
xLow = low(inv("D"));
bInit = true;
}
var vHigh = xHigh.getValue(-3);
var vLow = xLow.getValue(-3);
if(vHigh == null || vLow == null)
return;
return new Array (vHigh,vLow);
}
Comment