Turning an indicator into MTF?

Hooge

New member
how do you get your aggregated time to be dynamic on what it is being used with.

Take an indicator for example.
you want to use your indicator on not only 5 min charts but also 30 min or 1hr charts. how do you accomplish this without having to change the script for the Aggregated time every time?

Code:
#1hour script

def agg1 = AggregationPeriod.HOUR;

def highPrice = high(period = agg1);

def lowPrice = low(period = agg1);
 

BenTen

Administrative
Staff
VIP
It looks like you're trying to create an MTF version out of an existing indicator.

Take this script as an example:

Code:
# MTF Moving Average

input Period = aggregationPeriod.HOUR;
input AvgType = averageType.EXPONENTIAL;
input Length = 50;
input priceclose = close;

plot AVG = MovingAverage(AvgType, close(period = Period), Length);
AVG.setdefaultcolor(color.yellow);

Or this one.

It's important to note that you can only display a higher timeframe onto the lower timeframe chart. The opposite can not be done.
 

Similar threads

Top