Page 1 of 1

time passed to complete a bar (range-ticks-volume) indi  [SOLVED]

Posted: Sep 27 2015
by Grigorios
Hello,

I am looking for an indicator to show me as histogram the elapsed time in seconds for a volume or range bar to complete...does anyone have this ?

thanks in advance

Re: time passed to complete a bar (range-ticks-volume) indi

Posted: Sep 27 2015
by TJ
Hello,

I am looking for an indicator to show me as histogram the elapsed time in seconds for a volume or range bar to complete...does anyone have this ?

thanks in advance

Code: Select all


plot1( Time_s - Time_s[1] );

Re: time passed to complete a bar (range-ticks-volume) indi

Posted: Sep 28 2015
by Grigorios
Thanks TJ,

The indicator seems to add previous bars time on every hourly change...please take a look
at the picture...

Re: time passed to complete a bar (range-ticks-volume) indi

Posted: Sep 28 2015
by TJ
Give this a try:

Code: Select all


Plot10(( datetime - datetime[1] ) *86400 );

Re: time passed to complete a bar (range-ticks-volume) indi

Posted: Sep 28 2015
by Grigorios
now there is a big reading for the first bar of each day...
but not for all days...strange..

Re: time passed to complete a bar (range-ticks-volume) indi

Posted: Sep 28 2015
by TJ
now there is a big reading for the first bar of each day...
but not for all days...strange..
If you are not running a 24 hr chart, this will happen.

You have to add a condition to take the 1st calculation from the session opening instead of the previous bar.

Re: time passed to complete a bar (range-ticks-volume) indi

Posted: Sep 29 2015
by Grigorios
Hi TJ,
please take a look at this code...what you think..

Code: Select all

var: timelapsed(0);

if date <> date[1] then

timelapsed = time_s - (sessionstarttime(1,1)* 100)
else
timelapsed = (datetime - datetime[1]) * 86400;

Plot10(timelapsed);

Re: time passed to complete a bar (range-ticks-volume) indi

Posted: Sep 29 2015
by TJ
Hi TJ,
please take a look at this code...what you think..

Code: Select all

var: timelapsed(0);

if date <> date[1] then

timelapsed = time_s - (sessionstarttime(1,1)* 100)
else
timelapsed = (datetime - datetime[1]) * 86400;

Plot10(timelapsed);
Looks good !