Hi,
I have modified the formula of the low of the day to get the low of the previous 3-min candle as i wanted, but when i get a new low, the previous one is still showing on the chart.
How can i modify the code so that it only shows the low of the previous candle and not all of the previous lows before it?
The current code is below
function preMain() {
setPriceStudy(true);
setStudyTitle("Prev Low (PL)");
setCursorLabelName("PL");
setDefaultBarStyle(PS_SOLID);
setDefaultBarFgColor(Color.RGB(0x00,0x94,0xFF), 0);
setDefaultBarThickness(2);
setPlotType(PLOTTYPE_FLATLINES);
}
var bInit = false;
var xLow = null;
function main() {
if(isMonthly() || isWeekly() || isDaily())
return;
if(bInit == false){
xLow = low(inv("3"));
bInit = true;
}
var vLow = xLow.getValue(-1);
if(vLow == null)
return;
return (vLow);
}
I have modified the formula of the low of the day to get the low of the previous 3-min candle as i wanted, but when i get a new low, the previous one is still showing on the chart.
How can i modify the code so that it only shows the low of the previous candle and not all of the previous lows before it?
The current code is below
function preMain() {
setPriceStudy(true);
setStudyTitle("Prev Low (PL)");
setCursorLabelName("PL");
setDefaultBarStyle(PS_SOLID);
setDefaultBarFgColor(Color.RGB(0x00,0x94,0xFF), 0);
setDefaultBarThickness(2);
setPlotType(PLOTTYPE_FLATLINES);
}
var bInit = false;
var xLow = null;
function main() {
if(isMonthly() || isWeekly() || isDaily())
return;
if(bInit == false){
xLow = low(inv("3"));
bInit = true;
}
var vLow = xLow.getValue(-1);
if(vLow == null)
return;
return (vLow);
}