QTE Scalper Modified For ThinkOrSwim

Patterntrader5

New member
Author states:
A modified version of the QTE scalper indicator. Produces a buy/sell signal based on a 2 candle pattern. For long signals it produces a signal when the high and low of the second candle are below the high and low of the first candle and both candles close above the 10 period EMA. The reverse is true for short signals.

dwvGtp0.png


Please convert from Tradingview
https://www.tradingview.com/script/Kl5ciU3d-QTE-Scalper-Modified/
 
Last edited by a moderator:

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

Please convert from Tradingview
https://www.tradingview.com/script/Kl5ciU3d-QTE-Scalper-Modified/

Code:
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Adam911
//@version=5
//0.005
indicator("QTE Scalper Modified", overlay=true)

emaPeriodInput = input.int(10, "EMA Period", minval=2, maxval=50)
upArrowColorInput = input.color(color.green, "Up Arrow Color")
downArrowColorInput = input.color(color.rgb(255, 0, 21), "Down Arrow Color")
minAtrValueInput = input.float(1, "Minimum ATR Value for Signals", minval=0) // Default changed to 1
showAtrLabelInput = input.bool(true, "Show ATR Label")
atrLabelColorInput = input.color(color.white, "ATR Label Color")
touchTypeInput = input.string("Body Touch", "Candle Touch Type", options=["Body Touch", "Wick Touch", "No Touch"]) // Default changed to 'Body Touch'

// Create the EMA Filter line
emaFilter = ta.ema(close, emaPeriodInput)
plot(emaFilter, linewidth = 2)

// Calculate the 10-period ATR
atrValue = ta.atr(10)

// Basic signal conditions
upArrowCondition = ((high < high[1]) and (low < low[1])) and (open < close) and (close > emaFilter) and (close[1] > emaFilter[1]) and (atrValue > minAtrValueInput)
downArrowCondition = ((high > high[1]) and (low > low[1])) and (open > close) and (close < emaFilter) and (close[1] < emaFilter[1]) and (atrValue > minAtrValueInput)

// New 'Body Touch' condition
bool bodyTouchUp = (open < emaFilter and close > emaFilter) or (open > emaFilter and close < emaFilter)
bool bodyTouchDown = bodyTouchUp

bool wickTouchUp = (low <= emaFilter and close > emaFilter and open > emaFilter)
bool wickTouchDown = (high >= emaFilter and close < emaFilter and open < emaFilter)

// Existing 'No Touch' condition (unchanged)
bool noTouchUp = low > emaFilter // Entire candle, including wick, is above EMA
bool noTouchDown = high < emaFilter // Entire candle, including wick, is below EMA

// Modified logic for applying touch type conditions to signals
bool upArrow = false
bool downArrow = false

if touchTypeInput == "Body Touch"
    upArrow := upArrowCondition and (bodyTouchUp or wickTouchUp or noTouchUp)
    downArrow := downArrowCondition and (bodyTouchDown or wickTouchDown or noTouchDown)
else if touchTypeInput == "Wick Touch"
    upArrow := upArrowCondition and (wickTouchUp or noTouchUp)
    downArrow := downArrowCondition and (wickTouchDown or noTouchDown)
else if touchTypeInput == "No Touch"
    upArrow := upArrowCondition and noTouchUp
    downArrow := downArrowCondition and noTouchDown

alertcondition(upArrow, title="Bullish Signal", message="Bullish signal detected.")
alertcondition(downArrow, title="Bearish Signal", message="Bearish signal detected.")

plotshape(upArrow, style=shape.arrowup, color=upArrowColorInput, size=size.normal, location = location.belowbar)
plotshape(downArrow, style=shape.arrowdown, color=downArrowColorInput, size=size.normal, location = location.abovebar)

// Display the ATR Label (if enabled)
var label atrLabel = na
if showAtrLabelInput and barstate.islast
    label.delete(atrLabel)
    atrLabel := label.new(bar_index, high, "ATR: " + str.tostring(atrValue), yloc=yloc.abovebar, style=label.style_label_down, color=atrLabelColorInput)
check the below:

CSS:
#// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © Adam911
#indicator("QTE Scalper Modified", overlay=true)
# converted by Sam4Cok@Samer800    - 06/2024 - Request from UseThinkScript.com member

