Tick Speed / Bar Speed  [SOLVED]

Questions about MultiCharts and user contributed studies.
olobay
Posts: 47
Joined: 28 Dec 2011
Has thanked: 17 times

Tick Speed / Bar Speed

Postby olobay » 03 Jul 2016

Hi,

I'm looking for an indicator that would plot in a histogram, the length of time that the current tick bar took to complete. Does anyone have something like that to share or can someone share a link?

Thanks.

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Tick Speed / Bar Speed

Postby TJ » 04 Jul 2016

Hi,

I'm looking for an indicator that would plot in a histogram, the length of time that the current tick bar took to complete. Does anyone have something like that to share or can someone share a link?

Thanks.


try:

Time_s minus Time_s[1]

olobay
Posts: 47
Joined: 28 Dec 2011
Has thanked: 17 times

Re: Tick Speed / Bar Speed

Postby olobay » 04 Jul 2016

This is what I have so far but it's not working when the minute changes and the current bar has a seconds value that is lower than the previous [1] bar, even if the minute value is greater.

Code: Select all

input:
cap(15),
cap.color(darkgray);

if BarType = 0 then
begin
if date = date[1] then
begin
value1 = (time_s - time_s[1]);
if value1 <= cap then
plot1(value1, "tick time")
else
plot2(cap,"Cap", cap.color);
end;
end;
Attachments
No value.png
(53.52 KiB) Downloaded 1289 times

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Tick Speed / Bar Speed

Postby TJ » 08 Jul 2016

This is what I have so far but it's not working when the minute changes and the current bar has a seconds value that is lower than the previous [1] bar, even if the minute value is greater.

Code: Select all

input:
cap(15),
cap.color(darkgray);

if BarType = 0 then
begin
if date = date[1] then
begin
value1 = (time_s - time_s[1]);
if value1 <= cap then
plot1(value1, "tick time")
else
plot2(cap,"Cap", cap.color);
end;
end;
When you copy codes from the internet,
you should paste the complete code.

Why did you edit out the pertinent parts of the code?
Without disclosing what you have done,
you are just sending people off on a wild goose chase.

Also, you should not delete the header, because that's part of the code.

olobay
Posts: 47
Joined: 28 Dec 2011
Has thanked: 17 times

Re: Tick Speed / Bar Speed

Postby olobay » 09 Jul 2016

This is what I have so far but it's not working when the minute changes and the current bar has a seconds value that is lower than the previous [1] bar, even if the minute value is greater.

Code: Select all

input:
cap(15),
cap.color(darkgray);

if BarType = 0 then
begin
if date = date[1] then
begin
value1 = (time_s - time_s[1]);
if value1 <= cap then
plot1(value1, "tick time")
else
plot2(cap,"Cap", cap.color);
end;
end;
When you copy codes from the internet,
you should paste the complete code.
Why did you edit out the pertinent parts of the code?
You are just sending people off on a wild goose chase.

Also, you should not delete the header, because that's part of the code.
I didn't know that comments were pertinent.

Code: Select all

// Tick Speedo
//
// This indicator measures the time it takes to complete a tick or volume bar
// a Short bar denotes an active market.
// when the market is slow, it will take a long time to complete the bar.
// a cap is used to limit the height of the histogram during slow times
//
// pls post your comments and enhancement here:
// http://www.elitetrader.com/vb/showthread.php?s=&threadid=146049&perpage=40&pagenumber=1
//

input:
cap(15),
cap.color(darkgray);

if BarType = 0 then
begin
if date = date[1] then
begin
value1 = (time_s - time_s[1]);
if value1 <= cap then
plot1(value1, "tick time")
else
plot2(cap,"Cap", cap.color);
end;
end;
Help is appreciated.

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Tick Speed / Bar Speed

Postby TJ » 09 Jul 2016

I didn't know that comments were pertinent.

Code: Select all

// Tick Speedo
//
// This indicator measures the time it takes to complete a tick or volume bar
// a Short bar denotes an active market.
// when the market is slow, it will take a long time to complete the bar.
// a cap is used to limit the height of the histogram during slow times
//
// pls post your comments and enhancement here:
// http://www.elitetrader.com/vb/showthread.php?s=&threadid=146049&perpage=40&pagenumber=1
//

input:
cap(15),
cap.color(darkgray);

if BarType = 0 then
begin
if date = date[1] then
begin
value1 = (time_s - time_s[1]);
if value1 <= cap then
plot1(value1, "tick time")
else
plot2(cap,"Cap", cap.color);
end;
end;
Help is appreciated.

Where did you get this code?

olobay
Posts: 47
Joined: 28 Dec 2011
Has thanked: 17 times

Re: Tick Speed / Bar Speed

Postby olobay » 09 Jul 2016

From the EliteTrader forum. Why does it matter where it came from? I have a full lifetime licence for MultiCharts and I came to this forum for help.

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Tick Speed / Bar Speed

Postby TJ » 09 Jul 2016

From the EliteTrader forum. Why does it matter where it came from? I have a full lifetime licence for MultiCharts and I came to this forum for help.
Because that's not the code as posted in EliteTrader.
You butchered it. That's why it does not work.

