can anyone tell me what's wrong with this code. misses step 5 to get rawtime
//DELL 5 min chart, Time Template 1 day, PC time Zone GMT -8 Pacific Time
//DELL 5 min chart, Time Template 1 day, PC time Zone GMT -8 Pacific Time
Code:
var bInit = false; function preMain() { setPriceStudy(true); setShowTitleParameters(false); setShowCursorLabel(true); } var ssLast = null; var ssOpen = null; function main() { if(getBarState() == BARSTATE_NEWBAR) { var ssSymbol = "SPY"; db("1.ssSymbol",ssSymbol); var chInterval = getInterval(); db("2.chInterval",chInterval) var chIndex = getCurrentBarIndex(); db("3.chIndex",chIndex); ssLast = getValueAbsolute("Close", chIndex, ssSymbol + "," + chInterval); db("4.ssLast",ssLast); if(ssOpen == null || getDay(-1) != getDay(0)) { var chOpenRaw = getValue("rawtime",chIndex); db("5.chOpenRaw",chOpenRaw); var chOpenIndex = getFirstBarIndexOfDay(chOpenRaw); db("6.openindx",chOpenIndex); if (chOpenIndex != null) { ssOpen = getValueAbsolute("Open", chOpenIndex, ssSymbol + "," + chInterval); db("7.ssOpen",ssOpen); } } } return null; } function db(a,b,c,d,e,f,g,h,i) { var str = "[" + String("0"+getMonth()).slice(-2) + "/" + String("0"+getDay()).slice(-2) + " " + String("0"+getHour()).slice(-2) + ":" + String("0"+getMinute()).slice(-2) + "]"; str += ","; if (a != null) str += a; str += ","; if (b != null) str += b; str += ","; if (c != null) str += c; str += ","; if (d != null) str += d; str += ","; if (e != null) str += e; str += ","; if (f != null) str += f; str += ","; if (g != null) str += g; str += ","; if (h != null) str += h; str += ","; if (i != null) str += i; debugPrintln(str); return; }
Comment