We are looking for a count down clock to display on advanced charts. It would indicate the time remaining in the current candle or bar until it is closed. This would enable more precise analysis of chart indicators.
Announcement
Collapse
No announcement yet.
Countdown Clock
Collapse
X
-
This will show the % of the bar yet to be completed in the cursor window.
Needs some sprucing up, but seems to work for all intervals that are non tick or non volume, ie 15 min. 500tand 500v etc will not work.
function preMain(){
setPriceStudy(true);
}
function main(){
today =new Date;
CurHr =today.getHours();
CurMin =today.getMinutes();
CurSec =today.getSeconds();
curTime=CurHr*3600+CurMin*60+CurSec;
start=9*3600+30*60;
pctRemain=((curTime-start))%(getInterval()*60);
pctRemain=(100*(1-pctRemain/(getInterval()*60))).toFixed(0);
return pctRemain;
}
-
this should show the seconds remaining in the current bar
function preMain(){
setPriceStudy(true);
}
function main(){
today =new Date;
CurHr =today.getHours();
CurMin =today.getMinutes();
CurSec =today.getSeconds();
curTime=CurHr*3600+CurMin*60+CurSec;
start=9*3600+30*60;
pctRemain=((curTime-start))%(getInterval()*60)*1;
//pctRemain=(pctRemain*(getInterval()*60)).toFixed(0 );
return pctRemain;
}
Comment
-
This will count the number of seconds remaining in the current bar and report the results in the Formula Output window.
I forget how to report the answer in the cursor window, perhaps some one else will remind us.
function preMain(){
setPriceStudy(true);
}
function main(){
today =new Date;
CurHr =today.getHours();
CurMin =today.getMinutes();
CurSec =today.getSeconds();
curTime=CurHr*3600+CurMin*60+CurSec;
Start=9*3600+30*60;
pctRemain=(getInterval()*60)-((curTime-Start))%(getInterval()*60)*1;
debugPrintln(pctRemain);
return pctRemain;
}
Comment
Comment