I am trying to create an Indicator that tracks the difference between open/Close based on custom times to display on an intraday chart. I am able to show just the open or the close, but seem to be getting something wrong when I try to display the difference. Below is the code as I currently have it (not working). Have I just made a couple of small errors here, or am I way off track?
Thanks in Advance
Thanks in Advance
Code:
function preMain() { setPriceStudy(false); setStudyTitle("ES BASE Price"); setCursorLabelName("ES BASE Price", 0); setDefaultBarStyle(PS_SOLID, 0); setDefaultBarFgColor(Color.red, 0); setDefaultBarThickness(2, 0); setPlotType(PLOTTYPE_LINE, 0); } var DOpen=null var DClose=null var NKD_sym = "NKD U2"; function main (){ if (getHour(0,sym(NKD_sym)) == 8 && getMinute(0,sym(NKD_sym)) == 30-getInterval(0,sym(NKD_sym))) { // Is your 8:30am-inv bar DOpen= close(0,sym(NKD_sym)); } if (getHour(0,sym(NKD_sym)) == 20 && getMinute(0,sym(NKD_sym)) == 0-getInterval(0,sym(NKD_sym))) { // Is your 8:30am-inv bar DClose= close(0,sym(NKD_sym)) - DOpen(); } return DClose; }
Comment