How to make an MTF version of a custom script?


I've been looking this up, and from what I understand you have to add the aggregation values to all references to candles. This is the script I'm referring to:

Here's the actual code:

# QQE Indicator
# Converted by Kory Gill for BenTen at
# Original

declare lower;

input RSI_Period = 20;
input Slow_Factor = 5;
input QQE = 4.236;
input levelLine  = 35;
plot Level = levelLine;

def Wilder_Period = RSI_Period * 2 - 1;
def vClose = close;

def rsi = RSI(price = vClose, length = RSI_Period).RSI;
def rsi_ma = MovingAverage(AverageType.EXPONENTIAL, rsi, Slow_Factor);
def atr_rsi = AbsValue(rsi_ma[1] - rsi_ma);
def atr_rsi_ma = MovingAverage(AverageType.EXPONENTIAL, atr_rsi, Wilder_Period);
def dar = MovingAverage(AverageType.EXPONENTIAL, atr_rsi_ma, Wilder_Period) * QQE;

def DeltaFastAtrRsi = dar;
def RSIndex = rsi_ma;
def newshortband =  RSIndex + DeltaFastAtrRsi;
def newlongband = RSIndex - DeltaFastAtrRsi;

def longband = if RSIndex[1] > longband[1] and RSIndex > longband[1]
               then max(longband[1],newlongband)
               else newlongband;

def shortband = if RSIndex[1] < shortband[1] and  RSIndex < shortband[1]
                then min(shortband[1], newshortband)
                else newshortband;

def trend = if Crosses(RSIndex, shortband[1])
            then 1
            else if Crosses(longband[1], RSIndex)
            then -1
            else if !IsNAN(trend[1])
            then trend[1]
            else 1;

def FastAtrRsiTL = if trend == 1

Essentially what I want is to be able to change the aggregations, I don't need like 3 different aggregations. Just 1 for the base code itself. I tried looking through other MTF codes and added these:

input agg = AggregationPeriod.fifteen_min;
plot c = close(period = agg);

That didn't work though. I don't really see references to candles really in this script so I'm not sure where to add this. I'd appreciate if someone could help me figure this out.

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

@fungus12 Change vClose to higher agg.
Hm that works but now there's another issue. Here's what the QQE looks like at a 15m aggregation on a 3m chart:


But here's how the regular QQE looks on a 15m chart:


Is there any way to remedy that so they align more closely or is this just an inevitable byproduct of having a longer aggregation on a small timeframe?

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
411 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.