input showAtrLabel = yes; # "Show ATR Label")
input touchTypeInput = {Default "Body Touch", "Wick Touch", "No Touch"}; # "Candle Touch Type"
input movAvgType = AverageType.EXPONENTIAL;
input source = close;
input movAvgLength = 10; #, "EMA Period", minval=2, maxval=50)
input minAtrValue = 1.0; #, "Minimum ATR Value for Signals", minval=0) // Default changed to 1


def na = Double.NaN;
#// Create the EMA Filter line
def emaFilter = MovingAverage(movAvgType, source, movAvgLength);

plot movAvgLine = emaFilter;

#// Calculate the 10-period ATR
def atrValue = atr(Length = 10);

#// Basic signal conditions
def upArrowCondition = ((high < high[1]) and (low < low[1])) and (open < close) and (close > emaFilter) and (close[1] > emaFilter[1]) and (atrValue > minAtrValue);
def downArrowCondition = ((high > high[1]) and (low > low[1])) and (open > close) and (close < emaFilter) and (close[1] < emaFilter[1]) and (atrValue > minAtrValue);

#// New 'Body Touch' condition
def bodyTouchUp = (open < emaFilter and close > emaFilter) or (open > emaFilter and close < emaFilter);
def bodyTouchDown = bodyTouchUp;
def wickTouchUp = (low <= emaFilter and close > emaFilter and open > emaFilter);
def wickTouchDown = (high >= emaFilter and close < emaFilter and open < emaFilter);

#// Existing 'No Touch' condition (unchanged)
def noTouchUp = low > emaFilter; # // Entire candle, including wick, is above EMA
def noTouchDown = high < emaFilter; # // Entire candle, including wick, is below EMA

#// Modified logic for applying touch type conditions to signals
def upArrow; # = false
def downArrow;# = false
Switch (touchTypeInput) {
Case "Wick Touch" :
    upArrow = upArrowCondition and (wickTouchUp or noTouchUp);
    downArrow = downArrowCondition and (wickTouchDown or noTouchDown);
Case "No Touch" :
    upArrow = upArrowCondition and noTouchUp;
    downArrow = downArrowCondition and noTouchDown;
Default :
    upArrow = upArrowCondition and (bodyTouchUp or wickTouchUp or noTouchUp);
    downArrow = downArrowCondition and (bodyTouchDown or wickTouchDown or noTouchDown);
}

AddChartBubble(upArrow, low, "B", Color.GREEN, no);
AddChartBubble(downArrow, high, "S", Color.RED);

#// Display the ATR Label (if enabled)

AddLabel(showAtrLabel, "ATR (" + ROUnd(atrValue, 2) + ")", Color.WHITE);

#-- END of CODE
 
I don't see any chart bubbles.

You didn't provide enough information to say where you went astray.
If you are still having trouble using this study, here is another approach.

You can import this chart link, which has the study already applied to it.
shared chart link: http://tos.mx/!15RhPIGl Click here for --> Easiest way to load shared links
The indicator will also save to your library.
2xh1I1X.png
 
Author states:
A modified version of the QTE scalper indicator. Produces a buy/sell signal based on a 2 candle pattern. For long signals it produces a signal when the high and low of the second candle are below the high and low of the first candle and both candles close above the 10 period EMA. The reverse is true for short signals.

dwvGtp0.png


Please convert from Tradingview
https://www.tradingview.com/script/Kl5ciU3d-QTE-Scalper-Modified/
Does this only apply for the 30 min time frame? Is there an overall strategy you use this with?
 
Does this only apply for the 30 min time frame?

There is nothing in the code that precludes this script from working on all timeframes.
In the post above yours, the script is seen as applied to the daily timeframe.
It should be noted that the author of this script wrote it for scalping timeframes of 5-min and below.

Is there an overall strategy you use this with?

The author states that he likes to scalp with this indicator in trending markets.
If the market is going sideways or in a tight range it shouldn't be relied upon too much for placing trades based on the signals for obvious reasons.
read more:
https://www.tradingview.com/script/Kl5ciU3d-QTE-Scalper-Modified/
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
370 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