Howdy folks,
I've got a tricky problem, at least as far as my abilities and experience with "time" allows.
I use the following code on a 5 second chart to get time to my ten minute trading charts and it works fine in both real time and while doing playbacks of tic files.
I use the following code in my 10 minute charts to get the time from the 5 second charts. I do this as i need minutes and seconds which of course the 10 minute charts won't provide. I know that i can use "getMinute(inv("5s"))" and i do for real time but it slows playbacks down and doesn't solve my problem anyhow.
This works fine in both real time and playback .... my problem is when I fast forward or "jump" through the tic file. When i do this, i do get the correct highs and lows but the time that they occured at is always the last tic of the playback tic file. Does anyone have any ideas on how I can track the high and low and the time at which they occured while doing a "jump through" of a tic file ?
Much appreciated ...
Chris
I've got a tricky problem, at least as far as my abilities and experience with "time" allows.
I use the following code on a 5 second chart to get time to my ten minute trading charts and it works fine in both real time and while doing playbacks of tic files.
PHP Code:
function preMain(){
setPriceStudy(true);
setShowTitleParameters(false);
setComputeOnClose();
setStudyTitle("1 second data feed");
setShowCursorLabel(false);
}
function main(){
setGlobalValue ("mydata", new int_data(0));
}
function int_data(n){
this.year = getYear(n);
this.month = getMonth(n)-1;
this.day = getDay(n);
this.hour = getHour(n);
this.minute = getMinute(n);
this.second = getSecond(n);
}
PHP Code:
var THT;
var TLT;
var TH = null;
var TL = null;
var TSTH;
var TSTL;
var txtFlags = Text.ONTOP | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM;
function preMain(){
setPriceStudy(true);
setShowTitleParameters(false);
setShowCursorLabel(false);
setColorPriceBars(true);
setDefaultPriceBarColor(Color.black);
}
function main()
{
if(getSymbol() == "$PLAYBACK"){
pData = getGlobalValue("mydata");
vBarYear = pData.year;
vBarMonth = pData.month;
vBarDay = pData.day;
vBarHour = pData.hour;
vBarMinutes = pData.minute;
vBarSeconds = pData.second;
myDate = new Date(pData.year,pData.month-1,pData.day,pData.hour,pData.minute,pData.second);
}
if(TH == null || high() > TH){
TH = high();
THT = myDate;
}
if(TL == null || low() < TL){
TL = low();
TLT = myDate;
}
TSTH = (myDate.getTime() - THT.getTime())/60000;
TSTL = (myDate.getTime() - TLT.getTime())/60000;
drawTextAbsolute(500, 50, "High is " + TH + ", High Date = " + THT + ", since high is " + TSTH +
" minutes, Low is " + TL + ", Low Date = " + TLT + ", since low is " + TSTL +
" minutes", Color.blue, null, Text.BOLD | txtFlags, "Verdanna", 22, ("timer"));
drawTextAbsolute(500, 20, "Currently it is " + myDate, Color.blue, null, Text.BOLD | txtFlags, "Verdanna", 22, ("timernow"));
}
This works fine in both real time and playback .... my problem is when I fast forward or "jump" through the tic file. When i do this, i do get the correct highs and lows but the time that they occured at is always the last tic of the playback tic file. Does anyone have any ideas on how I can track the high and low and the time at which they occured while doing a "jump through" of a tic file ?
Much appreciated ...
Chris
Comment