QQE (Quantitative Qualitative Estimation) for ThinkorSwim

A

Art

New member
@BenTen I'm using the TradinView's QQE indicator, and I'd love to have it on Thinkorswim.
Is your 50 line can be compared to TV's 0 or 10 lines?

TV QQE indicator gives you a buy signal only when the lines are crossing 10 not zero.



Please could you explain?
 
BenTen

BenTen

Administrative
Staff
VIP
@Art There are different versions of QQE on TradingView, some are modified to produce slightly different signals using different inputs.
 
A

Art

New member
I see, so I'm assuming your 50 line is the positive/buy territory and not neutral, is that right?
 
S

sobiswas

New member
VIP
Can we create a watch-list column out of this? A label or a color if the signal triggers within last n period?
 
T

Trading51

Active member
2019 Donor
Warehouse
@BenTen Could you add color candles for this script, thanks.
 
BenTen

BenTen

Administrative
Staff
VIP
@Trading51 Can you be more specific? What would be the condition for the colored candles?
 
G

Gildes

New member
When there’s a cross over from the RSI and ATR
Add this Line at the end of the script

AssignPriceColor(if pRsiMa crosses above pFastAtrRsiTL then color.cyan else if pRsiMa crosses below pFastAtrRsiTL then color.orange else if pRsiMa > pFastAtrRsiTL then color.Green else if pRsiMa < pFastAtrRsiTL then color.Red else color.Gray);

AddCloud(pRsiMa, pFastAtrRsiTL , color.Green, color.RED);
 
Last edited:
S

sobiswas

New member
VIP
@BenTen - How do we convert the code to a watch-list column? Like one in ORB or MACD watch-list? Using labels or just color coded cells?
 
K

kcking

New member
I'd like to convert the qqe indicator into a strategy to backtest...can someone help?
 
Last edited:
BenTen

BenTen

Administrative
Staff
VIP
@kcking Define your condition for buying and selling. I may be able to put something together.
 
K

kcking

New member
@BenTen - here it is thanks

Long - entry when pRsiMa crosses above pFastAtrRsiTL, exit when price crosses upper band of Keltner channel
Short -entry when pRsiMa crosses below pFastAtrRsiTL, exit when price crosses lower band of Keltner channel
 
T

tradebyday

Active member
@kcking here is something to start
Code:
# QQE Indicator
# Converted by Kory Gill for BenTen at useThinkScript.com
# Original https://www.tradingview.com/script/zwbe2plA-Ghosty-s-Zero-Line-QQE/


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));

#
# TD Ameritrade IP Company, Inc. (c) 2007-2020
#

input displace = 0;
input factor = 1.5;
input length = 20;
input price = close;
input averageType = AverageType.SIMPLE;
input trueRangeAverageType = AverageType.SIMPLE;

def shift = factor * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length);

def average = MovingAverage(averageType, price, length);

plot Avg = average[-displace];
Avg.SetDefaultColor(GetColor(1));

plot Upper_Band = average[-displace] + shift[-displace];
Upper_Band.SetDefaultColor(GetColor(8));

plot Lower_Band = average[-displace] - shift[-displace];
Lower_Band.SetDefaultColor(GetColor(5));
# END

addOrder(OrderType.BUY_AUTO, pRsiMa crosses above pFastAtrRsiTL);
addOrder(OrderType.SELL_TO_CLOSE, price > Upper_Band);
addOrder(OrderType.SELL_AUTO, pRsiMa crosses below pFastAtrRsiTL);
addOrder(OrderType.BUY_TO_CLOSE, price < Lower_Band);
 
K

kcking

New member
@tradebyday thanks so much for this!

Question - the trades seem to be occuring 2 days after the qqe entry signal appears, can this be changed to the day after the signal?
 
A

Art

New member
I have another question and I hope someone has the answer. I've been using the TradingView's QQE and it was a big part of my strategy. And since it's available now for Thinkorswim I'm trying to add it to my scan so I don't have to check manually. The condition that I want to add is when pRsiMa is greater than pFastAtrRsiTL. But for some reason, it doesn't return any results. Is it because this is a custom script or there is a problem with the script above? I don't have the same problem with other custom indicators.

Note: 50 line cross signal works.
Thanks!
 
B

Barmarrs

New member
Warehouse
VIP
@Art I was having the same issue when using this. The scan wasn't yielding any results. I don't know if a workaround was ever figured out.
 
Top