I'd like to add a feature to this existing code for intraday high low efs.
If current intraday range is <=10.5, I'd like "3/2" text written above price bar the first time it's true (so not every price bar if <=10.5).
If current intraday range >10.5, then "5/4" text above first price bar once true.
Thank you in advance for the assistance.
function preMain() {
setStudyTitle("Day High/Low");
setCursorLabelName("Day's High", 0);
setCursorLabelName("Day's Low", 1);
setPriceStudy(true);
//setStudyMax(20);
//setStudyMin(0);
}
var vFlag = true;
var vHigh = null;
var vLow = null;
var vDay1 = null;
var vDay2 = null;
function main() {
var nState = getBarState();
if (nState == BARSTATE_NEWBAR) {
if (vDay1 == null) {
vDay2 = getDay();
} else {
vDay2 = vDay1;
}
vDay1 = getDay();
if (vDay1 != vDay2) {
vHigh = null;
vLow = null;
vFlag = true;
}
var vHour = getHour();
if (vHour >= 16) {
vFlag = false;
}
}
if (vFlag == true) {
if (vHigh == null) {
vHigh = high();
}
if (vLow == null) {
vLow = low();
}
vHigh = Math.max(high(), vHigh);
vLow = Math.min(low(), vLow);
}
drawTextRelative(-10, vHigh, "High is " + vHigh + " Low is " + vLow, Color.black, Color.red, Text.FRAME | Text.ONTOP | Text.BOLD | Text.RIGHT | Text.TOP, null, null, "OS");
return new Array(vHigh, vLow);
}
If current intraday range is <=10.5, I'd like "3/2" text written above price bar the first time it's true (so not every price bar if <=10.5).
If current intraday range >10.5, then "5/4" text above first price bar once true.
Thank you in advance for the assistance.
function preMain() {
setStudyTitle("Day High/Low");
setCursorLabelName("Day's High", 0);
setCursorLabelName("Day's Low", 1);
setPriceStudy(true);
//setStudyMax(20);
//setStudyMin(0);
}
var vFlag = true;
var vHigh = null;
var vLow = null;
var vDay1 = null;
var vDay2 = null;
function main() {
var nState = getBarState();
if (nState == BARSTATE_NEWBAR) {
if (vDay1 == null) {
vDay2 = getDay();
} else {
vDay2 = vDay1;
}
vDay1 = getDay();
if (vDay1 != vDay2) {
vHigh = null;
vLow = null;
vFlag = true;
}
var vHour = getHour();
if (vHour >= 16) {
vFlag = false;
}
}
if (vFlag == true) {
if (vHigh == null) {
vHigh = high();
}
if (vLow == null) {
vLow = low();
}
vHigh = Math.max(high(), vHigh);
vLow = Math.min(low(), vLow);
}
drawTextRelative(-10, vHigh, "High is " + vHigh + " Low is " + vLow, Color.black, Color.red, Text.FRAME | Text.ONTOP | Text.BOLD | Text.RIGHT | Text.TOP, null, null, "OS");
return new Array(vHigh, vLow);
}
Comment