/***************************************************************************** SCRIPT GENERATES REPORTS OF CLOSE() PRICES AT END OF EACH MINUTE OF A 60 MINUTE CANDLE USING TWO DIFFERENT METHODS - PLAYBACK OF A TIC FILE - ON A LIVE CHART CURRENTLY CANDLE DATE IN QUESTION IS SET MANUALLY USING getMonth(0) == 4 && gDate == 29 && hh == 16 (month, date, hour) TO USE, SET DATE AND HOUR TO ONE HOUR IN FUTURE AND LET RUN LIVE FIRST, ONCE THAT LIVE REPORT HAS BEEN GENERATED OVER THE COURSE OF THAT HOUR, DOWNLOAD ONE DAY OF TIC DATA (I USE GBPJPY) AND PLAY IT BACK TO GENERATE PLAYBACK REPORT. YOU CAN THEN IMPORT THE TWO REPORTS INTO EXCEL TO SEE THE DIFFERENCES *******************************************************************************/ var Rep; var oldMin = null; var txtFlags = Text.ONTOP | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM; function preMain() { setPriceStudy(true); setStudyTitle("playlive"); setShowCursorLabel(false); } function main() { var gDate = getDay(); var hh = hour(); var mm = minute(inv(1)); var ss = second(inv("1s")); if(getMonth(0) == 4 && gDate == 29 && hh == 22 && oldMin != mm && (getBarState() == 1 || getSymbol() == "$PLAYBACK" && mm != 59)){ drawLineRelative( 0, close()+10, 0, close()-10, PS_SOLID, 3, Color.red, "MzxA" ); if(getSymbol() == "$PLAYBACK") Rep = "PlayBack"; if(getSymbol() != "$PLAYBACK" && getBarState() == 1) Rep = "RealTime"; if(mm < 10) mm = "0"+mm; if(ss < 10) ss = "0"+ss; timeNow = hh + ":" + mm + ":" + ss; price = close(); Report(Rep,timeNow,price); debugPrintln("At " + hh + ":" + mm + ":" + ss + ", close() is " + close() + " " + getBarState() + "\n"); oldMin = mm; } } function Report(Rep,timeNow,price){ fpp = new File(Rep+".txt"); if(!fpp.exists()){ fpp.open("at+") fpp.writeln("Time" + "\tPrice"); fpp.close(); } fpp.open("at+") fpp.writeln(timeNow + "\t"+price); fpp.close(); return; }