olobay
Posts: 47
Joined: 28 Dec 2011
Has thanked: 17 times

Re: Tick Speed / Bar Speed

Postby olobay » 09 Jul 2016

The code as it came from EliteTrader did not work for me. TimeToMinutes or TimeToSeconds did not plot correctly for me that's why I came here asking for help.

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Tick Speed / Bar Speed

Postby TJ » 09 Jul 2016

The code as it came from EliteTrader did not work for me. TimeToMinutes or TimeToSeconds did not plot correctly for me that's why I came here asking for help.
Then you should have stated your problem up front in the very beginning,
and let people know that you have edited the code,
so that people do not waste time chasing down a perceived problem.

olobay
Posts: 47
Joined: 28 Dec 2011
Has thanked: 17 times

Re: Tick Speed / Bar Speed

Postby olobay » 09 Jul 2016

This is the code I started with:

Code: Select all

// Tick Speedo
//
// This indicator measures the time it takes to complete a tick or volume bar
// a Short bar denotes an active market.
// when the market is slow, it will take a long time to complete the bar.
// a cap is used to limit the height of the histogram during slow times
//
// pls post your comments and enhancement here:
// http://www.elitetrader.com/vb/showthread.php?s=&threadid=146049&perpage=40&pagenumber=1
//

input:
cap(15),
cap.color(darkgray);

if BarType = 0 then
begin
if date = date[1] then
begin
value1 = (TimeToMinutes(time)-TimeToMinutes(time[1]));
if value1 <= cap then
plot1(value1, "tick time")
else
plot2(cap,"Cap", cap.color);
end;
end;
It did not work. I changed the TimeToMinutes to TimeToSeconds and it did not work. Then I changed the code to this:

Code: Select all

// Tick Speedo
//
// This indicator measures the time it takes to complete a tick or volume bar
// a Short bar denotes an active market.
// when the market is slow, it will take a long time to complete the bar.
// a cap is used to limit the height of the histogram during slow times
//
// pls post your comments and enhancement here:
// http://www.elitetrader.com/vb/showthread.php?s=&threadid=146049&perpage=40&pagenumber=1
//

input:
cap(15),
cap.color(darkgray);

if BarType = 0 then
begin
if date = date[1] then
begin
value1 = (time_s - time_s[1]);
if value1 <= cap then
plot1(value1, "tick time")
else
plot2(cap,"Cap", cap.color);
end;
end;
This is much closer to working except for when the minute changes and the current bar has a seconds value that is lower than the previous [1] bar, even if the minute value is greater.

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Tick Speed / Bar Speed

Postby TJ » 09 Jul 2016

When you say "It did not work",
you have to describe what did not work.

No plot?
wrong color?
wrong type?
plotted wrong? how?
screen shots?
what is the instrument?
what is the chart interval?
what do you mean by wrong? wrong scale? wrong interval? wrong size?
how often is the "wrong"? all the time? intermittently wrong?
where did it go wrong? all the symbols or just one?
Is it "wrong" with all the chart intervals? or just one type?
when did it go wrong? in real time? off-line? during backtest?

You have to think through your problem.

Simply saying "It did not work" will not get you to the solution you desired.
You have to describe what did not work for you.

Simply saying "It did not work" will not turn a good code into bad code.
Butchering the code does not help.
You should begin this problem-solving process with your implementation, not with the code.

olobay
Posts: 47
Joined: 28 Dec 2011
Has thanked: 17 times

Re: Tick Speed / Bar Speed  [SOLVED]

Postby olobay » 10 Jul 2016

Thanks for your help. I figured it out. This gives me want I want.

Code: Select all

// Tick Speedo
//
// This indicator measures the time it takes to complete a tick or volume bar
// a Short bar denotes an active market.
// when the market is slow, it will take a long time to complete the bar.
// a cap is used to limit the height of the histogram during slow times
//
// pls post your comments and enhancement here:
// http://www.elitetrader.com/vb/showthread.php?s=&threadid=146049&perpage=40&pagenumber=1
//

input:
cap(15),
cap.color(darkgray);

if BarType = 0 then
begin
if date = date[1] then
begin
value1 = (TimeToSeconds(time_s)-TimeToSeconds(time_s[1]));
if value1 <= cap then
plot1(value1, "tick time")
else
plot2(cap,"Cap", cap.color);
end;
end;

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Tick Speed / Bar Speed

Postby TJ » 10 Jul 2016

Thanks for your help. I figured it out. This gives me want I want.
This is a community,
you should share the error that caused the problem
and how this code solved the problem.
This is how we learn from each others.

olobay
Posts: 47
Joined: 28 Dec 2011
Has thanked: 17 times

Re: Tick Speed / Bar Speed

Postby olobay » 17 Jul 2016

My issue was that I wanted to get a bar speed with a resolution in seconds. The TimeToMinutes only gave minute resolution as does the Time reserved word. I needed to get both of those to seconds resolution. TimeToSeconds obviously does that but then I needed to change the Time to Time_s which is seconds. That solved my issue.


Return to “MultiCharts”