Plot numberof renko bars per time period

Questions about MultiCharts and user contributed studies.
AdrianP
Posts: 46
Joined: 02 Sep 2014
Has thanked: 2 times
Been thanked: 1 time

Plot numberof renko bars per time period

Postby AdrianP » 02 Dec 2020

I'd like to plot on my chart, the number of renko bars that have taken place over the past X minutes.
This would update at the close of each new bar.

I believe MC can do this, but cannot find the right set of functions that will enable me to do this.

I would appreicate if support or someone with the know how, can help guide me in the right direction please.

Thanks

AdrianP
Posts: 46
Joined: 02 Sep 2014
Has thanked: 2 times
Been thanked: 1 time

Re: Plot numberof renko bars per time period

Postby AdrianP » 02 Dec 2020

Just to clarify. I'm only after a single number being plotted on the chart in some predefined location.
But it would also be interesting to plot a continuous indicator line to see how much it can vary.
I know back in March 2020, the number of renko bars being plotted, of any size, compared to normal, just went through the roof.

gpw797
Posts: 216
Joined: 04 Mar 2006
Has thanked: 3 times
Been thanked: 7 times

Re: Plot numberof renko bars per time period

Postby gpw797 » 02 Dec 2020

inputs:
Price (Close),
Length (14);

variables:
Renko_Time (0),
MyTime (0),
MyPlot (0),
OldTime ( 0 ),
NewTime (0),
TimeInterval ( 0 ),
MyAvg ( 0 ),
MinutesBetween(0);

OldTime = DateTime[1];
NewTime = DateTime;
TimeInterval =NewTime - OldTime;

MyAvg = AverageFC( TimeInterval, Length ) ;

plot1 (MyAvg, "Renko Time");

AdrianP
Posts: 46
Joined: 02 Sep 2014
Has thanked: 2 times
Been thanked: 1 time

Re: Plot numberof renko bars per time period

Postby AdrianP » 02 Dec 2020

Awesome stuff Thank you....now I am just trying to work out what it is plotting.
The 'close' isn't needed, and had no impact, so I deleted that.
I changed the average to "1" for now, so I can see specifically the value on each bar.
Now, 'DateTime' will be some large value, but you are comparing it to the prior bars DateTime. Is that right?
This isn't what I seek.
I wanted to know, for example, how many renko bars plotted in the past 60 minutes, updated each bar.
Currently when I plot your indicator, it plots a very tiny value of ~0 to.02.
On the RTY 40-20-20 renko chart I am looking at now, the numbers should be in the 10-20 region I think.
Im actually plottig flex renko, but that shouldn't make a difference compared to regular renko.

What I'm expecting to see in the code, is a counter, currenttime and the time X minutes ago.
But there are so many different time functions, my brain goes to mush :)

gpw797
Posts: 216
Joined: 04 Mar 2006
Has thanked: 3 times
Been thanked: 7 times

Re: Plot numberof renko bars per time period

Postby gpw797 » 02 Dec 2020

You could set up data2 to be hours or whatever time period you want to measure and subtract bar numbers on the other data1 (renko data) at beginning and end of bar.

AdrianP
Posts: 46
Joined: 02 Sep 2014
Has thanked: 2 times
Been thanked: 1 time

Re: Plot numberof renko bars per time period

Postby AdrianP » 03 Dec 2020

MC does not correctly deal with Data2 when it comes to Renko bars.
I'd rather not go there at all.
And frankly can't possibly see why it is needed.
How hard can it be to reference X minutes ago, then count the bars?
We do it all the time when using such functions as HighestBar or LowestBar to count the number of bars since an event.

User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Re: Plot numberof renko bars per time period

Postby syswizard » 03 Dec 2020

Well Dude, you just need to compute the time difference going back in time. Of course, this is trivial for time bars, but not so for Renko, Range, Tick, Volume bars. Always remember that DateTime is a double precision floating point value accurate to the millisecond.

Code: Select all

Input: iSecondsAgo(numericsimple) , oActualSeconds(numericRef) ; Vars: vIX(0) , vDeltaSecs(0) , vMax(1000) ; vIX = 0; vDeltaSecs = 0; While vDeltaSecs < iSecondsAgo Begin vIX = vIX + 1; vDeltaSecs = _szDateSecondsDifference(DateTime[vIX],DateTime); if vDeltaSecs >= iSecondsAgo and vIX < vMax Then Break; End; oActualSeconds = vDeltaSecs; _szDateSecondsBarsAgo = Iff(vIX < vMax, vIX, 0);

AdrianP
Posts: 46
Joined: 02 Sep 2014
Has thanked: 2 times
Been thanked: 1 time

Re: Plot numberof renko bars per time period

Postby AdrianP » 03 Dec 2020

When I try to compile your code as a new function, it gives me an error message, saying "assignment is allowed only for variables or array elements".


Return to “MultiCharts”