QQE (Quantitative Qualitative Estimation) for ThinkorSwim

for Bearish scan, you need to add another study in you scan setup and change this 2 line

Code:
#plot CrossAbove = if rsi_ma crosses above FastAtrRsiTL then 1 else 0;
plot CrossBelow = if rsi_ma crosses below FastAtrRsiTL then 1 else 0;

this way you can scan both way!
mbarcala; got it thanks;
Is this Correct?
#plot CrossAbove = if rsi_ma crosses above FastAtrRsiTL then 1 else 0;
plot CrossBelow = if rsi_ma crosses below FastAtrRsiTL then 1 else 0;
#plot Above = if rsi_ma > FastAtrRsiTL then 1 else 0;
#plot Below = if rsi_ma < FastAtrRsiTL then 1 else 0;

What are the other two lines at the bottom, currently not active?
 
mbarcala; got it thanks;
Is this Correct?
#plot CrossAbove = if rsi_ma crosses above FastAtrRsiTL then 1 else 0;
plot CrossBelow = if rsi_ma crosses below FastAtrRsiTL then 1 else 0;
#plot Above = if rsi_ma > FastAtrRsiTL then 1 else 0;
#plot Below = if rsi_ma < FastAtrRsiTL then 1 else 0;

What are the other two lines at the bottom, currently not active?
they are the same of the 2 first lines, delete them!
 
qLgSxk3.png

AFNqpDp.png


thinkScript Code

Code:
# QQE Indicator
# Converted by Kory Gill for BenTen at useThinkScript.com
# Original https://www.tradingview.com/script/zwbe2plA-Ghosty-s-Zero-Line-QQE/

declare lower;

input RSI_Period = 20;
input Slow_Factor = 5;
input QQE = 4.236;

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
                   then longband
                   else shortband;

plot pFastAtrRsiTL = FastAtrRsiTL;
plot pRsiMa = rsi_ma;
plot line50 = 50;

pFastAtrRsiTL.SetDefaultColor(CreateColor(225,109,47));
pRsiMa.SetDefaultColor(CreateColor(113,225,180));

Learn more about the QQE indicator and how to trade it:
Script looks dope! What was the name of the indicator again in the second picture that has the blue lines showing the bull flag and support and resistance lines? Thanks!
 
qLgSxk3.png

AFNqpDp.png


thinkScript Code

Code:
# QQE Indicator
# Converted by Kory Gill for BenTen at useThinkScript.com
# Original https://www.tradingview.com/script/zwbe2plA-Ghosty-s-Zero-Line-QQE/

declare lower;

input RSI_Period = 20;
input Slow_Factor = 5;
input QQE = 4.236;

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
                   then longband
                   else shortband;

plot pFastAtrRsiTL = FastAtrRsiTL;
plot pRsiMa = rsi_ma;
plot line50 = 50;

pFastAtrRsiTL.SetDefaultColor(CreateColor(225,109,47));
pRsiMa.SetDefaultColor(CreateColor(113,225,180));

Learn more about the QQE indicator and how to trade it:
Hi Ben...great indicator. Just coming across it now. Thanks for posting. Could you help me add some generator signals to the following conditions? I usually use the conditional wizard, but it won't let me since it's not a native study to TOS. I'd like to get notified when each of the following conditions occurs and put it on a lower study for:

  1. When pRSIma crosses above line50
  2. When pRSIma crosses below line50
  3. When pRSIma crosses below 65
  4. When pRSIma crosses above 35
Appreciate any help --ryan
 
Hi Ben...great indicator. Just coming across it now. Thanks for posting. Could you help me add some generator signals to the following conditions? I usually use the conditional wizard, but it won't let me since it's not a native study to TOS. I'd like to get notified when each of the following conditions occurs and put it on a lower study for:

  1. When pRSIma crosses above line50
  2. When pRSIma crosses below line50
  3. When pRSIma crosses below 65
  4. When pRSIma crosses above 35
Appreciate any help --ryan
Code:
plot line35 = 35;
line35.SetDefaultColor(Color.gray);
plot line65 = 65;
line65.SetDefaultColor(Color.gray);

plot upArrow1 = pRSIma crosses above line50;
upArrow1.SetPaintingStrategy(PaintingStrategy.Arrow_UP);
upArrow1.SetDefaultColor(Color.green);

plot dnArrow1 = pRSIma crosses below line50;
dnArrow1.SetPaintingStrategy(PaintingStrategy.Arrow_DOWN);
dnArrow1.SetDefaultColor(Color.red);

