• Get $30 off VIP with code SUMMER30. Ends July 27. Happy trading!

QQE (Quantitative Qualitative Estimation) for ThinkorSwim

CoachT

New member
@CoachT What do you mean by "resolves around the 50 line"?

This is what ive been able to come up with so far- I think i want the Histogram to act as a Oscillator around the 50 Line. I having a hard time with those adjustments.

Xg7HjRI.png
 

rad14733

Well-known member
VIP
This is what ive been able to come up with so far- I think i want the Histogram to act as a Oscillator around the 50 Line. I having a hard time with those adjustments.

Xg7HjRI.png
I'd be interested in an update on this QQE Histogram indicator... ;)
 

horserider

Well-known member
VIP
@CoachT The RSI uses a 0 to 100 scale. You would need to adjust that scale to range from -100 to 100 or some such adjustment. That should give the zero line as the center of the range.
 

FOTM_8888

Member
VIP
great job benten, this indicator look pretty good, ben can you add a buy and sell arrow to this indicator please on the candles. thank you very much.
 

BenTen

Administrative
Staff
VIP
@FOTM_8888 Here 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/

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;

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

plot UpSignal = if pRSIMA crosses above pFastAtrRsiTL then low else Double.NaN;
plot DownSignal = if pRSIMA crosses below pFastAtrRsiTL then high else Double.NaN;

UpSignal.SetDefaultColor(Color.MAGENTA);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.CYAN);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
 

bandzbond

New member
sorry but I'm new to reading tos code, i have a question for these two lines
i assume the first line is storing one absolute value in the variable atr_rsi correct?
but if so then how are you finding the EMA with that one value in the second line?
is atr_rsi an array?
thanks!


def atr_rsi = AbsValue(rsi_ma[1] - rsi_ma);
def atr_rsi_ma = MovingAverage(AverageType.EXPONENTIAL, atr_rsi, Wilder_Period);
 

rad14733

Well-known member
VIP
@bandzbond Remember, each of those lines gets executed with every trade so the second line paints the ema of the result stored in atr_rsi... This is a common concept that you will find in many indicators, especially lower indicators... Many study indicators plot both the original value as well as an overlaid moving average based on the original values...

As for the question about arrays, no, TOS does not support arrays... What may appear to be an array is simply a series of basic calculations done one after the other as trade data comes in, not an aggregate grouping of values as a whole... I hope that makes sense...
 

bandzbond

New member
ah that's interesting, to confirm my understand, I want to use an example, so lets say we had RSIs of these values: 40 50 60 70 80
basically the second line will be doing the EMA of these following absolute values (40-50),(50-60),(60-70), (70-80) right?
 

rad14733

Well-known member
VIP
ah that's interesting, to confirm my understand, I want to use an example, so lets say we had RSIs of these values: 40 50 60 70 80
basically the second line will be doing the EMA of these following absolute values (40-50),(50-60),(60-70), (70-80) right?
What the numbers are is irrelevant... Just remember the concept that every time the price changes, so does the moving average... The current price paints and so does the current average, on a price change by price change basis... And there is no array of data... When a chart starts painting, regardless of how far back it goes, TOS parses the servers database for each candle/bar - without building a data array...

For this very reason you should keep the length of your charts only as long as immediately needed... If you only need a few days of visual lookback then go with 3 or 5 days... For example, if you have a study that paints a 50 day moving average on a 3D 3M chart the study will only parse the database for the price values it needs, not the entire candle/bar worth of data... This reduces bandwidth overhead and reduces latency... It's all about making the platform efficient so that your charts stay as real-time as possible... After all, in reality, real-time data actually isn't real-time - it's the closest to real-time as the internet will allow at a given point in time...

All that being said, TOS most likely uses a streaming buffer of some sort but not what programmers would consider and array...
 

gate122

New member
Hello all. I like this QQE indicator thus far. Have anyone able to write a scanner thinkscript to scan when the 2 lines crossed (daily timeframe)?
 
Thread starter Similar threads Forum Replies Date
Xiuying QQE MTF (Multi Timeframe) for ThinkorSwim Indicators 15

Similar threads

Top