Input length increase automatically based on agg?

JP782

New member
Is there a way to have the length I set increase by 1 every X mins(whatever the agg time is set to)?
example: I set length to 384 at 9:30am, at 9:35am the length will automatically increase to 385 and so on every five minutes(or whatever the agg period is being used)?
The "why" for this
Im running MTF standard deviation 5min on a 1min chart and I have to adjust the length (bar count**) every 5mins to display the devs correctly
Code:
def nan = Double.NaN;
input FiveMinLength = 101;
def FiveMinRegression = Inertia(close(period = aggregationPeriod.FIVE_MIN), FiveMinLength);
def FiveMinStdDev = stdev(close(period = aggregationPeriod.FIVE_MIN), FiveMinLength);
** this is script I have running on chart to know what length to use
def BN = BarNumber();
AddLabel(yes,BN, color.DARK_ORANGE);
 
Last edited by a moderator:

barbaros

Administrator
Staff member
It is better for you to input the time and take a delta of current time and the inputed time to figure out how many increments you need to add.
 

JP782

New member
It is better for you to input the time and take a delta of current time and the inputed time to figure out how many increments you need to add.
:oops:?
There's no way to define length by using barnumber and aggregation?

THIS IS WRONG just using it as an example:
def length = barnumber(),period = aggregation.five_min;
 

barbaros

Administrator
Staff member
barnumber() is just a number that counts up from the first bar shown on the chart.
Aggregation period is in milliseconds.

Apples and oranges.
 

JP782

New member
Needing approval for every post/reply/comment is unproductive (we're dealing w/time sensitive issues at times) and completely unnecessary..
 
Top