plot upArrow2 = pRSIma crosses above 35;
upArrow2.SetPaintingStrategy(PaintingStrategy.Arrow_UP);
upArrow2.SetDefaultColor(Color.green);

plot dnArrow2 = pRSIma crosses below 65;
dnArrow2.SetPaintingStrategy(PaintingStrategy.Arrow_DOWN);
dnArrow2.SetDefaultColor(Color.red);
 
Code:
plot line35 = 35;
line35.SetDefaultColor(Color.gray);
plot line65 = 65;
line65.SetDefaultColor(Color.gray);

plot upArrow1 = pRSIma crosses above line50;
upArrow1.SetPaintingStrategy(PaintingStrategy.Arrow_UP);
upArrow1.SetDefaultColor(Color.green);

plot dnArrow1 = pRSIma crosses below line50;
dnArrow1.SetPaintingStrategy(PaintingStrategy.Arrow_DOWN);
dnArrow1.SetDefaultColor(Color.red);

plot upArrow2 = pRSIma crosses above 35;
upArrow2.SetPaintingStrategy(PaintingStrategy.Arrow_UP);
upArrow2.SetDefaultColor(Color.green);

plot dnArrow2 = pRSIma crosses below 65;
dnArrow2.SetPaintingStrategy(PaintingStrategy.Arrow_DOWN);
dnArrow2.SetDefaultColor(Color.red);
So great! Thank you Mbarcala...this teaches me how to do again in the future, but for now you saved my butt. appreciate it SO much.
 
Do you add this to the original script? Please can you post a picture?
For sure...I added the script at the bottom of the original study and then created a new study using it, and called it QQESignal as a new study. I kept the original study void of any signals on top (in the lower studies region) and then added this study below (also in the lower studies region of TOS), but turned off the oscillator on the new study so that all it was was the signals. That's how I prefer to see it personally (as opposed to them sharing the same lower region...too cluttered)...I don't know how to add an image here. It's asking me to give the image link from an HTTP address...? I took a screenshot so I'm happy to upload it somehow...just not sure how.
 
For sure...I added the script at the bottom of the original study and then created a new study using it, and called it QQESignal as a new study. I kept the original study void of any signals on top (in the lower studies region) and then added this study below (also in the lower studies region of TOS), but turned off the oscillator on the new study so that all it was was the signals. That's how I prefer to see it personally (as opposed to them sharing the same lower region...too cluttered)...I don't know how to add an image here. It's asking me to give the image link from an HTTP address...? I took a screenshot so I'm happy to upload it somehow...just not sure how.
Here is more detail on inserting images https://usethinkscript.com/threads/how-to-insert-image-in-a-post-thread.277/#post-1609

Thanks
 
For sure...I added the script at the bottom of the original study and then created a new study using it, and called it QQESignal as a new study. I kept the original study void of any signals on top (in the lower studies region) and then added this study below (also in the lower studies region of TOS), but turned off the oscillator on the new study so that all it was was the signals. That's how I prefer to see it personally (as opposed to them sharing the same lower region...too cluttered)...I don't know how to add an image here. It's asking me to give the image link from an HTTP address...?
 
LsM5sEX.png

Green spikes = long
Red spikes = short
Green bar = buy a short position that was oversold and trend is over
Red bar = sell a long position that was bought and trend is over
 
LsM5sEX.png

Green spikes = long
Red spikes = short
Green bar = buy a short position that was oversold and trend is over
Red bar = sell a long position that was bought and trend is over
Can you please post the exact code(s) you have shown in the picture for QQE and QQESignal?
 
I simply added the code provided by mbarcala to the end of the QQE script originally posted and created a new study. From there you need to add the study to your lower charts. From there you need to customize it to look however you want..make sense?
 
and the 35 line and 65 line are my own headrooms...depending on the security you may want to adjust it a little lower. Any higher I find and you risk not getting enough signals that are overbought or oversold....ie, 70 and 30 weren't giving me enough signals depending on the security or future contract
 
This is a great signal & it seems to work with highest %win rate on hourly. Awesome that it shows # of orders in a time frame & the P/L along side.
Is there a scan for index's this would for for? Specifically the NDX, SPX, RUT? Overnight action on QQQ,SPY & IWM seems to obscure the results. Below is the code I use for most accurate results.
# QQE Indicator
# Converted by Kory Gill for BenTen at useThinkScript.com
# Original https://www.tradingview.com/script/zwbe2plA-Ghosty-s-Zero-Line-QQE/

