SP indicator For ThinkOrSwim

QUIKTDR1

Active member
VIP
Author states:
SP Indicator - One of the best indicators for scalping trading on any timeframes. The best readings are given on 5, 15 and 30 minute frames.
For readings, several indicators are combined into one, which allows you to get a more accurate forecast, which is more than 90%.
Instruction.
The indicator is easy to use. Just install it and follow the arrows to go long or short. Stop loss set small, about 1-2%. In most cases, this is sufficient.

FrENdNm.png


Original Tradingview code:
https://www.tradingview.com/script/zhe6EyHi-sp-indicator/

New ThinkOrSwim code found below
 
Last edited by a moderator:
Could we get this open source code converted?

SP Indicator
https://www.tradingview.com/script/zhe6EyHi-sp-indicator/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Smoker024

//@version=5
indicator("SP Indicator", overlay=true)
ma(src, len) => ta.wma(2 * ta.wma(src, len / 2) - ta.wma(src, len), math.round(math.sqrt(len)))

BBMC = ma(close, 60)
rangema = ta.ema(ta.tr, 60)
upperk =BBMC + rangema * 0.2
lowerk = BBMC - rangema * 0.2
color_bar = close > upperk ? color.blue : close < lowerk ? color.fuchsia : color.gray

ExitHigh = ma(high, 15)
ExitLow = ma(low, 15)
Hlv3 = int(na)
Hlv3 := close > ExitHigh ? 1 : close < ExitLow ? -1 : Hlv3[1]
sslExit = Hlv3 < 0 ? ExitHigh : ExitLow
base_cross_Long = ta.crossover(close, sslExit)
base_cross_Short = ta.crossover(sslExit, close)
codiff = base_cross_Long ? 1 : base_cross_Short ? -1 : na

plotarrow(codiff, colorup=color.blue, colordown=color.fuchsia,title="Exit Arrows", maxheight=20, offset=0)
plot(BBMC, color=color_bar, linewidth=4,title='MA Trendline')
alertcondition(codiff == 1, 'Long', 'Long Condition at {{close}}')
alertcondition(codiff == -1, 'Short', 'Short Condition at {{close}}')

plot(close)

https://www.tradingview.com/script/zhe6EyHi-sp-indicator/
check the below:

CSS:
#// Indicator for TOS
#// © Smoker024
#indicator("SP Indicator", overlay=true)
# Converted by Sam4Cok@Samer800    - 10/2024

input showBands = yes;
input source = close;
input lookback = 60;
input multi = 0.2;

def na = Double.NaN;
def exitLength = RoundUp(lookback / 4, 0);

Script ma {
input src = close;
input len = 15;
    def sqLen = Round(sqrt(len), 0);
    def wma1 = wma(src, len);
    def wma2 = wma(src, len / 2);
    def ma = wma(2 * wma2 - wma1, sqLen);
    plot out = ma;
}
def tr = TrueRange(high, close, low);
def BBMC = ma(source, lookback);
def rangema = ExpAverage(tr, lookback);
def upperk =BBMC + rangema * multi;
def lowerk = BBMC - rangema * multi;
def col = if source > upperk then 1 else if source < lowerk then -1 else 0;

def ExitHigh = ma(high, exitLength);
def ExitLow = ma(low, exitLength);
def Hlv3 = if source > ExitHigh then 1 else if source < ExitLow then -1 else Hlv3[1];
def sslExit = if Hlv3 < 0 then ExitHigh else ExitLow;
def base_cross_Long = (close > sslExit) and (close[1] <= sslExit[1]);
def base_cross_Short = (sslExit > close) and (sslExit[1] <= close[1]);
def codiff = if base_cross_Long then 1 else if base_cross_Short then -1 else 0;

plot ExitArrowUp = if codiff>0 then low else na;
plot ExitArrowDn = if codiff<0 then low else na;
plot maTrendLine = BBMC;     # 'MA Trendline'
plot limitUp = if showBands then upperk else na;
plot limitDn = if showBands then lowerk else na;

maTrendLine.SetLineWeight(2);
maTrendLine.AssignValueColor(if col>0 then Color.CYAN else if col<0 then Color.MAGENTA else Color.GRAY);
limitUp.AssignValueColor(if col>0 then Color.CYAN else if col<0 then Color.MAGENTA else Color.GRAY);
limitDn.AssignValueColor(if col>0 then Color.CYAN else if col<0 then Color.MAGENTA else Color.GRAY);
ExitArrowUp.SetDefaultColor(Color.CYAN);
ExitArrowDn.SetDefaultColor(Color.MAGENTA);
ExitArrowUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
ExitArrowDn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);


#-- END of CODE
 
check the below:

CSS:
#// Indicator for TOS
#// © Smoker024
#indicator("SP Indicator", overlay=true)
# Converted by Sam4Cok@Samer800    - 10/2024

input showBands = yes;
input source = close;
input lookback = 60;
input multi = 0.2;

def na = Double.NaN;
def exitLength = RoundUp(lookback / 4, 0);

Script ma {
input src = close;
input len = 15;
    def sqLen = Round(sqrt(len), 0);
    def wma1 = wma(src, len);
    def wma2 = wma(src, len / 2);
    def ma = wma(2 * wma2 - wma1, sqLen);
    plot out = ma;
}
def tr = TrueRange(high, close, low);
def BBMC = ma(source, lookback);
def rangema = ExpAverage(tr, lookback);
def upperk =BBMC + rangema * multi;
def lowerk = BBMC - rangema * multi;
def col = if source > upperk then 1 else if source < lowerk then -1 else 0;

def ExitHigh = ma(high, exitLength);
def ExitLow = ma(low, exitLength);
def Hlv3 = if source > ExitHigh then 1 else if source < ExitLow then -1 else Hlv3[1];
def sslExit = if Hlv3 < 0 then ExitHigh else ExitLow;
def base_cross_Long = (close > sslExit) and (close[1] <= sslExit[1]);
def base_cross_Short = (sslExit > close) and (sslExit[1] <= close[1]);
def codiff = if base_cross_Long then 1 else if base_cross_Short then -1 else 0;

plot ExitArrowUp = if codiff>0 then low else na;
plot ExitArrowDn = if codiff<0 then low else na;
plot maTrendLine = BBMC;     # 'MA Trendline'
plot limitUp = if showBands then upperk else na;
plot limitDn = if showBands then lowerk else na;

maTrendLine.SetLineWeight(2);
maTrendLine.AssignValueColor(if col>0 then Color.CYAN else if col<0 then Color.MAGENTA else Color.GRAY);
limitUp.AssignValueColor(if col>0 then Color.CYAN else if col<0 then Color.MAGENTA else Color.GRAY);
limitDn.AssignValueColor(if col>0 then Color.CYAN else if col<0 then Color.MAGENTA else Color.GRAY);
ExitArrowUp.SetDefaultColor(Color.CYAN);
ExitArrowDn.SetDefaultColor(Color.MAGENTA);
ExitArrowUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
ExitArrowDn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);


#-- END of CODE

ty for ur qik reply
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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