declare lower;

input RSI_Period = 20;
input Slow_Factor = 5;
input QQE = 4.236;

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
then longband
else shortband;

plot pFastAtrRsiTL = FastAtrRsiTL;
plot pRsiMa = rsi_ma;
plot line50 = 50;

pFastAtrRsiTL.SetDefaultColor(CreateColor(225,109,47));
pRsiMa.SetDefaultColor(CreateColor(113,225,180));
def bull=pRsiMa>line50 and pFastAtrRsiTL>line50;
def bear=pRsiMa<line50 and pFastAtrRsiTL<line50;
addcloud(if bull or bear then prsiMA else double.nan, pFastAtrRsiTL,
color.green,color.red);
#chop cloud
addcloud(if !bull and !bear then pRsiMa else double.nan,pFastAtrRsiTL,
color.gray, color.gray);
 
I simply added the code provided by mbarcala to the end of the QQE script originally posted and created a new study. From there you need to add the study to your lower charts. From there you need to customize it to look however you want..make sense?
What post number by mbarcala?
 
I can't seem to get the same QQESignal as in post #57
there you go
Code:
# QQE Indicator
# Converted by Kory Gill for BenTen at useThinkScript.com
# Original https://www.tradingview.com/script/zwbe2plA-Ghosty-s-Zero-Line-QQE/

declare lower;

input RSI_Period = 20;
input Slow_Factor = 5;

def QQE = 4.236;
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 then longband else shortband;
def pFastAtrRsiTL = FastAtrRsiTL;
def pRsiMa = rsi_ma;
def line50 = 50;
def line25 = 25;
def line35 = 35;
def line65 = 65;

plot upArrow1 = if pRsiMa crosses above line50 then line50 else 0;
upArrow1.SetPaintingStrategy(PaintingStrategy.LINE);
upArrow1.SetDefaultColor(Color.green);

plot dnArrow1 = if pRsiMa crosses below line50 then line50 else 0;
dnArrow1.SetPaintingStrategy(PaintingStrategy.LINE);
dnArrow1.SetDefaultColor(Color.red);

plot upArrow2 = if pRsiMa crosses above line35 then line25 else 0;
upArrow2.SetPaintingStrategy(PaintingStrategy.LINE);
upArrow2.SetDefaultColor(Color.green);

plot dnArrow2 = if pRsiMa crosses below line65 then line25 else 0;
dnArrow2.SetPaintingStrategy(PaintingStrategy.LINE);
dnArrow2.SetDefaultColor(Color.red);
 
there you go
Code:
# QQE Indicator
# Converted by Kory Gill for BenTen at useThinkScript.com
# Original https://www.tradingview.com/script/zwbe2plA-Ghosty-s-Zero-Line-QQE/

declare lower;

input RSI_Period = 20;
input Slow_Factor = 5;

def QQE = 4.236;
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 then longband else shortband;
def pFastAtrRsiTL = FastAtrRsiTL;
def pRsiMa = rsi_ma;
def line50 = 50;
def line25 = 25;
def line35 = 35;
def line65 = 65;

plot upArrow1 = if pRsiMa crosses above line50 then line50 else 0;
upArrow1.SetPaintingStrategy(PaintingStrategy.LINE);
upArrow1.SetDefaultColor(Color.green);

plot dnArrow1 = if pRsiMa crosses below line50 then line50 else 0;
dnArrow1.SetPaintingStrategy(PaintingStrategy.LINE);
dnArrow1.SetDefaultColor(Color.red);

plot upArrow2 = if pRsiMa crosses above line35 then line25 else 0;
upArrow2.SetPaintingStrategy(PaintingStrategy.LINE);
upArrow2.SetDefaultColor(Color.green);

plot dnArrow2 = if pRsiMa crosses below line65 then line25 else 0;
dnArrow2.SetPaintingStrategy(PaintingStrategy.LINE);
dnArrow2.SetDefaultColor(Color.red);
If I want to change the settings to Faster Periods, the 3 lines on top
input RSI_Period = 20;
input Slow_Factor = 5;

def QQE = 4.236;

All I have to do is change these to
input RSI_Period = 6;
input Slow_Factor = 3;

def QQE = 2.621;

Or, there are other settings within the script that needs to be changed?
 

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

Thread starter Similar threads Forum Replies Date
Xiuying Repaints QQE MTF (Multi Timeframe) for ThinkorSwim Indicators 20

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
447 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.
Back
Top